Fix "Runaway argument" and "Paragraph ended before" in LaTeX
These errors mean a command’s argument was opened with { but never closed with }, so LaTeX kept reading until it hit a blank line or the end of the file. You will learn how to find the missing brace.
The message
Section titled “The message”When the argument runs into a blank line:
Runaway argument?{fig:results for the details../main.tex:4: Paragraph ended before \@kernel@ref was complete.When it runs to the end of the file:
Runaway argument?{an unclosed bold group. \par A new paragraph starts here. \end {docu\ETC.! File ended while scanning use of \textbf .The line after Runaway argument? shows the start of the argument that was never closed. That is the place to look.
Why it happens
Section titled “Why it happens”- A missing
}at the end of an argument, for example\ref{fig:resultsor\textbf{word. - A
}typed as)or]by mistake. - A blank line inside an argument that does not allow paragraphs, such as
\ref,\citeor\label.
Example
Section titled “Example”\documentclass{article}\begin{document}See Figure~\ref{fig:results for the details.
The next paragraph starts here.\end{document}Close the argument where it should end:
\documentclass{article}\begin{document}See Figure~\ref{fig:results} for the details.
The next paragraph starts here.\end{document}Help from Luzbase
Section titled “Help from Luzbase”- The code editor highlights matching brackets and closes
{for you as you type, which makes a missing}easier to spot. - For “File ended while scanning use of …”, the error summary in the Output panel shows the hint “A { or an argument is never closed. Check the braces before this point.”
Not on Luzbase yet? It compiles LaTeX in your browser and links each error to its line, often with the fix. Start writing free.
Related
Section titled “Related”- Too many }’s, the opposite problem
- Common LaTeX errors