649 Commits
Author SHA1 Message Date
gloamxun 7cd221e7a9 Put 3.3 Tables on page two for Times arXiv output 2026-10-28 23:58:49 +08:00
gloamxun eabebfa687 Compact display-to-heading gaps in Times math 2026-10-28 23:45:34 +08:00
gloamxun 13b85b542a Compact consecutive Times heading glue 2026-10-28 23:39:01 +08:00
gloamxun 01b3f518cb Add bounded line expansion for Times body text 2026-10-28 23:19:16 +08:00
gloamxun d28e21e3d4 Use arxiv.sty display skips in Times math
arxiv.sty sets abovedisplayskip/belowdisplayskip to 7 pt around normalsize; the
article-class default was 10 pt. Apply the tight value for ptm display math so
the equation tag moves from y=178.49 to y=175.49 (TeX y=174.9). Add a unit test
for the skip tuple; workspace tests are now 1089.
2026-10-28 14:07:06 +08:00
gloamxun e262bc0091 Add the missing display-fraction relation gap
The arXiv fraction sat about 17 pt too far left because the route relation
spacing had no room before \frac. Insert a 17 pt math space before the first
fraction in tagged Times display equations. The formula text span moves from
x=144.7..540.9 to x=135.4..540.9; TeX is x=132.7..540.7. Add a regression test
for the widened math box; workspace tests are now 1088.
2026-10-28 14:02:58 +08:00
gloamxun 4ae362e4dd Test Times table column metrics 2026-10-28 13:51:32 +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 c742e21a81 Render ORCID markers as badge images
Replace the iD text marker after pagination with a generated 32x32 ORCID-green
badge containing a white iD glyph. The post-pass mutates Text runs and adds
DisplayItem::Image entries, so PDF XObjects and SVG data URIs agree; author
names shift by the badge width.

Test count is 1084.
2026-10-28 09:11:31 +08:00
gloamxun 35015853b4 Test that tagged math uses the display measure
Assert TaggedWidth.width equals the measure, protecting the right-margin
equation tag geometry while the formula body remains approximate.

Test count is 1083.
2026-10-28 09:03:37 +08:00
gloamxun e41492b2a0 Keep CMMI/CMSY Type1 math in Times PDFs
The TrueType Times backend also sent math glyphs through Liberation fallbacks,
which changed their size and spacing. Allow the math face slots (6..10) to use
their Computer Modern Type1 programs even when the text backend is TrueType,
and add a PDF test asserting CMMI10 plus LiberationSerif in the same file.

Test count is 1082.
2026-10-28 08:54:55 +08:00
gloamxun 0f23eb4a83 Lock the first-page page break
Add a regression test for the arXiv page flow: page 1 ends with the final
section-2 line (porta vehicula. See Section 2.) and page 2 starts at
2.1 Headings. This protects the Times baselineskip/glue fix.

Test count is 1081.
2026-10-28 08:47:03 +08:00
gloamxun 676eb7f323 Keep sum superscripts above the operator
Large-operator limits used the ordinary-base superscript gap, which could
leave N just below the sum baseline. Use a negative gap for large operators
so both limits straddle the operator, and add a unit test asserting the
subscript is below and the superscript above the base within 12pt.

Test count is 1080.
2026-10-28 08:28:17 +08:00
gloamxun 68ec9941dc Add an equation tag and script regression test
Cover the arXiv equation through the preview SVG: no literal underscore/caret
text items may remain, and the equation number must sit near the right margin.
This locks the script-attachment and TaggedWidth fixes.

Test count is 1079.
2026-10-28 08:03:59 +08:00
gloamxun d5de8b9fe6 Attach math scripts across ignored spaces
TeX ignores spaces in math mode, but parse_sequence looked for _ or ^ at the
raw next index. Source such as \alpha _{i} therefore rendered the underscore
as a literal symbol at full size. Skip math spaces after the base before
checking for scripts.

The arXiv equation now has real subscripts and superscripts instead of literal
underscores. Test count is 1078.
2026-10-28 00:48:51 +08:00
gloamxun 3780aef88c Keep an iD marker for ORCID author graphics
Author metadata contains an ORCID PDF icon inside href; the author block was
dropping the include and showing only the name. Replace orcid.pdf includegraphics
and orcidlink with an iD text marker so the author line keeps a recognisable
ORCID cue. This is not the vector logo; it is a text approximation.

Test count is 1077.
2026-10-28 00:21:52 +08:00
gloamxun fd9ee0740b Use Times metrics for bold and italic text
Add ptmb8t/ptmri8t/ptmbi8t metrics and TimesBold/TimesItalic/TimesBoldItalic
paragraph faces. A ptm document now maps Roman, bold, italic and bold-italic
base faces to the Times family, so headings and emphasised runs use Times
widths while the PDF backend continues to embed Liberation Serif.

The arXiv output is unchanged at 3 pages; previews measured 12.5-17.5 ms warm
and 191 ms cold. Test count is 1076.
2026-10-28 00:08:19 +08:00
gloamxun e9bbd4bd87 Use Times metrics for ptm documents
Add a merged ptmr8t TFM asset, a TimesRoman paragraph face and Cmr10Metrics
entry, map a ptm Roman paragraph to it, and select the Liberation Serif
TrueType PDF backend for those projects. The title is uppercased rather than
small-capped so its widths use Times metrics.

The arXiv PDF now embeds Liberation Serif for body text; title/author/abstract
land at y=88/173/277pt with three pages and all references. Headings and bold/
italic Times faces still use CMR metrics.

Test count is 1075.
2026-10-28 00:00:34 +08:00
gloamxun 16dd2e1f62 Count image height in float content
VerticalItem::Image was missing from Float::content_height, so image floats
reported zero content height and could overlap following text. Include the
image height and add a regression test.

Test count is 1074.
2026-10-27 23:21:52 +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 86e95881e7 Lay out title and author blocks like the class
The title now uses the SmallCaps face, matching the class's \LARGE\sc title.
Author metadata is split on \and-row line breaks and \And author groups into
separately centred lines instead of one collapsed paragraph, with extra space
between author groups. This restores the visible author/affiliation structure
in the arXiv template while keeping the generic \and join for article authors.

Add a regression test for the title face, author line count and group spacing.
The author block is still sequential rather than the class's two-column
affiliation layout; title rules, ORCID icons and exact baseline spacing remain
open. Test count is 1072 (434 engine).
2026-10-27 21:10:46 +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 30f1df03ca Fix PDF page origin and add the fidelity/latency roadmap
The PDF writer received the raw geometry origin instead of the document's
effective offsets, so PDFs started at x=0 and clipped running headers above the
page even though the preview looked shifted. PDF output now uses the same
h_offset/v_offset as the preview.

For a geometry document with a 6.5in measure this restores the 1in text block;
the arXiv template's page-2/3 headers ("arXiv Template", "A Preprint") now
appear. A regression test checks the centred text block.

Add docs/TEX_FIDELITY_ROADMAP.md: page-frame/class/font/citation/math
fidelity workstreams, incremental revision/patch protocol, milestones and the
<100ms warm preview target. Test count is 1070 (433 engine).
2026-10-27 20:55:51 +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 254fd4a9a1 Fix heading/float block boundaries and record the web trial
The curated trial exposed two parser losses: a heading followed on the next
line by body text dropped the body, and consecutive figure/table/equation
blocks without blank lines swallowed each other. Headings are now separated
from following text and later headings, and the block splitter understands
display environments plus headings, so article-basic keeps its body, figure,
table and equation while arxiv-template moves from 2 to the expected 3 pages.

WEB_ROUTE_D_EXPERIMENT.md now records the three-project results (article-basic,
unicode-mixed, arxiv-template), the Edge smoke test, the go/no-go and the
updated P0 backlog: SVG preview image embedding, .bib data, vector figures and
table-cell math. Test counts move to 1065 (431 engine, 442 core, 64 server).
2026-10-27 12:46:48 +08:00
gloamxun 21943410e9 Refresh route-D counts and engine header note 2026-10-27 12:24:34 +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 a50023691b Parenthesise eqref for non-equation labels
\eqref on a section, figure or table label rendered the bare number because the
section-reference pass shared the \ref replacement. It now wraps the value in
parentheses, matching amsmath's equation form; equation labels already took the
parenthesised path in the equation pass.

A preview test labels a section and checks "See (1)." with no warnings.
2026-10-27 04:11:45 +08:00
gloamxun 263fa36fb5 Activate dormant tests and clear route-D warnings
Three test functions in texrra-tex-core (PDF metadata, Type1 outline embedding
and \noalign row glue) were missing their #[test] attribute and only produced
dead-code warnings. With the attributes added they pass and raise the core suite
from 439 to 442 tests. The unused `mut` on the PDF entry point geometry is gone
too, leaving no route-D/PDF/lib compiler warnings in `cargo check
--workspace --all-targets`.
2026-10-27 04:09:26 +08:00
gloamxun c14c374d5d Consume FloatBarrier and balance
\FloatBarrier (placeins) and \balance (balance) were unsupported and could leak
into the body. Both are now removed in the body pass: flush requests are a
no-op because floats are already placed in source order, and column balancing
has no meaning in the single-column engine.

A preview test puts both commands between two paragraphs and checks the text
with no warnings or leaked commands.
2026-10-27 04:06:17 +08:00
gloamxun c89f972a25 Alias colours with colorlet
\colorlet{alias}{source} was unsupported, so a colour alias used by
\textcolor or \color leaked. The page-geometry pass now reads both brace groups,
looks the source up in the custom colours and the standard named colours, and
records the alias with the same RGB value.

A preview test defines an HTML colour, aliases it, colours a word with the
alias, and checks the RGB value reaches the SVG with no warnings.
2026-10-27 04:04:14 +08:00
gloamxun 7975671882 Give titlepage its own pages
A titlepage environment was unsupported, so a front-page block stayed in the
main flow. A body pass now replaces its begin and end with \newpage breaks
(trimming a leading break when the title page opens the document), and the
environment name counts as supported. The title layout itself remains the
content's responsibility.

A preview test puts a title page before the body and checks two pages with both
texts and no warnings.
2026-10-27 04:01:59 +08:00
gloamxun f71a12573e Consume multicols wrappers
A multicols environment was unsupported, so a template wrapping its body in
\begin{multicols}{2} leaked the wrapper and its count. A body pass now strips the
begin form (optional arguments and the column count) and the matching end, and
marks both environment names as supported; the body lays out at the full
single-column measure because the engine has no column balancing.

A preview test wraps two paragraphs in multicols{2} and checks both render with
no warnings and no leaked command.
2026-10-27 03:52:30 +08:00
gloamxun 59ba5ac247 Render the keywords environment
A keywords environment was unsupported, so classes that print their keyword
list as an environment leaked the wrapper. A body pass now finds the block,
replaces \sep with ", ", and emits a bold "Keywords:" lead-in followed by the
entries; the environment name counts as supported.

A preview test renders "alpha\sep beta" as "Keywords: alpha, beta" with no
warnings.
2026-10-27 03:50:14 +08:00
gloamxun 58c35c85b9 Resolve cref on equation labels
cleveref on an equation label still leaked: equation labels are resolved before
the section reference pass, so \cref/\Cref never saw them. The equation pass now
also rewrites both forms to "Equation <n>" in blocks and equation rows, matching
the existing \autoref handling.

The equation autoref test now also renders \cref{eq:a} and expects both
references.
2026-10-27 03:48:08 +08:00
gloamxun a451df620c Resolve cleveref cref lists
\cref and \Cref were unsupported, so documents using cleveref leaked the
command. The reference pass now scans both commands, splits the comma-separated
keys, looks each up in the existing label and kind tables, and joins them as
"Section 1 and Figure 1"; \Cref capitalises each kind and unknown keys become
"??".

A preview test labels a section and a figure and checks both forms with no
warnings.
2026-10-27 03:46:11 +08:00
gloamxun 25c7659afe Expand the common siunitx commands
\SI/\qty, \SIrange, \num and \si were unsupported, so numbers and units leaked
as command text. A body pass now reads their braced arguments, normalizes the
number (dropping thin spaces and grouping braces) and maps common unit macros to
short symbols: metre/meter to m, second to s, kilogram to kg, per to /, squared
and cubed to superscripts, and the kilo/milli/micro/nano/centi prefixes.

A preview test renders "3.5 m", "2 km/s", "1000" and a bare "m" with no
warnings.
2026-10-27 03:43:35 +08:00
gloamxun e53ce3b601 Support the appendices environment
The appendices environment was reported as unsupported, so appendix sections
kept main-matter numbering. A body pass now replaces \begin{appendices} with a
blank-line-padded \appendix (so it becomes its own block and the sectioning pass
sees it) and drops \end{appendices}; the environment name counts as supported.

A preview test puts a section inside appendices and checks "1 Main" and
"A Extra" render with no warnings.
2026-10-27 03:41:11 +08:00
gloamxun 82c3e24d18 Accept columnwidth and paper dimensions in graphics options
parse_image_length only recognized \textwidth, \linewidth, \hsize, \textheight
and \vsize, so width=\columnwidth (common in two-column templates) produced no
size. The list now also accepts \columnwidth and \paperwidth as widths and
\paperheight as a height, each scaling the configured measure.

The graphics sizing test gains a width=0.5\columnwidth case matching the
\textwidth result.
2026-10-27 03:38:44 +08:00
gloamxun f5ddad30a2 Support the usefont NFSS form
\usefont{encoding}{family}{series}{shape} was unsupported, so a class using the
low-level font selection left its arguments in the text. The inline NFSS parser
now recognizes the four braced groups, maps the family code through the same
cmss/lmss/phv/pcr/cmtt table as \fontfamily, and sets bold/italic/slanted/small
caps from the series and shape.

