I am working on TeX Live 2013 with TeXShop (MacTex2013 distribution)
Expected behavior is, that in the case an error occurs during compilation the .aux file is purged. Subsequent compilation must therefore be done twice, to get the references right.
In the below "minimal" example, this does not happen. The .aux file remains half written causing a "file ended while scanning use of \@newl@bel" error.
Even minimal changes lead to the .aux file being correctly purged. Such as:
- Change of text in headlines or captions. Even a change of Ü to \"U.
- Omitting a \label{...} anywhere.
- Omitting a \cite{...} anywhere (providing a .bib resource has no effect).
- Not using biblatex or hyperref.
- Changing the page breaks.
Here is the self-contained file.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
%\usepackage[T1]{fontenc}
\usepackage{biblatex}
\usepackage{hyperref}
% ================================================
\begin{document}
\clearpage
\section{Geomaxrie der ganzzahligen linearen Optimierung}
\label{Sec.Einfuhrung}
. [figure]
\begin{figure}
\caption{Caption}
\label{Fig.Beispiel-ILP}
\end{figure}
\section{Gitterbasisreduktion und Voronoi Algorithmus}
\label{Sec.Voronoi}
.
.
.
.
.
.
.
.
.
.
cite\cite{Voronoi}
.
.
.
label\label{Thm.Voronoi}
.
.
label\label{Alg.VoronoiFilter}
.
.
label\label{Alg.VoronoiFilter.Bedingung}
.
.
.
.
.
.
.
.
.
label\label{Alg.CVPP}
.
.
.
.
.
.
.
label\label{Alg.VoronoiRelevant}
.
.
.
.
.
.
.
label\label{Alg.Voronoi}
.
\clearpage
\section{Ellipsoid-Überdeckungen und M-Ellipsoide}
\label{Sec.Ellipsoid-Methode.M-Ellipsoide}
. [figure]
\begin{figure}
.
\caption{Löwner-John-Ellipsoid mit Anwendung in der Ellipsoid Methode}
\label{Fig.MinEllipsoid}
\end{figure}
.
.
label\label{Thm.InertEllipsoid}
label\label{Thm.MEllipsoid}
.
.
. [figure]
\begin{figure}
\caption{Label}
\label{Fig.M-Ellipsoidoo}
\end{figure}
label\label{Alg.ConvexBodyEnumerationInformal}
.
.
\clearpage
\section{Berechnungsmodell}
\label{Sec.Berechnungsmodell}
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
cite\cite{M-Ellipsoid}
.
.
.
.
.
.
.
.
.
.
.
.
.
.
label\label{Def.SEP}
.
.
.
.
\section{M-Ellipsoid Algorithmen}
.
label\label{Theorem}
Cause error here: $
A simple error at this point results in the .aux file not being cleaned. Even marginal changes in the document above make the effect disappear
\end{document}
To reproduce the bug, do the following:
- Observe the single $ at the end of the document causing an error
- Compile (.aux remains in an unclean state)
- Correct the error
- Compile again (half written .aux causes error)
- Delete .aux file to recover
I know what happens and how to recover. My question is:
Why does this happen?
or better
Is there a way to prevent it?
In my current document, for every error I make while writing in the last section, I have to manually delete the .aux files to recover. Since I compile fairly often while writing, this is an annoyance and I'd like to prevent it.
From what I understand the output to an .aux file is buffered. In case of an error, compilation stops and the current buffer remains unwritten. At this point .aux file contains the buffer chunks already written, which may break anywhere, leaving incomplete definitions.
Normally I then don't work with the TeX engine on the console, but simply correct my error and restart.
I do not understand, what triggers the deletion of the .aux file, which, as the example shows does not work reliably. Possibly due to the biblatex or hyperref package. If you could shed some light on that?
Also of interest:
- Is there something to control the deletion of the .aux file after an error?
- Are there TeX/LaTeX commands I can use to manually flush the output buffer for the .aux file? I could use this command right before the section I am working on. That way, I probably won't have to deal with a corrupt .aux file that often anymore.
- Is there an Option for the pdflatex program so that the output buffers are flushed after an error. In most cases the error does not affect the .aux file, so there is no reason in not finish writing it. In the cases where it does, I would have to delete it then.
There are several related questions here on StackExchange:
.auxfiles and compile again. – daleif Sep 05 '13 at 13:19.auxfiles if there is an error, it's a good thing to check to make sure it was actually done. automatic deletion of potentially faulty.aux(and other derived files --.toc,.idx, etc.) is a relatively recent addition to latex processors; it's a good idea to become familiar with what happens "under the covers" rather than taking everything for granted. – barbara beeton Sep 05 '13 at 13:51.auxfiles. Specifically how to influence it, since it breaks on me. It's not that I am mad because I took it for granted, but that I want to simplify my workflow, since it doesn't break once a week like before, but for this specific document, every time. – Tobias Simon Sep 06 '13 at 10:33.auxfile wasn't broken. so why it's broken for you is a mystery to me. i have seen broken files of this nature, in particular a.indfile that had a%in an entry, and that was a serious pain, but i don't remember ever seeing a truncated.auxfile. – barbara beeton Sep 06 '13 at 12:52.auxfile is cleaned after the error for me too. Both "x" and return do not change the outcome. – Tobias Simon Sep 06 '13 at 14:19! Package inputenc Error: Unicode char \u8:Üb not set up for use with LaTeX.(or whatever char), and a final error! TeX capacity exceeded, sorry [parameter stack size=10000]. \@ifnextchar #1#2#3->at\clearpage. but the.auxfile is complete, not truncated. so the problem is different from what you describe. i think i can't be any more help here. – barbara beeton Sep 06 '13 at 18:09.auxfile. Only the malpractice of aborting the run caused the error in the first place. – Tobias Simon Sep 10 '13 at 08:17auxfiles and it worked fine after. – spaceKelan Oct 07 '23 at 11:08