Skip to content

\import and \subimport read the files they name - #223

Merged
tannevaled merged 1 commit into
mainfrom
import-package
Sep 4, 2026
Merged

\import and \subimport read the files they name#223
tannevaled merged 1 commit into
mainfrom
import-package

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

The import package is how a paper split across directories pulls its parts in:

\import{sections/}{intro}     % reads sections/intro.tex
\subimport{proofs/}{lemma}    % reads <current import path>proofs/lemma.tex

Both were undefined — and a skipped \import does not lose a command, it loses a
file
.

One elsarticle paper in the corpus imports seven of them:

2212.10475 pages drawn glyphs
reference 28 61 275 characters
before 5 16 868 — 28% of its own content
after 31 58 849

Nothing in the skipped-command report said that a quarter of the paper had gone
missing; \import appeared there as one more unknown command among sixteen.

Details worth knowing

The path is kept on a stack, so an imported file can \subimport relative to where
it lives, and the pop is appended to that file's own text so it runs exactly when
the file ends, whatever the file does in between.

The marker carries no @ in its name. It is read in the document's catcode
regime, where @ is not a letter: \gotex@importpop parsed as \gotex followed by
four letters and halted the run — which is how the first version of this failed.

A file the paper does not ship falls back to the bare name and, failing that, is
recorded as a skipped input rather than failing the render.

Measured

Page error over the 157 arXiv papers with a tectonic reference: 535 → 517.

Found with a new two-sided census — our drawn glyphs against the reference PDF's
extracted characters — which ranks papers by how much content is missing or
invented rather than by page count. This paper sat at 0.28 of the reference; the
next ones down that list are the same shape.

🤖 Generated with Claude Code

The import package is how a paper split across directories pulls its parts in:

	\import{sections/}{intro}     reads sections/intro.tex
	\subimport{proofs/}{lemma}    reads <current import path>proofs/lemma.tex

Both were undefined, and a skipped \import does not lose a command, it loses a
FILE. One elsarticle paper imports seven of them: it rendered 5 pages against a
reference of 28, drawing 16868 glyphs where the reference holds 61275 characters —
28% of its own content, with nothing in the skipped-command report to say that a
quarter of the paper had gone missing. With this it is 31 pages and 58849 glyphs.

The path is kept on a stack so an imported file can \subimport relative to where it
lives, and the pop is appended to that file's own text so it runs exactly when the
file ends. The marker carries no @ in its name: it is read in the DOCUMENT's
catcode regime, where @ is not a letter, and \gotex@importpop would have parsed as
\gotex followed by four letters and halted the run.

A file the paper does not ship falls back to the bare name and, failing that, is
recorded as a skipped input rather than failing the render.

Measured over the 157 arXiv papers with a reference: page error 535 → 517.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 904947c into main Sep 4, 2026
18 checks passed
@tannevaled
tannevaled deleted the import-package branch September 4, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant