Does LaTeX have any built-in way to detect stale .aux files without a full clean rebuild?
0 reputation · 30 Apr 2024, 13:13 UTC
LaTeX stores cross-references, table of contents entries, and bibliography data in auxiliary files (.aux, .toc, .bbl) between compilation passes. These files behave like a persistent cache: after structural edits such as removing a section or deleting a label, a single compile can produce incorrect page numbers or dangling references until enough passes regenerate them.
Build tools like latexmk rerun LaTeX until the auxiliary files stabilize, but this heuristic does not reliably catch every kind of semantic staleness, and the documented workaround of deleting all auxiliary files forces an expensive full rebuild on large documents with TikZ externalization or big bibliographies.
Assume a current LaTeX kernel (2023 or later) with latexmk as the build tool.
Does the LaTeX kernel or any core package provide a mechanism to validate or version auxiliary data so tools can detect staleness selectively, rather than recompiling everything? Is there a documented way to invalidate only the affected .aux content (for example, per-label or per-chapter via \include) instead of wiping all auxiliary files? And is there any standardized checksum or hash mechanism in the .aux format that build tools are expected to rely on?