You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Our lines hold 69 characters where the reference holds 66, with the font and the measure controlled #381
With the typeface and the measure both held identical to the reference, our lines still carry more text than TeX's. This issue is that residue, isolated from #352 (the space), #370 (the face) and #375 (the measure).
The measurement
2403.10748, pages 3–5, same 346pt measure, each engine set in lmroman10-regular.otf:
So the space accounts for one character; two remain.
What is already excluded
Glyph advances are exact. Same font, one \hbox, \the\wd: Thequickbrownfoxjumpsoverthelazydog is 171.8pt in tectonic and 171.80006pt here — the engine's own sp rounding, nothing more.
The badness formula is faithful: 100·|r|³ (go-typeset/linebreak), with r ≥ −1 for a node to survive and feasibility tested on badness against the tolerance, as tex.web §16773 has it.
Where the divergence shows
Same font, \hsize=200pt, one paragraph, line ends:
tectonic the / reads / Knuth / bad- / rather / hyphen- / everywhere.
ours the / reads / problem / and / paragraph / hy- / everywhere.
Eight lines in both, and the first two breaks agree. Then tectonic breaks earlier (after Knuth) and hyphenates bad-ness and hyphen-ation; we pack problem onto the line and later hyphenate hy-phenation.
Hyphens can only come from TeX's second pass, so tectonic's first pass (at \pretolerance=100, which we match) failed on this paragraph while ours succeeded. That is the thing to explain: with the same font, the same measure, the same tolerance and the same badness formula, one first pass finds a feasible solution and the other does not.
Two candidates I have not tested: what we count as the line's available stretch (\parfillskip and the final line's treatment), and whether our first pass accepts a solution containing a line TeX would call infeasible — hasBadLine is a separate check in breakSegment and may not be the same test.
Why it matters
It is the largest single contributor left to the corpus line deficit. Over the 31 papers whose page count already matches the reference exactly, we draw 9.6% fewer lines; controlling the font takes that to 6.5% (#356). The rest is here.
Same paragraph, same face, same 200pt measure, \hyphenpenalty=10000 on both sides so neither engine may hyphenate:
tectonic the / reads / Knuth / badness / than / hyphenation / everywhere.
ours the / reads / problem / and / paragraph / considering / everywhere.
Eight lines in both, the first two breaks agree, and the third diverges exactly as it did with hyphenation on: tectonic breaks after Knuth, we fit problem as well. So the difference is the breaker's choice, not whether hyphens are available to it — which removes the "first pass succeeds where TeX's fails" framing I gave above as the whole story. It may still be true; it is not sufficient.
(Getting that comparison took a fix of its own: \hyphenpenalty=10000 did nothing here, because the name resolves to a \newcount and hyphenateList read the Go field. That is in #380, along with the evidence that the two corpus papers which ask for it — 2205.03780, 2209.13121 — were being hyphenated against their wishes, 181 times on one of them.)
So what is left for this issue is narrower and sharper: with font, measure, tolerance, hyphen penalty and badness formula all matched, the two breakers still pick different breakpoints on the same paragraph. The next thing to measure is the badness each assigns to the same candidate line — which needs the ratio our breaker computes, not just the breaks it returns.
Correction: my witness put TeX in its degraded mode, and the breakers agree more than I said
The paragraph I compared at \hsize=200pt is one TeX cannot set within tolerance. Measuring the right edge of each line rather than only its last word:
line ends (x)
tectonic 333.0 333.0 338.1 342.9 333.0 … <- 5pt and 10pt PAST the margin
ours 333.0 333.0 333.0 333.0 333.0 …
TeX is emitting overfull boxes there — with hyphenation on and off. So that witness compares TeX's fallback against ours, not two healthy breakers: faced with no feasible solution, TeX overflows the measure and we make a loose line instead. Interesting in itself, and not what this issue is about.
Re-run at measures where neither engine overflows, same paragraph, same face:
\hsize
lines
breaks
260pt
7 = 7
differ by one word — we fit a where TeX does not
300pt
6 = 6
identical
340pt
5 = 5
differ — TeX hyphenates dy-namic, we keep the word whole
So our breaker matches TeX exactly on one of three measures and differs by a single word on the others, with TeX readier to hyphenate. That is a much smaller and more particular thing than "our first pass succeeds where TeX's fails", which I wrote above and which this does not support.
What still stands, because it was measured on a real document rather than a constructed one: on 2403.10748, same face and same 346pt measure, the reference's lines carry a median of 66 characters and ours 69 (68 with #352's space). The corpus form of it is in #356 — 9.6% fewer lines on the 31 papers whose page count already matches, 6.5% with the font controlled.
The mechanism is still open. What the constructed witnesses now say is that it is not a gross difference in the algorithm: it is worth looking at which paragraphs diverge in a real document and by how much, rather than at a synthetic one that may be pathological.
The badness formula is not the residue, and this closes that road by measurement rather than by reading
This issue lists "the badness formula is faithful: 100·|r|³" among what it has excluded. I set out to contradict that, because tex.web:2325-2333 is unusually emphatic:
It produces an integer value that is a reasonably close approximation to 100(t/s)³, and all implementations of TeX should use precisely this method. … The badness function defined here is capable of computing at most 1095 distinct values.
And go-typeset/[email protected]:893-902 is a continuous float cube:
b:=100*math.Abs(r) *math.Abs(r) *math.Abs(r)
So the two really are different functions, and the difference really does sit where this issue's residue sits — a first pass succeeds or fails on b <= tolerance, evaluated at the margin. That was the hypothesis.
It is wrong, and here is the measurement that kills it
§108 ported verbatim in scaled points — all three branches, (r*r*r + 2^17) / 2^18 rounding, r>1290 → inf_bad — against the float cube, asking the only question that can change a break: would a feasibility test answer differently?
sweep
cases
feasibility disagreements
one s (ten cmr10 spaces), ratio 0…3
3 001
0
twelve values of s straddling §108's branch boundaries, ratio −1…4
60 012
0
The s values are chosen from the source's own constants rather than at random: t<=7230584 is 110.3pt and picks the first branch, s>=1663497 is 25.4pt and picks the second, below both it falls to r:=t. Tolerances tested are the three TeX actually uses: \pretolerance 100, \tolerance 200, and inf_bad 10000. 992 distinct integer badness values were produced along the way, so the ladder was genuinely exercised.
The quantisation is real and it changes no decision at these tolerances. Both functions are monotone in the same direction and the integer one rounds to the nearest rung; a rung boundary would have to fall exactly on a tolerance to flip a verdict, and 100, 200 and 10000 are not near one.
What that leaves
This issue's exclusions stand, all four of them, and its question is unchanged and still open:
with the same font, the same measure, the same tolerance and the same badness formula, one first pass finds a feasible solution and the other does not.
⚠ The limit of my refutation, stated so nobody over-reads it: I measured the feasibility predicate on isolated (t, s) pairs. I did not measure demerits — badness + penalty summed over a path, where a systematic difference of a few units per line could still select a different break even when every line is individually feasible. That is a different experiment and I have not run it, so "the formula cannot explain this" is sound for the pass-1 failure the issue describes and is not a claim about the optimiser's choice among feasible paths.
⭐ Worth keeping regardless: §108 remains the thing TeX says every implementation should use, and the port above is twenty lines. The case for it is faithfulness and the demerits question, not this issue.
A second witness for this, found by accident while testing something else, and it
makes the overrun visible as ink past the box edge rather than as a character
count.
Measured
A \parbox{110pt} of long words, article at 10pt, against tectonic. The
x-extent of each line, as gotex-linediff reports it (x0 is the box's left
edge, 133.77):
widest line
ink
tectonic
x1 = 243.37
109.60pt on a 110pt measure
here
x1 = 248.58
114.81pt on a 110pt measure
The reference never exceeds the box. We exceed it by 4.81pt, which is +4.4% — and this issue's own figure, 69 characters where the reference holds
66, is +4.5%. Same quantity, two instruments.
Two details that narrow it
⛔ It is not punctuation and it is not hyphenation-boundary. The fixture has
two paragraphs, one with a comma after every word and one with none, and both
overrun identically. I had built it to witness \lccode word boundaries (#765
item 3, now #824) and it came back byte-identical before and after that change —
which is how this turned up.
⚠ The break points differ too, and in the direction the overrun predicts:
We take a LATER hyphenation point in the same word. That is consistent with a
measure we believe is wider than it is, rather than with a different set of Liang
points — but I have not isolated which, and the two are distinguishable: the same
word at a measure where only one break fits would say.
Not claimed
⚠ No mechanism. The candidates this sits between are the line measure handed to
the breaker, the advance of the material (#716's pairwise kerning, #754 item F),
and the breaker's own tolerance for an overfull line. One \parbox on one
machine says the quantity, not the cause.
Activity
and a document's \hyphenpenalty is now obeyed
tannevaled commentedon Sep 22, 2026
Hyphenation is excluded as the cause.
Same paragraph, same face, same 200pt measure,
\hyphenpenalty=10000on both sides so neither engine may hyphenate:Eight lines in both, the first two breaks agree, and the third diverges exactly as it did with hyphenation on: tectonic breaks after
Knuth, we fitproblemas well. So the difference is the breaker's choice, not whether hyphens are available to it — which removes the "first pass succeeds where TeX's fails" framing I gave above as the whole story. It may still be true; it is not sufficient.(Getting that comparison took a fix of its own:
\hyphenpenalty=10000did nothing here, because the name resolves to a\newcountandhyphenateListread the Go field. That is in #380, along with the evidence that the two corpus papers which ask for it —2205.03780,2209.13121— were being hyphenated against their wishes, 181 times on one of them.)So what is left for this issue is narrower and sharper: with font, measure, tolerance, hyphen penalty and badness formula all matched, the two breakers still pick different breakpoints on the same paragraph. The next thing to measure is the badness each assigns to the same candidate line — which needs the ratio our breaker computes, not just the breaks it returns.
\tolerance and \hyphenpenalty are TeX's, not a fresh register's (#380)
tannevaled commentedon Sep 23, 2026
Correction: my witness put TeX in its degraded mode, and the breakers agree more than I said
The paragraph I compared at
\hsize=200ptis one TeX cannot set within tolerance. Measuring the right edge of each line rather than only its last word:TeX is emitting overfull boxes there — with hyphenation on and off. So that witness compares TeX's fallback against ours, not two healthy breakers: faced with no feasible solution, TeX overflows the measure and we make a loose line instead. Interesting in itself, and not what this issue is about.
Re-run at measures where neither engine overflows, same paragraph, same face:
\hsizeawhere TeX does notdy-namic, we keep the word wholeSo our breaker matches TeX exactly on one of three measures and differs by a single word on the others, with TeX readier to hyphenate. That is a much smaller and more particular thing than "our first pass succeeds where TeX's fails", which I wrote above and which this does not support.
What still stands, because it was measured on a real document rather than a constructed one: on
2403.10748, same face and same 346pt measure, the reference's lines carry a median of 66 characters and ours 69 (68 with #352's space). The corpus form of it is in #356 — 9.6% fewer lines on the 31 papers whose page count already matches, 6.5% with the font controlled.The mechanism is still open. What the constructed witnesses now say is that it is not a gross difference in the algorithm: it is worth looking at which paragraphs diverge in a real document and by how much, rather than at a synthetic one that may be pathological.
\leftskip/\rightskip are the background, glue orders are carried, and…
\sloppy and \fussy do what latex.ltx says they do (#769)
tannevaled commentedon Nov 16, 2026
The badness formula is not the residue, and this closes that road by measurement rather than by reading
This issue lists "the badness formula is faithful:
100·|r|³" among what it has excluded. I set out to contradict that, becausetex.web:2325-2333is unusually emphatic:And
go-typeset/[email protected]:893-902is a continuous float cube:So the two really are different functions, and the difference really does sit where this issue's residue sits — a first pass succeeds or fails on
b <= tolerance, evaluated at the margin. That was the hypothesis.It is wrong, and here is the measurement that kills it
§108 ported verbatim in scaled points — all three branches,
(r*r*r + 2^17) / 2^18rounding,r>1290 → inf_bad— against the float cube, asking the only question that can change a break: would a feasibility test answer differently?s(tencmr10spaces), ratio 0…3sstraddling §108's branch boundaries, ratio −1…4The
svalues are chosen from the source's own constants rather than at random:t<=7230584is 110.3pt and picks the first branch,s>=1663497is 25.4pt and picks the second, below both it falls tor:=t. Tolerances tested are the three TeX actually uses:\pretolerance100,\tolerance200, andinf_bad10000. 992 distinct integer badness values were produced along the way, so the ladder was genuinely exercised.The quantisation is real and it changes no decision at these tolerances. Both functions are monotone in the same direction and the integer one rounds to the nearest rung; a rung boundary would have to fall exactly on a tolerance to flip a verdict, and 100, 200 and 10000 are not near one.
What that leaves
This issue's exclusions stand, all four of them, and its question is unchanged and still open:
⚠ The limit of my refutation, stated so nobody over-reads it: I measured the feasibility predicate on isolated (t, s) pairs. I did not measure demerits —
badness + penaltysummed over a path, where a systematic difference of a few units per line could still select a different break even when every line is individually feasible. That is a different experiment and I have not run it, so "the formula cannot explain this" is sound for the pass-1 failure the issue describes and is not a claim about the optimiser's choice among feasible paths.⭐ Worth keeping regardless: §108 remains the thing TeX says every implementation should use, and the port above is twenty lines. The case for it is faithfulness and the demerits question, not this issue.
🤖 Generated with Claude Code
tannevaled commentedon Nov 17, 2026
A second witness for this, found by accident while testing something else, and it
makes the overrun visible as ink past the box edge rather than as a character
count.
Measured
A
\parbox{110pt}of long words,articleat 10pt, againsttectonic. Thex-extent of each line, as
gotex-linediffreports it (x0is the box's leftedge, 133.77):
tectonicThe reference never exceeds the box. We exceed it by 4.81pt, which is
+4.4% — and this issue's own figure, 69 characters where the reference holds
66, is +4.5%. Same quantity, two instruments.
Two details that narrow it
⛔ It is not punctuation and it is not hyphenation-boundary. The fixture has
two paragraphs, one with a comma after every word and one with none, and both
overrun identically. I had built it to witness
\lccodeword boundaries (#765item 3, now #824) and it came back byte-identical before and after that change —
which is how this turned up.
⚠ The break points differ too, and in the direction the overrun predicts:
We take a LATER hyphenation point in the same word. That is consistent with a
measure we believe is wider than it is, rather than with a different set of Liang
points — but I have not isolated which, and the two are distinguishable: the same
word at a measure where only one break fits would say.
Not claimed
⚠ No mechanism. The candidates this sits between are the line measure handed to
the breaker, the advance of the material (#716's pairwise kerning, #754 item F),
and the breaker's own tolerance for an overfull line. One
\parboxon onemachine says the quantity, not the cause.
⚠ No corpus figure.
Refs #765, Refs #824, Refs #716, Refs #754.
🤖 Generated with Claude Code