LaTeX error "There's no line here to end": cause and fix
\\ or \newline ends the current line, but at this point no line has started. LaTeX is between two paragraphs, where a line break has nothing to break.
Why it happens
\\stands at the start of a paragraph, after a blank line or after a heading, to get vertical space.- Two
\\follow each other insidecenter,flushleftorflushrightto get an empty line. \\follows\item[Term]in adescriptionlist, to put the text below the term.\newlinestands at the start of a paragraph.
How to fix it
- Delete the
\\. A blank line in the source already starts a new paragraph. - For vertical space use
\vspace{1em},\smallskip,\medskipor\bigskip. See Horizontal and vertical space in LaTeX. - For more space after a line, give the break a length:
\\[1em]. - In a
descriptionlist, write\item[Term] \leavevmode \\so that there is a line to end.
A document that produces the message
\documentclass{article}
\begin{document}
\section{Results}
\\
The first paragraph.
\end{document}The corrected document
\documentclass{article}
\begin{document}
\section{Results}
\bigskip
The first paragraph.
\end{document}Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.
Finding the line in the editor
The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.