Set pages with TeX glue orders
This commit is contained in:
1 parent
00c23a3511
commit
52e3e0647c
5 files changed
+172
-25
No files matched your search
@@ -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`
|
||||
|
||||
+5
-3
@@ -116,7 +116,7 @@ and justification.
|
||||
| --- | --- | --- |
|
||||
| M0 | vertical list, page builder, checkpoint, page hash, edit demo | edit on page 2 rebuilds only page 2 |
|
||||
| M1 | TeX box/glue/penalty + paragraph builder (`\par`, `\hsize`, `\parindent`) | **partial**: item stream, CMR10 metrics, TeX Live en-US hyphenation, TeX demerits and tolerance passes, `\hangindent`/`\parshape`, `\parfillskip`, sentence spacing, `\spaceskip`/`\xspaceskip`, `\raggedright` (infinite `\rightskip`), `\looseness`, `\baselineskip`/`\lineskip`/`\parskip` interline glue, pdfLaTeX oracle matrix 90-240pt plus register, geometry, `\sfcode` and vertical-glue fixtures; generic fil glue and `\prevgraf` next |
|
||||
| M2 | page builder + `\output`, `\vsize`, `\topskip`, footnotes, floats | **partial**: `\vsize` page goal, `\topskip`, forced penalties, `Insertion` reserve, running `Mark`s, `OutputRoutine` hook, top/bottom `Float` placement; `page::PageBuilder` scores candidate breakpoints with TeX page badness, glue setting (with `\raggedbottom`/`\flushbottom` vertical glue setting applied when pages are materialised), `\topskip`/`\maxdepth`, and `Engine::layout_paged` uses it for documents whose units are single vertical items, placing top and bottom floats (with `\floatsep` and a `\bottomfraction` cap) and insertion classes on that path, while in-text floats flow inline as body material; paged layouts replay edits from the edited unit's page and fall back to a full rebuild only when insertions or an interpreted `\output` are present; `\output` is interpreted for a `\shipout`/`\ifdim`/`\ifnum`/`\ifodd`/`\ifcase` subset; `\pageno`, `\outputpenalty` and `\deadcycles` are readable registers and `PageFragment::penalty` carries the break penalty |
|
||||
| M2 | page builder + `\output`, `\vsize`, `\topskip`, footnotes, floats | **partial**: `\vsize` page goal, `\topskip`, forced penalties, `Insertion` reserve, running `Mark`s, `OutputRoutine` hook, top/bottom `Float` placement; `page::PageBuilder` scores candidate breakpoints with TeX page badness, glue setting (with `\raggedbottom`/`\flushbottom` applied when pages are materialised, and TeX glue orders `\vfil`/`\vfill`/`\vfilll` honoured so only the highest order with stretch is used), `\topskip`/`\maxdepth`, and `Engine::layout_paged` uses it for documents whose units are single vertical items, placing top and bottom floats (with `\floatsep` and a `\bottomfraction` cap) and insertion classes on that path, while in-text floats flow inline as body material; paged layouts replay edits from the edited unit's page and fall back to a full rebuild only when insertions or an interpreted `\output` are present; `\output` is interpreted for a `\shipout`/`\ifdim`/`\ifnum`/`\ifodd`/`\ifcase` subset; `\pageno`, `\outputpenalty` and `\deadcycles` are readable registers and `PageFragment::penalty` carries the break penalty |
|
||||
| M3 | `\halign`, `\omit`, `\span`, `\multispan`, booktabs/longtable | **partial**: source parsing, natural column widths, spans, rule rows, 10pt display-list painting and row-level page splitting; no booktabs/longtable parity yet |
|
||||
| M4 | math lists, scripts, fractions, radicals, accents, delimiters | **partial**: token parser, atom boxes with CMR10 metrics, delimiter scaling, accents and a display-list painter; no CMEX size variants or TeX math spacing classes yet |
|
||||
| M5 | NFSS/TFM metrics, CM/Latin Modern | same line/page breaks as reference |
|
||||
@@ -342,7 +342,7 @@ Math coverage includes fractions/roots, scripts, `\left...\right` with body-scal
|
||||
|
||||
Paragraph units carry a `ParagraphFont`; `Unit::paragraph_with_face` and `Unit::paragraph_with_style_and_face` select Roman, bold, italic, mono, or sans. The corresponding Computer Modern TFM (`cmr10`, `cmbx10`, `cmti10`, `cmbxti10`, `cmtt10`, `cmss10`) supplies advances, kerns, ligatures, and italic correction for layout, while the display list and PDF select the matching Liberation face. `Engine::edit` preserves the face when reflowing an edited paragraph.
|
||||
|
||||
The crate currently has 256 unit tests plus seven route-D integration tests and seventeen oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 380 tests (256 route-D unit, 7 route-D integration, 17 oracle, 71 v1 integration, 22 server, 4 v1 unit, 1 core unit, 2 binary units), with none ignored. v1 remains the live server path.
|
||||
The crate currently has 259 unit tests plus seven route-D integration tests and seventeen oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 383 tests (259 route-D unit, 7 route-D integration, 17 oracle, 71 v1 integration, 22 server, 4 v1 unit, 1 core unit, 2 binary units), with none ignored. v1 remains the live server path.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
@@ -382,7 +382,9 @@ deliberately open rather than approximated:
|
||||
for simple documents; `PageBuilder::ragged_bottom` selects `\raggedbottom`
|
||||
(the default) or `\flushbottom`, which stretches `VerticalItem::StretchGlue`
|
||||
in proportion to its stretch so the page body reaches the goal (only shrink
|
||||
is clamped, as in TeX); paged edits replay from the edited page, insertions
|
||||
is clamped, as in TeX); glue of the highest TeX order with stretch (`\vfil`
|
||||
and above) absorbs the whole setting, so a page that stops short of the goal
|
||||
is free when fill glue is present; paged edits replay from the edited page, insertions
|
||||
and an interpreted `\output` keep the full-rebuild fallback; paper margins
|
||||
remain open, and
|
||||
the `\output` interpreter only covers the shipout/ifdim/ifnum/ifodd/ifcase subset (explicit
|
||||
|
||||
Reference in new issue
Block a user