[texhax] \vskip at beginning of file

Daniel H. Luecking luecking at uark.edu
Wed Jul 20 20:34:21 CEST 2016

Jim Diamond wrote:
        In the context of someone putting some space at the top of the page,
        can anyone explain to me why we care about preserving \prevdepth ?

When a line of text is placed on a page, TeX tries to place it
With its baseline exactly one \baselineskip below the previous
line, so TeX inserts enough extra vertical space to achieve that

This process ignores any vertical space you insert yourself, but
does take into account the depth of the previous line (stored in
\prevdepth). So the amount of extra space added is \baselineskip
minus \prevdepth minus the height of the line being added, if
that calculated value is positive.

However, if \prevdepth is equal to exactly -1000pt then the extra
space is not added. TeX sets \prevdepth to -1000pt at the start of
page and after an \hrule.

\hrule height 0pt
\vskip -\topskip
\vskip 5in
%\prevdepth now -1000pt
will place "Text" with the top of the "T" at exactly 5 inches
below \voffset.

\null % place an empty line
\vskip 5in
%\prevdepth now 0pt
will place "Text" slightly lower (by the amount \baselineskip
minus the height of the "T").


Daniel H. Luecking
University of Arkansas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20160720/66d99529/attachment-0001.html>

More information about the texhax mailing list