I have a couple of LaTeX files with the same problem. If I produce an error, fix it, and then try to compile a pdf, I get the following error.
)Runaway argument?
{{
! File ended while scanning use of \@newl@ablel.
<inserted text>
\par
l.90 \begin{document}
If I then click on the console or trash my .aux
file, it compiles fine. Any thoughts on what is going on and how to prevent this annoying extra step?
Best Answer
This is the nature of the beast...
TeX employs an (external) auxiliary
.aux
file to store information at/of every run. This file is used extensively when dealing with labels and references (see Understanding how references and labels work) since the output routine only flushes pages after having collected enough content to fill it (and perhaps more). As is evident from your error snippet, it deals with an offending\label
usage.Here's the sequence that causes the error:
\label
-information is stored in.aux
. This information will be read during a subsequent compilation. If problematic code is written to the.aux
, you will only pick it up in this subsequent run. However, this run itself may compile without problem.Note that, even during the second compile (item 3 above) you are still writing problematic code to the
.aux
. So, even if you fix it and recompile, the problem will still show in the subsequent compile.Some problems are recoverable, but others are fatal, depending on when you are writing the information to the
.aux
. In a worst-case scenario - when the problem persists even though you've fixed your code - delete the offending.aux
and recompile (at least twice).How do you avoid this annoying extra step? Don't make mistakes... :) Well, at least not when dealing with content written to the
.aux
file.