# A fix for \vspace*, does it break other things?

Thanks to the answers to this question, I believe I have a fix for \vspace* that will make it work sanely at the top of a page.

\def\@vspacer#1{%
\ifvmode
\dimen@\prevdepth
\begingroup
\topskip\z@skip
\hrule\@height\z@
\nobreak
\endgroup
\vskip#1%
\vskip\z@skip
\prevdepth\dimen@
\else
\@bsphack
\@restorepar
\begingroup
\topskip\z@skip
\hrule\@height\z@
\nobreak
\endgroup
\vskip#1%
\vskip\z@skip
}%
\@esphack
\fi
}


The only change from the standard definition is the addition of \begingroup, \topskip\z@, and \endgroup.

As near as I can tell, this should only affect \vspace*s that appear at the beginning of a page. The idea is that \vspace*{5in} should really be 5in, not 5in + 10pt. And one shouldn't have to use \kern-\topskip after \vspace*s that appear at the top of the page.

Is there some reason this or something similar was not in the LaTeX 2e kernel? There are no comments in the source noting any sort of problems with \vspace and \topskip. In fact, \topskip is barely mentioned in the source.

-
@TH to understand you correctly you want the \vspace and \vspace* to produce identical behavior at the top of a page? – Yiannis Lazarides Dec 24 '10 at 6:50
@Yiannis: No. I want \vspace*{5in} at the top of the page to really be a skip of 5 inches. With the default definition, \vspace*{5in} at the top of a page gives you 5 inches plus \topskip (which defaults to 10 pt). Basically, I want \vspace* to always have the same behavior. – TH. Dec 24 '10 at 9:23
@TH I see, but IMHO you should then used vspace or define a macro @gobble@topskip. – Yiannis Lazarides Dec 24 '10 at 9:56
@Yiannis: I don't know what you mean. \vspace{x} expands to \vskip x\vskip 0pt. At the top of the page, TeX would discard them. Something like \@gobble@topsep would be easy enough, but you'd have to know that you're at the top of the page. I can't think of a good reason for \vspace* to have a different behavior at the top of the page versus part way down. In particular, \vspace*{0pt} should really not add any vertical space. At the very least, I've seen no documentation saying that the value you give it might not be the amount it skips. It seems like a bug in LaTeX to me. – TH. Dec 24 '10 at 10:07
Although this doesn't help, let me say that I can follow what you're saying; it looks indeed like a bug in \vpace*. I'm also curious what Herbert had in mind. – Hendrik Vogt Dec 30 '10 at 15:18

\documentclass[twocolumn]{article}
\usepackage{showframe}
\begin{document}
\vspace*{0pt}
ASDF
\newpage
ASDF
\end{document}


\vspace{0pt} is the command to insert a line of height 0. But is is a line and the following baseline is \baselineskip deeper. The \vspace*{0pt} or alternatively \vspace{0pt} is a very useful command insode minipages to fit parallel boxes at top. However, \vspace is measuered from the baseline.

-
I don't follow what you're trying to say here. \vspace{x} is just supposed to insert x amount of space in vertical mode. It has nothing to do with lines. In fact, it has nothing to do with \baselineskip at all. The only reason it saves and restores \prevdepth for \vspace* is because \hrule sets \prevdepth to -1000. – TH. Dec 24 '10 at 9:21

After some reflection, I think the right thing to do is not to fix the broken \vspace* behavior (because packages might actually rely on its brokenness, but to create a new macro \Vspace that is exactly the \@vspacer that can be used everywhere actually getting the specified amount of space is required.

I'll wait a bit before accepting to see if Herbert can explain what he meant.

-