1

~Disclaimer~ This question is a generalization of this question to the 3x3 case.

I would like the same format as the top example in the answer to the above question; That is, "Player 1" on the left, "Player 2" centered on top, with three actions for each player ("A", "B" and "C"). I took the code as given and tried to add a column, but I clearly didn't know what I was doing:

\documentclass{article}
\usepackage{multirow,array}
\begin{document}
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{cc|c|c|c|}
  & \multicolumn{1}{c}{} & \multicolumn{2}{c}{Player $2$}  & \multicolumn{1}{c}{} \\
  & \multicolumn{1}{c}{} & \multicolumn{1}{c}{$A$}  & \multicolumn{1}{c}{$B$}  & \multicolumn{1}{c}{$C$} \\\cline{3-4}
  \multirow{2}*{Player $1$}  & $A$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\\cline{3-4}
  & $B$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\\cline{3-4}
  & $C$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\\cline{3-4}
\end{tabular}
\end{table}
\end{document}

It's almost right, except some lines are missing in the third column. Also, "Player 1" and "Player 2" are no longer centered. What changes do we need in order to fix these issues?

Many thanks for your help!

6

Some suggestions:

  • Replace the \cline{3-4} directives with \cline{3-5}

  • Replace & \multicolumn{2}{c}{Player $2$} & \multicolumn{1}{c}{} with & \multicolumn{3}{c}{Player $2$}, i.e., let Player $2$ span all three columns

  • Replace \multirow{2}*{Player $1$} with Player $1$ and move the instruction down one row, to the row labelled "B".

enter image description here

\documentclass{article}
\usepackage{array}
\begin{document}
\begin{table}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{cc|c|c|c|}
  & \multicolumn{1}{c}{} & \multicolumn{3}{c}{Player $2$} \\
  & \multicolumn{1}{c}{} & \multicolumn{1}{c}{$A$}  & \multicolumn{1}{c}{$B$}  & \multicolumn{1}{c}{$C$} \\\cline{3-5}
            & $A$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\ \cline{3-5}
Player $1$  & $B$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\\cline{3-5}
            & $C$ & $(x,y)$ & $(x,y)$ & $(x,y)$ \\\cline{3-5}
\end{tabular}
\end{table}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.