Skip to content

the skips' width is taken off the measure ONCE: #780 counted it twice - #781

Merged
tannevaled merged 1 commit into
mainfrom
skipwidth-once
Nov 14, 2026
Merged

tannevaled merged 1 commit into
mainfrom
skipwidth-once

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

⛔⛔ A regression I merged this evening in #780, found by #583's own witness.

#780 gave the breaker a background carrying \leftskip and \rightskip — width, stretch by order, shrink — which is tex.web §16307-16315. But this engine does not keep line_width at \hsize; paragraph.go:81 hands breakSegment

lineWidth := spToPt(e.hsize - e.leftskip.width - e.rightskip.width)

so the widths were already off the measure and the background took them off again. tex.web's arrangement and this engine's are the same arithmetic. Doing both is not.

Measured

#583's witness: \rightskip=100pt, a 343.7pt measure, right margin at 477.50, against tectonic 0.17.0.

lines first line x1
reference 3 A fairly long subsection title that has to wrap onto a 377.85
before #780 3 the same split 377.87
#780 5 A fairly long subsection title that, stretched 377.87
this 3 the reference's split again 377.87

So #583's first defect was already fixed before #780, and #780 reopened it.

⛔ The margin could not see it, which is why the test passed

Every assertion in TestLineSkipsNarrowTheMeasureBeforeBreaking measures how far right the ink reaches, and that stayed correct through the double count — the lines are justified to the narrowed measure either way. What moved was how much text the breaker thought would fit: it packed less and stretched what it packed. Five lines where the reference sets three, each stretched to the same correct right margin.

The test now asks the question of the text: a paragraph at \rightskip=100pt must not gain more than one line over the unconstrained one. Mutating the width back in gives 6 lines against 3, and the assertion names the cause.

What is untouched

#768's witness is unchanged — five lines, the reference's five, lines 1–3 to 0.02pt — and the whole suite is green. The stretch half of the background, which is the \raggedright fix #780 existed for, is untouched; only the width is dropped.

⚠ What this means for #780's corpus table

It has to be re-run. #780 reported Σ|page error| 123 → 125 and mean divergence 3.884 → 3.935, against line agreement +0.11pt and one more exact page count. Part of that is likely this double count rather than the change #780 was making — a paragraph under \quote, \quotation, a contents entry or any \list was being broken against a measure 20–40pt too narrow. The machine's 1-minute load is above the measuring threshold as I write, so the re-run is owed, not done.

Refs #583, #768, #780.

🤖 Generated with Claude Code

⛔⛔ A REGRESSION I MERGED THIS EVENING, FOUND BY #583's OWN WITNESS.

#780 gave the breaker a background carrying \leftskip and \rightskip — width,
stretch by order, shrink — which is tex.web §16307-16315. But this engine does
not keep line_width at \hsize: paragraph.go:81 hands breakSegment

	lineWidth := spToPt(e.hsize - e.leftskip.width - e.rightskip.width)

so the widths were already off the measure, and the background took them off
again. tex.web's arrangement and this engine's are the same arithmetic; doing
BOTH is not.

Measured on #583's witness (`\rightskip=100pt`, a 343.7pt measure, right margin
at 477.50), against tectonic 0.17.0:

	reference      3 lines, `A fairly long subsection title that has to wrap onto a`, x1 377.85
	before #780    3 lines, the same split,                                           x1 377.87
	#780           5 lines, `A fairly long subsection title that`, stretched to       x1 377.87
	now            3 lines, the reference's split again,                              x1 377.87

So #583's first defect was already fixed before #780, and #780 reopened it.

⛔ AND THE MARGIN COULD NOT SEE IT, WHICH IS WHY THE TEST PASSED. Every
assertion in TestLineSkipsNarrowTheMeasureBeforeBreaking measures how far right
the ink reaches, and that stayed correct through the double count: the lines are
justified to the narrowed measure either way. What moved was how much text the
breaker thought would fit — it packed less and stretched what it packed. Five
lines where the reference sets three, each stretched to the same right margin.

The test now asks the question of the TEXT: a paragraph at \rightskip=100pt must
not gain more than one line over the unconstrained one. Mutating the width back
in gives 6 lines against 3 and the assertion names the cause.

⚠ #768's witness is unchanged (five lines, the reference's five, lines 1-3 to
0.02pt), and the whole suite is green: the stretch half of the background — the
\raggedright fix that #780 was for — is untouched. Only the width is dropped.

⚠⚠ AND THE CORPUS A/B ON #780 MUST BE RE-RUN. Its table showed Σ|page error|
123 → 125 and mean divergence 3.884 → 3.935 against line agreement +0.11pt and
one more exact page count; part of that is likely this double count rather than
the change #780 was making. The machine's 1-minute load is above the threshold
at the time of writing, so it is owed, not done.

