12 KiB
Route-D web experiment
Status: contract fixes and the curated three-project trial are complete
(engine contract 1058122, web cecad51), and the user-supplied arXiv
template has since been used for a second PDF-fix pass (recorded below).
Audit baseline: engine c49afbd, web 24c9593; 2026-10-27.
Verdict
Route-D is ready for a controlled web experiment on the supported article subset, not for silently replacing v1 on arbitrary projects. The core typesetter passes its workspace suite, corpus and pdfLaTeX oracle evidence; the project/web contract needed the fixes recorded below. Real-paper gaps are listed with priorities at the end.
Initial contract probe (before the fixes)
texrra serve with a real project and:
POST /api/projects/{id}/preview?engine=route-d- 200,
status: ok, one page, emptywarnings - no
durationMs - no
X-Preview-Engine
- 200,
- Preview without an engine query: same route-D response, same missing fields.
?engine=v1: 200, hasdurationMs, noX-Preview-Engine.- Route-D PDF: 200
application/pdf, noX-Preview-Engine.
Web app.js assumed durationMs on every successful preview, so route-D
previews reached the status line with undefined. The engine toggle also
assumed the server default was v1: its "v1" state sent no query parameter, which
now means route-D.
Contract changes in this increment
- Route-D preview JSON now carries
durationMs(flat, project and edit paths). - Project preview/PDF responses carry
X-Preview-Engine: route-d|v1, including cache hits and silent fallback to v1. - The web engine state is an explicit
route-d | v1value, defaulting to route-d, with migration from the old boolean localStorage key. - Both preview and PDF always send an explicit
?engine=...query. - The web status line tolerates a missing duration, shows the warning count and engine fallback, and exposes warning details in the status tooltip.
- PDF export notices when the response came from a fallback engine.
Feature matrix for web projects
| Area | Route-D | Evidence / impact |
|---|---|---|
| Article/report basics: title, sections, lists, TOC, page numbers | Supported | corpus and 1087-test suite |
| Inline/display math, equations, tags, cleveref | Supported | math tests, oracle fixtures |
| Floats, captions, tables, booktabs | Supported | table/math tests, corpus |
PNG/JPEG/BMP \includegraphics |
Supported | project image tests; PDF XObjects use pixel dimensions and the SVG preview embeds a PNG data URI |
| PDF/SVG/EPS figures | Not supported | undecodable images become placeholder rules |
Inline thebibliography + \cite |
Supported | numeric or custom labels; citation tests |
.bib + BibTeX data |
Partial | simple @article/@inproceedings fields are inlined as labeled thebibliography; project citations use author-year labels (Kour and Saabne, 2014a) |
Local .cls/.sty/\input |
Supported | project class/package tests |
| Arbitrary package code, TikZ/pgf | Not supported | text/class subset only |
Two-column / multicols |
Flattened | wrappers consumed; no column layout |
| fontspec/system fonts | Partial | family names map to the bundled CM/Liberation faces; external fonts not loaded |
| Complex scripts | Not supported | no shaping fallback; outside pdfLaTeX's own scope |
| Footnotes, marks, running heads | Partial | marks are document-level, not per-page |
\parbox wrapping |
Partial | width argument does not wrap |
| Raster images in the SVG preview | Placeholder | the SVG painter draws a grey rectangle; the PDF embeds the real image |
| Inline math in table cells | Readable fallback | math commands are converted to plain text (um, approx., 10**6); not typeset as math |
\fbox/rule-only figures |
Partial | the rule body is drawn; the surrounding fbox frame is not |
Nested-table images, \valign alignments |
Not supported/partial | documented engine limits |
Token stream/catcodes beyond @/% |
Partial | textual expander, not a TeX token stream |
Curated trial results
All three projects were created through the project API and rendered with both
engines. Durations are the server's durationMs (client HTTP elapsed in
parentheses); PDFs were checked for %PDF-.
| Project | Route-D | v1 | Notes |
|---|---|---|---|
article-basic |
1 page, 0 warnings, 502 ms (624 ms), PDF 633 ms / 466 KB | 1 page, 1449 ms (1456 ms), PDF 2701 ms / 488 KB | TOC, figure, table, equation and inline bibliography all present; figure raster is a grey placeholder in SVG |
unicode-mixed |
1 page, 0 warnings, 442 ms (510 ms), PDF 656 ms / 174 KB | 422, undefined control sequence \' |
Route-D handles accents, Greek math, colours and footnotes; v1 cannot compile the source |
arxiv-template |
3 pages, 0 warnings, 1448 ms (1514 ms), PDF 1572 ms / 448 KB | 3 pages, 4280 ms (4308 ms), PDF 4677 ms / 5.2 MB | After the second pass, basic .bib citations resolve [1]–[3], References is present and the table is readable; complex equations and rule/PDF-image figures remain approximate |
The first pass of this trial also exposed a parser bug: a heading followed on the next line by body text (no blank line) dropped the body, and consecutive display blocks without blank lines swallowed each other. Both were fixed before the table above was recorded:
- headings are separated from following text and from later headings;
figure,table,equation,align,gatherandmultlineblocks split from surrounding text and from each other.
A headless Edge smoke test of article-basic confirmed the editor loads, the
toolbar shows Route-D (实验), and the preview contains the body, table,
equation and captions. It also confirmed the remaining visual gap: the PNG
figure is a grey rectangle in the SVG preview (the exported PDF embeds it).
arXiv-template second pass
The user-supplied A_template_for_the_arxiv.zip exposed four additional
problems in the generated PDF, all fixed in the follow-up increment:
- Headings and title were letter-spaced. Plain text in a paragraph whose
base size was not 10pt took the
SizedTextinline-segment path, so its advances were scaled once for the run and again for the paragraph. The fallback run now uses the base size and the normal font path. - The table lost its third column. Table cells are painted as plain text;
$,\and other unsupported glyphs forced the whole cell through the PDF fallback font, leaving only a backslash. Table-cell math now has a readable ASCII fallback (Size (um),approx. 100,10**6). - Page numbers appeared twice.
fancyhdr's\cfoot{\thepage}was painted alongside the default route-D page number. Default numbering is now skipped for a fancy pagestyle. .bibdata was ignored. Simple@article/@inproceedingsentries are now parsed from project.bibfiles and inlined asthebibliographyentries before citation resolution, so the template's[?]markers become[1]–[3]and a References section is emitted.
Remaining visible gaps in this template:
- the display equation is still a rough approximation of the printed formula;
- the title rules, A Preprint undertitle and two-column author groups are now drawn; ORCID icons are still missing;
- the
\fbox{\rule...}figure body draws its rule as a filled box; the surrounding fbox frame is still missing; orcid.pdfis a vector image and stays unsupported;- the author block is concatenated and does not reproduce the class layout.
The revised PDF was rendered page-by-page and checked for the title, table,
references and page numbers. A project regression test now uploads a .bib
file and asserts that a route-D preview contains References, [1] and the
entry text.
TeX Live comparison (2026-10-27)
The uploaded template was compiled with TeX Live 2026 (pdflatex + bibtex +
two further pdflatex passes; TeX Live was installed piecemeal, so the log
still contains \languagename/cleveref undefined-control warnings, but the
3-page layout matches the template.pdf bundled in the zip). The resulting
PDF was rendered page-by-page next to the route-D output.
| Page element | TeX Live reference | Route-D output |
|---|---|---|
| Page count / paper | 3 pages, letter | 3 pages, letter |
| Typeface | Times (ptm, arxiv.sty) |
Times Roman/bold/italic metrics (ptmr8t, ptmb8t, ptmri8t, ptmbi8t) with Liberation Serif TrueType; math keeps CMMI/CMSY Type1 |
| Text block | 1in left/right margins, 6.5in measure | 1in margins and 6.5in measure; Times body baselineskip is 11.5pt with 2.5/1.5/0.83pt interword glue |
| Running header | arxiv Template / A PREPRINT |
arXiv Template / A Preprint on pages 2–3; small-caps styling differs |
| Title | A TEMPLATE FOR THE arxiv STYLE, small caps, rules above/below |
uppercase Times with rules above/below |
| Author block | two affiliations, ORCID icons, footnote symbols | two-column author table; ORCID shows an iD text marker instead of the vector icon |
| Abstract/keywords | small-caps heading, bold Keywords, · separators |
bold heading, comma separators |
| Citations | natbib author-year (Kour and Saabne, 2014a; …) |
author-year (Kour and Saabne, 2014a; Keshet et al., 2016) for .bib; numeric for unlabeled inline bibliographies |
| Table | booktabs rules, Size (µm), ~100, 10^6 |
centred with rules; Size (µm), ~100, 10⁶ |
| Figure | framed rule box above the caption | centred framed rule body (raster) on page 3 |
| Display equation | fully typeset fraction/product/sum | approximate body; fraction box uses full extents, large-operator limits straddle the operator closely, subscripts attach even after a space, and the tag is at the right margin |
| References | author-year, italic venue, DOI link | author-year entries; DOI appended when present in the .bib |
| Float order | figure/table on page 3 with section 3.4 | figure/table on page 3 above 3.3/3.4 |
After this comparison, the PDF page origin was fixed: the PDF writer had ignored the document's horizontal/vertical offsets, so route-D PDFs started at x=0 and clipped headers above the page. The revised PDF now has the 1in text block and page 2/3 headers. Times body metrics, title/author blocks, author-year citations and the sample's float order are now in place; math and general float placement still differ, and the real lipsum package text now drives the page breaks.
The visual difference is therefore not a single bug. Route-D models the document semantically and lays out paragraphs/tables/floats with its own page builder; it does not execute the LaTeX page builder, class styling, natbib formatting, math typesetting or font selection that TeX Live applies. The current output is a fast structural preview, not a replacement for the TeX-produced PDF. Closing the remaining gap requires work on page geometry and headers, Times-compatible metrics, title/author blocks, citation formatting, float placement and the math engine — not another small patch.
Go/no-go
- Go, limited to text/table/math documents: Route-D is the faster default and handles accents that v1 rejects.
- Conditional go for the supplied arXiv template's text, tables and simple
.bibreferences; no-go for complex equations, the missing fbox frame, vector/PDF images and image-heavy previews until those gaps are fixed. - Keep the explicit v1 escape hatch: v1 is not a universal fallback (it failed the Unicode trial), so the UI must continue to show the actual engine and warnings/fallbacks instead of assuming v1 always recovers.
Backlog after the trial
- P0: SVG preview raster-image embedding; PDF/vector figure support; complex-equation layout; vector/PDF images; float order/placement; full BibTeX/BibLaTeX coverage; visible capability warnings for unsupported content.
- P1: two-column/multicols layout; fontspec/system-font loading; common TikZ/package execution; longtable page splitting.
- P2: full catcode/token stream; nested-table images; per-page marks;
\parboxwrapping;\valignalignments; complex-script shaping.
Verification
./scripts/verify-route-d.sh
The contract tests are in tests/server.rs: project previews must report
route-d/v1 and durationMs, and route-D/v1 PDFs must carry the engine header.
Post-fix live probe of the same project: route-D preview returned 200 with
X-Preview-Engine: route-d, durationMs: 28.874, one page and empty warnings;
?engine=v1 returned X-Preview-Engine: v1 and durationMs: 824.35; the
route-D PDF returned X-Preview-Engine: route-d and %PDF-.