¿Cómo tener una línea horizontal completa en un entorno tabular?

¿Cómo tener una línea horizontal completa en un entorno tabular?

Quiero que las líneas horizontales atraviesen la segunda columna; desde el principio hasta el final de la segunda columna. Encontré algunas sugerencias para hacer una tabla anidada, pero no pude entenderlas. Este mi código:

\documentclass{article}
\usepackage{array,multirow}
\usepackage{booktabs}

\begin{document}
    \begin{tabular}{|c|c|c|c|c|}\hline
        a & \begin{tabular}{c | c}
            angel & value
        \end{tabular} & Overshoot  & Settling time & Rise time                  \tabularnewline\hline
        Case i
        &
        \begin{tabular}{c|@{}c@{}}
            $\theta_i$ &    \begin{tabular}{c}
                0 \\ 0 \\ 0 \\ 0
            \end{tabular}
            \tabularnewline\hline   
            $\theta_f$ &    \begin{tabular}{c}
                30 \\ 30 \\ 30 \\ 30
            \end{tabular}
            %               \tabularnewline\hline
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        \tabularnewline\hline
        Case ii
        &
        \begin{tabular}{c|@{}c@{}}
            $\theta_i$ &    \begin{tabular}{c}
                30 \\ 30 \\ 30 \\ 30
            \end{tabular}
            \tabularnewline\hline
            $\theta_f$ &    \begin{tabular}{c}
                60 \\ 60 \\ 60 \\ 60
            \end{tabular}
            %               \tabularnewline\hline
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\

        \end{tabular}
        \tabularnewline\hline
        Case iii
        &
        \begin{tabular}{c|@{}c@{}}
            $\theta_i$ &    \begin{tabular}{c}
                90 \\ 60 \\ 45 \\ 75
            \end{tabular}
            \tabularnewline\hline
            $\theta_f$ &    \begin{tabular}{c}
                120 \\ 90 \\ 105 \\ 135
            \end{tabular}
            %           \tabularnewline\hline
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        \tabularnewline\hline
        Case iv
        &
        \begin{tabular}{c|@{}c@{}}
            $\theta_i$ &    \begin{tabular}{c}
                120 \\ 90 \\ 105 \\ 135
            \end{tabular}
            \tabularnewline\hline 
            $\theta_f$ &    \begin{tabular}{c}
                150 \\ 120 \\ 135 \\ 165
            \end{tabular}
            %           \tabularnewline\hline
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        &
        \begin{tabular}{c}
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
            1  \\ 
            1  \\
        \end{tabular}
        \tabularnewline\hline
    \end{tabular}
\end{document}]

Respuesta1

Aquí tienes un punto de partida en el que puedes trabajar. Eliminé las reglas verticales y utilicé el comando \cmidrule{2-6}para dibujar reglas horizontales personalizadas.

\topruley \bottomruleaparecen antes y después de la tabla respectivamente, mientras que los horizontales completos se hacen con \midrule.

figura de mesa

\documentclass{article}
\usepackage{array,multirow}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{cccccc}
    \toprule
    a & angel & value & Overshoot & Settling time & Rise time \\ 
    \midrule
    \multirow{8}{*}{Case i} & \multirow{4}{*}{$\theta_i$}   & 0 & 1 & 1 & 1 \\
                            &                               & 0 & 1 & 1 & 1 \\
                            &                               & 0 & 1 & 1 & 1 \\
                            &                               & 0 & 1 & 1 & 1 \\ \cmidrule{2-6}
                            & \multirow{4}{*}{$\theta_f$}   & 30 & 1 & 1 & 1 \\
                            &                               & 30 & 1 & 1 & 1 \\
                            &                               & 30 & 1 & 1 & 1 \\
                            &                               & 30 & 1 & 1 & 1 \\ \midrule
                            &                               & ... & ... & ... & ... \\
                            &                               & ... & ... & ... & ... \\
                            &                               & ... & ... & ... & ... \\
                            &                               & ... & ... & ... & ... \\
    \bottomrule                 
\end{tabular}
\end{document}

Respuesta2

Es posible que desee utilizar el multirowpaquete en combinación con el \cmidrule{}comando:

\documentclass{article} 
\usepackage{array}
\usepackage{booktabs}
\usepackage{multirow}

\begin{document}
    \begin{tabular}{cccccc}
        \toprule
        a & angle & value & Overshoot & Settling time & Rise time \\ \midrule
        \multirow{8}{*}{Case i} & \multirow{4}{*}{$\theta_i$} & 0 & 1 & 1 & 1 \\
        {} & {} & 0 & 1 & 1 & 1 \\
        {} & {} & 0 & 1 & 1 & 1 \\
        {} & {} & 0 & 1 & 1 & 1 \\ \cmidrule{2-6}
        {} & \multirow{4}{*}{$\theta_f$} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\ \midrule
        \multirow{8}{*}{Case ii} & \multirow{4}{*}{$\theta_i$} & 0 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\ \cmidrule{2-6}
        {} & \multirow{4}{*}{$\theta_f$} & 30 & 1 & 1 & 1 \\
        {} & {} & 60 & 1 & 1 & 1 \\
        {} & {} & 60 & 1 & 1 & 1 \\
        {} & {} & 60 & 1 & 1 & 1 \\ \midrule
        \multirow{8}{*}{Case iii} & \multirow{4}{*}{$\theta_i$} & 0 & 1 & 1 & 1 \\
        {} & {} & 90 & 1 & 1 & 1 \\
        {} & {} & 90 & 1 & 1 & 1 \\
        {} & {} & 90 & 1 & 1 & 1 \\ \cmidrule{2-6}
        {} & \multirow{4}{*}{$\theta_f$} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\ \midrule
        \multirow{8}{*}{Case iv} & \multirow{4}{*}{$\theta_i$} & 0 & 1 & 1 & 1 \\
        {} & {} & 0 & 1 & 1 & 1 \\
        {} & {} & 0 & 1 & 1 & 1 \\
        {} & {} & 0 & 1 & 1 & 1 \\ \cmidrule{2-6}
        {} & \multirow{4}{*}{$\theta_f$} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        {} & {} & 30 & 1 & 1 & 1 \\
        \bottomrule
    \end{tabular}
