Repository navigation
Description
An audit of what this engine delegates — go-typeset/linebreak, go-typeset/hyphenation, go-opentype/opentype — looking for divergence from the reference that is not a gap in our TeX interpreter.
⚠ Everything below is read, not measured. Each finding names the file and line it was read from, and the measurement that would settle it. Nothing here should be quoted as a number until one of those measurements has been run.
Versions audited: linebreak v1.3.0, hyphenation v1.0.0, opentype v0.20.0 (fonts v0.14.0 indirect).
A. The breaker takes one measure per paragraph, so \hangindent and \parshape cannot reach it
func KnuthPlassWith(items []Item, lineWidth float64, p Params) ([]Line, bool)lineWidth is a scalar. TeX's line_break consults \parshape/\hangindent for each line (tex.web §847-850), so the first line of a bibliography entry is full width and the rest are indented.
This engine declares both — \hangindent at classkernel.go:131 — and the kernel substrate uses it for exactly that:
amssubstrate.go:524: \hangindent \wd\@tempboxa\noindent\box\@tempboxa
So every \bibitem, every \@hangfrom heading and every \parshape paragraph is broken on a uniform measure. Lines that should be short are set long, which is the right shape to produce fewer lines than the reference.
Candidate for #381 ("our lines hold 69 characters where the reference holds 66, with the font and the measure controlled"), #685, #589, and the \list/\parshape work held in #646.
Measurement that would settle it: one bibliography-heavy paper, our line count per entry against tectonic's, with \hangindent known non-zero.
B. \emergencystretch is declared and never reaches the breaker
texparams.go:60 declares the dimen. linebreak.Params has no field for it. What the third pass does instead (paragraph.go:251-258):
q := p
q.Tolerance = maxBadRatioThat is not TeX's emergency pass. TeX keeps \tolerance and adds \emergencystretch to the stretch available on every line (tex.web §16772-16774); the paragraph is re-broken with looser glue, and lines that remain infeasible stay infeasible. Raising the tolerance to its maximum instead accepts arbitrarily bad lines — a different set of breakpoints, and ours can keep a line TeX would have refused.
Measurement: a paragraph whose only solution needs \emergencystretch, set both ways.
C. \looseness is declared and not implemented
texparams.go:30 lists it at 0. TeX's post-pass (tex.web §873-875) re-breaks the paragraph to come out \looseness lines longer or shorter. A document that sets it gets no effect here, silently. Rare in arXiv papers, but silent, which is the part worth fixing.
D. The final pass is deliberately unarmed, and the reason is a library gap
paragraph.go:236-244 records it in full:
FinalPassIS NOT ARMED HERE YET … pass 2 does not fail here for a reason the library does not yet reproduce: TeX refuses to record a forced break whose line is past the threshold (tex.web§16769 → §16824-16831), while the library records every forced break unconditionally.
That is a defect in go-typeset/linebreak, named here, carried in #666. It is the one finding in this audit already written down; the rest were not.
E. Hyphenation is English-only, and the fallback is silence
hyphenation.go:57: any other \language gets nothing, since no patterns are embedded
hyphenation.go:63: if e.namedInt("language") != 0 { … }
hyph_en_us_patterns.txt is embedded; nothing else is. A paper in French, German or Spanish — and arXiv carries many — is set unhyphenated where tectonic hyphenates it. Unhyphenated text makes longer, looser lines and more of them.
This is a strong candidate for page-count divergence on a subset of the corpus that is invisible to a mean: it affects whole papers, not glyphs.
Measurement: partition the corpus by \documentclass language option / babel argument and compare Σ within each part. If the non-English part carries most of the deviation, this is it.
\lefthyphenmin/\righthyphenmin are honoured (hyphenation.go:71), so that half is aligned.
F. ⭐ The engine never runs the shaping pipeline, and asks for kerning pairwise
This is the finding I would chase first.
font.go:106: gids := o.fc.Shape(string(comps), "liga")
font.go:286: return ptToSP(o.fc.KernUnits(prev, cur) * o.fc.Scale())
Glyphs are resolved by a liga-only Shape, and kerning is then asked for two runes at a time. The library offers ShapePositioned, which runs GSUB then GPOS over a whole run with kern, mark and mkmk always on (shape.go:42-52). tectonic/XeTeX runs HarfBuzz over the run.
Three consequences, all widths:
- Contextual kerning never applies. GPOS chained-context lookups need the run; a pair lookup cannot see them.
- Kerning next to a ligature is taken between the wrong pair —
KernUnits(prev, cur)is given runes, so afterfibecomes one glyph the kern against its neighbour is computed from the component, not the ligature. - Only
ligais requested.clig,rlig,caltandloclare part of the default set a shaper activates for Latin; without them our glyph run differs from the reference's before any kerning happens.
Candidate for #716 ("the fidelity metric cannot see a kerning defect: 1.12pt per AV"), and for any "our lines are narrower/wider" finding.
Measurement: one paragraph, our total advance against ShapePositioned's over the same string, and both against XeTeX. go-tex/fontcmp already asks two engines the identical question.
Not a divergence: the kerning source is right. KernUnits prefers GPOS pair positioning and falls back to the legacy kern table (face.go:155-170), which is what a modern shaper does.
What I did not establish
- No measurement. Every item above is read from source. I have not run one paper through two engines to attribute a single page to any of them.
- No ranking. I believe F and E are the largest because they affect every glyph and whole papers respectively, but "believe" is the word: The fidelity metric cannot see a kerning defect: 1.12pt per AV was invisible to every number we steer by #716 measured 1.12pt per AV pair and nothing has measured E at all.
go-typeset/bidiwas not audited — the engine does not import it.- Vertical material (
\baselineskip,\lineskip, page breaking) is ours, not delegated, so it is out of this audit's scope by construction. A page-count gap can come from there and this audit would not see it.
Each heading above is meant to become its own issue once measured; this one is the map.
🤖 Generated with Claude Code
Prior art: priorart "divergence from tectonic caused by font metrics hyphenation or line breaking rather than the interpreter" at 2026-11-11 15:17 CET reported prior art; checked: 957 entries. #700 is the prior exhaustive read, but of the REFERENCE SOURCES (latex.ltx etc), not of our delegated libraries. #612 and #731 covered the space advance, now merged. #716 measured a kerning defect the metric cannot see; this names its mechanism (pairwise KernUnits instead of ShapePositioned). #381/#685/#589 are symptoms whose cause A may be. No entry audits linebreak/hyphenation/opentype as dependencies.
Activity
tannevaled commentedon Nov 11, 2026
⛔ Finding F is refuted for the case that matters, measured
F was the one I said I would chase first — "the engine never runs the shaping pipeline, and asks for kerning pairwise". The mechanism is real. The consequence I attributed to it is not, on the fonts this corpus is actually set in.
Latin Modern Roman 10pt, the engine's real path against
ShapePositionedUnits(s, "liga"):Same glyph count, same width to four decimals, ligature-heavy cases included.
The three ways this measurement nearly lied, in order
Worth recording, because each is a shape that recurs.
1. A font that could not answer. The first run used the engine's default face and found no difference — but that face is a math font. The control: 20 of 20 classic kerning pairs are non-zero in it (
AV−1.00pt,VA−1.05pt), so kerning was genuinely active and the agreement was not vacuous for kerning. It forms no ligatures at all, so it could not test the ligature half. A second font was needed, and it is the one the corpus uses.2. A shaper asked the wrong question.
ShapePositionedUnits(s)with no features reported the same glyph count as runes on Latin Modern too — because the library's default feature set is positioning (kern,mark,mkmk).ligais GSUB and must be requested. I was comparing two paths that both declined to ligate: an agreement about nothing. Withligaasked for, "office" goes 6 glyphs → 4 and −0.57pt.3. A probe that was not the engine. That −0.57pt looked like the finding confirmed. It was not: my probe summed
CharDimsrune by rune, and the engine does not set text that way.appendCharfoldsprev+curinto the Unicode ligature codepoint when the font has the glyph (ligature.go), so "office" sets aso + ffi + c + e. Measuring the engine's actual fold is what produced the table above.Three times, the number in front of me was confident and about something else.
What F should now say
I have left the issue body as written rather than editing F out: the audit said in its own header that everything in it was read and not measured, and this is what measuring one of them produced.
🤖 Generated with Claude Code
tannevaled commentedon Nov 11, 2026
Finding E is real and it is one paper in 154, counted
E says the engine embeds US-English hyphenation patterns and nothing else, so a paper in another language is set unhyphenated where the reference hyphenates it. I wrote that it was "a strong candidate for page-count divergence on a subset of the corpus that is invisible to a mean: it affects whole papers, not glyphs."
Counted over the curated 154-paper list:
Verified on the survivor:
\usepackage[english,greek]{babel} % language dictionaries.0.6% of the corpus. E cannot account for a Σ of 294. It remains a correctness gap — a Greek paper is set wrong — and it is not a lever on the fidelity number.
⛔ And the first count was wrong by two thirds
The census first reported three papers — German, Greek, Italian. Spot-checking the German one found this:
Commented out. The package is never loaded. A regex over raw source measures what a file contains; TeX cares what it executes. Stripping
%-to-end-of-line (an escaped\%not counting) took the number from 3 to 1.One check of one paper caught it. I ran that check because this exact defect — a sweep that measures its own pattern — has turned up three times today already, in
priorart's[closed], inprivscan's idea of a private path, and in the first version of a scanner I wrote this morning that could not see the paths it existed to find.Where the audit stands after two measurements
\hangindent,\parshape)\emergencystretchnot threaded\loosenessunimplementedThe two I called out as "the ones I would chase first" are the two that have now been measured and shrunk. A is the one I did not name and did not measure.
🤖 Generated with Claude Code
tannevaled commentedon Nov 11, 2026
Finding A is confirmed against tectonic, with a control — and it is worse than A said
One document, two engines, two paragraphs: the first on a uniform measure as a control, the second asking for
\hangindent=4em \hangafter=1— what every\bibitemdoes.The control is identical in both engines, word for word, five lines each. So the comparison below is about the hanging indent and nothing else.
tectonic:
ours:
Two things, not one:
A understated it
A said the scalar
lineWidthmeans\hangindent"cannot reach the breaker". The witness says more:\hangindentis not applied anywhere — not as an indent on the drawn lines, not as a narrowed measure.classkernel.go:131declares the dimen and nothing reads it. It is a register the document can set and the engine ignores.Why this is the one to chase
Every
\bibiteminthebibliographyis a hanging-indented paragraph. The corpus is 154 real arXiv papers; a paper with forty references has forty of them, each set on a measure four ems too wide, each therefore liable to lose a line. Lines lost at the end of a document are pages lost, which is the channel Σ reads.I have not measured that consequence — how many corpus pages this accounts for — and it is the next measurement, not a claim. What is measured here is the mechanism, against the reference, with a control.
Where the audit stands now
\hangindent/\parshape\emergencystretchnot threaded\loosenessunimplementedThe two findings I called the largest are the two that shrank under measurement. The one I did not name is the one that holds.
🤖 Generated with Claude Code
tannevaled commentedon Nov 13, 2026
⭐ BIBLIOGRAPHY PASS, 2026-11-13. F WAS MEASURED AND DOES NOT REPRODUCE ON THE
CORPUS'S OWN FONT. E's library half is fixed. The versions this audit read have
moved.
This issue says every finding is "read, not measured". Here are measurements
for two of them.
⛔ F: the predicted width divergence is not there, on Latin Modern at 10pt
F says the engine resolves glyphs with a
liga-onlyShapeand then asks forkerning two runes at a time, so contextual kerning never applies and kerning
next to a ligature is taken between the wrong pair. The stated measurement was
"our total advance against the reference's over the same string".
Run,
\setbox0=\hbox{…}in both engines, Latin Modern Roman 10pt, the corpus'sown font and size:
WaffleAVoffice(ffi)ToAffliction(ffl)Five for five, to the rounding of the two
\showtheformats. That includesboth ligature cases and both classic kern pairs — exactly the shapes F predicts
would go wrong.
⚠ What this does and does not settle. It settles that the hand-rolled path
costs nothing on this font at this size, which is where the corpus lives. It
does NOT refute F's mechanism: contextual GPOS lookups and the
clig/calt/loclfeatures are real, and a font that uses them would still diverge —Latin Modern evidently does not exercise them in these words. So F stops being
"the finding I would chase first" and becomes "a hazard for fonts the corpus
does not use", until someone measures a font that does.
⚠ And #716's 1.12pt per
AVwas LibertinusSerif, a different font, and wasa kerning-SOURCE defect since fixed. The
AVabove is Latin Modern and agrees.⭐ And the library has removed F's stated blocker
opentype.ShapePositionedUnitsexists in the version this engine already pins(v0.20.0,
shape.go:101), and its doc comment is about this consumer by name:That price is gone — the unrounded call carries font units to the last line. So
adopting the shared pipeline is now possible without losing metric precision.
Given the table above it is no longer urgent for width, but it is the
mutualised path, and it brings
clig/calt/locland mark attachment withit.
E: the library half is fixed, the engine half is not
E is "hyphenation is English-only". Half of what made it worse was a defect in
the library itself:
Pointsindexed its value array by BYTE and read it back byRUNE, so every accented word broke at an offset — go-typeset/hyphenation#8,
released as v1.0.1 and adopted here in #774, measured against the reference
(
présenta-tion, where before we setprésent-ationandéléme-ntaires).E's own subject — no patterns for any language but English — is untouched.
Versions: this audit read three, and one has moved
go-typeset/linebreakgo-typeset/hyphenationgo-opentype/opentype⚠ Separately:
go-opentype/fontscarries tag v0.14.0 while its latest GitHubRELEASE is v0.9.0. Tags without releases are the shape
ghrelease --backfillexists for; nothing here depends on it, but a reader comparing release pages
would read the module as four minors older than it is.
What I did not do
No corpus A/B for any of this: the 1-minute load average was 11 and 120
compiles would starve the other sessions on this host. Every number above is a
box width, which is exact and cheap.
deps: go-opentype/opentype v0.21.1, which moves nothing on the page (#…
README: say what hyphenation does, and what it does not (#777)
tannevaled commentedon Nov 15, 2026
Three of this audit's findings now have the measurement they asked for, and one of them is much smaller than the audit hoped: the corpus is not multilingual.
\loosenessis set by NO measured paper,\emergencystretchby four, and only ONE of 154 has a non-English main language.This issue says up front that nothing in it should be quoted as a number until one of its measurements has been run. These are three of those runs — the population is the 154 papers of
clean-list.txt, the same list the A/B samples from.Method, because the obvious version of it is wrong twice
A
grep -rl loosenessover the paper tree answers about ~2935 papers, not the 154 that are measured, and matches the bare substring in prose and comments. And the list names each paper'smain.tex, not its directory, so walking a list entry visits one file and silently skips every\inputed chapter — the first version of this census read 154.texfiles for 154 papers, one apiece, where walking the directories reads 679.So: a Go program over the list, walking each paper's directory, with TeX comments stripped (a
%not preceded by an odd number of backslashes), and\documentclassas a positive control so that a zero cannot be a scan that read nothing.C.
\looseness— 0 of 154 papers⭐ So implementing
\loosenessis bit-identical on this corpus and owes no A/B — the finding is real (declared attexparams.go:30, silently ineffective) but it is a correctness fix, not a fidelity lever. Worth knowing before anyone budgets corpus time for it.⚠ It is not cheap, though, and it is blocked: tex.web §873-875's post-pass re-breaks the paragraph to come out
\loosenesslines longer or shorter, which needs the breaker to offer the alternatives rather than one answer. That is ago-typeset/linebreakfeature, and enginemainis on linebreak v1.5.0 — every new library feature is behind the v1.8.0 bump in #784, which is itself held on the corpus A/B.B.
\emergencystretch— 4 of 154 papers, two of them\maxdimen⭐ So this one does owe an A/B, and it is the sharper of the two. The audit's point stands and now has a population:
paragraph.go:251-258raisesTolerancetomaxBadRatioinstead of adding stretch, and those are not the same paragraph. The two\maxdimenpapers are the extreme case — a document asking for unlimited emergency stretch, against a third pass that instead accepts arbitrarily bad lines at the ORIGINAL glue.E. The corpus is not multilingual, so this is not the page-count lever
The audit calls English-only hyphenation "a strong candidate for page-count divergence on a subset of the corpus that is invisible to a mean". Measured:
⛔ And one of those two is an English paper. babel makes the last language in the option list the main one — which this engine already implements and documents,
babel.go:62-74("the last one is the main language") — so[russian, english]selects english, with russian merely available to\selectlanguage. Only2401.03325([english,greek]) has a non-English main language.So finding E affects 1 paper of 154, not a subset large enough to move a corpus figure. The divergence is real for that paper and for arXiv at large; it is not the explanation for #381's line-density gap, and finding A (one measure per paragraph, so
\hangindent/\parshapecannot reach the breaker) remains the much better candidate for that.⚠ Not claimed
babel,polyglossiaor\documentclass. A\selectlanguage{french}in the body, or a class that sets a language internally, is not counted. For the two it did find, I read the option list rather than inferring from the package name.go-typeset/linebreak's recorded gap, carried in \parfillskip is appended to every forced-break fragment, so a forced break leaves its line unjustified #666.🤖 Generated with Claude Code
gotex-paramcensus: which MEASURED papers set a parameter (#791)
the comment said the pass stays, is gone, and is still here (#797)
tannevaled commentedon Nov 17, 2026
⚠ This audit is stale in the half that matters, and I nearly redid two of its
findings before checking. It was taken at
linebreak v1.3.0; the engine is onv1.10.0 today, and three of the six are closed. Posting the status so the map
stops pointing at work that exists.
Read from the source as it stands now, not from the audit:
\hangindent/\parshapecannot reach the breaker\emergencystretchdeclared and never reaching the breaker\loosenessdeclared and not implementedShapePositionedThe three that closed, with where to look
A.
libs.go:30,57aliaslinebreak.Measureandlinebreak.KnuthPlassShaped;paragraph.go:353,:395and:405all break through the shaped entry pointwith a per-line
shape. Landed by #795 (\hangindent), #798 (\parshapeas aprimitive), #796 (a shape lasts one paragraph), after #757 and #760 named it. The
library half is
linebreak#19, released in v1.10.0 — whose doc records itwas "measured by a consumer against tectonic on a
\hangindent=4emparagraph".B.
paragraph.go:391-405reads the register and setsq.EmergencyStretch,and
emergencystretch_test.gois the witness this audit asked for — "a paragraphwhose only solution needs
\emergencystretch, set both ways". The library halfis
linebreak#18:bg.Stretch[0] += p.EmergencyStretchon the final pass, whichis §863's background and not a looser tolerance.
D.
paragraph.go:394setsp.FinalPass = emergency <= 0and:403arms itfor the third pass;
badbox_test.go:94says "since FinalPass IS ARMED". Thelibrary gap this depended on is closed.
The three that stand
C.
\loosenessappears in this repository only insidecmd/gotex-paramcensus, as a term that tool can census — never in the breaker.And
linebreakhas noLoosenessinParams: I readorigin/main. So thisis a library gap first, as B and D were, and the engine cannot fix it alone.
tex.web §873-875 is the post-pass.
E.
hyphenation.go:23embedshyph_en_us_patterns.txtand:114still says"any other language gets nothing, since no patterns are embedded".
F.
font.go:353still callsKernUnits, a pair query, andfont.go:337carries the reason it cannot speak for every font. #807 did not close it — it made
it reportable:
Diagnostics.KerningIsAFloorsays "the pair values were usedbut contextual GPOS lookups could not be evaluated", i.e. we know we are
under-reporting. That is worth having before the shaper work in #792, because it
turns a silent approximation into a flagged one.
Why I am posting this rather than a fix
⛔ An hour ago I rebuilt #724 without reading it, having been shown its branch by
priorart. An audit that names six divergences is the single most likely placefor that to happen again, and three of these six would each have been a day's
work already done. A map's value is that it is current.
Refs #795, Refs #798, Refs #796, Refs #807, Refs #666, Refs #792.
🤖 Generated with Claude Code
tannevaled commentedon Nov 17, 2026
Item (C),
\looseness: the library half is done and released; the engine halfdoes not work, and I am not landing it until it does.
The library half
go-typeset/linebreakv1.12.0 (#22) implements it, with the two things itneeds — the choice itself (
tex.web:17197-17237) and the state it chooses from.That second part is where the work was:
tex.web:16107-16114keys the DP byposition, line and fitness, and collapsing the line dimension is an
optimisation licensed only "when the looseness parameter is zero" (
:16716,easy_line:=max_halfword). Keyed by fitness alone, a paragraph offered exactlyone ending and the choice had a list of one.
#825 takes that version into this engine. Seven witnesses are byte-identical
across the bump and the suite is green.
⛔ The engine half, measured and withheld
The wiring is one line —
Looseness: e.namedInt("looseness")inbreakSegment'sParams. I wrote it, measured it, and took it out.The register arrives correctly:
\looseness=-1reads back-1throughnamedInt. But across eighteen configurations the line count is identicalfor
\looseness0, +1 and −1 in every one:Eighteen for eighteen is not "no feasible alternative here" — it is systematic.
Something between this engine's paragraph builder and the library's choice
removes the alternative endings before
\loosenessis consulted. The library'sown fixture does move (3 lines → 4 at
\looseness=1) on the same shape in thesame units, so the choice works when it is reached.
⚠ No mechanism claimed. The candidates I would look at are the three-pass
loop (an unmatched looseness fails a non-final pass,
:17203, so pass 1 declinesand pass 2 accepts whatever it reached — which should still be the closest
available, not the base), the per-segment split at forced penalties, and the
Backgroundthis engine adds for\leftskip/\rightskip. I have isolated noneof them.
Wiring a parameter whose effect cannot be witnessed would ship an unexercised
path and let the next reader believe
\loosenessworks. That is why item (C)stays open here with the library half done.
Refs #825, Refs go-typeset/linebreak#22, Refs go-typeset/linebreak#12.
🤖 Generated with Claude Code
take linebreak v1.12.0, and \looseness with it
tannevaled commentedon Nov 17, 2026
⛔ Correcting my own comment above, an hour later. I wrote that the
\loosenesswiring "does not work" and offered eighteen flat rows as theevidence. The rows were measured on the wrong glue, and the wiring works.
What was wrong with the measurement
Every one of those eighteen fixtures set
\spaceskip=4pt plus 8pt minus 2pt.\spaceskipis a\newskipregister in this engine and not the base interwordglue —
spacefactor.go:104-109states it plainly: "\spaceskip as the baseglue … declared in this engine as \newskip registers rather than real glue
parameters, so there is nothing to read; a document that sets them is unaffected
today".
So the breaker received
spMock's own3pt plus 1.5 minus 1space. On a 50ptmeasure that makes a three-word line need ratio 4.7, and no second ending
survives
\adjdemerits— one feasible ending, nothing for\loosenessto choosebetween, eighteen times. The parameter was reaching the breaker throughout.
What separated it
Two steps, neither of them re-reading the numbers:
(3 → 4), so the version, the aliases and the choice were all fine and the
difference had to be in what the engine hands over.
w=3.00 y=1.50 z=1.00where the source said4 / 8 / 2.
A fixture whose glue is
\hskip— which this engine does honour — moves theline count as the source says it should.
Status of item (C)
Closed by #825, which takes
go-typeset/linebreakv1.12.0 and adds the oneline that passes the register, with three rows: the move, the control
(
\looseness=0is the old behaviour exactly), and an unreachable\looseness=5that must still set the paragraph (
tex.web:17203).⚠ And a new item for this audit, which is what the hour actually bought:
\spaceskipand\xspaceskipare accept-and-ignore.spacefactor.godocumentsit honestly at the call site, and nothing on this tracker says it, so the next
person to write a fixture with
\spaceskipwill measure the font's space andbelieve otherwise — as I did. Filed separately.
Refs #825, Refs go-typeset/linebreak#22.
🤖 Generated with Claude Code
take linebreak v1.12.0, and \looseness with it (#825)