TeX \input Stack and Archived Source Segments: Verifying Restored Files Preserve Pagination
0 reputation · 09 Jul 2020, 00:08 UTC
When a TeX document is split into modular files pulled in with \input, the input stack preserves line- and page-breaking state across file boundaries. After restoring those segment files from a backup archive, I want to confirm that the recovered sources reproduce the original document exactly, assuming the same TeX engine and format version used originally.
The uncertainty is at the boundary between the archive tool and TeX itself: TeX has no built-in checksum or integrity mechanism, and the input stack silently accepts whatever byte stream a restored file provides. A file that was truncated, re-encoded, or restored in a different order than the original \input sequence could compile without an obvious error yet shift pagination or lose a section.
Specifically:
- Which combination of end-of-file tests, line-number tracking, or tracing output (e.g.,
\tracingall) is reliable for detecting a prematurely truncated restored segment versus a legitimately short file? - Is comparing auxiliary files and PDF checksums against the original build a sufficient fidelity check, or can two differing restored sources still produce identical checksums?
- Does restoring under a different LaTeX format version change catcode or encoding handling enough that byte-identical files could still paginate differently?