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:
- You compile your document.
\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.
- You compile your document again in order to make sure the references settle. However, now the problematic code is read in, causing the error.
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.
:)
.aux
file. Sometimes just passing over the error, instead of interrupting the LaTeX run, can cure it by writing a correct file at the end of the run..aux
file is deleted, that file compiles fine? Obviously, not every error should produce so terrible an error. Also: is 'the same problem' due to the same bad command..?\@newl@ablel
but only\@newl@bel
...