Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LaTeX: longtable causes unnecessary page break?

3,691 views
Skip to first unread message

peter...@my-dejanews.com

unread,
May 21, 1999, 3:00:00 AM5/21/99
to

I'm revising a 15 page document with LaTeX2e (Web2C, WinNT), using the
longtable package. I have one case in which I get a single line of text
at the top of the page, and the table which follows it (only about 3
inches tall) is on the next page, so most of the page is blank! I have
set LTchunksize to 2, so that's not the problem.

In fact, I determined experimentally that simply adding more text to the
paragraph before the table causes the table to paginate correctly. I
think if there's only one line above the table on the page, it breaks to
the next page. If the previous paragraph has more than one line, the
table is right below it, as it should be.

By the way, this was in the middle of the document, so I don't know how
easy this would be to reproduce with a single page.

Anyone seen anything like this? Any newer versions of longtable which
fix this problem?

Thanks,

-pd

--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---

David Carlisle

unread,
May 21, 1999, 3:00:00 AM5/21/99
to peter...@my-dejanews.com

what happens if you put \clearpage at the point just above the table
where the page should have broke.

If you can make a test file of reasonable size, you could send a bug
report using latexbug.tex, but no promises, it's hard to get this
right all the time.

David

Heiko Oberdiek

unread,
May 21, 1999, 3:00:00 AM5/21/99
to
peter...@my-dejanews.com wrote:

>I'm revising a 15 page document with LaTeX2e (Web2C, WinNT), using the
>longtable package. I have one case in which I get a single line of text
>at the top of the page, and the table which follows it (only about 3
>inches tall) is on the next page, so most of the page is blank! I have
>set LTchunksize to 2, so that's not the problem.
>
>In fact, I determined experimentally that simply adding more text to the
>paragraph before the table causes the table to paginate correctly. I
>think if there's only one line above the table on the page, it breaks to
>the next page. If the previous paragraph has more than one line, the
>table is right below it, as it should be.
>
>By the way, this was in the middle of the document, so I don't know how
>easy this would be to reproduce with a single page.

X:= the page with the one line
1. Look at the page break between X-2 and X-1.
2. Add a \clearpage in the sources at this place.
3. Check: The one line page should remain.
4. Now you can delete all before the \clearpage
5. Check.
6. a) Simplify the text on page X-1 (now page 1),
b) replace complicated stuff with \vspace, ...
c) Remove packages that are no more needed,
remove definitions, ...
7. Check.
Now you should have a small file that can be posted.

>Anyone seen anything like this? Any newer versions of longtable which
>fix this problem?

A long time ago I have reported this problem with an official
bugreport: tools/2796
There is another bugreport tools/2601 this a similar problem.

Hello David, a year ago you have promised to try fixing it?

The problem: \LT@start sets first glue \LTpre. Then it looks
at \pagetotal/\pagegoal to check whether is there enough
place for the longtable. If there isn't enough place it
performs a pagebreak: \vfil\break
But now the glue \LTpre remains: If there isn't place for this
glue at the previous page, a new page have to be started
and produces the nearly empty page.

If the following patch solves your problem, then you are a victim
of tools/2796 and have the problem solved by this workaround.

\usepackage{longtable}
\makeatletter
\typeout{fix for tools/2796}
\def\LT@start{%
\let\LT@start\endgraf
\endgraf\penalty\z@\vskip\LTpre
\dimen@\pagetotal
\advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
\advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
\advance\dimen@ \ht\LT@foot
\dimen@ii\vfuzz
\vfuzz\maxdimen
\setbox\tw@\copy\z@
\setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
\setbox\tw@\vbox{\unvbox\tw@}%
\vfuzz\dimen@ii
\advance\dimen@ \ht
\ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi
\advance\dimen@\dp
\ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi
\advance\dimen@ -\pagegoal
% \ifdim \dimen@>\z@\vfil\break\fi
\ifdim \dimen@>\z@\unskip\vfil\break\fi
\global\@colroom\@colht
\ifvoid\LT@foot\else
\advance\vsize-\ht\LT@foot
\global\advance\@colroom-\ht\LT@foot
\dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@
\maxdepth\z@
\fi
\ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi
\output{\LT@output}}
\makeatother

