[Tex/LaTex] Using vspace, with spacing

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?

Best Answer

\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

enter image description here

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}

enter image description here

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}

enter image description here

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.