Refs #583, #768, #780.

Co-Authored-By: Claude Opus 5 <[email protected]>
@tannevaled

Copy link
Copy Markdown
Contributor Author

And the witness the whole background change existed for now matches the reference exactly, with this fix in place.

\raggedright at \hsize=120pt, both paragraphs in one file, against tectonic 0.17.0:

                        reference                        here
justified   Typographical incomprehen-            257.54 | 257.55
            sibilities overwhelm every para-      267.90 | 267.91
            graph of this page.                   215.50 | 215.51

ragged      Typographical                         196.63 | 196.64
            incomprehensibilities                 224.69 | 224.70
            overwhelm every                       206.33 | 206.32
            paragraph of this page.               234.91 | 234.92

Seven lines, every one the reference's, within 0.02pt. The ragged paragraph takes no hyphens and the justified one takes two — which is the divergence that started this: before the glue orders, our two paragraphs were identical, the ragged one carrying the justified one's hyphens because the breaker never saw the fil as infinite. §16790-16793 gives such a line badness 0, so TeX's first pass — which has no hyphenation at all — succeeds, and now ours does too.

⚠ Which is also why dropping the width and keeping the stretch is the right cut. \raggedright's \rightskip is 0pt plus 1fil: no width, infinite stretch. This fix removes the width from the background and leaves the stretch, so the ragged case above is untouched while #583's \rightskip=100pt case stops being narrowed twice. The two halves of the background were never the same thing, and only the width was double-counted.

For the record, the full set of witnesses this pair now matches the reference on:

witness reference here
\raggedright at 120pt, both paragraphs 3 + 4 lines, 2 and 0 hyphens identical, 0.02pt
#583 \rightskip=100pt 3 lines 3 lines, same split
#583 contents entry with \dotfill 2 lines at the margin identical, 0.02pt
#768 \hsize=45pt \fussy 5 lines 5 lines, first three identical; residue is ev-ery
aaa every aaa. at 18pt ev-/ery identical

🤖 Generated with Claude Code

@tannevaled
tannevaled merged commit 3afebd8 into main Nov 14, 2026
18 checks passed
@tannevaled
tannevaled deleted the skipwidth-once branch November 14, 2026 21:47
@tannevaled

Copy link
Copy Markdown
Contributor Author

The corpus A/B has been re-run clean, and it refutes what I said about it. The double count was not the cause of the page cost.

I wrote on #780 and #781 that part of Σ|page error| 123 → 125 was "likely this double count rather than the change #780 was making". That was a hypothesis stated as likely, and it is now measured false.

The clean run

gotex-refdiff -layout, 60 sampled at seed 1, between the exact commits — base be1decd (pre-#780), head 3afebd8 (#780 + #781). Load 5.65–7.55, under the ~8 threshold, so this one was taken properly; the earlier pair ran at 9–12.

base head
mean line agreement 91.35% 91.57% +0.22 pt better
mean divergence 3.833 3.872 +0.039 worse
page count exactly the reference's 12/41 12/41 ±0
Σ|page error| 124 126 +2 worse

41 papers scored on both sides, identical populations, no status flips — no reference-extraction flake this time, so nothing is excluded.

What changed, and what did not

Line agreement roughly doubled against the contaminated run: +0.22pt here against +0.11pt with the double count in place. So removing it did help, and the earlier figure understated the change's effect on lines.

Σ|page error| is still +2, and it is the same two papers as before:

2607.12864   article   ref 55   base 54 → head 53   MISSING PAGES
2607.01348   article   ref 36   base 34 → head 33   MISSING PAGES

Both were already under the reference and each loses one more page. The third mover from the contaminated run (2608.00249, PAGE OVERFLOW (+7)) no longer moves at all — that one was the double count.

So the honest reading

The change makes lines more like the reference and leaves page capacity slightly worse on the two tightest papers. Those two are #381's direction — our lines hold more than the reference's — and with hyphens no longer padding lines out to fill a measure, the papers that were already fitting too much fit a little more. Better line agreement does not fix a capacity bias, and on this sample it exposes it.

⚠ Not claimed: that #381 explains it. Two papers, one page each, named so anyone can check; the mechanism is a hypothesis and the measurement above is not a test of it.

⚠ And the retraction stands on its own: I attributed a cost to a defect because the defect was in front of me, and the defect was real but not the cause. The figures to cite for the #780+#781 pair are the ones in this comment, not the ones on #780.

🤖 Generated with Claude Code

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