Daniel Lemire's blog

, 1 min read

Longtable LaTeX package breaks pages after header

Here’s an annoying longtable bug for those of you using LaTeX for a living. Sometimes, but rarely so, a longtable will break at the oddest places when using horizontal lines (hline), including right after the header. The solution is to define a special kind of hline called “nobreakhline” and use that instead where you don’t want any page breaks.


\makeatletter
\def\nobreakhline{%
\multispan\LT@cols\unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
\noalign{\penalty10000}}
\makeatother