I noticed a strange behaviour when using \multicolumn
inside a tabu
environment with X columns. Here is an example:
\documentclass[12pt]{report}
\usepackage{tabu}
\usepackage{booktabs}
\begin{document}
correct:
\begin{tabu} {rr}
\toprule
\rowfont[c]{\itshape} \multicolumn{2}{c}{1--2}\\
\cmidrule{1-2}
\rowfont[c]{\itshape} A & B \\
\midrule
100 & 200 \\
\bottomrule
\end{tabu}
wrong:
\begin{tabu} to 4cm {X[r]X[r]}
\toprule
\rowfont[c]{\itshape} \multicolumn{2}{c}{1--2} \\
\cmidrule{1-2}
\rowfont[c]{\itshape} A & B \\
\midrule
100 & 200 \\
\bottomrule
\tabuphantomline
\end{tabu}
\end{document}
In the second table, the multicolumn is not centered correctly. Moreover, the rowfont
formatting affects not just one, but all following lines. Adding a \tabuphantomline
, as suggested in the tabu
manual when dealing with multicolumns, did not help.
This behaviour seems to occur only when the table "starts" with a multicolumn. When I put a regular (single) column first, everything works fine.
I wonder if this is a bug or incompatibility or if I'm just missing out on something...