LaTeX error "Paragraph ended before \label was complete": cause and fix
A blank line came while TeX was still reading the argument of the command named in the message. Commands such as \label, \cite or \vspace do not accept a paragraph break in their argument, so TeX stops reading there. In most cases a closing brace is missing.
Why it happens
- A closing brace is missing, as in
\label{sec:intro. TeX reads on until the next blank line. - The argument contains a blank line although the command does not allow one.
\caption{...}and\textcolor{red}{...}are two examples. - An optional argument is not closed:
\item[Labelwithout]. - The command was defined with
\newcommand*. The star forbids paragraph breaks in the arguments.
How to fix it
- Add the missing
}. The line afterRunaway argument?in the log shows where the argument begins. - Remove the blank line from the argument. To colour several paragraphs, write
{\color{red} ...}instead of\textcolor. - If the message names a command you did not type, it is an internal helper of one you did:
\@vspacebelongs to\vspace,\Gin@iito\includegraphics,\@itemto\item. - Define your own command with
\newcommandwithout the star if its argument has to hold several paragraphs.
A document that produces the message
\documentclass{article}
\begin{document}
\section{Introduction}\label{sec:intro
This section states the question.
\end{document}The corrected document
\documentclass{article}
\begin{document}
\section{Introduction}\label{sec:intro}
This section states the question.
\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.