Commit Graph
40 Commits
Author SHA1 Message Date
gloamxun 752af43f32 Select a native XeTeX compatibility profile and wide spacing codes 2026-11-21 12:17:53 +08:00
gloamxun 6e573dc1ce Run cancellable pdfTeX matching in native frontends 2026-11-20 16:43:48 +08:00
gloamxun 2741546ca8 Advance native LaTeX execution and preview 2026-11-18 22:17:21 +08:00
gloamxun ba61faf142 Format BibTeX entries like unsrtnat
Rewrite author names as First Last (with Oxford-comma lists), use plain titles
and italic journal/booktitle with In, order the bibliography by first citation,
carry the 2014a/b suffix into the reference text, and fix page/publisher
punctuation. The valid TeX-oracle score rises from 0.8605 to 0.8958.

Add two formatter tests; the workspace now has 1086 tests.
2026-10-28 13:43:24 +08:00
gloamxun 1b0f4c8ab3 Append DOI fields to project bibliography entries
.format_bib_entry ignored the doi field, so the arXiv first reference lost its
doi:10.1109/... suffix. Append doi:<value> when present and extend the server
bib test fixture/assertions.

Test count stays 1078.
2026-10-28 00:54:05 +08:00
gloamxun c2310d85ac Emit author-year labels for project BibTeX
The project .bib inliner now derives author-year labels (with a/b
disambiguation for duplicate author-years) and writes them as optional
\bibitem labels. The route-D citation pass uses those labels only when they
look like author-year labels: \citep gets parentheses, \citet becomes
Author (Year), and reference entries lose their numeric brackets. Inline
thebibliography entries without such labels remain numeric.

The arXiv sample now prints (Kour and Saabne, 2014a; Keshet et al., 2016) and
Kour and Saabne (2014b), matching natbib semantics more closely. Test count
stays 1073.
2026-10-27 23:07:00 +08:00
gloamxun d124c646a1 Serialise only changed pages for patch previews
render_json now accepts an optional page whitelist. The new
project_preview_patch_json_with_images path passes changedPages before building
page SVGs, instead of serialising all pages and filtering afterwards in the
server. Cache hits still use the old filter helper.

Add scripts/bench-preview.py: repeated buffer edits against a running server,
reporting HTTP/server latency, bytes and changedPages. Measure release builds:
article-basic 37.5 ms (one page), arXiv late edit p50 199 ms / p95 222 ms with
one changed page at 175 KB, arXiv heading edit ~480 ms. This is a solid
improvement over the debug numbers previously quoted, but the 10-page <100 ms
target remains unmet.

TEXRRA_PROFILE=1 now gates the geometry/paragraph/before-render timings. Test
count is 1073 (67 server).
2026-10-27 21:36:01 +08:00
gloamxun 9231c3a7d6 Return dirty-page preview patches
Project previews accept ?patch=1 and only include pages listed in changedPages.
Cache hits return an empty patch list. The web client applies sparse patches by
page index instead of rebuilding every page.

Add a two-page server test that edits only the second page and checks that the
patched payload contains exactly the changed page indices. Measure the arXiv
heading edit: 2 of 3 pages still changed (315 KB vs 396 KB full, 2.66 s), so
dirty-page transfer is in place but incremental layout latency is not.

Test count is 1073 (67 server).
2026-10-27 21:18:39 +08:00
gloamxun e2e80e8728 Compile editor buffers without waiting for a save
Project preview accepts ?buffer=1 and reads the editor text from the POST body.
The source is still expanded with project includes/packages/images, but the file
on disk is not touched, so typing can drive layout immediately while the normal
450 ms save timer runs independently.

Add a server test that previews buffer text, finds it in the SVG, and verifies
hello.tex on disk was not rewritten. Roadmap notes that warm buffer previews
are still ~430 ms (article) and ~2.1 s (arXiv), and that dirty-page streaming
is the next latency step.
2026-10-27 21:01:24 +08:00
gloamxun b1e3e03f00 Fix the arXiv-template PDF output
The user-supplied template PDF exposed four concrete problems:

- title/headings were letter-spaced: plain text in a large paragraph took the
  SizedText segment path and was scaled twice; the fallback run now stays at
  the base size and is scaled once by the paragraph;
- the table lost its third column because unsupported math glyphs were sent
  through the PDF fallback font; table-cell math now has a readable ASCII
  fallback (Size (um), approx. 100, 10**6);
- fancyhdr's \cfoot{\thepage} was painted together with route-D's default page
  number; default numbering is skipped for a fancy pagestyle;
- .bib data was ignored; simple @article/@inproceedings entries are now parsed
  from project .bib files, inlined as thebibliography entries, and resolved by
  the existing citation pass, producing References and [1]-[3].

The regenerated 3-page PDF was checked for title/heading spacing, table text,
references and a single page number per page. A project regression test covers
the .bib path, and the table/heading fixes have unit tests.

Remaining visible limits in this template: the complex display equation, the
\fbox/rule figure body, vector/PDF images and the author block layout.
Test count moves to 1069 (444 core, 432 engine, 65 server).
2026-10-27 13:38:36 +08:00
gloamxun fab26234fc Discover a texrra-web sibling checkout
The repository is checked out as texrra-engine next to texrra-web, but
find_web_root only looked for ../web and ./web, so a plain
`cargo run --release -- serve examples/hello.tex 4174` served the "frontend not
found" page. The search now also accepts ../texrra-web and ./texrra-web, and the
startup warning names the sibling checkout. README and STATUS document the
accepted layouts.

