Skip to content

class-geometry: exact standard-class + geometry page frame (KC-103) - #85

Merged
jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/class-geometry
Sep 13, 2026
Merged

jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/class-geometry

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

KC-103 (kabir-claude, mac-m5pro-kabir): document class + page geometry fidelity.

What

New standalone crate crates/class-geometry (zero deps). Nothing outside it is touched.

  • Classes: article/report/book in 10/11/12pt on a4/a5/b5/letter/legal/executive paper, with landscape, oneside/twoside, onecolumn/twocolumn, titlepage, openright/openany, fleqn/leqno and draft. Computed from size1x.clo/bk1x.clo using TeX integer arithmetic, with each constant cited by file and line.
  • geometry v6.0, ported macro by macro: every margin/body/include/ratio/scale/lines/heightrounded/bindingoffset/paper key, plus sequential \geometry{} calls.
  • PageFrame: odd/even text left edge, header/footer/first-line baselines, columns, marginpar side, and the PDF MediaBox.
  • Headings and page styles: \@startsection specs, \chapter/\chapter*/\part, secnumdepth/tocdepth, the empty/plain/headings/myheadings styles and their mark rules.
  • Preamble scanner: DocumentSetup::from_preamble.
  • CONTRACT.md: proposed render-pipeline integration. render-pipeline itself is not edited.

Oracle

oracle/generate.py runs pdflatex (TeX Live 2026, used as an oracle only) and writes tests/data/oracle.txt. cargo test never runs TeX.

96/96 fixtures pass. 2881/2881 lengths match exactly and 2112/2112 \pdfsavepos positions match exactly (worst error 0sp).

Positions are measured with \pdfsavepos because pdftotext is not installed, and it is exact rather than 0.01bp.

Findings

  • Without geometry, the PDF MediaBox is the engine default (letter), even with a4paper.
  • The class processes options in declaration order, not the order you write them.
  • geometry: when only top or left is given, the first ratio share goes to the bottom or right margin.

Excluded

These are on other branches: \maketitle/title layout (daniel-parent/maketitle, daniel-title/title-layout), page-control commands (daniel-parent/page-control), list spacing (daniel-parent-b/setlist-spacing).

Validation: cargo test, cargo clippy --all-targets (0 warnings), cargo fmt --check.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

Why: every glyph's position depends on the class/geometry page frame;
render-pipeline only models article + margin= in floating point.

Behavior:
- New standalone crate crates/class-geometry (zero deps). TeX integer
  arithmetic (round_decimals, xn_over_d, \divide, \@settopoint,
  print_scaled) so lengths match pdflatex to the scaled point.
- article/report/book x 10/11/12pt x a4/a5/b5/letter/legal/executive,
  landscape, oneside/twoside, onecolumn/twocolumn, titlepage, openright/
  openany, fleqn/leqno, draft (size1x.clo + bk1x.clo, cited by line).
- geometry v6.0 macro-by-macro: keys, \Gm@detall cases 0-7, adjustbody/
  adjustmp, includehead/foot/mp, ratios, scale, lines, heightrounded,
  bindingoffset, landscape/paper keys, sequential \geometry calls.
- PageFrame: odd/even text left, head/foot/first baselines, columns,
  marginpar side, PDF MediaBox (engine default letter without geometry).
- \@startsection specs, \chapter/\chapter*/\part, secnumdepth/tocdepth,
  page styles (empty/plain/headings/myheadings) and mark rules.
- DocumentSetup::from_preamble scanner; CONTRACT.md proposes the
  render-pipeline integration (render-pipeline not edited).
Oracle: oracle/generate.py (pdflatex 1.40.29, TeX Live 2026, oracle only)
-> tests/data/oracle.txt, 96 fixtures; cargo test: 96/96 fixtures,
2881/2881 lengths exact, 2112/2112 \pdfsavepos positions exact (0sp).
Validation: cargo test, cargo clippy --all-targets (0 warnings), cargo fmt.
Excluded (other branches): \maketitle/title layout, page-control
commands, list spacing.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-103, 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
@jay3332

jay3332 commented Sep 13, 2026

Copy link
Copy Markdown
Member

Merged to main via integration/2026-09-13c (Commander orchestrator-jaysen-claude); hermetic library, tests green.

@jay3332
jay3332 merged commit 4dd5fd1 into main Sep 13, 2026
14 of 18 checks passed
@GoKubar
GoKubar deleted the agent/kabir-claude/class-geometry branch September 13, 2026 18:12
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.

2 participants