Repository navigation
Description
Every display equation costs 13.1pt too much — and it is not the formula
The first attributable cause of the +50 page bias (#622), found with probes that need
no page alignment at all, so none of #622's measurement traps apply.
The witness, in six lines
\documentclass[10pt]{article}
\begin{document}
\setbox0=\vbox{\begin{equation} E = \sum_{i=1}^{n} \frac{x_i^2}{\sqrt{1+y_i}} \end{equation}}
\message{[EQH=\the\ht0][EQD=\the\dp0]}
x
\end{document}| hauteur du vbox | |
|---|---|
| gotex | 49.441pt |
| tectonic | 36.313pt |
| écart | +13.13pt par display, +36 % |
It is NOT the mathematics
The same formula as a plain box:
\setbox0=\hbox{$\displaystyle E = \sum_{i=1}^{n} \frac{x_i^2}{\sqrt{1+y_i}}$}| hauteur | profondeur | total | |
|---|---|---|---|
| gotex | 16.071pt | 13.370pt | 29.44pt |
| tectonic | 16.514pt | 12.799pt | 29.31pt |
0.13pt apart. go-tex/math sets the formula correctly; the excess is entirely in
what the equation environment packs around it:
| emballage vertical | |
|---|---|
| gotex | 49.441 − 29.44 = 20.0pt |
| tectonic | 36.313 − 29.31 = 7.0pt |
Our \abovedisplayskip and \belowdisplayskip both read 10.0pt plus 2.0pt minus 5.0pt
— the reference's values — and 10 + 10 = the 20pt measured. So the parameters are right
and the contribution is wrong: something adds both skips where the reference adds
about one baseline's worth.
What it costs on a page
\loop\advance\n by1 \P \begin{equation} E_{\the\n} = … \end{equation} \ifnum\n<40 \repeat| pages | |
|---|---|
| gotex | 6 |
| tectonic | 5 |
40 displays × 13.13pt = 525pt, against a \textheight of 550pt: one page, exactly as
measured. A paper with a hundred displays gains two and a half.
The controls that make this attributable
Three probes where the two engines agree exactly, so the fourth is not a general
divergence:
| probe | gotex | tectonic |
|---|---|---|
| 300 one-line paragraphs | 7 pages | 7 pages |
| 80 multi-line prose paragraphs | 6 pages | 6 pages |
40 \sections + prose |
6 pages | 6 pages |
| 40 display equations + prose | 6 pages | 5 pages |
And the page geometry is identical before any of it — read out of both engines on the
same document:
[TH=550.0pt][TS=10.0pt][BS=12.0pt][MD=5.0pt][VS=550.0pt][TW=345.0pt] gotex
[TH=550.0pt][TS=10.0pt][BS=12.0pt][MD=5.0pt][VS=550.0pt][TW=345.0pt] tectonic
So: same box, same prose capacity, same section cost, same formula — and 13.1pt of extra
glue per display.
Found along the way
\showthe is undefined in this engine, which is why measure dimens reads nothing
from it and refuses (correctly) rather than reporting zeros. It is a TeX primitive, and
our own measurement tooling wants it; every number above had to go through
\message{\the…} instead. Worth its own issue.
🤖 Generated with Claude Code
Activity
tannevaled commentedon Nov 4, 2026
A hypothesis checked and discarded, and the real location narrowed
What I thought it was
tex.web:22578-22585chooses between the long and short display skips:displayskip.gouses\abovedisplayskipand\belowdisplayskipunconditionally, andthe LaTeX 10pt values make the arithmetic look conclusive: (10 + 10) − (0 + 6) = 14pt
against a measured 13.1pt.
Why that is wrong
The rule keys on
\predisplaysize, and this engine does not have it:So the rule cannot be evaluated here — that part is real. But measuring what the
reference actually chose kills the hypothesis: with
\predisplaysizeat 48.37pt and acentred display's
d+s≈ 0,d+s <= pre_display_sizeis true, so tectonic took thelong skips in both cases. The short-skip branch was never reached.
Confirmed independently by the control, once I read it properly:
The gap is the same in both. If the short-skip rule were the cause it would appear in
one case and not the other. (That control was also confounded on first reading — the
"long" line wrapped, so the two cases differ by a text line as well; the gap being
constant is what survives.)
Where it actually is
Both engines use the same two skips, with the same values, and the formula box agrees to
0.13pt. The 13–14pt therefore sits in the interline contribution around the display,
which
displayskip.go:80-88adds deliberately and documents:That reasoning and that measurement are sound. The open question is whether the
correction overshot — 13pt is close to a
\baselineskipof 12pt plus change — and themeasurement that settles it is the same one quoted there, re-run now: baseline to
baseline across a display between two text lines, both engines.
Still true and still worth fixing on its own
\predisplaysizeis absent, so the long/short choice cannot be made at all. It is a TeXprimitive, the rule above is unimplementable without it, and the short branch does exist
in real documents — a display after a line that ends before the display's left edge.
That is a separate defect from the 13pt, and this issue should not be closed by fixing
only one of them.
🤖 Generated with Claude Code
tannevaled commentedon Nov 4, 2026
Located: we add a full
\baselineskipon top of the skip, above the displayBaseline to baseline across one display between two text lines — the same measurement
displayskip.go:80-88rests on — read off both PDFs withgotex-linediff:+13.95pt, agreeing with the +13.13 and +13.66/+14.24 measured two other ways. Three
independent probes, one number.
The shape of it
Above the display the reference's net advance is 11.96pt — exactly one
\baselineskip, with the 10pt\abovedisplayskipabsorbed:append_to_vlistadds\baselineskip − prev_depth − height(b)(tex.web§679), which goes to zero or negativeonce the skip and the display's own height are counted, so the skip does not simply add.
We produce 21.92 = 11.96 + 9.96: the skip on top of a full baselineskip.
⚠ And the numbers in the existing comment are the mirror image of today's
displayskip.go:86-88justifies adding the interline glue with:Today, by the same measurement: reference 29.89pt, ours 43.84pt. Our current value is
within 0.1pt of the number that comment attributes to the reference, and the
reference's current value is near the one it attributes to us.
I am not asserting the two sides were swapped — the earlier probe used
\[…\]wheremine uses
$$…$$, and the fonts differ (ours resolves STIXTwoMath here, the referenceLMRoman) — but the coincidence is close enough that the fix this comment justifies should
not be trusted until that measurement is re-run in its original form. If the sides were
swapped, the correction moved us to the reference's wrong-side number, which would
explain a 13.95pt excess that no parameter accounts for.
Next
Re-run the original
\[…\]probe, same fonts both sides, before changing any code. Thedefect is confirmed and reproducible either way; what is not yet settled is whether the
remedy is to remove the added interline glue or to compute it the way §679 does.
🤖 Generated with Claude Code
tannevaled commentedon Nov 4, 2026
Re-run in the comment's own form: the earlier measurement does not reproduce
The previous note held off on code because two things differed from the probe
displayskip.go:86-88cites: it used\[…\]where I used$$…$$, and the fontsresolved differently. Both are now controlled.
The probe form makes no difference at all
Same document with
\[E = 1\]instead of$$E = 1$$, both engines:Byte-identical to the
$$run on both sides. The two spellings produce the samegeometry here, so the form the earlier probe used cannot explain anything.
The font is excluded by the measurement itself
Our run resolves
STIXTwoMath-Regularwhere the reference usesLMRoman10-Regular, andthat is worth excluding rather than arguing about — so look at the first baseline,
which is placed before any display is involved:
0.02pt apart. Whatever the font changes vertically on this page, it changes it by two
hundredths of a point. It cannot account for 13.95.
So
Measured in the comment's own form, with the font excluded, the reference is at 29.89
and we are at 43.84 — each within ~2pt of the value the comment assigns to the other
side.
I still cannot prove the sides were swapped: I did not run that earlier probe and
cannot see its inputs. What I can say is that its result does not reproduce, and that
the interline glue added on its authority is the whole of a 13.95pt excess that no
parameter accounts for.
⇒ The remedy is not "remove the glue" either — that was tried before and is what the
comment was written to prevent. It is to compute the contribution the way
tex.web§679does,
\baselineskip − prev_depth − height(b)floored by\lineskip, and then measurethis same three-baseline probe against the reference's 11.96 / 17.93. That is a code
change with a known target number, which is the state this issue should be in before
anyone writes it.
🤖 Generated with Claude Code
tannevaled commentedon Nov 4, 2026
One more narrowing, from the code rather than a probe
interlineGlue(paragraph.go:362-371) already implementstex.web§679 exactly:and the parameters read correctly:
\lineskip1.0pt,\lineskiplimit0.0pt,\baselineskip12.0pt.So the formula is not the defect. The excess has to be in what
placeDisplayhandsit — the
prevDepthin force when the display box is contributed, or the height of thebox it contributes — not in how the glue is computed from them.
That is where a fix should start looking, and it is a smaller search than the one this
issue opened with.
A probe that did not work, recorded so no one repeats it
Reading
\the\prevdepthjust before the display returns −999.99998pt(
ignore_depth), because the message is expanded in horizontal mode: the paragraph hasnot been contributed yet, so
\prevdepthstill describes the enclosing vertical list,not the state the display will see. Instrumenting this from inside the document does not
reach the quantity in question; it has to be read from the engine's own node list.
🤖 Generated with Claude Code
tannevaled commentedon Nov 4, 2026
⛔ I was wrong to discard the short-skip hypothesis. It is the cause, to the hundredth of a point
Read out of the engine's own vertical list, which is where I said this quantity had to
come from:
interlineGlueis right in both places. Our baseline-to-baseline above the display is2.350 + 10.000 + 3.080 + 6.570 = 22.00pt, against the 21.92 measured off the PDF.Now put the short skips in instead:
\abovedisplayshortskip= 0pt,\belowdisplayshortskip= 6ptExact above, 0.07pt below. 10pt + 4pt = the 13.95pt excess, accounted for entirely.
Why I talked myself out of it
The rule is
tex.web:22580:I read
\predisplaysizeas 48.37pt, assumedd+s ≈ 0for a centred display, concludedd+s <= pre_display_sizewas true, and therefore that tectonic had taken the longskips.
d+sis not zero — it is the display's left edge. On this page the displaystarts at x=292.53 while the previous line ends at x=230.83: the line ends before the
display begins, there is clearance, and the condition is false → the short skips.
So the measurement I offered as a refutation (“the gap is the same whether the preceding
line is long or short”) was measuring two cases that both take the short branch, because
both lines end well before a centred display's left edge. It could not have separated
them.
What the fix is, with its target numbers
Implement
tex.web:22578-22585: track\predisplaysize(the effective width of the lastline before the display), compare it against the display's
d+s, and choose\abovedisplayshortskip/\belowdisplayshortskipwhen there is clearance. Both parametersalready exist here with the right values (
0.0pt plus 3.0ptand6.0pt plus 3.0pt minus 3.0pt);displayskip.gosimply never selects them, and\predisplaysizeis absent.Target for the three-baseline probe: 11.96 above, 17.93 below, against our present
22.00 and 22.00.
🤖 Generated with Claude Code