Skip to content

class-geometry: model KOMA typearea DIV (#842 complete; supersedes #847) - #858

Merged
d-q222 merged 2 commits into
mainfrom
muse/koma-typearea2
Sep 18, 2026
Merged

d-q222 merged 2 commits into
mainfrom
muse/koma-typearea2

Conversation

@d-q222

@d-q222 d-q222 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Completes #842. This supersedes #847 (the paper-size half): it reimplements that area more fully and conflicts with it in four files, so landing one coherent change is cleaner than a conflicted merge. #847's regression controls are carried over and still pass. I'll close #847 as superseded when this lands.

What it does

  • crates/class-geometry: new ClassKind::{Scrartcl,Scrreprt,Scrbook} (+scrarticle alias); KOMA option parsing in given order (paper=, fontsize=, DIV=, BCOR=, include flags, pagesize=false, legacy DIV12/BCOR5mm, unused warnings for the rest); full typearea DIV computation — A4 table 8/10/12, explicit DIV, calc with CM good-widths, classic, BCOR, twoside, mpinclude, head/footinclude, too-short-page recompute; sp-exact paper sizes; PDF media follows the class paper unless pagesize=false.
  • crates/compiler: KOMA classes default to 11pt body and honour fontsize=. Standard classes unchanged.

The measurement, and why the acceptance bar is met by different evidence than specified

Same 40-paragraph filler, both engines, oracle pdflatex TeX Live 2026:

pdflatex FlashTeX
page-2 band 639.72 pt 645.50 pt (was 538.0; gap 87.6 → 5.78)
pages 10 10
page-1/2 word counts 638 / 636 638 / 636
line pitch 13.5491 13.5493
media 595.276 × 841.89 595.276 × 841.89

My acceptance criterion said "within 2 pt of the oracle band" and the raw bbox residual is 5.78 pt. The lane proved that residual is not geometry. Rasterising both at 200 dpi with pdftoppm, the true ink band is 637.56 pt in both, with identical first and last ink rows (243 / 2013). The 5.78 pt is poppler reporting line-boxes for FlashTeX's OTF subset versus tight boxes for pdflatex's Type 1 — a font-emission artifact in crates the lane is not allowed to touch.

I'm accepting that as proof: pagination, word distribution, line pitch, media and rendered ink all agree. Tightening OTF glyph boxes is a separate concern in crates/pdf/crates/font-*, and chasing the bbox number would have meant changing font emission to satisfy a measurement tool.

Regression controls (both from #847, both still green)

  • \documentclass[a4paper]{article} stays 612 × 792 letter — correct, because article's a4paper sets \paperwidth but not pdfTeX's page size. "Fixing" this to A4 would break exact parity.
  • \documentclass{article} band unchanged.

Tests

crates/class-geometry: 32 passed / 0 failed — 21 new KOMA tests asserting live-pdflatex \number lengths to the sp across 30 option combinations. crates/compiler --lib: 460 passed / 0 failed.

Scope honesty

Explicitly warned, not silently ignored: fontsize other than 10/11/12, DIV=areaset, exotic papers, headlines=/footlines=, parskip=*, and KOMA sans heading fonts. Each lands in unused or is documented.

The class-geometry work is live (render-pipeline uses path = "../class-geometry"), so it reaches users immediately. The compiler edit sits behind the frozen vendor/compiler snapshot and needs the pending re-pin — though end-to-end pagination already matches without it.

Implemented by a sandboxed Muse lane; reviewed and published by the Commander.

🤖 Generated with Claude Code

pdflatex (TeX Live 2026) divides the page into a DIV grid instead of the
standard classes' fixed text block; implement that computation to the
scaled point: the A4 default table (8/10/12), explicit DIV, DIV=calc
(good line width from CM alphabet widths), DIV=classic, BCOR, twoside,
mpinclude, headinclude/footinclude, the too-short-page DIV recompute,
and typearea's own paper sizes (letter is 612bp x 792bp). typearea also
sets the PDF media from the paper, unlike the standard classes.

Issue #842, part 2.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
KOMA's default size is 11pt (10.95pt body), not the 10pt the standard
classes assume; read fontsize= when the class is scrartcl/scrreprt/
scrbook so body metrics match the new typearea geometry.

Issue #842, part 2.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
@d-q222
d-q222 merged commit f189d33 into main Sep 18, 2026
22 checks passed
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