Skip to content

render-pipeline: twoside, twocolumn, page styles and marks (class-geometry steps 4-5) - #102

Closed
GoKubar wants to merge 1 commit into
agent/kabir-claude/render-pipeline-class-geometryfrom
agent/kabir-claude/render-pipeline-class-geometry-2
Closed

GoKubar wants to merge 1 commit into
agent/kabir-claude/render-pipeline-class-geometryfrom
agent/kabir-claude/render-pipeline-class-geometry-2

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Stacked on #99 (agent/kabir-claude/render-pipeline-class-geometry @ 29aad13). This adopts class-geometry CONTRACT steps 4–5 in crates/render-pipeline. The page frame from class-geometry already carried every value needed.

What changes in the layout

  • Left edge per page. Even pages of two-sided documents use \evensidemargin. Blocks are still assembled at \oddsidemargin; each placed line gets an x offset (Laid::line_dx), applied in assemble. One-sided pages have offset 0.
  • Two columns. The page builder fills columns of \textheight, and each pair becomes one page. The second column sits \columnwidth + \columnsep to the right. Columns are not balanced, as in LaTeX.
    • \columnseprule (the class value or a preamble \setlength) is drawn centred in the gap, full column height, on every page.
    • Two-column documents use \parindent 1em and \sloppy.
  • \flushbottom applies to two-sided and two-column documents, as the standard classes do. A page that ends at an ordinary break has its glue stretched or shrunk to \textheight. Pages ended by \newpage/\clearpage, and the last page, keep natural glue.
  • Headers and footers.
    • Page styles plain, empty, headings and myheadings come from class-geometry's StyleMacros. The preamble \pagestyle sets them; a body \pagestyle changes them from the page it ships on; \thispagestyle affects one page.
    • Each line is laid out as L\hfil C\hfil R across \textwidth, at the header or footer baseline.
    • Page numbers are upright. Running heads are slanted \slshape, using a new Role::Slanted font role (lmromanslant* with ec-lmro* metrics).
  • Marks.
    • Sections and chapters issue marks as each class's \ps@headings defines them. A chapter mark reads "CHAPTER 1.", then a space at space factor 3000, then a control space.
    • \markboth and \markright in the body set marks, and their argument text is removed from the body.
    • \leftmark is the last mark on the page. \rightmark is the first mark on the page, or the previous page's last mark if the page has none.
  • \chapter in report and book.
    • Page break, then \thispagestyle{plain}.
    • \vspace*{50pt}, then "Chapter n" in \huge bold, 20pt of space, the title in \Huge bold, and 40pt of space.
    • The first paragraph after it is not indented.
    • Sections are numbered chapter.section.
  • \noindent now works. The compiler treats it as a no-op, so the adapter reads it from the source bytes; it applies when it comes directly before a paragraph.
  • Body-only input and non-standard classes keep \pagestyle{empty}.

Gates

  • HW1/HW2 byte-identical. Base (29aad13) and new binaries were run from the same path and working directory. Display-list JSON and PDF are identical for both:
  • Tests. cargo test --release: 99 passed, 0 failed, 1 ignored (render-pipeline: page frame from class-geometry (CONTRACT steps 1-3) #99's 98 plus the new page_frame). tests/latex_structure.rs's secnumdepth case now sets \pagestyle{empty}, because the plain footer prints "1".
  • Oracle. tests/page_frame.rs checks 22 fixtures in fixtures/page-frame/. Expected positions are read from pdflatex's own content streams by tools/page-frame-oracle/generate.py (MacTeX 2026, pdfTeX 1.40.29, T1 with lmodern); pdftotext's xMin was cross-checked and agrees. Cargo tests never run TeX. Tolerance is 0.1pt everywhere.
feature fixtures result
page numbers and running heads (text, x, baseline) all 22 90/90 words
\columnseprule 09 3/3 rules
body left edge per page and per column all 22 60/60
two-column line starts (x and baseline) 08, 09, 10, 19 748/748
all line starts (x and baseline) all 22 2111/2111 matched out of 2120; 9 unmatched because the line breaks differ (14: 3, 16: 4, 17: 2)
chapter openers (plain footer, title, body) 11, 12, 13, 21 all chrome and lines pass
\noindent 14 28/28 matched line starts

Before this PR every chrome check was 0, two-column output ran to 5 pages instead of 3, and even-page edges were off.

Correction: the commit message of aaeb444 gives three totals wrong: chrome 83, left edges 63, line starts 1970. The table above has the correct figures, summed from the per-fixture output of cargo test --release --test page_frame -- --nocapture. I did not amend, to avoid a force-push.

Not implemented (documented in the README)

  • The blank page \cleardoublepage adds before an openright chapter that would start on an even page.
  • \pagenumbering: numbering is always arabic from 1.
  • \maketitle's \thispagestyle{plain}.
  • \chapter in two-column documents (\@topnewpage).
  • Floats and footnotes.
  • Page-style commands inside \input files.
  • Macros inside mark or chapter titles: their source text is used as is.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

…steps 4-5)

Per-page left edges (even pages at \evensidemargin) via Laid::line_dx;
two-column pages from pairs of \textheight columns with \columnseprule;
\flushbottom glue set for two-sided/two-column documents and \sloppy in
two columns; header/footer lines from class-geometry StyleMacros (plain,
empty, headings, myheadings; body \pagestyle and \thispagestyle) with
\slshape running heads (Role::Slanted, ec-lmro metrics) and
\sectionmark/\chaptermark/\markboth/\markright marks; report/book
\chapter openers (\thispagestyle{plain}, \@makechapterhead, chapter.section
numbers); \noindent read from the source. Body-only input keeps
\pagestyle{empty}.

Oracle: tests/page_frame.rs, 22 pdflatex fixtures (positions read from
the PDF content streams by tools/page-frame-oracle/generate.py): chrome
83/83, rules 3/3, left edges 63/63, matched line starts 1970/1970 within
0.1pt. HW1/HW2 display lists and PDFs byte-identical.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude class-geometry steps 4-5, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar

GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on main fe864d9 as #105 (branch agent/kabir-claude/render-pipeline-class-geometry-2r, 6c858cd). The head branch of this PR can't be retargeted, so #105 supersedes it. That PR lists the conflict resolution with graphics-floats and the tests: page_frame 22/22, HW1/HW2 byte-identical.

@GoKubar
GoKubar deleted the branch agent/kabir-claude/render-pipeline-class-geometry September 13, 2026 18:12
@GoKubar GoKubar closed this Sep 13, 2026
@GoKubar
GoKubar deleted the agent/kabir-claude/render-pipeline-class-geometry-2 branch September 13, 2026 18:51
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