On Tue, Sep 08, 2015 at 07:16:52AM +0000, Guenter Milde wrote: > On 2015-09-08, Scott Kostyshak wrote: > > On Mon, Sep 7, 2015 at 9:57 PM, Enrico Forestieri <for...@lyx.org> wrote: > >> On Mon, Sep 07, 2015 at 04:11:07PM -0400, Scott Kostyshak wrote: > >>> On Sun, May 03, 2015 at 02:02:06AM +0200, Enrico Forestieri wrote: > >>> > On Sat, May 02, 2015 at 07:03:53PM -0400, Scott Kostyshak wrote: > > >>> My question is, when the user begins a preview, shouldn't the .aux > >>> always removed so there is a fresh compile? > > No. > > >>> I think the answer has to do with somehow there is a faster > >>> compilation if that .aux can be reused. > > Yes. > > >>> What determines whether the aux should be used or regenerated though? > >>> LyX or LaTeX? > > Aux files are (re)generated with every LaTeX run. Whether they are outdated > or not is determined by LaTeX based on the content: > > * if they are outdated (e.g. new or removed sections, targets on a > different page, ...) LaTeX will issue the usual "labels may have changed" > warning, triggering a new LaTeX run. > > * if they are still up-to-date, one LaTeX run will suffice to get a document > with valid cross-links - this is checked automatically by LaTeX after any > compilation run. > > There are cases where you this simple logic may fail: > > a) includeonly, > > >> There are cases where the previously generated aux files are useful and > >> removing them causes wrong results. For example, if you include a number > >> of child documents, say a child for each chapter, like this: > > >> \begin{document} > >> \include{chap1} > >> \include{chap2} > >> ... > >> \end{document} > > >> latex generates aux files for each included child. If you later are only > >> working on chapter 4, you could do > > >> \includeonly{chap4} > >> \begin{document} > >> \include{chap1} > >> \include{chap2} > >> ... > >> \end{document} > > >> and only chap4.tex gets compiled while cross-references to other chapters > >> are still correct because their aux files are still there. > > > And how do we know that the aux files do not need updating? Does this > > depend on whether the timestamp of the corresponding .tex is newer or > > older? > > There is no timestamp comparison. The \includeonly option is also just for > speedup during editing/preview. The user is responsible to include files > that have changed significantly or live with an approximation of the > document as preview. The final compilation should in any case be done with > all documents included. > > > b) removal of packages or other definitions from the preamble: > > When latexing "per hand", I mostly just leave the *.aux files in the > folder for late use (which may be after some years...) > > Sometimes get an compilation error when removing a language option > from a document and re-compiling: "language .... not defined". > This is caused by the *.aux file still containing use cases for this > language. > > The problem usually goes away for the next run (because the aux-file was > updated). > > LyX could trigger removal of *.aux files if the same error occures in two > successive compilation runs.
Thanks a lot, Günter. This is very helpful! Scott