[comp.text.tex] \topskip = 0pt produces bug in LaTeX

ogawa@ORION.ARC.NASA.GOV (Arthur Ogawa) (03/13/91)

In LaTeX, the \clearpage command, when used twice in succession,
should not eject extra blank pages, thus, after the first \clearpage
has been processed, the second \clearpage should act as a no-op.
However, if you have naively set the \topskip to 0pt, this will not
work correctly: you have effectively prevented LaTeX's clever output
routine from functioning as designed.
 
There are numerous other places where you will get extraneous pages
for similar reasons.
 
The lesson is: Don't set \topskip = 0pt, rather
set it to, say, 0.01pt. Nobody will be the wiser but LaTeX.
 
Don't ask me how long I worked to figure this out, or on how
many separate occasions.
 
I know that there is a note in Leslie Lamport's bug list to
the effect that he is aware that something goes wrong when
the value of \topskip is zero:
 
| 111.  Setting \topskip to 0pt does weird things.  I haven't figured out
| why, but there's no reason to set \topskip to 0pt, so this is not
| considered a bug.  (Discovered by Mabry Tyson.)
 
Considering that this is the case, LaTeX itself should probably check
that \topskip has not been set to zero, and issue an error message.
 
But until that day, please, if you are rewriting LaTeX .sty files,
puh-lease, don't set \topskip to 0pt.
 
PS
 
Leslie may have figured this out by now, but I do know the reason
"weird things" happen: in the code for \@doclearpage, LaTeX
does the following:
 
        \setbox\@tempboxa\vsplit\@cclv to\z@
                \unvbox\@tempboxa
        \setbox\@tempboxa\box\@cclv
 
The effect of this is to throw away all of what is in \box255, except
for a bit of (zero-height) material at the beginning. At this juncture
the stuff that is being discarded is oftentimes a \vbox that LaTeX put
there automatically (preceded by \topskip glue), and the stuff that is
being reinserted into the vertical list is oftentimes a \mark and a \write-{}.
 
The purpose of sticking these objects into the vertical list is so that
LaTeX can force TeX into the output routine at will.
 
When the \topskip is set to 0, all the material is reinserted into the
vertical list. Then LaTeX thinks it has a non-trivial page, and you get
a blank page.
 
Hoping that this makes a difference,
Art