[Tex/LaTex] TeX ignores \vskip at the beginning of document

spacingtex-core

Here is a simple Plain TeX snippet for demonstration

\vskip 3in
Aaaaa
\vskip 3in
Bbbbb
\end

When I compile this with pdftex, I expect to see a 3-inch-high blank space, then Aaaaa, followed by another 3-inch-high blank space, then Bbbbb. But the first \vskip appears to be ignored by TeX.

On the other hand, when I do this

\hrule height 0pt
\vskip 3in
Aaaaa
\vskip 3in
Bbbbb
\end

The output is what I expect. But I see no reason why a dummy 0-point-hrule is necessary.

Best Answer

Vertical space is removed at page breaks. The start of a document is considered to happen at a page break. Use \vglue instead of \vskip for "non disappearing space".

From the TeXbook, p. 352

You can get horizontal space that never disappears by saying \hglue<glue>; this space is able to stretch or shrink. Similarly, there's a vertical analog, \vglue<glue>.

There is a difference in how pages and paragraphs are treated: \hskip at the start of a paragraph doesn't disappear, because of the indent box that's always inserted at the start of a paragraph.

If you notice, the first example in the TeXbook, story.tex, starts with a \hrule just to avoid the following vertical space to disappear.


The above considerations are for Plain TeX; in LaTeX one should use \vspace for "disappearing space" and \vspace* for the non disappearing variety.