rolfn / xltabular

LaTeX package which combines longtable and tabularx.
Other
10 stars 3 forks source link

Fatal error if first row after a manual pagebreak starts with multicolumn command #8

Closed jdeut closed 4 years ago

jdeut commented 4 years ago

Foreword

I think i encountered an issue with xltabular, that I have posted on tex.stackexchange.com recently.

(see https://tex.stackexchange.com/questions/523537/fatal-error-if-first-row-after-a-manual-pagebreak-starts-with-multicolumn-comman)

Example Document

\documentclass{article}
\usepackage{xltabular}
\usepackage{booktabs}
\begin{document}

\begin{xltabular}{\linewidth}{l>{\raggedright}X}
        \caption{Caption}\tabularnewline
        \toprule
        \multicolumn{2}{l}{Header bli bla blub}\tabularnewline 
        \midrule
    \endhead
        \bottomrule
    \endfoot
    a  & b \tabularnewline 
    c & d \tabularnewline
    \pagebreak
    %e & f \tabularnewline % LINE 17
    \multicolumn{2}{l}{multicolumn}\tabularnewline
\end{xltabular}

\end{document}

Issue

The document listed above doesn't compile. The following fatal error occurs during compilation:

./doc.tex:19: Misplaced \omit.
\multispan ->\omit 
                   \@multispan 
l.19     
\end{xltabular}

If I uncomment line 17 so that the first row after \pagebreak doesn't start with a multicolumn everything works fine.

rolfn commented 4 years ago

Our xltabular based on and used the package ltablex. A similar example with ltablex instead of xltabular shows the same error:

\documentclass{article}
\usepackage{ltablex}
\usepackage{booktabs}
\begin{document}

\begin{tabularx}{\linewidth}{l>{\raggedright}X}
        \caption{Caption}\tabularnewline
        \toprule
        \multicolumn{2}{l}{Header bli bla blub}\tabularnewline 
        \midrule
    \endhead
        \bottomrule
    \endfoot
    a  & b \tabularnewline 
    c & d \tabularnewline
    \pagebreak
    %e & f \tabularnewline % LINE 17
    \multicolumn{2}{l}{multicolumn}\tabularnewline
\end{tabularx}

\end{document}

I cannot solve this problem. Sorry. I can only suggest a poor hack. Replace \pagebreak by \pagebreak\tabularnewline[-\normalbaselineskip].

jdeut commented 4 years ago

Our xltabular based on and used the package ltablex. A similar example with ltablex instead of xltabular shows the same error:

Thank you for pointing this out. That helped me a lot.

In addition to your solution I found a similar solution originally proposed for ltablex:

https://tex.stackexchange.com/questions/281179/multispan-omit-error-when-using-pagebreak-before-multicolumn