# tabu starting with "X-multicolumn" yields strange formatting

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...

## 1 Answer

I would never use tabu!

Even though I am reluctant to investigate why it happens, the following works:

\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{\itshape} \multicolumn{2}{c}{1--2} \\
\cmidrule{1-2}
\rowfont[c]{\itshape} A & B \\
\midrule
\rowfont[c]{\normalfont} 100 & 200  \\
\bottomrule
\tabuphantomline
\end{tabu}

\end{document}


The problem is with \rowfont[c]