Using vspace, with spacing?

When I use the vspace command it won't work unless I put a new, empty line before and after the command. Is this normal? If it is, why is that? Why does it require spacing around the command?

-
It is not normal if you really need to put an empty line before it. Needing one afterwards is a different matter. –  cfr Jan 12 at 4:43
It does work (most of the code for \vspace is explicitly dealing with the case when it does not have a blank line before it), it may be that you are expecting it to do something else, but in that case it would be more helpful if you said what you expected it to do. –  David Carlisle Jan 12 at 10:57
covers the same territory: Non-uniform white spacing with \vspace –  barbara beeton Jan 12 at 13:24

\vspace only takes effect when LaTeX creates a line break or a new paragraph. I think more technically, \vspace only has effect when LaTeX is in vertical mode. If LaTeX is not currently in vertical mode, LaTeX saves the \vspace until next time it enters vertical mode.

So for example I can write:

\documentclass{article}
\begin{document}

Alice was beginning \vspace{2ex} to get very tired of sitting by her sister on
the bank, and of having nothing to do. Once or twice she had peeped
into the book her sister was reading, but it had no pictures or
conversations in it, and what is the use of a book,'' thought
Alice, without pictures or conversations?''

\end{document}


which results in

If I want to force the \vspace at the point where I place it, I must start a newline there also:

\documentclass{article}
\begin{document}

Alice was beginning \vspace{2ex}\newline to get very tired of sitting by her sister on
the bank, and of having nothing to do. Once or twice she had peeped
into the book her sister was reading, but it had no pictures or
conversations in it, and what is the use of a book,'' thought
Alice, without pictures or conversations?''

\end{document}


Alternatively you can start a new paragraph:

\documentclass{article}
\begin{document}

Alice was beginning \vspace{2ex}

\noindent
to get very tired of sitting by her sister on
the bank, and of having nothing to do. Once or twice she had peeped
into the book her sister was reading, but it had no pictures or
conversations in it, and what is the use of a book,'' thought
Alice, without pictures or conversations?''

\end{document}


These last two examples may look very similar, but the effects could be different if you've set \parskip to a non-zero value, which is generally discouraged.

-
If \vspace only has effect when LaTeX is in vertical mode, why don't you put \newline or \par or a blank line before \vspace rather than after \vspace? :-) Because intuitively the mode switching should happen before \vspace. –  In PSTricks we trust Jan 12 at 4:43
@StiffJokes \newline / \\  don't start vertical mode, they just put a negative penalty into the horizontal list so that a linebreak will be added at that point when th eparagraph is broken into lines. –  David Carlisle Jan 12 at 10:52
It's probably misleading to say it saves the \vspace : the vspace is executed (and any macros in its argument fully expanded) at the point it appeares, the resulting space though goes into a vadjust node that will be inserted after the current line. so `\setlength\foo{3pt}\vspace{\foo}\setlength\foo{10pt} zzzzzz\par} then 3pt not 10pt will be added –  David Carlisle Jan 12 at 10:55
@DavidCarlisle: OK. Thanks. –  In PSTricks we trust Jan 12 at 11:07