1

When I want to have a space between lines I use \\~\\ or \newline

For example

    Hello this is an example

    \\~\\

   Goodbye

I get the error there is no line to end here.

What am I doing wrong?

lockstep
  • 250,273
Al jabra
  • 373

2 Answers2

5

If you really want to skip a line, use

First line

\medskip

last line

A larger space is obtained with \bigskip

egreg
  • 1,121,712
  • I thought \medskip was defined by the document class, is it always guaranteed (assuming the user hasn't redefined it) to be the equivalent of skipping a line? – Au101 Jul 25 '16 at 21:25
  • 1
    @Au101 Not strictly “skipping a line”, but it leaves a visible amount of white space. It's not necessary (and I'd not recommend it) to have a full “blank line”. – egreg Jul 25 '16 at 21:32
1

You should not skip lines in this manner, you're better off using \vspace.

however, to answer your question, what you have there actually is

First line

\newline
~
\newline

last line

The first newline does not have a line to end. so it should simply be

First line

~\\

last line
Elad Den
  • 3,941
  • I think the mention of \vspace should come right at the start. The line skipping is not recomendable at all. – Johannes_B Jul 25 '16 at 09:24
  • I agree, edited accordingly – Elad Den Jul 25 '16 at 09:31
  • @eladden \vspace doesnt really do anything to my code. – Al jabra Jul 25 '16 at 09:32
  • @Aljabra the way to use it is \vspace{sizeofskip} check out this link https://www.sharelatex.com/learn/Line_breaks_and_blank_spaces you can also use \medskip – Elad Den Jul 25 '16 at 09:35
  • 1
    This answer is wrong – egreg Jul 25 '16 at 09:35
  • 2
    while that avoids the error message the markup ~\\ is still completely wrong and would for example produce something that looks like vertical space but is in fact a paragraph with no text that is not dropped at a page break, and as always if you end a paragraph with \\ you will get underfull; box 10000 warnings. – David Carlisle Jul 25 '16 at 09:43
  • 1
    And the recommendations in the sharelatex page are wrong as well – egreg Jul 25 '16 at 09:43