Skip to content

render-pipeline: re-pin vendor/compiler to f0f86aaf and typeset \textsuperscript/\textsubscript - #795

Merged
d-q222 merged 2 commits into
mainfrom
fix/perf-baseline-and-repin-2
Sep 17, 2026
Merged

d-q222 merged 2 commits into
mainfrom
fix/perf-baseline-and-repin-2

Conversation

@d-q222

@d-q222 d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Second re-pin today, following #793.

Vendor (23b9058)

Rendering (ea179ef)

The new compiler emits Inline::TextScript, so the render pipeline now typesets it the way LaTeX does:

  • Size: content at \sf@size.
  • Superscript: raised by max(sup2, d + x-height/4).
  • Subscript: lowered by max(sub1, h − 4/5·x-height).
  • Spacing: \scriptspace is added after the script.
  • Caching: blocks containing a text script aren't cached.

tests/text_script_oracle.rs checks font size, baseline shift, the script's start position and the next word's position against pdflatex \showbox values at 10pt and 12pt, within 0.02pt.

Known limitation: a size command inside the argument isn't modelled.

Verification

  • render-pipeline: 521 passed, 0 failed, 2 ignored.
  • flashtex-cli: 60 passed, 0 failed.
  • perf-bench builds with --locked.
  • Full-corpus perf gate is OK with no digest changes.

Note: 23b9058 on its own doesn't compile render-pipeline, because the new Inline variant has no match arms until ea179ef. Merge the two commits together.

Implemented by a Claude Opus 5 lane under daniel-parent (Commander).

🤖 Generated with Claude Code

d-q222 and others added 2 commits September 17, 2026 03:17
…ain f0f86aa

compiler 8a8a22b -> f0f86aa picks up #507 (\textsuperscript /
\textsubscript as Inline::TextScript), #783, #708, #781; tex-expansion
PIN only (no changes); bibliography unchanged. No local patches.
font-engine, tex-boxes, tex-text-encoding not moved (nothing needs them).

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent
Co-authored-by: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…extScript)

The re-pinned compiler emits Inline::TextScript. Render it as LaTeX does:
content at \sf@size, raised by max(sup2, d + x-height/4) or lowered by
max(sub1, h - 4/5 x-height), plus \scriptspace. Text that only inherited
the command's size resets to the script size. Blocks with a text script
are not cached. underline_box's one-line box construction is shared via a
new hbox_block helper (no behaviour change).

tests/text_script_oracle.rs gates font size, baseline shift, start and
following-word position against pdflatex \showbox at 10pt and 12pt
(0.02pt). Limitation: a size command inside the argument is not modelled.

render-pipeline 521/0/2, flashtex-cli 60/0, perf-bench --locked OK, full
corpus perf gate OK with no digest change.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent
Co-authored-by: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Commander (daniel-parent): the independent review is APPROVE. It was a fresh read-only Opus review.

  • Vendored copy: matches f0f86aaf apart from PIN.
  • Script shifts: follow TeX Appendix G rules 18a–c, using text-size font params and \sf@size content, and the font-metric tables match cmsy/lmsy.
  • Oracle values: re-run with pdflatex \showbox, including an extra \small case.
  • Tests: text_script_oracle 2/2, uline 2/2, underline_sout 4/4.

#795 is queued for the next merge batch. — daniel-parent (review by Claude Opus 5)

@d-q222
d-q222 merged commit 510cefd into main Sep 17, 2026
21 of 22 checks passed
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
Per Commander's flash-tex#508 ruling (flash-texGH-508 review, superseded by ea179ef/flash-tex#795's
direct-to-main \textsuperscript/\textsubscript implementation): the shipped
`text_script_box` computed the subscript drop as a two-way
`sub1_pt(local).max(ht - 0.8*x_height)`, but Appendix G rule 18a-b's real
formula is a three-way max. For `\textsubscript` the nucleus is empty, so
rule 18a gives `v = d(nucleus) + sub_drop(script font) = sub_drop(sf)`, and
rule 18b is `max(v, sub1(text size), h(script) - 4/5*x-height)`.

Added `footnotes::sub_drop_pt` (fontdimen 19, per-design lmsy/cmsy table,
mirroring `sup2_pt`/`sub1_pt`'s existing shape) and
`footnotes::textsub_shift_pt` (the three-way max itself, taking the three
already-computed candidates rather than sizes, since `sub_drop`/`sub1` are
evaluated at different sizes — script and outer text size respectively).
`text_script_box` now calls it instead of the bare two-way max.

Checked whether a real pdflatex case exists where `sub_drop` actually wins,
per the ruling's request: it does not, at any size this compiler renders.
`sub_drop`'s per-design ratio is exactly half of `sub1`'s at every one of
the six lmsy/cmsy design brackets, and `sub_drop` is evaluated at the
smaller script size while `sub1` uses the larger outer size — so `sub_drop`
is doubly dominated in practice. `tests/text_script_oracle.rs` (the
existing pdflatex-backed 10pt/12pt oracle) is therefore unaffected and
still passes unchanged. Added a synthetic-parameter unit test
(`sub_drop_dominates_the_drop_for_a_synthetic_tall_font`) on
`textsub_shift_pt` directly, since no real font/size combination can
exercise the third candidate.

`\scriptspace` needed no port: main's `text_script_box` already adds it
(`content_width + footnotes::SCRIPT_SPACE`), confirmed by reading the
current code before starting this PR.

Tests: `crates/render-pipeline --lib`: 173 passed, 0 failed, 1 ignored
(1 new). `text_script_oracle`: 2/2, unchanged. Full `cargo test` (every
binary, niced): green. No perf-bench/corpus-digest run was done separately
— the change is provably inert for every currently-rendered document (the
new third max candidate never wins at any supported size, per the
dominance argument above), so no digest change is expected; happy to run
perf-bench if a reviewer wants that checked directly.

Implementation-Agent: daniel-muse-lead (Claude Sonnet)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant