Preview the arXiv template without warnings

The archived class file expands \maketitle, \section and \keywords into LaTeX
internals that route-D does not model, so the template's title block, headings
and keywords were replaced by LaTeX machinery and 20+ control words reached
layout.

Keep \maketitle, \thanks and the heading commands out of generic macro
expansion so the native title block and section parser see them; scrub the
author metadata (\href labels, ORCID \includegraphics, text-style wrappers,
line breaks and \And) into plain text; turn \keywords into a "Keywords: ..."
paragraph; expand \lipsum[n]/[a-b] to filler paragraphs; drop `%` comments and
external \bibliography/\bibliographystyle commands (an inline thebibliography
still supplies References); and start a new block when center/flushleft/
flushright follows text on the same chunk.

The arXiv fixture now previews with zero warnings in two pages, covered by a
JSON-level regression test. Remaining class support is still semantic rather
than a TeX VM.
This commit is contained in:
gloamxun committed 2026-10-26 23:20:58 +08:00
1 parent 1b7baa0257
commit 21d48866de
3 files changed
+371 -10

No files matched your search

+9 -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`). 971 workspace tests are green and no oracle
PDF opt-in with `?engine=route-d`). 975 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.
@@ -381,6 +381,14 @@ Acceptance: `article.cls` at 10/11/12pt matches pdfLaTeX page count exactly;
the journal class matches page count within one page and column geometry within
1mm.
Progress: the arXiv template's class (`arxiv.sty`) previews with no warnings in
two pages. `\title`/`\author`/`\thanks` stay on the native title path, heading
commands are kept for the native section parser instead of expanding their class
redefinitions, `\keywords` becomes a plain paragraph, `\lipsum[n]` expands to
filler text, comments and external `\bibliography` commands are dropped, and a
`center`/`flushleft`/`flushright` environment that follows text starts its own
block. Class files are still mapped semantically rather than executed by a VM.
### P7 — Service and incrementality
Scope:
+7 -4
View File
@@ -370,7 +370,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`, `cmssbx10`, `cmssi10`, `cmcsc10`) supplies advances, kerns, ligatures, and italic correction for layout, the display list selects the matching face, and the PDF writes Computer Modern Type1 outlines for each built-in face (`cmr10`/`cmbx10`/`cmti10`/`cmbxti10`/`cmtt10`/`cmss10`/`cmssbx10`/`cmssi10`/`cmcsc10`, plus `cmmi10` for mathematical italic letters, `cmsy10` for math symbols and `cmex10` for big operators), falling back to Liberation subsets only for characters the Type1 encodings cannot address; those fallback glyphs keep their Unicode text under PDF extraction, so accented and Greek words round-trip; Type1 faces carry a ToUnicode CMap built from the requested characters, so glyphs whose names are ambiguous in the Adobe Glyph List (capital Omega, which would otherwise extract as U+2126) keep their intended code points. `Engine::edit` preserves the face when reflowing an edited paragraph.
The crate currently has 434 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 971 tests (434 route-D unit, 349 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 60 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
The crate currently has 434 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 975 tests (434 route-D unit, 353 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 60 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
### M0 incremental demo
@@ -485,9 +485,12 @@ deliberately open rather than approximated:
Class files contribute multi-line `\newcommand`/`\def`/`\newenvironment`
bodies: the source is joined at balanced braces and the whole definition is
captured, while `\ifhmode`/`\ifvmode`/`\ifmmode` resolve as the
horizontal/vertical/math approximations. The arXiv class preamble no longer
leaks into the body: the template now previews as four pages instead of one
page of `\NeedsTeXFormat`/`\fancyhf` text.
horizontal/vertical/math approximations. The arXiv class now previews with
no warnings in two pages: `\maketitle`/`\thanks` stay on the native title
path, heading commands are not expanded through class redefinitions,
`\keywords` becomes a plain paragraph, `\lipsum[n]` expands to filler text,
comments and external `\bibliography` commands are dropped, and
`center`/flush environments that follow text start their own block.
- Page hashes cover rendered items/insertions/marks/floats, not source-dependency
metadata, so replaying an earlier page cannot change its hash merely by
re-attaching source hashes.