Repository navigation
the kernel's own marks read the page's, closing #727 - #732
Conversation
The behaviour is RIGHT and measured; six tests encode the old one, and converting them is not a thing to rush. Pushed so the work is not lost, not proposed. WHAT IT DOES, and it is #727's residual: \markboth / \markright emit the pair as a \mark beside writing \@theMark, as the kernel does (ltpage.dtx:239-244, 265-267) — the pair is for a class to read back, the mark is for the page builder; \leftmark / \rightmark read \botmark / \firstmark (ltpage.dtx:341-342) instead of the single live pair. MEASURED on three sections forced onto three pages, \pagestyle{headings}: page 2 head "2 DEUXIEME SECTION" page 3 head "3 TROISIEME SECTION" Each page carries ITS OWN section. With one live pair every page showed the document's last one, which is exactly what #727 reports. Our \ps@headings redefines \sectionmark as a \markright, so with one pair the final section won everywhere. ⛔ WHY IT IS HELD. Six tests fail, all of them probing \leftmark / \rightmark at DOCUMENT time: TestClassKernelDeclarations/marks TestOnlyNumberedSectionsMark TestPagestyleHeadingsDeclaresAHead TestRunningMarks TestAClassThatBringsItsOwnMarkbothReachesTheHead TestMarkrightKeepsTheLeftHalf They are not wrong about the engine; they are wrong about TeX. The values belong to a page, so outside a page there are none — a real LaTeX answers empty there too, and latex.ltx has carried a note about this since 1993: "Stopgap solution to make \leftmark and \rightmark work without initializing mark until the problem is solved" (ltpage.dtx:318-323), with an upstream \task still open on it. And in THIS engine the page builder runs after the whole document is read, so document time can never see a page's marks at all. So the six have to be rewritten against the DRAWN HEAD rather than against an expansion — the same move as #728's test, which stopped probing \gotex@rightmark (the storage) and started probing \rightmark (what a page style reads). Doing that properly needs a helper for reading a rendered page's text, and six careful conversions. Rushing them is how a suite ends up asserting the implementation instead of the behaviour. Nothing is measured on the corpus either: the machine's 1-minute load was 20.05 against a ceiling of ~8. Depends on #729 (the mark primitives); this branch sits on top of it. Co-Authored-By: Claude Opus 5 <[email protected]>
…held They probed \leftmark/\rightmark at DOCUMENT time, where those now expand \botmark/\firstmark -- values that belong to a page, published by the page builder, which runs after the whole document has been read. A real LaTeX answers empty there too; latex.ltx has carried a note about it since 1993 (ltpage.dtx:318-323, upstream \task still open). So the tests were not wrong about the engine, they were wrong about TeX. The split they become: SEMANTICS at document time through \@theMark, the kernel's own name for the live pair (ltpage.dtx:355) -- a documented variable classes write and read, amsart among them -- and REACHABILITY through the head actually drawn, read with pageText(). TestClassKernelDeclarations/marks, TestMarkrightKeepsTheLeftHalf and TestRunningMarks take the first; TestPagestyleHeadingsDeclaresAHead, TestOnlyNumberedSectionsMark and TestAClassThatBringsItsOwnMarkbothReachesTheHead take the second. ⛔ Two things the conversion exposed. The class-own-markboth fixture copied only the \@theMark half of amsart's idiom and left out \mark{\the\@temptokena}: enough while \rightmark read the pair directly, and not a class at all once the pair travels -- a fixture missing the line that makes the mechanism work was testing it not working. And the needles carry no spaces, because pageText collects glyphs and not the glue between them. The obsolete comment in classkernel_test.go went with it: it stated the divergence as permanent ("which this page builder does not do yet").
Corpus, control =
|
| paper | before | after | ref | deviation |
|---|---|---|---|---|
2402.04711 |
194 | 195 | 198 | −4 → −3, closer |
2405.05734 |
16 | 17 | 16 | +0 → +1, exact lost |
⛔ 2405.05734's ink is identical on both sides — 49141 → 49141 — with one more page. Same content, one more page, which is the signature of a changed breakpoint and not of changed material. And that is expected here rather than a surprise: \markboth/\markright now emit \mark nodes, and a mark permits a break after it (precedes_break(#) == (type(#) < math_node), mark is type 4 < 9 — the rule #729 made this engine obey). Emitting marks therefore adds legal breakpoints, and the page builder is free to use one.
So the engine is more faithful and one paper's exact match was collateral. Σ says the trade is even (those two alone: 4 → 4) and the bias says it is slightly favourable.
One figure worth naming because its direction is the opposite of the headline
2405.10478: 22 pages unchanged, ink 65786 → 65588, a drop of 198. Every other mover gains ink (2407.18384: 516945 → 523615 on a 315-page document). A head gaining text can only add ink, so a drop means the head's text got shorter — consistent with per-page marks replacing "the document's last section", which is what main showed on every page, with the section the page is actually in. That is the intended effect and the drop is evidence of it working.
⚠ I have not rendered that paper to read its head, so the explanation above is inference from the ink and the mechanism, not a measurement. What would settle it is reading page 2's head text on both binaries, as was done for 2111.13456 on #729.
⛔⛔ Correction: that ink drop is a REGRESSION, and this branch must not mergeI wrote, one comment up, that Page 3's running head, same file, two binaries: The head went from So the honest reading of the whole set changes with it: of the 18 papers whose render differs, I have verified one by eye and it is wrong. The other 17 are now unknown rather than good, including the ones whose ink rose — a head can gain ink by being wrong as easily as by being right. #732 is not mergeable and I am not asking for it. Three things it needs:
⛔ And the method lesson, since it is the second time in two days: I had the measurement that contradicted me (an ink figure moving the wrong way, alone among eighteen), named it as worth explaining, and then explained it instead of looking. The flag I attached — "inference from the ink and the mechanism, not a measurement" — was correct and should have been a blocker, not a caveat. |
⛔ Correcting the correction: it is not a regression. The branch is right and
|
| page 3's head | ||
|---|---|---|
main |
References |
the document's last mark, leaking onto a page that is not the bibliography |
| this branch | . in white |
the short title the class puts there, which the author made invisible |
And the white is honoured: page 3 carries two white fills, and the . I read came out of the fill-opacity="0" searchable text layer, not from visible ink. On screen that head is blank, which is what the reference shows and what the document asked for.
So the ink falling 65786 → 65588 is the intended effect after all: a wrong word removed, a deliberately invisible character in its place. My first reading of it was right, my "regression" was wrong, and what settled it was neither inference nor the look of the glyph but the paper's own source line.
What this leaves standing, and what it does not
- Still true: of the 18 papers whose render differs, I have now verified one. The other 17 are unverified, and a head can gain ink by being wrong as easily as by being right. That is work, not an assumption to make either way.
- Still true:
2405.05734goes 16 → 17 pages with identical ink, because emitting\marknodes adds legal breakpoints (precedes_break, mark is type 4 < 9). One exact match lost, one paper closer, Σ flat, bias −12 → −10. - No longer true: that this branch mangles a head.
⛔ The method lesson is the one worth keeping, and it is sharper than "measure, don't infer": I inferred, then I looked at the pixels and still got it wrong, because a single period in a running head looks exactly like a broken mark. What distinguished them was two more facts — the source line and the fill colour. Looking is not one act; "read the pixels" is only sufficient when you also know what the document asked for.
|
Held, and now with the reason measured rather than asserted. I said I would read the changed renders instead of inferring them; here is what they say. The sweep
Two moved by a page, and with the reference as
⛔ Σ on those two alone: 4 → 4. A net movement of zero that hides a document leaving exactness. The aggregate would have reported this change as costless. What 2405.05734 is\documentclass[lettersize,journal]{IEEEtran}
...
\markboth{Journal of \LaTeX\ Class Files,~Vol.~18, No.~9, September~2020}%
{How to Use the IEEEtran \LaTeX{} Templates}
\maketitleUnmodified IEEEtran template boilerplate, and the With this change that call emits a So the hypothesis is that this page is the correct consequence of a mark finally existing, and that it reveals a separate error it used to mask. That is a hypothesis, not a finding, and it is precisely the shape that has been wrong before here: a change that is right in mechanism and still costs a document its exactness needs the page itself read, not the mechanism re-argued. Also unresolved: four documents LOSE ink at identical page counts
Only the first is explained: 2405.10478's own Against that, eleven documents gain ink at unchanged pagination — 2407.18384 by 6670 and 2209.13768 by 570 — which is the expected shape of heads appearing where there were none. What it would take to merge
Until both are done this stays shut, because the figure that would normally justify it — Σ — is exactly the figure that cannot see what this change did. 🤖 Generated with Claude Code |
The corpus sweep this pull request owed, and it costs Σ 2
Here they are. Two papers gain a page, both already over the reference, and none moves toward it. Exact pagination does not move. What the description predicted, and how this differsThe body says the change should be invisible to Σ:
and names the mechanism by which a mark can change a page count, as a thing already handled:
Two papers here do exactly that — 201→202 and 17→18, each one page. Either the preamble case is not fully handled, or a second route contributes a mark to a page that is not open yet. I have not established which, and the two named papers are where to look. ⚠ What this measurement is and is not
And a correction to what I said about this pull requestI reported it for two days as "green and parked, blocked on a quiet machine". The machine was part of it, but two other things I said were blocking were not: the corpus was on this disk all along, and the curated list and its reference page counts were in a different directory than I had looked in. Once resolved, the sweep took four minutes. It is still a real result that the change costs 2. The decision — whether a correct running head is worth two pages on two papers, or whether those two papers are a second defect to fix first — is not mine to take alone, and the first measurement of it is above. 🤖 Generated with Claude Code |
Closes #727. Refs #426 — this reaches the rest of its papers, but that issue stays open until the 18 changed renders are each read rather than inferred (see the comments below).
Our own
\markboth/\markrightemit the pair as a\mark, and\leftmark/\rightmarkread the marks of the page being shipped instead of the single live pair.ltpage.dtx:239-244and:265-267for emitting the mark beside writing the pair — the pair is for a class to read back, the mark is for the page builder — and:341-342for the accessors. It sits on #729, which made\marktravel.Measured:
mainputs a section from the FUTURE in the headThree sections forced onto three pages,
\pagestyle{headings}, same file, two binaries. Page 2's head:main3 TROISIEME SECTION2 DEUXIEME SECTIONmainshows the document's last section on every page — so a reader on page 2 is told they are in section 3, which has not started yet, beside the folio 2. Our\ps@headingsredefines\sectionmarkas a\markright, and with one live pair the final section wins everywhere.The six tests this was held for
They probed
\leftmark/\rightmarkat document time, which now expands\botmark/\firstmark— values that belong to a page, published by the page builder, which runs after the whole document has been read. A real LaTeX answers empty there too, andlatex.ltxhas carried a note about that since 1993 (ltpage.dtx:318-323, with an upstream\taskstill open). The tests were not wrong about the engine; they were wrong about TeX.They become a deliberate split:
\@themarkpageText()TestClassKernelDeclarations/marksTestPagestyleHeadingsDeclaresAHeadTestMarkrightKeepsTheLeftHalfTestOnlyNumberedSectionsMarkTestRunningMarksTestAClassThatBringsItsOwnMarkbothReachesTheHead\@themarkis the kernel's own name for the live pair (ltpage.dtx:355) — a documented variable classes write and read, amsart among them — so the left column asserts an interface and not an internal. What it cannot show is reachability, which is exactly what the right column is for. That distinction is the whole lesson of #728: a test that names the storage cannot tell a mark that was set from a mark that is reached.⛔ Two things the conversion exposed
My own fixture was not a class.
TestAClassThatBringsItsOwnMarkbothReachesTheHeadcopied the\@themarkhalf of amsart's idiom and left out\mark{\the\@temptokena}. That was enough while\rightmarkread the pair directly, and it is not a class at all once the pair travels — a fixture missing the line that makes the mechanism work was testing the mechanism not working. It now emits the mark, as amsart does.An obsolete comment went with it.
classkernel_test.gostated the divergence as permanent: "the difference needs marks to travel with page breaking, which this page builder does not do yet". It does now.Checks
go test ./...green across the repository,go vetclean,gofmt -l .silent.mainrunning; its numbers come here before merge.hashdiffis the channel to read it on — a head's text changing moves ink, not page counts.🤖 Generated with Claude Code