Honour club and widow penalties on paragraph lines

Route-D expanded a paragraph into one node per line without TeX's
\clubpenalty/\widowpenalty, so a page break could orphan the first line or
widow the last. Insert the penalties between line nodes (150 by default, read
from the source registers) and make the page builder reject any penalty of
10000 or more as a breakpoint. Forced -10000 values now break exactly where
pdfLaTeX does; two page oracle fixtures compare per-page text, and unit tests
cover the node order and the forbidden breakpoint.
This commit is contained in:
gloamxun committed 2026-10-26 22:14:01 +08:00
1 parent 1bb28cf141
commit 8ac2e828df
6 files changed
+210 -4

No files matched your search

+6 -1
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`). 958 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`). 963 workspace tests are green and no oracle
fixture is ignored. Preview JSON also carries a `warnings` array naming
environments route-D cannot lay out and control words that survived layout, so
unsupported source is reported instead of being silently typeset.
@@ -304,6 +304,11 @@ and `[b]` floats that fit or defer to the next page); each
asserts the same page count and the same per-page body text as pdfLaTeX, with
footnote text excluded from the body comparison. Route-D's source mapping still
does not raise LaTeX floats, so the float fixture drives `Engine` directly.
Two more fixtures pin TeX's orphan and widow controls: `\clubpenalty=-10000`
forces a break after a paragraph's first line and `\widowpenalty=-10000` forces
one before its last, page for page against pdfLaTeX. The paged builder inserts
both penalties between line nodes (150 by default) and refuses any penalty of
10000 or more as a breakpoint.
### P3 — `\halign` / `\valign` (L2)