The documentation for the multirow package implies that the content of a \multirow
will be vertically centered by default. In this example (machine-generated from a Word document, hence all the poodlefaking):
- in the first row, the first cell spans 3 rows, and the other cells are just cells;
- in the second row, the first cell continues its spanning, and the other cells all span 2 rows;
- the author has unwittingly added a bogus third row, but it shouldn't matter, as it has to be there to be the recipient of the spans from rows 1 and 2.
(Ignore the extra rules: I'm still working on the code to get that right)
The problem is that the text in col 1 is not vertically-centred with respect to the 3 rows that it spans. Cells 2/3/4 on row 2 are correctly vertically-centred in themselves. I can try to add the fixup
optional argument to \multirow
, but this is within an automated process, so working out how much to add is problematic, as for the general case, there is no easy way to calculate the amount.
\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{array,multirow}
\pagestyle{empty}
\begin{document}
% code generated from Word OOXML via XSLT2
\begin{tabular}{@{}
|>{\raggedright}p{3cm}
|>{\raggedright}p{3cm}
|>{\raggedright}p{3cm}
|>{\raggedright}p{3cm}
|@{}}\hline
% first row
\multirow{3}{3cm}[-2\baselineskip]{Tests:}
&\multicolumn{1}{|>{\raggedright}m{3cm}|}{Vortest}
&\multicolumn{1}{|>{\raggedright}m{3cm}|}{1. Nachtest}
&\multicolumn{1}{|>{\raggedright}m{3cm}|}{2. Nachtest}\\
% second row
&\multirow{2}{3cm}{Juni vor dem TSC}
&\multirow{2}{3cm}{September nach dem TSC}
&\multirow{2}{3cm}{Mai/Juni im Jahr nach dem TSC}
\\\cline{1-1} % this is line 24
% bogus third row
&&&\\\cline{1-1}\cline{2-2}\cline{3-3}\cline{4-4}
\end{tabular}
\end{document}
The other problem is that processing this document gets me the error:
! Misplaced \omit.
\@cline #1-#2\@nil ->\omit
\@multicnt #1\advance \@multispan \m@ne \ifnum \@...
l.24 \\\cline{1-1}
! Leaders not followed by proper glue.
<to be read again>
\hfill
l.24 \\\cline{1-1}
multirow
is a good solution, it may not be appropriated for what you are trying to achieve since it has to be manually twicked to span correctly over multiline cells. Using nestedtabular
can also produce the same thing.