Documentation
¶
Overview ¶
Command gotex-refdiff is a reference-diff corpus sampler: the highest-signal fidelity detector for gotex. Over a random SAMPLE of a directory of real arXiv papers it compiles each paper twice — once with a real LaTeX engine (tectonic, the ground truth) and once with gotex — extracts the text of both PDFs with pdftotext, and reports a per-paper word-recall ratio: the fraction of the reference's extractable content words that gotex reproduced. The report is ranked worst-first, so the papers where gotex loses the most REAL content against a ground-truth engine surface directly as fix targets.
It is a developer tool, not a CI gate: it needs network (tectonic downloads its package bundle on first use) and poppler's pdftotext. tectonic and pdftotext are taken from PATH when present, else from pkgx (with the poppler project pinned so `pkgx pdftotext` does not stall on MultipleProjects). A real PDF that the extractor fails to read is marked extract-error and excluded from the score — never scored as lost content — and surfaced loudly on stderr, so a broken extractor cannot silently corrupt a measurement. Example:
GOWORK=off go run ./cmd/gotex-refdiff -corpus /path/to/arxiv/work -n 40
The recall ratio is robust to the three known-expected engine differences documented in scripts/fidelity.sh (page numbers, math rendered as vector paths, and the fi/fl ligature ToUnicode gap); see contentWords in analyze.go.
The -layout flag switches to the geometric complement of the recall measure. Recall says WHAT text gotex reproduced; the layout diff says WHERE it landed. It reuses the same corpus sampler, top-level resolution and compile wiring, but extracts per-word bounding boxes with `pdftotext -bbox`, aligns the two word streams by content, and ranks papers worst-first by a layout-divergence score combining matched-word displacement, page-count agreement, and line-break agreement. It masks the same three known differences, so the score reflects REAL layout divergence. See layout.go. Example:
GOWORK=off go run ./cmd/gotex-refdiff -corpus /path/to/arxiv/work -n 40 -layout