\end{document}

Las líneas verticales en las tablas LaTeX normalmente no se ven muy bien, así que, si es posible, no las utilices.

Respuesta3

Una solución con un código más simple con el makecellpaquete, que permite saltos de línea en las celdas:

\documentclass{article}
\usepackage{array,multirow, makecell}
\usepackage{booktabs}
\setcellgapes{2pt}

\begin{document}

\makegapedcells
\begin{tabular}{|c|c|c|c|c|c|}
\hline
a & angel & value & Overshoot & Settling time & Rise time \tabularnewline\hline
    \multirowcell{5}{Case i}
    & $\theta_i$ & \makecell{0 \\ 0 \\ 0 \\ 0}%\\
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    \tabularnewline\cline{2-3}
    & $\theta_f$ & \makecell{30 \\ 30 \\ 30 \\ 30}
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%
    \tabularnewline\hline
    \multirowcell{5}{Case ii}
    & $\theta_i$ & \makecell{30 \\ 30 \\ 30 \\ 30}%\\
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    \tabularnewline\cline{2-3}
    & $\theta_f$ & \makecell{60 \\ 60 \\ 60 \\ 60}
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%
    \tabularnewline\hline
    \multirowcell{5}{Case iii}
    & $\theta_i$ & \makecell{90 \\ 60 \\ 45 \\ 75}%\\
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    \tabularnewline\cline{2-3}
    & $\theta_f$ & \makecell{120 \\ 90 \\ 105 \\ 135}
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%
    \tabularnewline\hline
    \multirowcell{5}{Case iv}
    & $\theta_i$ & \makecell{90 \\ 60 \\ 45 \\ 75}%\\
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    & \makecell{1 \\ 1 \\ 1 \\ 1}% \\ 1 \\ 1 \\ 1 \\ 1}
    \tabularnewline\cline{2-3}
    & $\theta_f$ & \makecell{150 \\ 120 \\ 135 \\ 165}
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%&
     & \makecell{1 \\ 1 \\ 1 \\ 1}%
    \tabularnewline\hline
\end{tabular}

\end{document}

ingrese la descripción de la imagen aquí

Respuesta4

Aquí hay una opción usandobooktabs(lo incluiste, pero nunca usaste sus capacidades) ysiunitxpara alineación horizontal de números enteros en una tabla:

ingrese la descripción de la imagen aquí

\documentclass{article}
\usepackage{booktabs,siunitx}

\begin{document}
\begin{tabular}{c c S[table-format=3] c c c}
  \toprule
  Case & Angle & {Value} & Overshoot & Settling time & Rise time \\
  \midrule
  I   & $\theta_i$ &   0 & 1 & 1 & 1 \\
      &            &   0 & 1 & 1 & 1 \\
      &            &   0 & 1 & 1 & 1 \\
      &            &   0 & 1 & 1 & 1 \\
      \cmidrule{2-6}
      & $\theta_f$ &  30 & 1 & 1 & 1 \\
      &            &  30 & 1 & 1 & 1 \\
      &            &  30 & 1 & 1 & 1 \\
      &            &  30 & 1 & 1 & 1 \\
  \midrule
  II  & $\theta_i$ &  30 & 1 & 1 & 1 \\
      &            &  30 & 1 & 1 & 1 \\
      &            &  30 & 1 & 1 & 1 \\
      &            &  30 & 1 & 1 & 1 \\
      \cmidrule{2-6}
      & $\theta_f$ &  60 & 1 & 1 & 1 \\
      &            &  60 & 1 & 1 & 1 \\
      &            &  60 & 1 & 1 & 1 \\
      &            &  60 & 1 & 1 & 1 \\
  \midrule
  III & $\theta_i$ &  90 & 1 & 1 & 1 \\
      &            &  60 & 1 & 1 & 1 \\
      &            &  45 & 1 & 1 & 1 \\
      &            &  75 & 1 & 1 & 1 \\
      \cmidrule{2-6}
      & $\theta_f$ & 120 & 1 & 1 & 1 \\
      &            &  90 & 1 & 1 & 1 \\
      &            & 105 & 1 & 1 & 1 \\
      &            & 135 & 1 & 1 & 1 \\
  \midrule
  IV  & $\theta_i$ & 120 & 1 & 1 & 1 \\
      &            &  90 & 1 & 1 & 1 \\
      &            & 105 & 1 & 1 & 1 \\
      &            & 135 & 1 & 1 & 1 \\
      \cmidrule{2-6}
      & $\theta_f$ & 150 & 1 & 1 & 1 \\
      &            & 120 & 1 & 1 & 1 \\
      &            & 135 & 1 & 1 & 1 \\
      &            & 165 & 1 & 1 & 1 \\
  \bottomrule
\end{tabular}
\end{document}

El uso demultirowNo es realmente necesario si se utiliza una pantalla adecuada.

información relacionada