Skip to content

docs(engine): running heads, and the stub that outlived three correct fixes - #25

Merged
tannevaled merged 1 commit into
mainfrom
docs/running-heads
Nov 8, 2026
Merged

tannevaled merged 1 commit into
mainfrom
docs/running-heads

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

The third surface for the marks work. The README (engine#734) and the landing page (go-tex.github.io#221, merged and verified live) carry it; this is the one that can afford the mechanism.

Why it goes beside the hashdiff table

That table exists to say what the three fidelity numbers cannot see, and running heads are its clearest case:

renders that differ 6 of 154
movement in Σ|deviation| 0, at identical page counts
papers that gained a head they had been missing 27 of the 128 with a reference PDF

Zero movement is the honest figure, not a disappointing one: a head replaces blank space in a running header the page had already reserved. Only a per-page hash sees the change at all.

The mechanism is cited, not asserted

Every part of it is a decision a reader can check against the source it was ported from:

  • fire_up derives the three quantities a head is written from (tex.web:19718-19729, :19782-19789): \topmark is the previous page's \botmark, \firstmark is this page's first mark or else \topmark, and \botmark is this page's last mark and is not cleared on a page that carries none — which is precisely what makes a head persist across a chapter.
  • Above that, latex.ltx keeps the left/right pair in one token list, \@themark (ltpage.dtx:355), read back through \@firstoftwo/\@secondoftwo (:167-174, :341-342), and \@markright keeps the left half deliberately — which is why \markright inside a \section does not erase the chapter.

And the lesson, in a callout

It generalises well past this engine, so it is set off rather than buried: the change took four fixes, three of them correct and insufficient. A one-line substrate stub, \def\mark#1{}, accepted its argument and discarded it one layer below all three, so each correct fix above it changed nothing observable and therefore looked wrong. What found it was not a better fix but a different question — a test asking whether the node arrives, rather than whether the layer emitting it is right. Any stub that accepts input and drops it will outlive every repair made above it.

Checks

Built locally with the pinned theme submodule, and checked in the output rather than on a zero exit status — a build that succeeds while a shortcode survives as literal text is a passing build and a broken page:

  • hugo --minify clean, 14 pages;
  • the prose, the new table row and the callout's inner text are all present in public/packages/engine/index.html;
  • zero occurrences of a literal {{< in the rendered HTML.

I will check the published page after the Pages build rather than assuming the deploy implies it.

Refs go-tex/engine#426, go-tex/engine#729

🤖 Generated with Claude Code

… fixes

The marks work is the clearest case the page-count barometer cannot report,
so it belongs beside the hashdiff table that already explains why: 6 of 154
renders differ at IDENTICAL page counts, and 27 of the 128 corpus papers
with a reference PDF now get the head they had been missing, for zero
movement in the three numbers -- a head replaces blank space in a header
that was already reserved.

The mechanism is written down with the sources it was ported from rather
than asserted, because every part of it is a decision someone can check:
fire_up derives the three quantities a head is written from
(tex.web:19718-19729, :19782-19789) -- topmark is the previous page's
botmark, firstmark is this page's first mark or else topmark, and botmark is
this page's last mark and is NOT cleared on a page carrying none, which is
what makes a head persist across a chapter. Above that, latex.ltx keeps the
left/right pair in one token list, \@theMark (ltpage.dtx:355), read back
through \@firstoftwo/\@secondoftwo (:167-174, :341-342), and \@markright
keeps the left half on purpose -- which is why \markright in a \section does
not erase the chapter.

And the lesson, in a callout because it generalises past this engine: the
change took four fixes, three of them correct and insufficient, because a
one-line substrate stub -- \def\mark#1{} -- accepted its argument and
discarded it one layer BELOW all three. Each correct fix above it changed
nothing observable and so looked wrong. What found it was a different
question rather than a better fix: a test asking whether the node ARRIVES,
not whether the layer emitting it is right. Any stub that accepts input and
drops it will outlive every repair made above it.

Built locally with the pinned theme submodule and checked in the OUTPUT,
not just for a zero exit: the prose, the table row and the callout's inner
text are all present in public/packages/engine/index.html, and no literal
shortcode survived into the HTML.

Refs go-tex/engine#426, go-tex/engine#729

Co-Authored-By: Claude Opus 5 <[email protected]>
@tannevaled
tannevaled merged commit a0b927d into main Nov 8, 2026
2 checks passed
@tannevaled
tannevaled deleted the docs/running-heads branch November 8, 2026 12:20
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