LaTeX error "Runaway argument?": cause and fix
TeX was reading the argument of a command and did not find the closing brace. Runaway argument? is the first of three lines: the second shows the beginning of the text TeX took for the argument, and the third is the error itself, Paragraph ended before \label was complete or File ended while scanning use of \@xdblarg.
Why it happens
- The closing brace of an argument is missing:
\textbf{importantinstead of\textbf{important}. - The argument is closed with the wrong character, for example
\textbf{important]or\textbf{important). - A
%in the same line turns the closing brace into a comment:\textbf{important % check}. - An optional argument is not closed:
\item[Labelwithout].
How to fix it
- Read the line below
Runaway argument?. It begins where the argument begins, so the command with the missing brace stands right before that text in your source. - Add the
}at the end of the argument. - If the error has a line number, it marks the place where TeX gave up, the next blank line. The brace is missing above that line.
- Move a
%comment behind the closing brace.
A document that produces the message
\documentclass{article}
\begin{document}
This result is \textbf{important and must be checked.
The next paragraph follows.
\end{document}The corrected document
\documentclass{article}
\begin{document}
This result is \textbf{important} and must be checked.
The next paragraph follows.
\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.