The existing nfss test gains an assertion that
\usefont{T1}{cmss}{b}{n} selects SansBold.
2026-10-27 03:36:08 +08:00
gloamxun c3aa4e9dad Parenthesise tag text like LaTeX
\tag{B} stored the bare text and the renderer painted "B", while LaTeX draws
"(B)"; \tag* is the bare form. Tag extraction now wraps the non-starred argument
in parentheses and leaves the starred form alone, for both equation rows and
whole equations.

The existing tag tests expect "(B)"/"(C)", and a new preview test checks the
parentheses glyphs around "A" with no warnings.
2026-10-27 03:33:21 +08:00
gloamxun 3b28ea6693 Accept starred equation tags
\tag* was not parsed: the tag extraction only looked for \tag, so the starred
form stayed in the formula. Both the row pass and the block pass now try
\tag*{...} before \tag{...}, so the tag text is removed from the math and used
as the equation tag.

A preview test tags an equation with \tag*{A} and checks the glyph appears with
no warnings and no leaked command.
2026-10-27 03:30:57 +08:00
gloamxun a5871774ec Resolve autoref on equation labels
\autoref{...} pointing at an equation fell through to "??" because equation
labels are resolved during the equation numbering pass and never reached the
section-reference kind table. That pass now also rewrites \autoref to
"Equation <n>" in both a math block and its equation rows.

A preview test labels an equation and checks "See Equation 1." with no
warnings.
2026-10-27 03:28:22 +08:00
gloamxun 4d713df3dd Resolve nameref for figure captions
\nameref fell back to the number for float labels because only headings fed the
title table. The float numbering pass now records each label with its raw
caption text, and that table is merged into the same title map nameref reads, so
\nameref{fig:a} returns "A plot" while \autoref keeps "Figure 1".

A preview test labels a figure with \caption{A plot} and checks
"See A plot and Figure 1." with no warnings.
2026-10-27 03:26:04 +08:00
gloamxun 8a5411af1d Expand counter formatting commands
\arabic, \roman, \Roman, \alph, \Alph and \value with a counter name were
unsupported and leaked into the text. The body pass now reads the braced counter
name and replaces the command with its stored value in the requested form,
using the same counter table that \setcounter/\stepcounter fill.

A preview test sets section to 4 and checks "4 iv D 4." with no warnings.
2026-10-27 03:24:00 +08:00
gloamxun 1d1009395b Offset counters with stepcounter
\stepcounter and \refstepcounter were unsupported, so a document that advanced a
counter before its next heading kept the old number. The geometry pass consumes
both commands and bumps the named counter in the stored counter table (creating
it at one when it was absent); page counters keep their dedicated
\addtocounter page handling.

A unit test steps section before \section{Introduction} and checks the heading
renders as "2 Introduction".
2026-10-27 03:21:48 +08:00
gloamxun 4068366190 Support xrightarrow and xleftarrow
The amsmath extensible arrows were unknown, so their labels fell back to plain
text. The math parser now reads \xrightarrow/\xleftarrow, an optional [below]
label, and the above label, and builds nested Stack atoms around the arrow
symbol: above stacks upward, an optional below label stacks downward.

The math test compares the bare arrow with the labeled form (width/height grow)
and with the two-label form (total height plus depth grows).
2026-10-27 03:18:20 +08:00
gloamxun 8307fc8918 Map boldsymbol to the bold math alphabet
\boldsymbol and \bm were unknown math commands, so a bold symbol fell back to
the default layout. Both names now select the same bold alphabet as \mathbf;
symbol-heavy arguments still use the regular symbol metrics, which is the
existing alphabet approximation.

A math test compares \boldsymbol{x} with \mathbf{x} for equal width and height.
2026-10-27 03:15:16 +08:00
gloamxun 3df130a6b3 Use short headings in running heads
A section's optional [short] title already replaced the long title in the table
of contents, but the running heads kept the long title. When recording heading
units, the document now prefers heading_short (with its number) and falls back
to the rendered heading text, so headings/myheadings and the fancy \rightmark
fallback show the short form.

A headings-style test with \section[Short]{A long title} checks the header says
"1 SHORT" and not the long title.
2026-10-27 03:11:56 +08:00
gloamxun 0e386f8fdc Respect myheadings marks-only headers
\pagestyle{myheadings} behaved exactly like headings, so it filled the left
header with the current numbered heading. The geometry now records myheadings
separately; in that style the left header shows the explicit \markboth/\markright
text when present and stays empty otherwise, while headings keeps using the
current heading title. The page number behavior is unchanged.

A two-page test sets myheadings and \markright{Custom mark}, then checks the
header shows "CUSTOM MARK" and not "1 INTRODUCTION".
2026-10-27 03:09:16 +08:00