Yours sincerely
Heiko <ober...@ruf.uni-freiburg.de>

Donald Arseneau

unread,
May 21, 1999, 3:00:00 AM5/21/99
to
In article <7i45ch$4h0$1...@nnrp1.deja.com>, peter...@my-dejanews.com writes...
>
From: as...@erich.triumf.ca (Donald Arseneau)
Newsgroups: comp.text.tex
Subject: Re: LaTeX: longtable causes unnecessary page break?
Summary:
Date: 21 May 1999 19:49 PST
Distribution: world
Keywords:

In article <7i45ch$4h0$1...@nnrp1.deja.com>, peter...@my-dejanews.com writes...


>I'm revising a 15 page document with LaTeX2e (Web2C, WinNT), using the
>longtable package. I have one case in which I get a single line of text
>at the top of the page, and the table which follows it (only about 3
>inches tall) is on the next page, so most of the page is blank!


Here's what's happening...it is a result of TeX collecting
more than fits on a page before it decides where to break the
page ...

When the longtable starts, it checks if it has enough room on
the page, but in your case TeX had not yet decided to break the
page yet, so it appears to be at the bottom of an already-full
page, so longtable forces a page break. However, that page was
actually *over* full, and the last line couldn't fit, so TeX
decided to split the page above that last line. You get that
automatic page break plus lontable's forced break.

This might be my fault... I forwarded the page breaking code from
wrapfig.sty to David, so if he is using that, then wrapfig.sty
is wrong too.

Are you using an up to date longtable? Maybe you are just seeing
the bad-old behaviour.

By the way, this confusion is the same that causes LaTeX to put
marginpars on the wrong side near page breaks.

If longtable checks properly, it should never get confused like
this. When there is a forced break, TeX will not split the page
above that unless the material absolutely will not fit on a page.

Donald Arseneau as...@triumf.ca

David Carlisle

unread,
May 22, 1999, 3:00:00 AM5/22/99
to

> If longtable checks properly,

If....

David

Jonathan Fine

unread,
May 23, 1999, 3:00:00 AM5/23/99
to
Donald Arseneau <as...@erich.triumf.ca> writes

>By the way, this confusion is the same that causes LaTeX to put
>marginpars on the wrong side near page breaks.

In his "Macros for Jill", Knuth solve the problem of marginal notes by
processing the file twice, once with the marginal items on the left, and
once with them on the right.

Now print the odd numbered pages from the right run, and the even pages
from the left run. It's done.

Can this problem be solved in any other way?

"Macros for Jill" was published in TUGboat, in 1988. It is republished
in Don Knuth's "Collected Papers in Digital Typography" (CSLI and CUP),
available now (or soon) in good bookstores everywhere.

Jonathan Fine, Cambridge, UK
Active TeX and the DOT syntax
http://www.active-tex.demon.co.uk/

peter...@my-dejanews.com

unread,
May 24, 1999, 3:00:00 AM5/24/99
to
In article <87zp2x7...@dcarlisle.demon.co.uk>,

David Carlisle <da...@dcarlisle.demon.co.uk> wrote:
>
> > If longtable checks properly,
>
> If....

Unfortunately (or fortunately), I have since edited the document and
this problem no longer shows up. However, I will look out for it, and
try some of the various suggestions proposed.

Thanks very much,

Robin Fairbairns

unread,
May 25, 1999, 3:00:00 AM5/25/99
to
Jonathan Fine <fi...@active-tex.demon.co.uk> wrote:
>Donald Arseneau <as...@erich.triumf.ca> writes
>>By the way, this confusion is the same that causes LaTeX to put
>>marginpars on the wrong side near page breaks.
>
>In his "Macros for Jill", Knuth solve the problem of marginal notes by
>processing the file twice, once with the marginal items on the left, and
>once with them on the right.
>
>Now print the odd numbered pages from the right run, and the even pages
>from the left run. It's done.
>
>Can this problem be solved in any other way?

in principle, yes, but it's distinctly tricky, and requires output
routine hacking (and since most people use latex, and latex's output
routine is somewhat of a nightmare ...)

i wish you'd remembered knuth's technique when that unfortunate german
student was getting desperate about his dissertation a few days
back ;-)
--
Robin Fairbairns, Cambridge

0 new messages