Verified without TEXRRA_WEB_DIR: the server printed "Serving the web frontend
from ../texrra-web" and GET / returned the editor index.
2026-10-27 12:56:13 +08:00
gloamxun 1058122388 Add route-D web contract and experiment matrix
Route-D preview JSON now reports durationMs on the flat, project and edit
paths, and project preview/PDF responses carry X-Preview-Engine (route-d or
v1), including cache hits and silent fallback. The server tests assert the
headers, the duration field and both PDF engines.

docs/WEB_ROUTE_D_EXPERIMENT.md records the audit verdict, the initial contract
probe, the supported/gap matrix, the three-project trial plan and the
prioritised backlog; ROUTE_D_STATUS.md links to it and the test counts move to
1063.
2026-10-27 12:23:04 +08:00
gloamxun 371f05baaa Default project previews and PDFs to route-D
uses_route_d still treated v1 as the default unless TEXRRA_ENGINE=route-d was
set, so only the flat /preview endpoint had switched. Make route-D the default
there too: an explicit engine parameter still wins, TEXRRA_ENGINE=v1 forces the
old pipeline, and a route-D error now falls through to the v1 compiler instead
of answering 422 (both preview and PDF).

Because route-D follows pdfLaTeX's Letter default for geometry-less documents,
the two server tests that asserted the v1 A4 page now ask for ?engine=v1 or
expect 215.9mm. A new test starts a server without the environment variable and
checks a project preview uses route-D's italic math face with no literal $.
2026-10-27 00:32:45 +08:00
gloamxun a56d441513 Make route-D the default flat preview engine
POST /preview served the v1 pipeline while route-D lived behind /api/route-d
and the project engine switch. Try route_d::preview_json first and keep the v1
compiler as the fallback when route-D rejects the source; ?engine=v1 forces the
old path and the project endpoints are unchanged.

Both paths now answer with an X-Preview-Engine header (route-d or v1) so the
choice is observable, and the server test helper compares header names
case-insensitively because tiny-http lowercases them.

A server test posts a document and checks route-d by default plus v1 when the
query asks for it.
2026-10-27 00:27:59 +08:00
gloamxun 3723036710 Run package document hooks and strip makeat 2026-10-25 00:41:24 +08:00
gloamxun e3e230042a Answer flat route-D errors with JSON messages 2026-10-25 00:39:04 +08:00
gloamxun 9195d090de Merge passed package and class options
Preamble \PassOptionsToPackage and \PassOptionsToClass declarations are
collected and merged into the next \usepackage or \documentclass request,
so the shared option lists in article-class projects reach the local
class and package option protocol.
2026-10-25 00:07:39 +08:00
gloamxun 04446e673f Inline input files inside project classes and packages 2026-10-24 23:47:57 +08:00
gloamxun cca108dc15 Memoise the flat route-D render endpoints 2026-10-24 23:45:28 +08:00
gloamxun 9aacb91184 Resolve graphics through graphicspath directories 2026-10-24 23:35:14 +08:00
GloamXun 0f8aff7290 Embed project images in route-D previews and PDFs 2026-10-24 23:29:15 +08:00
gloamxun 00f95fdd09 Execute option declarations in local packages 2026-10-24 23:18:28 +08:00
gloamxun fe9e93f796 Inline local base classes from LoadClass 2026-10-24 23:14:01 +08:00
gloamxun 4b0e4eba0c Cache route-D project PDF exports 2026-10-24 23:10:09 +08:00
gloamxun 6d5a3eb686 Run local class option declarations 2026-10-24 23:07:51 +08:00
gloamxun 91a75820a4 Default to route-D with TEXRRA_ENGINE 2026-10-24 23:03:34 +08:00
gloamxun 0651e15111 Cache route-D project previews by expanded source 2026-10-24 22:47:19 +08:00
gloamxun f48b10340a Inline required local packages recursively 2026-10-24 22:32:41 +08:00
gloamxun 64325d4b87 Inline local class files in project previews 2026-10-24 22:30:23 +08:00
gloamxun a7f3680a13 Inline local style packages in project previews 2026-10-24 22:27:30 +08:00
gloamxun 6a4483cf4d Expand input files in project PDF exports 2026-10-24 22:10:08 +08:00
gloamxun 9599436447 Expand input and include files in project previews
Project previews now expand \input{...} and \include{...} from the
project store (adding a .tex suffix when needed) before route-D parses
the source. Unknown paths and cycles leave the directive as literal
text.
2026-10-24 20:56:54 +08:00
gloamxun c3277531d3 Export project PDFs through route-D when selected 2026-10-21 01:15:09 +08:00
gloamxun ea69301804 Reuse route-D page checkpoints in project previews 2026-10-20 23:13:49 +08:00
gloamxun fe7fd68321 Let project previews opt into the route-D core 2026-10-20 23:09:32 +08:00
gloamxun ec9ce3b765 Export route-D preview pages as PDF 2026-10-20 21:41:46 +08:00
gloamxun dbccedb579 Expose route-D page-hash diffs for paragraph edits 2026-10-20 21:18:57 +08:00
gloamxun 875f8a7600 Expose route-D pages through a preview endpoint 2026-10-20 21:15:35 +08:00
gloamxun bad477fbee Add compiler and server regression tests
Expose the compiler session as a library target, run core as a workspace member, and add direct typeset tests plus end-to-end HTTP tests. Coverage: examples, arXiv fixture, starred headings, rectangles, errors, page-hash cache stability, static frontend assets, project API, preview/PDF, traversal rejection, and the legacy endpoint.
2026-10-19 12:31:05 +08:00
gloamxun bb1d9e0561 Initial texrra engine
Rename the crate, binary, core crate, font families, env vars, and internal commands from texcraft/tex-engine to texrra. Serve the separately versioned texrra-web frontend from TEXRRA_WEB_DIR, ../web, or ./web instead of embedding index.html. Add starred section heading support and an arXiv template conformance fixture.
2026-10-19 11:41:46 +08:00