1

Why does the following table breaks with TeX saying that

! Extra alignment tab has been changed to \cr.
<recently read> \endtemplate 

l.9 \end{tabularx}

?

If I change the column specification from c>{\raggedright}X to >{\raggedright}Xc (that is, change the order) the document compiles correctly.

\documentclass{article}
\usepackage{tabularx}
% \usepackage{booktabs}
\begin{document}
\begin{tabularx}{2cm}{c>{\raggedright}X}
  a & b \\
  % \midrule Yet another error
  c & d \\
\end{tabularx}
\end{document}

Moreover, if I use one of booktabs's rules in the middle of the table (not before the first row, not after the second, but in the middle, specifically), the error changes. I assume that it's a consequence of the first, so perhaps solving the first this one will disappear too.

Bernard
  • 271,350
LaTeXer
  • 1,492

1 Answers1

2

Use \raggedright\arraybackslash where \arraybackslash restores \\ to its "end of table row" meaning,

David Carlisle
  • 757,742