Repository navigation
The second pass is the final pass, and we loaded patterns the reference has not - #778
Conversation
…1.4.0
Pushed early for visibility; two tests are red and judged in the pull request.
go-typeset/linebreak v1.4.0 makes §16769's branch faithful — a forced break past
the threshold is no longer recorded, and artificial_demerits fires only where the
line is hopeless or the break is forced. Both were the reasons written here for
leaving Params.FinalPass off (paragraph.go:304-318), so the flag can now say what
TeX says:
second_pass:=true; final_pass:=(emergency_stretch<=0); {§863}
set on ENTERING the second pass. \emergencystretch is accept-and-ignore here, so
this pass is always the final one.
Measured on #768's own witness (\hsize=45pt, \fussy), against tectonic 0.17.0:
reference 5 lines, FOUR overfull (18.1, 13.92, 14.3, 18.16pt)
before 7 lines, every one fitting
armed 7 lines — the wide-open pass throws the answer away
armed, no w-o 5 lines, and lines 1-3 the reference's to 0.02pt
So the wide-open pass IS #768's finding (2). It is NOT removed here: doing so
turns four more tests red, all saying the same thing — a word that must be
hyphenated stops being hyphenated, because go-typeset/linebreak#12 item (1) (one
float of stretch, fil flattened to 1e6) makes a \raggedright line TeX scores at
badness 0 score 10000 here and be infeasible. The order is item (1), then the
pass, then #768.
Co-Authored-By: Claude Opus 5 <[email protected]>
…ce has not Two changes, both measured against tectonic 0.17.0, both reached from #768. ## 1. FinalPass is armed (tex.web §863) second_pass:=true; final_pass:=(emergency_stretch<=0); set on ENTERING the second pass. \emergencystretch is accept-and-ignore here, so this pass is always the final one and artificial_demerits belongs to it. The comment that said otherwise named two library defects as the reason; both are go-typeset/linebreak#12 item (5) and its neighbour, fixed in v1.4.0 (bumped here): a forced break past the threshold is no longer recorded, and the clause no longer fires outside §16769's branch. ## 2. We loaded ushyphmax's extra patterns; LaTeX loads hyphen.tex's The embedded file is ushyphmax.tex: hyphen.tex's patterns, a marker line, then 492 additions. language.dat loads hyph-en-us.tex, the FIRST half. Liang takes the highest value at a position, so an addition changes a word's breaks — and an EVEN one FORBIDS a break the first half allows. .ev2 an addition, value 2, between `ev` and `ery` ev1er hyphen.tex, value 1, same position so `every` had no break point at all. tectonic at \hsize=18pt sets `ev-`/`ery`. Loading now stops at the marker; `incomprehensibilities`, `overwhelm`, `paragraph`, `photography`, `typographical` and `democracy` break exactly where they did, which is why nothing caught this. The file keeps both halves: it is a verbatim extract and the licence header is its provenance. ## Measured #768's witness, \hsize=45pt, \fussy, face and \tolerance verified identical: reference 5 lines, FOUR overfull (18.1, 13.92, 14.3, 18.16pt) before 7 lines, all fitting armed 7 lines armed, no w-o 5 lines, lines 1-3 the reference's to 0.02pt badbox_test.go's witness (\hsize=45pt, \tolerance=10000), reference log `prevgraf 7 lines` and ONE `Overfull \hbox (33.1pt too wide)`: six of our seven lines are now the reference's to 0.01pt, where the paragraph used to go to greedyLines entirely. `aaa every aaa.` at \hsize=18pt: ours is now the reference's four lines. ## The wide-open pass stays, and it is now located It is #768's finding (2): a pass at \tolerance=maxBadRatio that tex.web does not have, which throws away the answer the pass above found. Removing it turns four tests red, all saying "a word that must be hyphenated stops being hyphenated" — go-typeset/linebreak#12 item (1), one float of stretch, so a \raggedright line TeX scores at badness 0 is infeasible here. Order: item (1), the pass, then #768. ## Tests corrected, each against the reference rather than against us - subcaption: `(b)Second` was OUR artefact. \subcaptionbox sets its caption in a \parbox as wide as the panel with \centering; tectonic on the same shape gives `(b)` / `Sec-` / `ond` and no overfull box. - badbox: `hensibili` was greedyLines' own break; the reference breaks `hensibil-`. The second overfull line (`every para-`, 2.93pt) is the wide-open pass declining the `ev-ery` the patterns now offer, and is pinned WITH that reason so it returns to the reference's one when the pass goes. - the pattern table gained `every`, `democracy`, `photography`; `every` is the only one whose answer moves with the marker, checked by mutation. ⚠⚠ THE CORPUS A/B IS OWED AND HAS NOT RUN. This changes line breaking and hyphenation for every English document. The machine's 1-minute load is 62; counts would be exact but 120 compiles now would starve the other sessions. Deferred on purpose and said out loud. Refs #768, go-typeset/linebreak#12. Co-Authored-By: Claude Opus 5 <[email protected]>
|
The corpus A/B this PR said it owed has run, on two metrics and three builds. It says the change is faithful and costs one page; it does not say the corpus got better. Why two metricsThe word-recall A/B ran first and is nearly useless here, which is worth saying rather than quoting: Recall compares multisets of words. It sees a hyphenation change (a split word becomes two tokens) and is almost blind to where the lines fall, which is most of what this PR does. So the measurement below is Three builds, so each half is attributableA third engine was built for this — final pass armed, ushyphmax's extra patterns still loaded — through a throwaway
On a mean divergence of ~3.87 those are +0.5% and +0.03%. 25 of 40 papers moved on the full change — 13 better, 12 worse — which is a real but direction-neutral perturbation, not an improvement and not a break. ⛔ One page moved, and it is the final pass
The final-pass-only build already has the extra page, so the patterns did not cause it. Everything else about that paper is identical across all three runs — same median and p95 displacement (0.115 / 0.909), same line agreement (91.8%), same 3702 matched words, same 95.8% word recall. It gained one page and nothing else changed. Filed separately. ⚠ Two things checked rather than assumedThe paper missing from the head side is not ours. Load. Both pairs ran at 1-minute load 9–12, above the ~8 threshold. Divergence, displacement and page counts are geometry and counts — exact under load. What load actually threatens is timeouts changing which papers are scored, and the scored sets are identical within each pair except for the reference failure above. What this does and does not licenseDoes: the change is what Does not: any claim that corpus fidelity improved. It did not, on this sample, on either metric. Anyone reading this later should not cite it as a gain. Marking ready for review on that basis: faithful, corpus-neutral, one page regression filed. 🤖 Generated with Claude Code |
|
The page this PR looked like it cost is not its own: #779 is closed and the measurement moved to #281.
And the caption is the wrong size to begin with: the reference sets both this paper's table captions in So the breaker was answering "does this caption fit?" about a caption of the wrong face, weight and size. That is A line-breaking decision taken on the wrong metrics is not a line-breaking defect. This PR did not introduce a page; it flipped a coin #281 had left spinning. The controls are kept on #779 for the record: three builds attribute the flip to the final pass and not to the hyphenation half, and the count of papers whose page count is exactly the reference's is 12/40 before and after. The corpus reading in the comment above is unchanged: faithful, corpus-neutral on both metrics. Ready for review. 🤖 Generated with Claude Code |
… the wide-open pass is gone (#780) * \leftskip/\rightskip are the background, glue orders are carried, and the wide-open pass is gone go-typeset/linebreak v1.5.0 implements tex.web §16307-16315 and §16790-16793, so the three things this engine did instead can all go. ⛔ (1) THE FIL IS CARRIED, NOT FLATTENED. toItems read if c.spec.stretchOrder > 0 { st = 1e6 } which made `plus 1fil` a large FINITE stretch. §16790-16793 gives any line carrying fil/fill/filll badness 0 and fitness `decent` — perfect, not merely very good — so a flattened fil came out with a large but finite badness. ⛔ (2) THE SKIPS ARE THE BACKGROUND. They were added to each line AFTER breaking, so the breaker never saw them: it broke the paragraph justified and the ragged glue was painted on afterwards. skipBackground() now hands them to the breaker as §16307-16315 seeds active_width with them, width and stretch-by-order and shrink. ⛔ (3) AND THE WIDE-OPEN PASS IS GONE — #768's finding (2). A pass at \tolerance=maxBadRatio has no counterpart in tex.web; §863 has three passes and none of them raises the tolerance. It survived #778's removal attempt because four tests then stopped hyphenating words that must be hyphenated: \raggedright lines TeX scores at badness 0 were infeasible here, so our pass 2 had no solution where TeX's had one. (1) and (2) remove that cause, and the first pass's hand-opened tolerance goes with it. ## Measured #768's witness (\hsize=45pt, \fussy), face and \tolerance verified identical: reference Typographical / incomprehen- / sibilities over- / whelm ev- / ery paragraph. here Typographical / incomprehen- / sibilities over- / whelm every / paragraph. FIVE lines against the reference's five, lines 1-3 matching to 0.02pt. Before: seven. The residue is `ev-ery`, a hyphenation point we take and the reference does not on the same patterns. Corpus, gotex-refdiff -layout, 60 sampled seed 1, 40 scored both sides, load 5-10 (geometry and counts are exact under load; what load threatens is which papers get scored, and the sets differ only by a reference extraction that failed on one run — 2607.11306, flaky in both directions across four runs today): mean line agreement 91.23% -> 91.34% +0.11 pt better page count exact 12/40 -> 13/40 +1 better Σ|page error| 123 -> 125 +2 WORSE mean divergence 3.884 -> 3.935 +0.051 WORSE moved 35 of 40; one status flip, 2607.28976 MISSING -> ok (and 25 -> 26 pages against a reference of 26: a paper that did not render now renders exactly right) ⚠ THE TALLY AND THE ERROR DISAGREE, so both are here. Three papers moved one page and two of them are MISSING PAGES (-3 and -2): we fit MORE per page than the reference, which is #381's standing finding and is exposed slightly further now that we no longer pad lines out with extra hyphens. The third is PAGE OVERFLOW (+7) on a class whose line agreement is 75%. ⚠ NOT CLAIMED: that the corpus got better. On the aggregates it did not. What it got is faithful — two workarounds removed and one sentence of tex.web applied where three special cases stood. ## Three defects found on the way, all one mistake A ratio read without its order. Line.Ratio is measured against the HIGHEST order on the line, so an ordinary last line with \parfillskip = 0pt plus 1fil reports a ratio near 300: - hasBadLine called EVERY paragraph bad, so the first pass failed on all of them and every document went to the hyphenating pass; - the underfull counter reported an underfull line on an ordinary paragraph; - and the text layer DISCARDED inter-word glue arriving while its run was empty — the case after a formula, where the math closes the run before the glue arrives. `$E = mc^2$ exactly` came out `mc^2exactly`. The third only showed once the spacing was RIGHT: the reference ends that witness line at x1=408.21 and we now end at 406.91, where we used to end at 477.50 — almost 70pt wide. The layer's gap threshold had been calibrated against our own loose spacing, so the exact signal is used instead of widening the bar. ## Two fixtures asserted what the reference does not do Both re-checked against fresh tectonic runs rather than against the note in the test: - \hyphenation{photo-graphy}: at \hsize=58pt the reference leaves `photography` WHOLE (`A photography / and a manu- / script and a bib- / liography fol- / low here.`), so asserting `photo-` there was asserting our own old output. At 40pt it does break `photo-graphy`, and that is the fixture now; the pattern half moved to its own test with its own measure. - TestHyphenationInsertsHyphen: at spMock's widths the best hyphenated first line is 28pt on a 32pt measure with 1.5pt of stretch — badness near 1900, so NOTHING hyphenated is feasible at \tolerance=200 and one overfull line is the right answer. The fixture now states a tolerance in which its own subject can happen. Refs #768, #381, go-typeset/linebreak#12. Co-Authored-By: Claude Opus 5 <[email protected]> * README: the fourth pass is gone, and the corpus says faithful rather than better The passage said that pass STAYS, with the reason it had to. Both halves are now false: linebreak v1.5.0 removed the reason and this branch removed the pass. The witness (5 lines against the reference's 5, first three to 0.02pt) and the corpus table — line agreement and exact page counts up, Σ|page error| and divergence down — are stated together, because the tally and the error disagree and a reader must see both. Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Opus 5 <[email protected]>
paragraph.go's note on the wide-open tolerance pass had accumulated three
generations, each appended above or below the last:
⛔⛔ THE WIDE-OPEN PASS STAYS, AND IT IS NOT TeX
⛔⛔ AND IT IS GONE
⛔ SO WHY IS IT STILL HERE
⚠ THE ORDER IS THEREFORE FIXED: ... then this pass goes
⛔ A reader cannot tell which tense is current, and one did not: #754's audit of
the delegated layers reports that this function "raises the tolerance to 1e4
instead (paragraph.go:251-258)", citing line numbers that by then pointed INTO
the comment rather than at code. The pass was already gone — there are exactly
two breaking calls in the file. A stale comment cost a published audit one of
its six findings.
Rewritten as one record in one order: what the pass was, what it cost (the #768
witness against tectonic 0.17.0, kept verbatim), why it could not simply go
(#778's six red tests, four of them a word that must be hyphenated going
unhyphenated), and why it is gone (linebreak v1.5.0's glue orders removed the
cause, #780 consumed them here).
Every measured number is kept. What is removed is the three tenses.
⚠ Two of the old headings survive as QUOTATIONS inside the sentence that
describes the defect, which is the point of them.
Co-authored-by: Claude Opus 5 <[email protected]>
Draft: the corpus A/B is owed and has not run (load 62). The code and the tests are ready.
Two changes, both reached from #768, both measured against tectonic 0.17.0.
1.
FinalPassis armed —tex.web§863set on entering the second pass.
\emergencystretchis accept-and-ignore here, so this pass is always the final one andartificial_demeritsbelongs to it.paragraph.gosaid the flag could not be armed and named two library defects as the reason; both are go-typeset/linebreak#12 item (5) and its neighbour, fixed in v1.4.0, bumped here.2. We loaded patterns the reference has not
The embedded file is
ushyphmax.tex:hyphen.tex's patterns, a marker line, then 492 additions. LaTeX'slanguage.datloadshyph-en-us.tex— the first half. Liang takes the highest value at a position, so an addition changes a word's breaks, and an even one forbids a break the first half allows:| pattern | from | value at
ev|ery||---|---|---|
|
.ev2| ushyphmax's additions | 2 — even, refuses ||
ev1er| hyphen.tex | 1 — odd, allows |so
everyhad no break point at all. tectonic at\hsize=18ptsetsev-/ery. Loading now stops at the marker;incomprehensibilities,overwhelm,paragraph,photography,typographicalanddemocracybreak exactly where they did, which is why nothing caught it.Measured
#768's witness (
\hsize=45pt,\fussy, face and\toleranceverified identical):badbox_test.go's witness — the reference's log saysprevgraf 7 linesand oneOverfull \hbox (33.1pt too wide): six of our seven lines are now the reference's to 0.01pt, where that paragraph used to go togreedyLinesentirely.aaa every aaa.at\hsize=18ptis now the reference's four lines exactly.The wide-open pass stays, and it is now located
It is #768's finding (2): a pass at
\tolerance=maxBadRatiothattex.webhas no counterpart for, which throws away the answer the pass above found. Removing it turns four tests red, all saying the same thing — a word that must be hyphenated stops being hyphenated — becauselinebreak#12item (1) (one float of stretch,plus 1filflattened) makes a\raggedrightline TeX scores at badness 0 infeasible here. Order: item (1), then the pass, then #768.Tests corrected against the reference, not against us
(b)Secondwas our own artefact.\subcaptionboxsets its caption in a\parboxas wide as the panel, with\centering; tectonic on the same shape gives(b)/Sec-/ondand no overfull box.hensibiliwasgreedyLines' break; the reference breakshensibil-. The second overfull line (every para-, 2.93pt) is the wide-open pass declining theev-erythe patterns now offer, and is pinned with that reason so it returns to the reference's single box when the pass goes.every,democracy,photography;everyis the only one whose answer moves with the marker — checked by mutation, and the suite goes red on it.⚠ What is owed
The corpus A/B. This changes line breaking and hyphenation for every English document, and the honest measurement is a before/after against the reference over the corpus, not a witness. The machine's 1-minute load is 62; counts would be exact under load but 120 compiles now would starve the other sessions sharing this host. Deferred on purpose, and this should not merge until it has run.
Refs #768, go-typeset/linebreak#12.
🤖 Generated with Claude Code