Repository navigation
a display chooses between the long and the SHORT skips, as tex.web:22580 does - #684
Merged
Merged
Conversation
…580 does
The short pair was never selected, and that cost 13.95pt on every display.
if (d+s <= pre_display_size) or l then {not enough clearance}
begin g1:=above_display_skip_code; g2:=below_display_skip_code; end
else
begin g1:=above_display_short_skip_code; g2:=below_display_short_skip_code; end
The short pair is for a display whose left edge falls to the RIGHT of where the
previous line ends: the two do not collide, so little space is needed. A centred
display after an ordinary short line is exactly that case, and it is the common one.
Measured baseline to baseline across one display between two text lines:
au-dessus en dessous
tectonic 11.96 17.93
nous, avant 21.92 21.92
nous, apres 11.96 17.93
Exact, to the hundredth of a point, on both sides. 40 displays in a document went
from 6 pages to 5, which is tectonic's 5; the prose control stays at 6, also
tectonic's.
\predisplaysize is new here and follows tex.web:21781-21813 including its two
details that are easy to miss:
- the running sum stops at the last VISIBLE node. A line ends with \parfillskip and
text does not "reach" trailing glue; counting it would make every line full-width
and select the long pair always — the original defect under another name.
- only INFINITE stretch poisons the sum. Ordinary interword glue stretches finitely
and must pass, or every justified line would report \maxdimen. The reference
settles it: tectonic prints \predisplaysize as 48.37pt and 93.77pt on two ordinary
lines, finite values where a poisoned sum shows 16383.99998pt.
- it starts at shift_amount + 2*quad, and the two quads are not decorative: without
them a line reads shorter than it is and the short pair is chosen too often, the
error in the direction that TIGHTENS the page.
An existing test asserted one branch without knowing there were two.
TestDisplaySkipsAroundDisplay used `before $$x$$ after`, which takes the SHORT
branch, and asserted 10pt there — freezing the defect. It now uses a display wide
enough to reach back under the preceding line, which is the long branch it meant to
test, and the short branch has a test of its own. A long preceding PARAGRAPH does not
produce the long branch, and the comment says so: the quantity TeX measures is that
paragraph's last line, and a paragraph long enough to wrap ends on a short remainder.
NOT DONE HERE: \predisplaysize is computed where it is needed rather than exposed as
a register, so \the\predisplaysize is still undefined; and displayLeftEdge reads the
CENTRED case, which is what \[…\] and equation produce. A display shifted by
\displayindent (fleqn) would need its own left edge.
Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #683 — the first attributable cause of the page bias (#622).
The defect
The short pair of display skips was never selected.
tex.web:22578-22585:The short pair is for a display whose left edge falls to the right of where the
previous line ends — they do not collide, so little space is needed. A centred display
after an ordinary short line is exactly that, and it is the common case.
Measured, baseline to baseline
Exact on both sides. A document of 40 displays went 6 pages → 5, which is
tectonic's 5; the 80-paragraph prose control stays at 6, also tectonic's.
Corpus A/B — and what the headline hides
Control
712e574, treatment2637a60:The bias — the figure #622 is about — improves by 15 pages, and the median absolute
deviation reaches 0.
Σ|·| moves by one, and that is the number to read. All 14 movers got shorter, by
the right amount; that helps the papers that were too long and hurts the ones that were
already too short:
2305.01199+2→+1,2311.02037+3→+2,2311.08855+1→0,2311.09365+2→+1,2312.02121+1→0,2406.15398+2→+1,2407.21763+2→+1,2408.08199+1→02206.055400→−1,2403.107480→−1,2208.08532−2→−3,2304.06058−3→−4,2311.00084−1→−2,2407.18384−9→−11Two documents that were exact are no longer. I am not reporting "+50 → +35" without
this table: the net gain of 1 on Σ hides eight improvements and six regressions.
Why that is a reason to merge, not to revert
The spacing now matches the reference to the hundredth of a point on a probe where
nothing else is in play. The six that got worse were compensating: they are all
papers we already set too short, and our surplus display glue was partly cancelling a
different deficit. Removing the surplus does not create their problem, it uncovers
it — and it is now measurable on its own, which it was not while two errors were
subtracting.
The render channel says the same: 73 of 154 render differently, 59 of them invisible to
a page count.
The existing test asserted one branch without knowing there were two
TestDisplaySkipsAroundDisplayusedbefore $$x$$ after— a short line and a centreddisplay, i.e. the short branch — and asserted 10pt there, freezing the defect. It now
uses a display wide enough to reach back under the preceding line, which is the long
branch it meant to exercise, and the short branch has a test of its own.
⚠ A long preceding paragraph does not produce the long branch, and the comment says
so: the quantity TeX measures is that paragraph's last line, and a paragraph long
enough to wrap ends on a short remainder. Widening the display moves the other half of
the same comparison.
NOT DONE HERE
\predisplaysizeis computed where it is needed, not exposed as a register, so\the\predisplaysizeis still undefined.displayLeftEdgereads the centred case, which is what\[…\]andequationproduce. A display shifted by
\displayindent(fleqn) needs its own left edge.🤖 Generated with Claude Code