[Tex/LaTex] Will cruft from a previous compile ever change the final look of the document

best practicesproofreadingtex-core

Ok, this has been bugging me for a while; Will cruft left over from a previous run of LaTeX ever change how my document looks?

Would the following procedures ever give me different results:

I compile my document until it stabilizes (All references resolved and such) then edit my document and recompile until it stabilizes.

vs.

I compile my document until it stabilizes (All references resolved and such) then edit my document. Now I delete everything but my *.tex and *.bib files and recompile until it stabilizes.

I'm probably just asking this due to being used to all the cruft word leaves in old documents, but it has been bugging me for a while. Does LaTeX save math and such things in the *.aux and such, and would it ever arrive at a different solution due to this saved information?

I only included the compile until it stabilizes bit, as I don't want answers about references and things; I know that in any situation where you have to compile more then once you will obviously get a different outcome if you delete the intermediate files. I'm interested in the final document as I'd share it with someone. If this is the case, then I should be careful to always delete the intermediate files and recompile before sharing my document with anyone.

Best Answer

If your edit removes packages then that can remove definitions of things that are still in the aux file. hyperref and babel are two notable examples. In this case you get an error when the aux file is read at begin document.

It is quite possible to write commands where you get no error and just stabilise to an incorrect point if you read an aux file from a previous run after which the source file has been changed. Early versions of longtable would do this, which was why by default longtable did not try to align its parts and stabilize, you had to explicitly add \setlongtables once you had finished editing. longtable v4 introduced a more careful algorithm that internally protects itself from edits to the table and so is safe to load aux files from previous runs even if the file has been edited. (This was due to David Kastrup)