Set pages with TeX glue orders

This commit is contained in:
gloamxun committed 2026-10-23 04:18:14 +08:00
1 parent 00c23a3511
commit 52e3e0647c
5 files changed
+172 -25

No files matched your search

+5 -4
View File
@@ -48,7 +48,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
`\bottomnumber`, `\totalnumber`), insertion classes (`\skip`, fraction and
absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the
route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
PDF opt-in with `?engine=route-d`). 380 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`). 383 workspace tests are green and no oracle
fixture is ignored.
Known gaps, in dependency order:
@@ -236,7 +236,8 @@ demerit fixtures stay open until that trade-off is understood.
Scope:
- glue setting in vertical lists (ragged/flush bottom), `\vsize`, `\voffset`,
- glue setting in vertical lists (ragged/flush bottom, `\vfil`/`\vfill`
orders), `\vsize`, `\voffset`,
`\topskip`, `\maxdepth`, `\splittopskip`, `\splitmaxdepth`;
- TeX page builder: candidate breakpoints, cost = badness + penalty, page goal
recomputation as insertions arrive, `\pagegoal`, `\pagetotal`, `\pagedepth`,
@@ -264,7 +265,7 @@ badness from the page goal and accumulated glue, adding the break penalty, and
applying `\topskip` to the first box and `\maxdepth` to the page depth. Seven
unit tests cover overfull avoidance, exact glue filling, forced penalties,
penalty-driven earlier breaks, `\topskip`, `\maxdepth`, marks, insertion
limits, float placement and vertical glue setting.
limits, float placement, vertical glue setting and glue orders.
`Engine::layout_paged` now feeds it every document whose units are single
vertical items (`Document::max_depth` supplies `\maxdepth`) and materialises the
chosen fragments as hashed pages; ties go to the breakpoint closest to the page
@@ -279,7 +280,7 @@ the source. Insertion classes are placed by the
paged builder with their limits and held-over material, top floats are placed
at the head of a fragment with `\textfloatsep` reserved above the body, and
bottom floats sit at the page bottom with `\floatsep` between them and a
`\bottomfraction` cap; in-text floats flow inline with their `\intextsep` gaps counted as body height. Vertical glue is set when pages are materialised: `PageBuilder::ragged_bottom` defaults to `\raggedbottom`, while `\flushbottom` stretches `VerticalItem::StretchGlue` proportionally so the page body reaches the goal (`PageFragment::set` records the signed setting amount). Paged layouts also record the
`\bottomfraction` cap; in-text floats flow inline with their `\intextsep` gaps counted as body height. Vertical glue is set when pages are materialised: `PageBuilder::ragged_bottom` defaults to `\raggedbottom`, while `\flushbottom` stretches `VerticalItem::StretchGlue` proportionally so the page body reaches the goal (`PageFragment::set` records the signed setting amount); glue orders follow TeX, so only the highest order with stretch (for example `\vfil`) takes the setting and short pages are free. Paged layouts also record the
node index starting each page, so `Engine::edit` reuses the sealed prefix and
rebuilds only the pages from the edited unit onward; insertions and interpreted
`\output` keep the full-rebuild fallback. Next: extend the `\output`