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.

Fails
\documentclass{article}
\begin{document}
\textbf{bold text and more

Another paragraph.
\end{document}
Fixed
\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.

Fails
\documentclass{article}
\usepackage{amssymb}
\newcommand{\R}{\mathbb{R}
\begin{document}
Let $x \in \R$.
\end{document}
Fixed
\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

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

Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors