12 KiB
Native paragraph state and construction — 2026-10-31
2026-11-03: W3-S2 now extracts original mark nodes from actual packed paragraph lines into their vertical positions before interline penalties. Marks from unboxed lists migrate; packed child boxes retain their own marks. Live split parameters consume these raw line/mark lists through real vsplit. Workspace1330/0; true page/output/shipout and format boot remain unfinished. Older counts and limits below are historical.
Subsequent box/list diagnostic acceptance (2026-11-01): native inspection consumes actual showboxbreadth/showboxdepth and original nodes/settings in real log/terminal output. Full workspace: 1200 passed / 0 failed; 152 exact recursive lists, 24 paragraph lists, 24 byte-printer cases, 17 CLI tests and five-show/ 19-word PDF gate pass. Unchanged LaTeX stops at errorcontextlines (526:1), full startup false. Compound math/glue inspection and full interaction remain open. Earlier counts/boundaries below are historical; no font/template fidelity claim.
Subsequent delimiter acceptance (2026-11-01): native delimiter fields and construction now consumes real delcodes, left/right fields, factor/shortfall and actual TFM variants/extensible recipes. Full workspace: 1195 passed / 0 failed; 452 exact DVI cases, code/group readbacks, a 61-word PDF and full-delimiter ink gate pass. Generic odd-sp fraction/reboxing rounding is corrected. Unchanged LaTeX stops at showboxbreadth (524:1), full startup false. Earlier counts, boundaries and unimplemented-left/right/delimiter notes below are historical.
Subsequent font-state/accent acceptance (2026-11-01): native font integers and accents now consumes real first-load defaultskewchar and globally mutable skewchar/ hyphenchar in actual mathaccent/discretionary/hyphenation construction. Full workspace: 1191 passed / 0 failed, 438 accent DVI geometry and 28 mutable-hyphen timing cases, a 54-word PDF and full-accent ink gate. Unchanged LaTeX stops at delimiterfactor (523:1), with full format boot still false. Earlier boundaries, counts and unimplemented-accent/font-integer notes below are historical.
Subsequent font-slot acceptance (2026-11-01): native font diagnostics now consumes tracinglostchars/tracingonline using actual TFM/Type1 slots, with real font predicates, log/terminal delivery and fatal PDF protection. Full workspace: 1187 passed / 0 failed; prior slice gates remain green. Unchanged LaTeX now stops at defaultskewchar (522:1), so earlier boundaries/counts on this page are historical. Full format startup remains false.
Current follow-up (2026-11-01): native display math is accepted: 1182 workspace tests, 58 vlist / 36 page / 24 quantity-mode-pack cases and a three-page PDF gate. Unchanged LaTeX now stops at tracinglostchars (508:1). Earlier counts/boundaries below describe their original slices.
Current follow-up (2026-11-01): native interline penalties are accepted: 1176 workspace tests, 100 vlist and 64 actual page-ownership cases; unchanged LaTeX now stops at displaywidowpenalty (502:1). Earlier acceptance counts/boundaries below describe their original slices, not current startup.
Current follow-up (2026-11-01): native inline math is accepted: 1171 workspace tests; unchanged LaTeX now stops at clubpenalty (500:1). This document retains its original slice's evidence and limits; current math/family coverage is defined by the linked follow-up.
Earlier subsequent update: native boxes/vpack is now accepted, with 1164 workspace tests and the format boundary at binoppenalty (498:1). This page retains the paragraph-slice evidence and its original 1159-test baseline.
The strict Route-D token executor builds and breaks paragraphs itself. Parameters have real layout consumers; execution does not concatenate source strings or call the transitional frontend, v1, or a TeX subprocess. Real pdfTeX is used only by independent tests and audit scripts.
State and timing
Owned meanings in execution/parameters.rs include 28 typed parameters:
- Integers: pretolerance, tolerance, hbadness, linepenalty, hyphenpenalty, exhyphenpenalty, doublehyphendemerits, finalhyphendemerits, adjdemerits, looseness, hangafter, lefthyphenmin, righthyphenmin, uchyph, defaulthyphenchar.
- Dimensions: hsize, parindent, hangindent, emergencystretch, lineskiplimit.
- Glue: leftskip, rightskip, parfillskip, spaceskip, xspaceskip, parskip, baselineskip, lineskip.
They use the native scoped save stack, global/globaldefs rules, typed quantity scanning, the/number, arithmetic, dependencies and serialized state. INITEX uses actual TeX defaults: tolerance 10000, hangafter 1, other integer parameters zero, dimensions/glue zero, and nullfont. Default non-INITEX native mode remains an explicitly configured text bootstrap: CMR10 10pt, hsize 468pt, baselineskip 12pt and parfillskip 1fil. It is not a loaded plain or LaTeX format.
| Stage | State consumed |
|---|---|
| Font load | Actual embedded CMR10 resource and defaulthyphenchar; repeated identical loads reuse the resource |
| Paragraph start | parindent, parskip, left/right hyphen minima; indent/noindent and real horizontal mode |
| Character/space execution | Exact TFM glyph/ligature/kern metrics, current font, spaceskip/xspaceskip and spacefactor |
| Paragraph end | hsize, hanging shape, break thresholds/penalties/demerits, left/right/final glue, exceptions |
| Append measured lines | Previous depth, baselineskip, lineskiplimit/lineskip and captured parskip |
| Export | Fixed measured lines, with one TeX-sp to display-bp conversion (800/803) |
A paragraph retains its own parameter snapshot, original node/source spans and measured lines. A later assignment or group restoration cannot reflow it. Spaces retain the glue computed when the spacer executes. Looseness/hanging parameters reset locally after par, including par in vertical mode, independently of globaldefs. Mode conditionals inspect the actual current builder. Unexpandable commands and groups terminate ligature/kern joining; ordinary macro expansion retains token-based joining.
Native construction and breaking
execution/paragraph.rs owns glyph, indent, normal/explicit kern, glue, penalty and discretionary nodes. The breaker uses integer TeX badness, finite shrink, infinite stretch orders, fitness classes, demerits, equivalent line-number classes, TeX tie ordering, looseness and hanging indentation. Pretolerance runs without automatic hyphens; a second pass inserts real declared exceptions; emergency stretch and final-pass artificial demerits permit the corresponding last-resort overfull lines. There is no greedy or old-parser fallback.
ASCII language-0 hyphenation exceptions execute through hyphenation. No English patterns are silently supplied. The first paragraph word is not automatically hyphenated, matching TeX. Explicit discretionary and literal font-hyphen breaks use their respective penalties. Required splitting inside an existing ligature fails explicitly until discretionary reconstruction is implemented.
Packed rows contain fixed glue and exact glyph height/depth. After the box slice, VerticalMaterial stores actual appended root lists and Execution.document exports those batches. BuiltParagraph/Character records remain traces, rather than being restyled from final State. The shared page/display/PDF path does not run text parsing or paragraph reflow. hbadness controls actual underfull-line diagnostics; overfull boxes remain diagnosed independently of that threshold.
Font and product boundaries
The native font command currently accepts only the real bundled cmr10 resource at its 10pt design size (at 10pt or scaled 1000). Current font selection has scoped restoration. Missing resources/sizes and missing text glyphs fail; nullfont cannot silently paint CMR10. Common ff/fi/fl/ffi/ffl ligatures use exact TFM slot metrics. Unsupported OT1 punctuation ligature sequences error.
This is not a complete font subsystem: arbitrary font IDs/resources/sizes, fontdimen, hyphenchar mutation, full OT1/T1 encoding and ligature programs, TFM/VF/map lookup, NFSS and XeTeX/OpenType shaping remain open. Other open work includes patterns/languages/code tables, general discretionary replacement, parshape, everypar, native math modes and display execution. Native box/ restricted-horizontal/internal-vertical modes are implemented in the later box slice. Unsupported primitives are not registered as inert parameters.
The export canvas is still explicit host policy (612 x 792bp, 72bp origin, 648bp page goal, 10bp top skip), not native page-parameter or output-routine execution. Native vertical kern/penalty and boxes are implemented in the later box slice. Deferred I/O still requires native box/shipout integration; the CLI rejects pending whatsits. HTTP/project routes remain on the transitional frontend, without an automatic fallback from strict native execution. No incremental execution or Typst-like latency claim follows from this paragraph slice.
Verification
- Five paragraph/state integration tests, including 119 actual pdfTeX INITEX comparisons of line contents, line boxes and interline glue (at most 1sp error). Variants cover thresholds, widths, demerits/penalties, looseness, hanging shape, exceptions, common ligatures, command/group boundaries, explicit kern/glue/discretionary nodes, spacefactor and forced breaks.
- Pretolerance changes the actual selected pass and line breaks. Other checks cover snapshots/scopes/global assignments, space creation timing, depth and paragraph spacing, mode conditions, badness warnings, overflow, nullfont, font-resource reuse, unsupported input and JSON round trips.
- A native INITEX CLI fixture exports a real one-page PDF. The independent scripts/check-native-paragraphs.py checks the same source with real INITEX pdfTeX: 89 words in identical order, CMR10 in both PDFs, maximum word-box errors below 0.02bp. This is a CMR10 fixture gate, not template/NFSS fidelity.
- Full workspace: 1159 passed / 0 failed. The existing 90 native token, 101 quantity, 12 filesystem comparisons and selected/discarded shipout oracle remain covered. Release, fmt/diff and math D regression are checked separately.
cargo test -p texrra-tex-core --offline --test execution_paragraphs -- --nocapture
cargo test --workspace --offline -- --test-threads=1
cargo build --release --offline
python scripts/check-native-paragraphs.py --binary target/release/texrra \
--output-dir /tmp/texrra-native-paragraph --json /tmp/texrra-native-paragraph/pdf-oracle.json
python scripts/probe-native-format.py --binary target/release/texrra \
--texmf /usr/share/texlive/texmf-dist \
--json /tmp/texrra-native-paragraph/format-probe-final.json
Real LaTeX startup and next work
The unchanged pinned LaTeX2e 2025-11-01 entry advances from pretolerance at 491:1 through tolerance/hbadness to 494:1, missing vbadness. Actual auxiliary time/date writing, reading and the source's directory checks still execute. The audit preserves source SHA and records format_boot_passed=false. Three more source lines are reached; real format boot has not passed.
The next box slice is accepted: native boxes, vpack and current next work. It implements actual packaging diagnostics and moves the unchanged format to 498:1, missing binoppenalty. Native math/list consumers, whatsit/shipout and page execution, full fonts/format closure and native dump/load remain open.
Current evidence: /tmp/texrra-native-paragraph/ (PDFs, raster, word-box audit, format audit and math regression). Final logs: /tmp/texrra-paragraph-accepted- workspace.log and /tmp/texrra-paragraph-accepted-release.log. Earlier quantity and job evidence remains historical under /tmp/texrra-native-registers/ and /tmp/texrra-native-job/.