表形式の環境で完全な水平線を表示するにはどうすればよいでしょうか?

表形式の環境で完全な水平線を表示するにはどうすればよいでしょうか?

水平線を 2 列目全体に、つまり 2 列目の最初から最後まで引くようにします。ネストされたテーブルを作成するための提案をいくつか見つけましたが、理解できませんでした。これが私のコードです:

\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}]

答え1

これが作業の出発点です。垂直方向の罫線を削除し、\cmidrule{2-6}カスタムの水平方向の罫線を描画するためのコマンドを使用しました。

\topruleと は\bottomruleそれぞれ表の前後に表示され、水平方向のものは で表示されます\midrule

表図

\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}

答え2

multirow次のコマンドと組み合わせてパッケージを使用することもできます\cmidrule{}:

\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}

LaTeX の表の縦線は通常見栄えがよくないので、可能な限り使用しないでください。

答え3

makecellセル内での改行を可能にする、パッケージを使用したよりシンプルなコードによるソリューション:

\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}

ここに画像の説明を入力してください

答え4

ここでオプションを使用するbooktabs(あなたはそれを含めましたが、その機能を使用したことはありません)そしてsiunitx表内の整数の水平方向の配置:

ここに画像の説明を入力してください

\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}

の用法multirow適切なディスプレイが使用されている場合、実際には必要ありません。

関連情報