# Vertical centering a text for multi row in an uneven table

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}


• I've posted an answer, but I wonder, if you really want a row 2cm high, ot only some vertical padding above and below the rows? Mar 5 '16 at 16:54
• I was playing around with the parameters, it was the last setting. Sure the padding would be better
– fial
Mar 6 '16 at 19:48

Here is a simpler code, using the makecell package. The key point is the number of lines in \multirow doesn't denote the number of rows, but the number of lines (or an equivalent).

\documentclass{article}
\usepackage{array}
\usepackage{multirow, makecell}
\newcommand\mystrut{\rule[-0.9cm]{0pt}{2cm}}

\begin{document}

\begin{table}
\begin{tabular}{cc|c|c|}
\cline{3-4}
& & \multicolumn{2}{c|}{True condition} \\
\cline{2-4}
& \multicolumn{1}{|c|}{Total population} \\
\cline{1-4}
\multicolumn{1}{|c}{\multirowcell{6}[0.5ex]{Predicted condition}}
& \multicolumn{1}{ |c| }{\mystrut\makecell[l]{Predicted condition \\ positive}} & \makecell[l]{True\\ positive} & \makecell[l]{False\\ positive}\\
\cline{2-4}
\multicolumn{1}{|c}{}& \multicolumn{1}{ |c| }{\mystrut\makecell[l]{Predicted condition\\
negative}} & \makecell[l]{False\\ negative} & \makecell[l]{False\\ positive}\\
\cline{1-4}
\end{tabular}
\end{table}

\end{document}


• +1 for introduction sentence! Many people aren't aware to this :-) Mar 5 '16 at 17:11