I'm unable to center a table's multirow vertically (it works only horizontally):
\def\arraystretch{1.5}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{table}[t]
\caption{Caption.}
\label{table:label}
\begin{tabularx}{\columnwidth}{| Y | Y | X | X |}
\hline
& OA & Acc & Time [minutes] \\
\hline
\multirow{2}{*}{\hfil A} & \multirow{2}{*}{100\%} & 100\% & x \\
\cline{3-4}
& & 100\% & y \\
\hline
\multirow{2}{*}{B} & & 100\% & 100\% \\
\cline{3-3}
& - & Urban areas: 100\% & \\
\hline
\end{tabularx}
\end{table}
Best Answer
What is important for
multirow
is not the number of rows it has to encompass, but the number n oflines
. These may be different for cells in paragraph mode likep,m, b
orX
. Changing the value of\arraystretch
also makes the computation of equivalent lines more complex. Since version 2.0, if I remember well, multirow accepts a number of lines with decimal values, which makes it easier to fine-tune the vertical position of the contents. Here, I should have takenn=3
, butn=2.8
yields a better result.Unrelated: I replaced the hyphen in the last \multirow, which is irrelevant here, with a more correct endash. Also I loaded
caption
to have a decent spacing between caption and table.