Advance native LaTeX execution and preview

This commit is contained in:
gloamxun committed 2026-11-18 22:17:21 +08:00
1 parent 91f9d76b16
commit 2741546ca8
414 files changed
+99872 -933

No files matched your search

+31 -7
View File
@@ -1,5 +1,28 @@
# Rust-native LaTeX compiler direction
Product clarification, 2026-11-02: [NATIVE_PRODUCT_GOAL.md](NATIVE_PRODUCT_GOAL.md)
governs this architecture. The product is a native LaTeX kernel with complete
original-project portability and realtime incremental rendering. The Web app
is a test frontend. Typst informs sessions, dependencies, invalidation and reuse;
native TeX/LaTeX execution supplies language and layout semantics. Input/state/
resource identities must be built with execution, ahead of safe checkpointing.
G1 diagnostic work is a paused, incomplete supporting slice of that roadmap.
Product direction updated 2026-10-31: the target product is Route-D, fully
replacing v1 with its own native TeX execution, lists, layout and export.
The current-implementation descriptions below also document the older v1
pipeline and its Texlang adapter; those are historical audit material, not
the architecture to carry into Route-D. Independent verified components may
be ported behind Route-D-owned interfaces. See [the active plan](ROUTE_D_PLAN.md).
The owned Route-D token/state/primitive bootstrap and explicit partial e-TeX
macro/integer and job-time/I/O slices are implemented in texrra-tex-core::execution
(1153 tests, 90 token probes, 101 quantity probes, 12 filesystem comparisons and a shipout oracle).
Its strict native CLI bypasses this older adapter pipeline. The unmodified
format initializes native mathematical constants/registers and reaches pretolerance;
HTTP migration, full native format boot and font fidelity remain pending.
See [NATIVE_EXECUTION_CORE.md](NATIVE_EXECUTION_CORE.md) for current evidence.
## Goal
Build a Rust compiler whose output follows XeTeX/LaTeX behavior closely, while
@@ -28,13 +51,14 @@ architecture](https://github.com/typst/typst/blob/main/docs/dev/architecture.md)
2. **Tokenization and expansion** preserve TeX tokens, source spans, grouping,
category codes, and macro state. Expansion produces syntax that later passes
can inspect without throwing away source locations.
3. **Document interpretation** builds a semantic document tree for paragraphs,
math, tables, floats, labels, references, and bibliography entries. Cross
references and bibliography resolution run as explicit passes.
4. **Layout** converts semantic content into TeX-style boxes, glue, penalties,
and page frames. Paragraph breaking and page building operate on those
structures. Math uses the same box model, including stacked fractions and
script placement.
3. **Primitive and format execution** consumes native tokens with real state,
groups, modes and horizontal/vertical/math lists. Actual kernel/class/package
code determines higher-level document behavior. Reference and bibliography
workflows retain real auxiliary dependencies and multi-pass convergence.
4. **Layout** measures and packs native boxes, glue, penalties and page lists.
Paragraph breaking, math conversion, alignments, insertions and page/output
routines operate on owned execution results. No second frontend infers
class/package behavior from source strings or template names.
5. **Export** turns final page frames into PDF. Other views, if added, consume
the same frames rather than implementing a second approximation of layout.