Skip to content

\footnoterule is a macro the page builder executes, not three nodes built in Go (#677) - #679

Merged
tannevaled merged 1 commit into
mainfrom
footnoterule-is-a-macro
Nov 3, 2026
Merged

tannevaled merged 1 commit into
mainfrom
footnoterule-is-a-macro

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

The head of the parity roadmap (#677) now that \thefootnote is closed:
\footnoterule is named by 62 of the 154 measured papers — and 60 of them
redefine it
, counted on their own sources with the usual positive and negative
controls on the pattern. The name's frequency is not the defect's size; the
redefinitions are.

The defect

assemblePage emitted three hard-coded nodes:

kernNode{width: -ptToSP(3)},
ruleNode{width: e.hsize * 2 / 5, height: defaultRule},
kernNode{width: ptToSP(2.6)},

so no class and no document could change the rule. What this drew happens to be
article.cls:605-608:

\renewcommand\footnoterule{\kern-3\p@ \hrule\@width.4\columnwidth \kern2.6\p@}

which is why nothing ever looked wrong — the engine agreed with the commonest class
by coincidence and with nobody else
. The kernel's own rule is a fixed 2in
(latex.ltx:13162-13163), a different number, so even the default was right only for
article and its relatives.

Measured

A document asking for \hrule width 3in height 2pt, read off the SVG:

largeur hauteur
avant 138 0.4
après 216.81 2

216.81 is 3 × 72.27. The redefinition takes effect exactly; before, the document was
ignored.

The control that matters

A document redefining nothing renders byte-identically before and after. All 154
corpus papers can carry footnotes, so a macro path that shifted the default would have
moved everything.

The one internal difference is 138 sp — 0.002 pt — because TeX reads .4 and
multiplies in scaled points where the Go code did an integer * 2 / 5. The reference's
arithmetic wins, and it rounds away before any output precision, which is why that SVG
is identical. The test states the tolerance and why it exists.

\let\footnoterule\relax draws nothing

article.cls:172 does exactly that in the \if@titlepage branch, so a title page's
notes carry no rule. A name that exists but is not a macro therefore yields an empty
list: reading "not a macro" as "use the built-in rule" would put a rule on the one
page the class took trouble to clear.

The precedent for executing a macro at page-assembly time is latexHead
(fancyhdr.go:176), which reads \@oddhead's body the same way.

Verified by mutation: forcing the fallback fails the redefinition test and the \relax
test, and leaves the default-geometry control passing.

Corpus A/B

Control 40ee57f (main), treatment d0c7ec6:

pages  : 154 comparés, 0 ont bougé, Σ|·| = 0, biais = +0   (inchangé: +49 contre la référence)
rendu  : 154 comparés, 40 DIFFÉRENTS, dont 40 à pagination identique

40 of 154 render differently, none of them visible to a page count. The headline
bias is unchanged — a no-regression result.

The figure sits under its bound: 60 papers redefine \footnoterule, 40 moved. The rest
presumably redefine it to something equivalent to .4\columnwidth, or do it in a file
this engine does not execute, or carry no footnote on a rendered page.

⚠ What I have not separated out: the 138 sp arithmetic difference could in principle
tip a borderline rounding on some document, so I cannot claim all 40 moved because a
redefinition took effect. The plain-document control says it does not happen there; it
does not prove it happens nowhere.

🤖 Generated with Claude Code

…built in Go

FROM THE PARITY ROADMAP (#677), now its head: \\footnoterule is named by 62 of the 154
measured papers, and 60 of them REDEFINE it -- counted on their own sources, with the
usual positive and negative controls on the pattern.

THE DEFECT. assemblePage emitted three hard-coded nodes:

	kernNode{width: -ptToSP(3)},
	ruleNode{width: e.hsize * 2 / 5, height: defaultRule},
	kernNode{width: ptToSP(2.6)},

so no class and no document could change the rule. What this drew happens to be
article.cls:605-608,

	\\renewcommand\\footnoterule{\\kern-3\\p@ \\hrule\\@width.4\\columnwidth \\kern2.6\\p@}

which is why nothing ever looked wrong: the engine agreed with the commonest class by
coincidence and with nobody else. The KERNEL s own rule is a fixed 2in
(latex.ltx:13162-13163) -- a different number -- so even the default was only right for
article and its relatives.

MEASURED. A document asking for \\hrule width 3in height 2pt, read off the SVG:

	avant   width="138"     height="0.4"      <- notre filet, le document ignoré
	apres   width="216.81"  height="2"        <- 3in = 3 x 72.27

CONTROL, and it is the one that matters: a document that redefines NOTHING renders
BYTE-IDENTICALLY before and after. 154 of 154 corpus papers can carry footnotes, so a
macro path that shifted the default would have moved everything.

The one internal difference is 138 sp -- 0.002 pt -- because TeX reads ".4" and
multiplies in scaled points where the Go code did an integer `* 2 / 5`. It is the
reference s arithmetic that wins, and it rounds away at any output precision, which is
why the SVG is identical. The test states the tolerance and why it exists.

⛔ \\let\\footnoterule\\relax DRAWS NOTHING. article.cls:172 does exactly that in the
\\if@titlepage branch, so a title page s notes carry no rule. A name that exists but is
not a macro therefore yields an EMPTY list: reading "not a macro" as "use the built-in
rule" would put a rule on the one page the class took trouble to clear.

The precedent for executing a macro at page-assembly time is latexHead
(fancyhdr.go:176), which reads \\@oddhead s body the same way.

Verified by mutation: forcing the fallback fails the redefinition test and the
\\relax test, and leaves the default-geometry control passing.

Co-Authored-By: Claude Opus 5 <[email protected]>
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