[Tex/LaTex] How to make row lines span only certain columns

multirowtables

I have a table that uses multirows and I want some row lines to span certain columns as illustrated below. If someone could just type up how I could do this using my code it would greatly appreciated!

What my table looks like:
enter image description here

What I want my table to look like:
enter image description here

My code:

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

Best Answer

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

enter image description here

Related Question