Runaway argument?
A command's argument was never closed, so TeX read on to the end of a paragraph or of the file. Add the missing } after the argument.
Help centre › LaTeX errors › Braces and environments · Error: the build stops or the output is wrong
What the log says
Runaway argument?
{bold text and more \par Another paragraph. \end {document}
! File ended while scanning use of \textbf .
<inserted text>
\par Also printed as: File ended while scanning use of <name>
What it means
TeX was collecting the argument of a command, everything between { and its matching }, and never found the }. It prints the start of what it collected after Runaway argument?, then the reason it stopped: File ended while scanning use of … when it read to the end of the file, or Paragraph ended before … was complete when the command does not accept paragraph breaks. The command named in that second line is the one whose argument is unclosed.
Causes and fixes
Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.
1. A closing brace is missing from a command's argument
The text after Runaway argument? starts right after the opening {: find that place in your file and add the } where the argument should end.
\documentclass{article}
\begin{document}
\textbf{bold text and more
Another paragraph.
\end{document}\documentclass{article}
\begin{document}
\textbf{bold text} and more
Another paragraph.
\end{document}2. A definition in the preamble is not closed
A \newcommand missing its last } swallows the rest of the file, \begin{document} included; the message then names an internal command such as \@argdef. Check the braces of the definitions above the reported point.
\documentclass{article}
\usepackage{amssymb}
\newcommand{\R}{\mathbb{R}
\begin{document}
Let $x \in \R$.
\end{document}\documentclass{article}
\usepackage{amssymb}
\newcommand{\R}{\mathbb{R}}
\begin{document}
Let $x \in \R$.
\end{document}3. An unclosed brace in a footnote, caption or other long argument
\footnote{, \caption{ and \textit{ accept paragraph breaks, so an unclosed one runs to the end of the file. The command named after scanning use of tells you which kind to search for.
4. A short argument (label, reference, title) that runs into a blank line
This produces Paragraph ended before … was complete instead; see that page.
Finding the line when the line number does not help
- The
l.<n>line is often the last line of the file and does not help. Search instead for the text shown afterRunaway argument?: the brace that is never closed is just before it. - Commenting out halves of the document (or using
\end{document}early) narrows it down when the text shown is not distinctive.
In Manulyx
The editor shows the error with an explanation, and the compile log is parsed into a list of problems, so the runaway text is shown next to the command it belongs to.
Write in Manulyx for free · Journal templates
More in braces and environments
- Missing } inserted.A { group was still open when maths or a table cell ended. Close the brace before the $ or & that ends it.
- LaTeX Error: \begin{<a>} on input line <n> ended by \end{<b>}An environment is closed by the wrong \end: a misspelled \end, environments closed in the wrong order, or a missing \end{…} further up.
Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors