如何使行线仅跨越某些列?

如何使行线仅跨越某些列?

我有一张使用多行的表格,我想让一些行线跨越某些列,如下图所示。如果有人能帮我写出如何使用我的代码来实现这一点,我将不胜感激!

我的桌子是什么样的: 在此处输入图片描述

我希望我的表格看起来像这样: 在此处输入图片描述

我的代码:

  \begin{center}
  \begin{tabular}{ |c|c|c|c| } 
  \hline
  If... & Player 1 removes... & Matches Left & Wins? \\
  \hline
  \multirow{3}{8em}{$k +1 \equiv 0$ (mod $4$)} & 1 matches & $k \equiv 3$ (mod $4$) & \multirow{2}{4em}{Player 2} \\ 
  & 2 matches & $(k-1) \equiv 2$ (mod $4$) & \\ 
  & 3 matches & $(k-2) \equiv 1$ (mod $4$) & Player 1\\ 
  \hline
  \multirow{3}{8em}{$k +1 \equiv 1$ (mod $4$)} & 1 matches & $k \equiv 0$ (mod $4$) & \multirow{3}{4em}{Player 2} \\ 
  & 2 matches & $(k-1) \equiv 3$ (mod $4$) & \\ 
  & 3 matches & $(k-2) \equiv 2$ (mod $4$) &  \\ 
  \hline
  \multirow{3}{8em}{$k +1 \equiv 2$ (mod $4$)} & 1 matches & $k \equiv 1$ (mod $4$) & Player 1 \\ 
  & 2 matches & $(k-1) \equiv 0$ (mod $4$) &\multirow{2}{4em}{Player 2} \\ 
  & 3 matches & $(k-2) \equiv 3$ (mod $4$) &  \\ 
  \hline
  \multirow{3}{8em}{$k +1 \equiv 3$ (mod $4$)} & 1 matches & $k \equiv 2$ (mod $4$) & Player 2 \\ 
  & 2 matches & $(k-1) \equiv 1$ (mod $4$) & Player 1 \\ 
  & 3 matches & $(k-2) \equiv 0$ (mod $4$) &  Player 2 \\ 
  \hline
  \end{tabular}
  \end{center}

答案1

使用\cline{2-4}

\begin{tabular}{ |c|c|c|c| } 
    \hline
    If... & Player 1 removes... & Matches Left & Wins? \\
    \hline
    \multirow{3}{8em}{$k +1 \equiv 0$ (mod $4$)} & 1 matches & $k \equiv 3$ (mod $4$) & \multirow{2}{4em}{Player 2} \\ 
    & 2 matches & $(k-1) \equiv 2$ (mod $4$) & \\\cline{2-4} 
    & 3 matches & $(k-2) \equiv 1$ (mod $4$) & Player 1\\ 
    \hline
    \multirow{3}{8em}{$k +1 \equiv 1$ (mod $4$)} & 1 matches & $k \equiv 0$ (mod $4$) & \multirow{3}{4em}{Player 2} \\ 
    & 2 matches & $(k-1) \equiv 3$ (mod $4$) & \\ 
    & 3 matches & $(k-2) \equiv 2$ (mod $4$) &  \\ 
    \hline
    \multirow{3}{8em}{$k +1 \equiv 2$ (mod $4$)} & 1 matches & $k \equiv 1$ (mod $4$) & Player 1 \\ \cline{2-4}
    & 2 matches & $(k-1) \equiv 0$ (mod $4$) &\multirow{2}{4em}{Player 2} \\ 
    & 3 matches & $(k-2) \equiv 3$ (mod $4$) &  \\ 
    \hline
    \multirow{3}{8em}{$k +1 \equiv 3$ (mod $4$)} & 1 matches & $k \equiv 2$ (mod $4$) & Player 2 \\ \cline{2-4}
    & 2 matches & $(k-1) \equiv 1$ (mod $4$) & Player 1 \\ \cline{2-4}
    & 3 matches & $(k-2) \equiv 0$ (mod $4$) &  Player 2 \\ 
    \hline
\end{tabular}

在此处输入图片描述

相关内容