I'd would like to center a text within a \multirow
cell ("Predicted condition", see image),in the working code given. But when I increase the size of the other cells ("True positive" and so on, see image), by \parbox
, and do a line break for the multirow
cell, the vertical centering for the text ("Predicted condition") doesn't work. Can someone give me a hint what the mistake is, I don't see it.
\begin{tabular}{cc|c|c|}
\cline{3-4}
& & \multicolumn{2}{c|}{True condition} \\
\cline{2-4}
& \multicolumn{1}{|c|}{Total population} & Condition positive & Condition negative \\
\cline{1-4}
\multicolumn{1}{|c}{\multirow{2}{*}{Predicted condition}} &\multicolumn{1}{ |c| }{\parbox{3cm}{Predicted condition\\
positive}} & \parbox[c][2cm]{3cm}{True\\ positive} & \parbox[c][2cm]{3cm}{False\\ positive}\\
\cline{2-4}
\multicolumn{1}{|c}{}& \multicolumn{1}{ |c| }{\parbox{3cm}{Predicted condition\\
negative}} & \parbox[c][2cm]{3cm}{False\\ negative} & \parbox[c][2cm]{3cm}{False\\ positive}\\
\cline{1-4}
\end{tabular}
\end{table}
Best Answer
Here is a simpler code, using the
makecell
package. The key point is the number of lines in\multirow
doesn't denote the number ofrows
, but the number oflines
(or an equivalent).