1

I've seen that the \multispan ->\omit is a common error. But I couldn't figure it out. I'm getting

! Misplaced \omit. \multispan ->\omit

\@multispan l.12 \end{tabularx}

I tested with the following MWE to show the error:

\documentclass{article}

\usepackage{ltablex}
\begin{document}

\begin{tabularx}{\linewidth}{cc}
abc & abc \\
\pagebreak
\multicolumn{2}{c}{text}\\
abc & abc \\
abc & abc \\
\end{tabularx}
\end{document}

What is the problem? Can someone explain?

  • you don't need ltablex/tabularx there (it can do nothing useful without an X column anyway) just use a standard longtable then \pagebreak will work. – David Carlisle Dec 2 '15 at 15:49
  • I have a table that spans several pages, that's why. I strip that information for the sake of MWE-ness. But I wanted to show that the environment used was a tabularx in case that is the problem. – adn Dec 2 '15 at 16:50
  • Longtable will do multipage tables (that is what ltablex is using anyway) – David Carlisle Dec 2 '15 at 17:07
3

It seems to be that the ltablex package does not support that. You are not using any tabularx features, so just use longtable here. This runs without error

\documentclass{article}

\usepackage{longtable}
\begin{document}

\begin{longtable}{cc}
abc & abc \\
\pagebreak
\multicolumn{2}{c}{text}\\
abc & abc \\
abc & abc \\
\end{longtable}
\end{document}

If you are committed to sticking with ltablex then you can do

\documentclass{article}

\usepackage{ltablex}
\begin{document}

\begin{tabularx}{\linewidth}{cc}
abc & abc \\
\noalign{\break}
\multicolumn{2}{c}{text}\\
abc & abc \\
abc & abc \\
\end{tabularx}
\end{document}
|improve this answer|||||
  • Actually, I have a table typeset using tabularx and ltablex (for the \pagebreak). However, I removed that information to keep it simple. Is there a way to do it using tabularx? – adn Dec 2 '15 at 16:52
  • @adn probably it's fixable but if someone takes two of my packages and breaks them in combination then they should fix it:-) I have a different merge of tabularx and longtable on ctan (ltxtable.sty) so you could use that instead, but in 99.9999% of the cases you don't need tabularx and it's better to just use longtable. – David Carlisle Dec 2 '15 at 17:10
  • @adn see update, I added an ltablex version (against my better judgement:-) – David Carlisle Dec 2 '15 at 17:16
  • Thanks, I will migrate to longtable per your advice. Thanks! – adn Dec 2 '15 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.