"No line here to end"

The error

snippet.latex
! LaTeX Error: There's no line here to end.
 
See the LaTeX manual or LaTeX Companion for explanation.

appears when you give LaTeX a \\ command at a time when it's not expecting it; it is a line-breaking command, and is confused if LaTeX isn't building a paragraph when you give the command. A common case is where you've decided you want the label of a list item to be on a line of its own, and written (for example):

snippet.latex
\begin{description}
\item[Very long label] \\
Text...
\end{description}

The proper solution to the problem is to write a new sort of description environment, that does just what you're after. (The _LaTeX Companion_ offers a rather wide selection of variants of these things.)

A straightforward solution, which avoids the warning, is to write:

snippet.latex
\begin{description}
\item[Very long label] \leavevmode \\
Text...
\end{description}

which starts a paragraph before forcing a break. The expdlist package provides the same functionality with its \breaklabel command, and mdwlist provides it via its \desclabelstyle command.

The other common occasion for the message is when you're using the center (or flushleft or flushright) environment, and have decided you need extra separation between lines in the environment:

snippet.latex
\begin{center}
First (heading) line\\
\\
body of the centerd text...
\end{center}

The solution here is plain: use the \\ command in the way it's supposed to be used, to provide more than just a single line break space. \\ takes an optional argument, which specifies how much extra space to add; the required effect in the text above can be had by saying:

snippet.latex
\begin{center}
First (heading) line\\[\baselineskip]
body of the centerd text...
\end{center}

You can use \leavevmode, as above:

snippet.latex
\begin{center}
First (heading) line\\
\leavevmode\\
body of the centerd text...
\end{center}

but that is just as tiresome to type as \\ with an optional argument, and can not be recommended.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Creative Commons Lizenzvertrag Edit this page Old revisions Sitemap Backlinks RSS feed Impressum Flattr this