I’ve noticed this question because it popped up at the top of the list of active questions a few hours ago, and I would like to add another, minor remark to the excellent answer given by @egreg.
There is another difference between
\vskip \medskipamount % say
and
\vspace{\medskipamount}
and it is how they behave if an \addvspace
and/or an \addpenalty
command immediately follows them. Indeed, \vspace
adds a second zero-length skip, which causes an ensuing \addvspace
(resp., \addpenalty
) command not to remove the preceding space before adding its own vertical space (resp., penalty). This zero-length skip is, of course, not added by \vskip
, which is a primitive command, with the effect that an \addvspace
that comes immediately after (that is, without intervening items in the current vertical list) will remove the vertical space added by \vskip
if it shorter than the space specified in its own argument.
In other words, if you say
\vspace{\medskipamount}
\addvspace{\bigskipamount}
both spaces will survive and you'll get a total vertical space of \medskipamount
+\bigskipamount
, whilst with
\vskip \medskipamount
\addvspace{\bigskipamount}
only the taller of the two spaces will survive (\bigskipamount
, in this case).
The behavior of \addpenalty
is similar, but in order to see it clearly we need to look at the tracing produced by \showlists
. Consider the following (almost) MWE:
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
% \usepackage[ascii]{inputenc}
\showboxbreadth = 1000
\showboxdepth = 10
\begin{document}
Short paragraph~\#1.
\vskip \medskipamount
\addvspace{\bigskipamount}
Short paragraph~\#~2.
\vspace{\medskipamount}
\addvspace{\bigskipamount}
Short paragraph~\#~3.
Let's now consider penalties. To see the difference, you'll have to look at
the transcript file, and read the tracing produced by \verb|\showlists|.
Short paragraph~\#4.
\vskip \medskipamount
\addpenalty{123}
\addvspace{\bigskipamount}
Short paragraph~\#~5.
\vspace{\medskipamount}
\addpenalty{123}
\addvspace{\bigskipamount}
Short paragraph~\#~6.
\showlists
\end{document}
This is the excerpt of the tracing that pertains to the tract between the “Short paragraphs” #4 and #5:
\glue 6.0 plus 2.0 minus 2.0
\glue -7.94397 plus -2.0 minus -2.0
\penalty 123
\glue 1.94397
\glue 6.0 plus 2.0 minus 2.0
\glue -6.0 plus -2.0 minus -2.0
\glue 12.0 plus 4.0 minus 4.0
\glue(\parskip) 0.0 plus 1.0
As you see, there is a backspace of -7.94397 plus -2.0 minus -2.0
(points) before the penalty item: this backspace compensate both for the preceding vertical space of 6.0 plus 2.0 minus 2.0
(always points), that comes from \vskip \medskipamount
, and for the depth of the last line of text (the latter being a recent correction of an old LaTeX bug). Note also the second backspace before \glue 12.0 plus 4.0 minus 4.0
, which is the glue corresponding to \bigskipamount
.
On the other hand, the corresponding excerpt for paragraphs #5 and #6 is
\glue 6.0 plus 2.0 minus 2.0
\glue 0.0
\penalty 123
\glue 12.0 plus 4.0 minus 4.0
\glue(\parskip) 0.0 plus 1.0
Here you can see the zero-length vertical space of which we spoke above, and no backspacing at all.