5

For this minimal example

\documentclass{article}
\begin{document}
\noindent
Hallo \\
How \\
Are \\
\vspace{15cm}You?
\end{document}

There is no vertical space created between the word Are and You. How can I add vertical space between them? Using \vspace* did not work either.

  • Just leave an empty line after Are and remove the `\\` – user31729 Apr 1 '16 at 13:21
  • 1
    You might want to use \\[15cm], but you're misusing the tool anyway. There is very rarely need for \\ in normal text. – egreg Apr 1 '16 at 13:23
  • You could also use \par instead of `\\` after "Are". – A Feldman Apr 1 '16 at 13:25
  • @egreg actually I tried '\vspace[15cm]You?' and it seemed to work, and I have no idea why. – A Feldman Apr 1 '16 at 13:41
9

\vspace if used mid paragraph, as here, stores the vertical space in a special place (a vadjust node) which is then inserted after the paragraph has been broken into lines, after the line on which the space is added. in your example the \vspace is added in the last line of the paragraph so the space comes after the paragraph. Compare

\documentclass{article}
\begin{document}
\noindent
Hallo \\
How \\
Are \\
You?

xxxxx

\noindent
Hallo \\
How \\
Are \\
\vspace{15cm}You?

xxxxx
\end{document}

enter image description here

to add a space at the linebreak you should use

\\[3cm]

but it is almost always wrong to use \\ at all apart from its use in tables.

0

In cases like this, I write

a lot of stuff I write\\
a new line\\
\vspace{15cm} \ \\     % the \ is necessary, otherwise you will get a no-line-to-end-error.
You

\vspace and \hspace are very sensitive to new lines (\\) and new paragraphs (double linefeed). Changing vspace to \vspace* is also always a good first try.

There will be people saying, that this code isn't beautiful. Remember: All codes are beautiful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.