81 lines
4.4 KiB
Markdown
81 lines
4.4 KiB
Markdown
# Engine status
|
|
|
|
The project is split into two repositories: `texrra-engine` (this Rust engine
|
|
and HTTP server) and `texrra-web` (the static editor frontend). The engine
|
|
discovers the frontend through `TEXRRA_WEB_DIR`, `../web`, or `./web`.
|
|
|
|
Rust-native, Typst-inspired incremental LaTeX engine. No external XeLaTeX is
|
|
invoked. The live server keeps compiled documents cached and only rebuilds when
|
|
the source changes; the SVG preview is refreshed per page.
|
|
|
|
## Implemented
|
|
|
|
- Headings: numbered `\section`/`\subsection`/`\subsubsection` and starred
|
|
`\section*` variants (starred headings do not advance the counter).
|
|
- Box material: `\rule` (raise/width/height), inline framed `\fbox`, block
|
|
`\parbox`/`\minipage`, `\vbox`/`\vtop` (full-width block approximation),
|
|
inline `\mbox`, `\makebox[width][align]`, `\raisebox`, `center`, `\hrule`
|
|
with `width`/`height`.
|
|
- Fonts: Liberation Serif/Sans/Mono faces, bold/italic/monospace/sans
|
|
declarations with group scoping, grouped text-style commands, true small caps
|
|
(lowercase uppercase glyphs at 80% size), and sans/serif/mono small caps.
|
|
- Paragraphs: Knuth-Plass breaking, TeX hyphenation patterns, justification,
|
|
`\centering`/`\raggedright`/`\raggedleft` declarations and environments,
|
|
first-line `\parindent` (17pt default, group-scoped, `\setlength`/
|
|
`\addtolength`/`\noindent` aware), and `\hfill`/`\hfil` infinite glue.
|
|
- Pages: A4/A5/B5/Letter/Legal/Executive, landscape, geometry margins and
|
|
text block, geometry-aware `\textwidth`/`\textheight`/`\linewidth`/
|
|
`\columnwidth` (as live named length registers), automatic pagination, `\newpage`/`\pagebreak`; figures/tables
|
|
honor `[htbp]` hints with top/bottom/page/here approximations. Page styles:
|
|
default `plain` page numbers, `\pagestyle{empty|plain|fancy}`,
|
|
`\thispagestyle`, fancyhdr `\fancyhead`/`\fancyfoot` (L/C/R) and
|
|
`\lhead`/`\chead`/`\rhead`/`\lfoot`/`\cfoot`/`\rfoot`, with `\thepage`
|
|
resolved at paint time.
|
|
- Notes: `\footnote{...}` page-bottom insertion area with separator rule,
|
|
superscript markers, and title/author `\thanks`.
|
|
- Contents: `\tableofcontents`, `\listoffigures`, and `\listoftables`
|
|
generate headings plus entries from numbered sections and captioned
|
|
figures/tables; page numbers are resolved after pagination.
|
|
- Class sizes: 10pt/11pt/12pt set the body size and propagate through
|
|
headings, title material, lists, tables, block boxes, footnotes, and the
|
|
default paragraph indent (10/12pt use 15pt; 11pt uses 17pt).
|
|
- Classes/packages: built-in classes, local `.cls`/`.sty`, paper options,
|
|
`\DeclareOption`/`\ProcessOptions`/`\ExecuteOptions`/option passing.
|
|
- Compatibility: spacing macros (quad/qquad/thin/en/med/thick, `\vspace*`,
|
|
`\hspace*`, skips), text symbols/letters/punctuation, break advisories,
|
|
metadata, citations/references, tables/lists/images.
|
|
- Live preview: paragraph cache, page-hash diffing, warm rebuilds in the low
|
|
milliseconds for small edits.
|
|
|
|
## Remaining structural work
|
|
|
|
See `docs/ROADMAP.md` for concrete implementation plans.
|
|
|
|
## Known approximations / gaps
|
|
|
|
- Boxes: `\parbox`/`\minipage` are block-level; `\vbox`/`\vtop` map to a
|
|
full-width block rather than true nested VBox material.
|
|
- Pages: float placement is immediate rather than a deferred float queue
|
|
(no `\textfraction` tuning, no reordering around later text). Pagination is
|
|
performed by the positioned renderer; the separate page-break planner was
|
|
removed.
|
|
- Notes: footnotes inside captions, floats, or arbitrary boxes are not
|
|
collected; the insertion area currently follows the page where the paragraph
|
|
ends rather than the exact reference line.
|
|
- Contents: entries use infinite glue instead of dotted leaders and only
|
|
numbered headings plus captions are listed; per-chapter contents in
|
|
book/report are not distinguished.
|
|
- Miscellaneous: a document-level `\renewcommand{\maketitle}` is ignored in
|
|
favor of the engine title block.
|
|
|
|
## Verification
|
|
|
|
- `examples/hello.tex`, `examples/boxes.tex`, `examples/compat.tex` compile to
|
|
one A4 page each; the arXiv template project compiles to 3 Letter pages.
|
|
- `cargo fmt --check` passes; `cargo test --offline` (36 tests: 32 compiler
|
|
integration tests + 4 server tests) covers the three examples, the arXiv
|
|
fixture, floats/newpage, page styles and `\thispagestyle`, SVG/PDF output,
|
|
project API, static frontend assets, path traversal, the legacy
|
|
`/texrra` endpoint, and page-hash cache stability.
|
|
- Warm preview: hello ~0.6ms, arXiv ~13ms (release server, page layout cached).
|