Vertical space different at top of first page

The problem is that the \baselineskip glue is inserted before the first line in the page after \vspace*. And it depends on the depth of the previous line. At beginning of the document, this depth is zero, but after the last line of the second paragraph is printed, the depth is derived from the depth of the p and q letters. If you remove the second paragraph then the last line includes only the rutrum word and it has zero depth.

If \vspace* isn't used after page break then the "unstable" \baselineskip is removed because it is "discardable item" after page break and \topskip glue is normally used.

The \vspace* implementation is bad, because it saves \prevdepth (it is used for next \baselineskip glue), then it puts non-discardable item (\hrule) plus desired \vskip and then restores the \prevdepth register:

\def\@vspacer#1{%
  \ifvmode
    \dimen@\prevdepth
    \hrule \@height\z@
    \nobreak
    \vskip #1
    \vskip\z@skip
    \prevdepth\dimen@
  \else ...

Now, the "unstable" \baselineskip is added after the material from \vspace* and it isn't removed at page break.

I suggest to use

\par \null \nobreak \vskip-\baselineskip \vskip<desired amount> \relax

instead LaTeX's \vspace*.


Wipet's analysis is correct. If precise spacing at the top is needed, the prevdepth should be neutralized.

\documentclass{article}
\usepackage{lipsum}

\makeatletter
\g@addto@macro{\newpage}{\nointerlineskip}
\makeatother

\begin{document}
\nointerlineskip
\vspace*{10pt}
\lipsum[1]
\newpage
\vspace*{10pt}
\lipsum[1]
\end{document}

However, a \nointerlineskip should be added in case we need a space in the very first page, because LaTeX inserts a whatsit at the top.

Tags:

Spacing