Files
texrra-engine/docs/ROUTE_D_STATUS.md
T
gloamxun 0a4bc0ade5 Handle cleardoublepage and column switches
\cleardoublepage was unsupported and \onecolumn/\twocolumn leaked into the
text. The block splitter now treats \cleardoublepage like \newpage/\clearpage
(it sets the pending page break) and consumes the two column switches, since
the engine lays documents out in a single column.

A test alternates the three commands around First/Second/Third, checks at least
two pages, all three texts present, and no leaked commands or warnings.
2026-10-27 02:21:01 +08:00

96 lines
4.4 KiB
Markdown
Executable File

# Route-D status (handoff after the round-150 recovery)
Status: active on `main` in `texrra-engine` (the tree is clean after each push).
This page collects what route-D currently does, how to verify it, and the
limits that remain. It is the short companion to the long implementation log in
`ROUTE_D_PLAN.md` and the model notes in `TEX_CORE.md`.
## Verification
Run from the repository root:
```sh
cargo fmt --all -- --check
cargo test --workspace --offline
```
The workspace currently passes **1027 tests**:
| Suite | Tests |
| --- | --- |
| route-D unit (engine) | 437 |
| engine binary unit | 398 |
| server integration | 63 |
| v1 integration | 71 |
| pdfLaTeX oracle | 42 |
| route-D integration | 10 |
| engine/core unit | 4 + 1 |
The oracle suite compiles fixtures with `pdflatex`, extracts word boxes with
`pdftotext -bbox`/`pdftoppm`, and compares route-D page geometry; it skips
(saying so) when the TeX tools are absent. The server suite includes
`corpus_documents_preview_without_warnings`, which previews
`examples/hello.tex`, `examples/boxes.tex`, `examples/compat.tex` and
`fixtures/arxiv-template/template.tex` and asserts 200, at least one page and an
empty `warnings` array for each. A manual sweep of the same four documents
reports 0 warnings, 1/1/1/2 pages and under 1.5 s per preview.
## Service defaults
- Flat `POST /preview` and the project preview/PDF endpoints try route-D first
and fall back to v1 on error. The flat response carries
`X-Preview-Engine: route-d|v1`.
- `?engine=v1` or `TEXRRA_ENGINE=v1` forces the old pipeline; an explicit
`?engine=` wins over the environment.
- `/api/route-d/preview`, `/api/route-d/pdf` and `/api/route-d/edit/{unit}`
remain the explicit route-D surface.
- Geometry-less documents default to Letter (pdfLaTeX's default), not the old
v1 A4 default.
## Implemented areas
- **Paragraphs/pages**: Knuth-Plass breaking with prefix-sum candidates,
hyphenation, justification, `\parindent`/`\parskip`, baselineskip/`\lineskip`,
TeX badness page breaking with glue orders, `\topskip`/`\maxdepth`, insertion
classes, marks, floats, `\output` program, incremental page replay.
- **Macros**: textual expansion with group scopes (`{}`,
`\begingroup`), `\def`/`\gdef`/`\edef`/`\xdef`, delimited and undelimited
parameters, `\let`, `\chardef`, `\newif`, `\csname`, `\expandafter`,
`\futurelet`, `\aftergroup`, `\afterassignment`, `\scantokens`, token
registers, `\string`, `\meaning`, `\expanded`, `\unexpanded`,
`\detokenize`; `@` and `%` catcodes are applied.
- **Boxes**: `\sbox`/`\savebox` measured at definition (width/height/depth,
image bodies use decoded pixels), frozen dimensions, `\wd`/`\ht`/`\dp`,
unbreakable `\mbox`/`\usebox`, `\parbox` content, framed/colour boxes.
- **Tables**: `tabular`/`longtable`, `\multicolumn`, `\multirow`, `p{}`
wrapping, `\tabskip`/`\tabcolsep`, booktabs rules, row splitting, real nested
tabulars, and `\valign` transposed into a tabular.
- **Math**: CM metrics and Type1 faces, fractions/scripts/delimiters, aligned
environments, operators, and inline math scaled proportionally at any
paragraph size.
- **Fonts**: twelve CM text faces and four math faces, Liberation fallback per
glyph, Greek/Cyrillic/accents, Greek math commands, fontspec family aliases.
- **Service**: both preview paths default to route-D with v1 fallback, caches
and sessions, engine-labelled flat responses.
## Known limits
- Expansion is textual, not a token stream; the catcode table models only `@`
and `%` (other `\catcode` assignments are consumed but not applied).
- Complex-script shaping (Devanagari, Thai, emoji) has no fallback face; this is
outside pdfLaTeX's own scope and is reported rather than silently mis-set.
- A `\parbox` keeps its content unbreakable; its width argument does not wrap.
- Images inside a nested table are not merged into the outer display list.
- `\valign` cells are left-aligned; its preamble alignments/vertical rules are
ignored.
- `\unexpanded` freezes its tokens during an edef-style pass and they expand
at use time; the wider token-stream semantics of `\edef` remain textual.
## Continuing
1. Read `TEX_CORE.md` for the model and `ROUTE_D_PLAN.md` for the phase history.
2. Pick a limit above, add a route-D unit test (and a server/corpus test when
user-visible), update the relevant doc paragraph, and push to `main`.
3. Keep `cargo fmt --all -- --check` and the full workspace suite green before
every push; the oracle suite needs `pdflatex`, `pdftotext` and `pdftoppm`.