TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

while intensively using the longtable environment, I ran into a situation where a the table is broken to the next page immediately after its endfoot line, without any real table row on the starting page. How to fix this?




Here nearly at bottom of page, a longtable follows\ldots
\hline\multicolumn{2}{|l|}{\textsl{\ldots continued from previous page}}
\multicolumn{2}{|l|}{\textsl{will be continued on next page\ldots}}\\*
aa: & 4711\\
aaa: & 2\\
aaaa: & 4711-2\\


The problem is that I'm going to create many documents automatically and therefore may not see such layout problems.

If the initial vertical space is a bit less or more, the problem disappears...

Thanks in advance for help and ideas!

share|improve this question
It can experimentally be found that the critical minimum length is \vspace*{187.212502mm} for this example, at least in my envrionment. I don't know why and what that tells... – tueftl Sep 18 '12 at 11:46
@DavidCarlisle: with \setlength{\LTpre}{0pt} the problem disappears in this MWE (the minimum length then is \vspace*{189.338523mm}), but that seems to be not always a workaround. – tueftl Sep 27 '12 at 11:53
up vote 2 down vote accepted

As a workaround, \usepackage{needspace} may be added to declare the minimum space for, say, 2 table rows (one data row and the continuation message).

Just add \newdimen\LTpreNeededspace once and the following code before each \begin{longtable}:

\multiply\LTpreNeededspace by 2 % Request 2 table lines, each including single '\hline', to fit on a page
\addtolength{\LTpreNeededspace}{\dimexpr\LTpre - \glueshrink\LTpre\relax}\addtolength{\LTpreNeededspace}{\arrayrulewidth}   % Additionally, request the top '\hline' and the minimum value of '\LTpre'.
\addtolength{\LTpreNeededspace}{2.2pt}  % The reason for this necessary add-on is not yet clear.
share|improve this answer
\setlength{\LTpreNeededspace}{\dimexpr\LTpre - \glueshrink\LTpre\relax} should do (assuming that the shrink component is finite, of course). – egreg Sep 18 '12 at 10:56
Edit: added the \dimexpr term as suggested by egreg and removed last paragraph including this link. Thanks! All my trials with boxes didn't lead to this target (to compute 8.0pt from the default 12.0pt plus 4.0pt minus 4.0pt of LTpre)... – tueftl Sep 18 '12 at 11:16
Edit: added another 2.2pt to the requested length (2.13pt were identified as minimum); compare with the critical minimum \vspace* value posted as comment to the question. – tueftl Sep 18 '12 at 11:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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