Skip to content

render-pipeline: paint \uline, \sout and text \underline rules (#312, #330; stacked; needs vendor/compiler re-pin) - #329

Closed
d-q222 wants to merge 18 commits into
mainfrom
agent/daniel-parent/uline-gh312
Closed

d-q222 wants to merge 18 commits into
mainfrom
agent/daniel-parent/uline-gh312

Conversation

@d-q222

@d-q222 d-q222 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Part 2 of #312, stacked on #328. Lane daniel-parent, claim GH-312.

Change (crates/render-pipeline/src and tests only; no vendor/ edits)

Why draft

This PR does not build against main's frozen vendor/compiler (E0599 no variant Underline, 4 errors) until the integration lane re-pins vendor/compiler past #328. Once the re-pin lands, retarget to main, rebase and run the gate.

Tests (worker, on the combined branch before the split, b128ecdc)

Pipeline --lib 79/0 and --test uline 2/0. These must be re-run after the re-pin.

Provenance

cursor-agent cursor-grok-4.6-high-fast; daniel-parent reviewed.


Update: #330 folded in

Adds the painting for MathUnderline (kernel \underline) and Strike (ulem \sout), plus tests/underline_sout.rs, which checks against pdflatex within 0.01pt. The worker ran it against a scratch vendor/compiler copy that was reverted and never pushed: --lib 85/0, uline 2/0, underline_sout 4/0. It still builds only after the vendor/compiler re-pin past #328. agent/daniel-parent/uline-gh312 @ 2c8fef0e; its diff vs #328's branch is pipeline-only.

d-q222 and others added 2 commits September 13, 2026 23:13
)

With ulem loaded, \uline{...} emits Inline::Underline and a 0.4pt rule
whose top sits at \dp of \hbox{(j} (max of '(' and 'j'; 0.25em for
cmr/lmr). Kernel text-mode \underline is unchanged (math-rule geometry).
Single-line unbreakable fragment; ulem leaders can wrap.

pdflatex (TeX Live 2026) \uline{word}: 10pt rule(-2.5+2.9); 12pt
rule(-3.0+3.4).

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-uline):
- compiler lib: test result: ok. 298 passed; 0 failed
- compiler --test uline: test result: ok. 3 passed; 0 failed
- compiler --test supported_latex: test result: ok. 8 passed; 0 failed
- compiler --test robustness --skip deeply_nested_input_does_not_blow_the_stack:
  test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Stacked on agent/daniel-parent/uline-compiler (5567522). Diff vs that
branch is crates/render-pipeline/src and tests only. vendor/ is origin/main's
frozen snapshot (VENDORING.md); this crate does not build until the
integration lane re-pins vendor/compiler past the compiler PR. That is
expected.

Paints a 0.4pt rule whose top is \dp of \hbox{(j} (0.25em for cmr/lmr)
below the baseline, matching pdflatex 10pt rule(-2.5+2.9) and 12pt
rule(-3.0+3.4) within 0.01pt.

cargo check --manifest-path crates/render-pipeline/Cargo.toml --tests:
error[E0599] no variant Underline on vendor flashtex_compiler::parser::Inline
(4 errors). Will compile after the re-pin.

This lane branch was reset onto the compiler SHA (from b128ecd) then this
commit added; push uses --force-with-lease.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
d-q222 and others added 6 commits September 13, 2026 23:24
Reproduction tests: \underline{under} and \usepackage[normalem]{ulem}
\sout{struck} currently drop their argument (unsupported recovery treats
the single lowercase word as a parameter). Tests require the text to
survive and a rule to be laid out. \uline geometry is unchanged.

pdflatex (TeX Live 2026, /Library/TeX/texbin/pdflatex):
- theta = \fontdimen8\textfont3 = 0.39998pt at both 10pt and 12pt (cmex10)
- \underline{under}: inner dp=0; kern 1.19994 (=3theta); rule(0.39998+0.0);
  outer dp=1.9999 (=5theta). 12pt same theta/kern/rule (cmex10 unscaled).
- \sout{struck}: 10pt rule(2.76805+-2.36806); 12pt rule(3.24167+-2.84167)
  (0.55ex + 0.4pt height, depth -0.55ex). ex 10pt=4.30554, 12pt=5.16667.
- \uline{word} still 10pt rule(-2.5+2.9), 12pt rule(-3.0+3.4).

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-ulsout):
- control compiler --lib: test result: ok. 298 passed; 0 failed
- control compiler --test uline: test result: ok. 3 passed; 0 failed
- control compiler --test supported_latex: test result: ok. 8 passed; 0 failed
- compiler --test underline_sout: test result: FAILED. 0 passed; 4 failed
- control pipeline --tests: error[E0599] no variant Underline (vendor, expected)

Next: generalise Inline::Underline with kernel/\sout geometry; keep \uline
byte-identical. Pipeline paint in a later commit (no vendor/ edits).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Generalise Inline::Underline with UnderlineGeom rather than duplicating
the wrapper. \uline stays UlemDescender + 0.4pt (0.25em top); its tests
still pass. Kernel \underline is latex.ltx $\@@underline{\hbox{#1}}$
(TeXbook Rule 10 / tex.web §735): θ=0.39998pt from cmex10 \fontdimen8
(unscaled at 10pt and 12pt), rule top 3θ below hbox depth, extra depth
5θ. \sout is \ULdepth=-.55ex; \UL@setULdepth is a no-op when ULdepth is
not \maxdimen, so the rule is height 0.55ex+0.4pt depth -0.55ex.

pdflatex: \underline{under} kern 1.19994 rule(0.39998+0.0) outer dp
1.9999 at both sizes. \sout{struck} 10pt rule(2.76805+-2.36806), 12pt
rule(3.24167+-2.84167). \uline{word} still 10pt rule(-2.5+2.9), 12pt
rule(-3.0+3.4). Arguments are no longer dropped.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-ulsout):
- compiler --lib: test result: ok. 298 passed; 0 failed
- compiler --test uline: test result: ok. 3 passed; 0 failed
- compiler --test underline_sout: test result: ok. 4 passed; 0 failed
- compiler --test supported_latex: test result: ok. 8 passed; 0 failed
- compiler --test robustness --skip deeply_nested_input_does_not_blow_the_stack:
  test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out

Next: pipeline paint of kernel/\sout geometry (src|tests only; no vendor/).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Stacked on the compiler commit. Diff is crates/render-pipeline/src and
tests only. vendor/ is origin/main's frozen snapshot; this crate does
not build until the integration lane re-pins vendor/compiler past the
compiler commits (UnderlineGeom). Expected.

Paints the same geometries as the compiler: \uline 0.4pt top at (j
depth; kernel \underline θ=0.39998pt top at box_depth+3θ (TFM depth);
\sout 0.4pt top at -(0.55ex+0.4pt). Local scratch vendor copy:
--test uline ok 2/0, --test underline_sout ok 4/0, --lib ok 85/0.
That copy was reverted and is not in this commit.

cargo check --tests after restore: error[E0432] UnderlineGeom and
error[E0599] no variant Underline on vendor Inline.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Reproduction tests: \underline{under} and \usepackage[normalem]{ulem}
\sout{struck} currently drop their argument (unsupported recovery treats
the single lowercase word as a parameter). Tests require the text to
survive and a rule to be laid out. \uline geometry is unchanged.

pdflatex (TeX Live 2026, /Library/TeX/texbin/pdflatex):
- theta = \fontdimen8\textfont3 = 0.39998pt at both 10pt and 12pt (cmex10)
- \underline{under}: inner dp=0; kern 1.19994 (=3theta); rule(0.39998+0.0);
  outer dp=1.9999 (=5theta). 12pt same theta/kern/rule (cmex10 unscaled).
- \sout{struck}: 10pt rule(2.76805+-2.36806); 12pt rule(3.24167+-2.84167)
  (0.55ex + 0.4pt height, depth -0.55ex). ex 10pt=4.30554, 12pt=5.16667.
- \uline{word} still 10pt rule(-2.5+2.9), 12pt rule(-3.0+3.4).

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-ulsout):
- control compiler --lib: test result: ok. 298 passed; 0 failed
- control compiler --test uline: test result: ok. 3 passed; 0 failed
- control compiler --test supported_latex: test result: ok. 8 passed; 0 failed
- compiler --test underline_sout: test result: FAILED. 0 passed; 4 failed
- control pipeline --tests: error[E0599] no variant Underline (vendor, expected)

Next: generalise Inline::Underline with kernel/\sout geometry; keep \uline
byte-identical. Pipeline paint in a later commit (no vendor/ edits).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Generalise Inline::Underline with UnderlineGeom rather than duplicating
the wrapper. \uline stays UlemDescender + 0.4pt (0.25em top); its tests
still pass. Kernel \underline is latex.ltx $\@@underline{\hbox{#1}}$
(TeXbook Rule 10 / tex.web §735): θ=0.39998pt from cmex10 \fontdimen8
(unscaled at 10pt and 12pt), rule top 3θ below hbox depth, extra depth
5θ. \sout is \ULdepth=-.55ex; \UL@setULdepth is a no-op when ULdepth is
not \maxdimen, so the rule is height 0.55ex+0.4pt depth -0.55ex.

pdflatex: \underline{under} kern 1.19994 rule(0.39998+0.0) outer dp
1.9999 at both sizes. \sout{struck} 10pt rule(2.76805+-2.36806), 12pt
rule(3.24167+-2.84167). \uline{word} still 10pt rule(-2.5+2.9), 12pt
rule(-3.0+3.4). Arguments are no longer dropped.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-ulsout):
- compiler --lib: test result: ok. 298 passed; 0 failed
- compiler --test uline: test result: ok. 3 passed; 0 failed
- compiler --test underline_sout: test result: ok. 4 passed; 0 failed
- compiler --test supported_latex: test result: ok. 8 passed; 0 failed
- compiler --test robustness --skip deeply_nested_input_does_not_blow_the_stack:
  test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out

Next: pipeline paint of kernel/\sout geometry (src|tests only; no vendor/).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
@d-q222 d-q222 changed the title render-pipeline: paint ulem \uline's rule (#312, stacked; needs vendor/compiler re-pin) render-pipeline: paint \uline, \sout and text \underline rules (#312, #330; stacked; needs vendor/compiler re-pin) Sep 14, 2026
…mpiler inventory

The integration triage on #2 (5661305277) found this PR regenerates
crates/compiler/supported/supported-latex.json without the Mac bundled copy,
so CompletionTests.testBundledInventoryMatchesTheCompiler would fail once it
lands. Merged current main (which carries #327's sync), regenerated with
crates/compiler/scripts/render_supported_latex.sh, and copied the inventory
byte-for-byte to apps/mac/Sources/FlashTeXMac/Resources/supported-latex.json.
supported_latex 8/0.

Commit-Executor: Claude Code (daniel-parent, mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…em package entries; regenerate inventory and sync Mac copy

supported.rs conflict: #380 added the natbib PACKAGES entry where this branch
added ulem; kept both (alphabetical). Generated files regenerated with
render_supported_latex.sh; Mac bundled copy byte-identical.

Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@d-q222

d-q222 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Base note: #328 was superseded by #390 (same commits rebased by the integration lane), so this draft now targets main. Until #390 lands, its diff includes #390's compiler commits. It still needs the vendor/compiler re-pin past #390 before it builds.

Only generated docs/user/compiler.md conflicted; took main's (the compiler half
is now on main, so this branch's compiler files equal main's).

Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…s Item::LeaveVmode

adapter.rs and incremental.rs conflicts were two additive Item variants (and
their hash_items arms) at the same place; kept both.

Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 14, 2026
Removed the Inline::Underline arms Codex had added to adapter.rs (inline_span,
the items_cached hash with tag 18, and the items_from_inlines_styled content
arm). #329 (agent/daniel-parent/uline-gh312) already handles Underline there
and paints the rule; keeping both would conflict and duplicate. Against the
re-pinned vendor, the three matches need a wildcard until #329 lands, so
merge order is #402 -> re-pin + #329 -> this branch, which then drops the
wildcards in favour of #329's arms.

Tests (Codex, alternate CARGO_TARGET_DIR, dirty re-pinned vendor):
fill_leaders `test result: ok. 4 passed; 0 failed`; lib `test result: ok. 107 passed; 0 failed`.

Implementation-Agent: codex gpt-5.6-luna (max), wildcard comments by daniel-parent
Commit-Executor: daniel-parent (Claude Code), direct git (Codex sandbox could not write .git on resume)
Lane-Owner: daniel-parent (mac-m5pro-dq222)

Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
GoKubar added a commit that referenced this pull request Sep 14, 2026
…n `par-leading` on

`vendor/compiler` is re-pinned to `faa7d484` (WIP commit df05f74); this makes
the pipeline compile against what it finds there and switches `par-leading` on.

`par-leading` was inert: #437's `Block::Paragraph::leading_pt` needs #436's
`Parsed::block_par_leading`, which the old pin did not carry. Measured end to
end from a clean checkout, not inferred from a green build: `{\small ...\par}`
in an 11pt article now sets baselines 11.955 bp apart, exactly pdflatex's
11.955 bp (`\small` = 12pt in size11.clo); the old pin gave 13.549 bp, i.e.
`\normalsize`, wrong by 1.594 bp per line.

Three moved compiler APIs, none swallowed by a wildcard arm:

* `Inline::HFill { leader }` (#320). The glue is set exactly — `\hrulefill`
  and `\dotfill` are `\leavevmode\leaders<box>\hfill\kern\z@`, so all three
  parts are emitted. Both extras are load-bearing: `\leavevmode` keeps a lone
  `\hrulefill` paragraph from being dropped along with the `\vspace` before it
  (that took `enumitem-worksheet` from 3 pages to 2), and `\kern\z@` stops
  TeX's end-of-paragraph final-glue deletion (tex.web §816) from eating a
  trailing fill. The leader box is *not* painted — this pipeline has no
  leaders outside `typeset/toc.rs`, and paragraph-layout reports no per-glue
  set width — so every occurrence is lowered with a typed `unsupported_inline`
  warning naming the command. `fixtures/divergence-probes/min-hrulefill`, which
  recorded `Date:` 198.51 bp left of pdflatex, is now 0.55 bp from the oracle.
* `Diagnostic.labels`/`.notes`/`.help` (#346/#389). display-list-v2's
  diagnostic is `additionalProperties: false` over `{code, message, severity,
  sources}`, so rather than invent wire fields, `from_compiler` folds them onto
  the fields that already mean the same thing: label spans join `sources`,
  their texts plus notes and help become `[note: …]`/`[help: …]` clauses on
  `message`, and `help.replacement` back-fills `suggestion`. One line only —
  `flashtex-render --tex` prints `severity[code] message (line:col)` per line.
* `Inline::Underline` (#328/#390). PR #329 was written for this re-pin, is
  pipeline-only and applied cleanly; its only integration gap was a `VBlock`
  literal predating `broken_penalty`.

The pin itself also starts warning `unsupported_feature` for
`\usepackage{amsmath}`, which `e44d5917` did not. That line is user-visible on
every amsmath document and claims "not implemented" about constructs this
pipeline does set — a cross-crate disagreement for the owners, not something a
re-pin settles. `tests/amsmath_inline.rs` excludes that one wording by a
documented predicate and stays strict about everything else.

Gates: render-pipeline 295 passed / 0 failed / 2 ignored (254 before);
compiler 588 / 0 / 4; amsmath 59/59; tabular 106/106; HW1 and HW2 3 pages,
0 errors, 0 font-FAILURE diagnostics; corpus page counts 22/22.

Corpus geometry (rank.py, same pdf-exact, only the producer varying), before →
after: dx 85.74% → 85.61%, dy 75.04% → 75.73%, both 68.97% → 69.11%, aligned
words 15073 → 15099, reflowed 131 → 129. 21 of 22 fixtures are bit-identical;
all movement is `enumitem-worksheet` (dy +34.14 pp, aligned 332 → 357) plus one
word in `unicode-accents`. That fixture's dx percentage falls 2.75 pp while its
absolute count rises 157 → 159: 25 more words are measured, and the new ones
sit outside 0.5 bp because the leader rule is still unpainted.

No other vendor directory needed re-pinning; the four that differ from `main`
do so by their own rows' deliberate choices, and the vendored compiler
type-checks against them.

Implementation-Agent: Claude Opus 5 (lane vendor-repin-2, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 14, 2026
… catch the pipeline up to it (#451)

* WIP: vendor/compiler re-pinned to faa7d48 + par-leading enabled (does not compile yet)

* render-pipeline: build against the re-pinned vendor/compiler, and turn `par-leading` on

`vendor/compiler` is re-pinned to `faa7d484` (WIP commit df05f74); this makes
the pipeline compile against what it finds there and switches `par-leading` on.

`par-leading` was inert: #437's `Block::Paragraph::leading_pt` needs #436's
`Parsed::block_par_leading`, which the old pin did not carry. Measured end to
end from a clean checkout, not inferred from a green build: `{\small ...\par}`
in an 11pt article now sets baselines 11.955 bp apart, exactly pdflatex's
11.955 bp (`\small` = 12pt in size11.clo); the old pin gave 13.549 bp, i.e.
`\normalsize`, wrong by 1.594 bp per line.

Three moved compiler APIs, none swallowed by a wildcard arm:

* `Inline::HFill { leader }` (#320). The glue is set exactly — `\hrulefill`
  and `\dotfill` are `\leavevmode\leaders<box>\hfill\kern\z@`, so all three
  parts are emitted. Both extras are load-bearing: `\leavevmode` keeps a lone
  `\hrulefill` paragraph from being dropped along with the `\vspace` before it
  (that took `enumitem-worksheet` from 3 pages to 2), and `\kern\z@` stops
  TeX's end-of-paragraph final-glue deletion (tex.web §816) from eating a
  trailing fill. The leader box is *not* painted — this pipeline has no
  leaders outside `typeset/toc.rs`, and paragraph-layout reports no per-glue
  set width — so every occurrence is lowered with a typed `unsupported_inline`
  warning naming the command. `fixtures/divergence-probes/min-hrulefill`, which
  recorded `Date:` 198.51 bp left of pdflatex, is now 0.55 bp from the oracle.
* `Diagnostic.labels`/`.notes`/`.help` (#346/#389). display-list-v2's
  diagnostic is `additionalProperties: false` over `{code, message, severity,
  sources}`, so rather than invent wire fields, `from_compiler` folds them onto
  the fields that already mean the same thing: label spans join `sources`,
  their texts plus notes and help become `[note: …]`/`[help: …]` clauses on
  `message`, and `help.replacement` back-fills `suggestion`. One line only —
  `flashtex-render --tex` prints `severity[code] message (line:col)` per line.
* `Inline::Underline` (#328/#390). PR #329 was written for this re-pin, is
  pipeline-only and applied cleanly; its only integration gap was a `VBlock`
  literal predating `broken_penalty`.

The pin itself also starts warning `unsupported_feature` for
`\usepackage{amsmath}`, which `e44d5917` did not. That line is user-visible on
every amsmath document and claims "not implemented" about constructs this
pipeline does set — a cross-crate disagreement for the owners, not something a
re-pin settles. `tests/amsmath_inline.rs` excludes that one wording by a
documented predicate and stays strict about everything else.

Gates: render-pipeline 295 passed / 0 failed / 2 ignored (254 before);
compiler 588 / 0 / 4; amsmath 59/59; tabular 106/106; HW1 and HW2 3 pages,
0 errors, 0 font-FAILURE diagnostics; corpus page counts 22/22.

Corpus geometry (rank.py, same pdf-exact, only the producer varying), before →
after: dx 85.74% → 85.61%, dy 75.04% → 75.73%, both 68.97% → 69.11%, aligned
words 15073 → 15099, reflowed 131 → 129. 21 of 22 fixtures are bit-identical;
all movement is `enumitem-worksheet` (dy +34.14 pp, aligned 332 → 357) plus one
word in `unicode-accents`. That fixture's dx percentage falls 2.75 pp while its
absolute count rises 157 → 159: 25 more words are measured, and the new ones
sit outside 0.5 bp because the leader rule is still unpainted.

No other vendor directory needed re-pinning; the four that differ from `main`
do so by their own rows' deliberate choices, and the vendored compiler
type-checks against them.

Implementation-Agent: Claude Opus 5 (lane vendor-repin-2, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

* render-pipeline: an appended `[help: …]` clause must not defeat the package supersede

Regression in this branch, found in review of #451. `from_compiler` appends the
compiler's structured `help`/`notes` to `message` as ` [help: …]` clauses;
`packages::supersede_message` ends its match with

    strip_suffix(" are recognised but not implemented")

so with a clause on the end the match failed, the `else` branch returned the
message unchanged, and every superseded `\usepackage` diagnostic leaked into the
render output. Not just amsmath: every package in `implemented_by_pipeline` —
amsfonts, lmodern, microtype, geometry, graphicx, tikz — and the mixed list too,
where `packages amsmath, booktabs, …` should be trimmed to `booktabs` and was
instead shown in full, telling the reader this pipeline does not implement things
it does.

`split_clauses` now peels trailing clauses off the body before matching and
re-attaches them to whatever survives a trimmed list. It keys on the clause
*shape* — ` [<label>: <text>]` with a plain-word label, bracket-depth aware so
clause text may contain brackets and a body merely ending in `]` is not eaten —
rather than on the two labels that exist today, so a third kind appended later
needs no further fix. `preamble_command_superseded` reads the body too: `lib.rs`
calls it on the compiler's diagnostic *before* the conversion, so it was not
leaking, but it compares the whole message for equality and would the moment that
call moved.

Measured on the owner's fixtures, before → after: HW1 6 → 4 diagnostics, HW2
9 → 7, `unsupported_feature` leaks 2 → 0 in each; what remains is
`math_resource_profile`, which is informational.

This also retracts a wrong conclusion in the previous commit. I had reported the
amsmath warning as purely a consequence of the re-pin and loosened
`tests/amsmath_inline.rs` to tolerate it. The pin does newly emit it, but it never
reaches a consumer — the supersede drops it — so it was visible only because of
the bug above. That test is restored to `main`'s strict assertion and passes 11/11
on its own.

Tests: `packages` unit tests for a superseded message with a clause (each of the
eight packages), the mixed list with a clause, several clauses, clause text
holding brackets, and bodies that merely end in `]`; plus two end-to-end tests in
`compiler_diagnostic_forward` covering the real render path, which is where the
clause actually gets appended. The existing `supersede_message` tests all used
bare messages, which is why this got through.

Gates re-run: render-pipeline 303 passed / 0 failed / 2 ignored; amsmath 59/59;
tabular 106/106; HW1 and HW2 3 pages, 0 errors, 0 font-FAILURE diagnostics;
corpus page counts 22/22. Corpus geometry is unchanged by this commit (dx 85.61%,
dy 75.73%, both 69.11%, aligned 15099) — the supersede moves diagnostics, not
glyphs.

Implementation-Agent: Claude Opus 5 (lane vendor-repin-2, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

---------

Co-authored-by: Claude Opus 5 <[email protected]>
@d-q222

d-q222 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

daniel-parent: landed via #451, which wired this PR's Inline::Underline rendering into the re-pin (its words: "#329 was viable and is wired in rather than reimplemented"). Closing as merged-by-other-PR; issue #312 can be closed against #451 once it's verified in the app.

@d-q222 d-q222 closed this Sep 14, 2026
GoKubar added a commit that referenced this pull request Sep 14, 2026
…from listings, Underline from #329)

The merge conflict spanned a closing brace: HEAD's `Item::Lap` arm in
`hash_items` ended after the `=======` marker, so a naive union of the two
sides dropped one `}` and left the function unclosed. Both variants and both
match arms are kept; the discriminants (202 Lap, 12 Underline) do not clash.

cargo test --release --no-fail-fast on crates/render-pipeline: 353 passed, 0 failed.
GoKubar added a commit that referenced this pull request Sep 14, 2026
…xed columns, numbers, caption, frame space (#453)

* render-pipeline: `\lstset` and the `lstlisting` keys — basicstyle, fixed columns, numbers, caption, frame space

`fixtures/real-world/listings-manual` was the worst document in the corpus by
vertical accuracy — dy 3.83%, dx 49.36% — because `\lstinline` aside, none of
the `listings` keys existed. Its `\lstset` was not even read: the compiler
reported `\lstset` and then, having taken its argument for preamble material,
reported `\ttfamily`, `\small`, `\bfseries`, `\itshape` and `\tiny` too, six
errors for one command that typesets nothing.

The keys are read here from the source bytes, the way `abstractenv`,
`tikzpicture` and a list's `\begin` keys already are. That is not a
preference: this crate builds against `vendor/compiler`, so a key model added
to the compiler would not reach it until the vendor pin moves. A separate
compiler PR makes `\lstset` a command the compiler accepts in its own right;
this one does not depend on it and does not re-pin anything.

Every number below came out of pdfTeX (TeX Live 2025, listings v1.10c) —
`\showoutput` on a probe with the fixture's own preamble, and the content
stream of the fixture's pinned reference — never from a key's name.

**`basicstyle`.** `\lst@Init` runs the declarations before the first line, so
the block is set at that size *and at that size's own `\baselineskip`*:
`\ttfamily\small` in an 11pt article is `\fontsize{10}{12}`. We were setting
it at the 10.95 pt body size with the 13.6 pt body leading — 1.594 bp per line
over 39 lines. `\lstinline` gets the same face (listings adds only
`flexiblecolumns` to it), which is why the reference's
`\lstinline|ftxc build --watch|` is `SFTT1000`, not `SFTT1095`.

**`columns=[c]fixed`,** the default. An output token of `n` characters is set
as `\hbox to n\lst@width` with `\hss` between the characters *and* at both
ends, so each of the `n + 1` fils gets `n(W - w)/(n + 1)`. pdfTeX writes
exactly that: the fixture's `def` gets `-78`/`-79` and its 20-character
`write_default_config` `-100`. Tokens are listings' own rule — a maximal run
of letters, digits and `_`; the underscore being a letter is what makes that
identifier one token. `ec-lmtt10` and `cmtt10` both have quad 1.05 with every
character 0.525, so `W - w` is exactly `0.1em` and the whole grid is one
number; a basicstyle that is not monospaced has no single character width and
gets none, and the limitation says so.

**`numbers`.** `\llap{\normalfont \lst@numberstyle{\thelstnumber}
\kern\lst@numbersep}` — `\normalfont` is why the reference's numbers are
roman under a typewriter basicstyle, and `\llap` right-aligns them: its `1`
starts at 58.385 bp and is 3.652 wide, so its right edge plus 10 pt is the
72 bp margin, and `10` starts 3.652 further left. `\llap` is a new
`Item::Lap`, laid out in `hlist` where widths are known. Two things it had to
get right: the pull-back is a kern and a kern at the head of a line is
discarded (TeX §879), so the item opens with the same empty `\hbox`
`\leavevmode` already uses; and `hlist` ends every list it builds with TeX's
paragraph end (`\penalty10000 \parfillskip \penalty-10000`), which belongs to
a paragraph and not to this `\hbox` — left in place it broke the line after
the number, putting every numbered line one line below its own number.

**`caption` and `frame`.** `\showoutput` gives the vertical list between the
paragraph before and the first code line as `\vspace\lst@aboveskip` (6pt),
`\abovecaptionskip` (3pt), the centred `\normalsize` caption,
`\belowcaptionskip` (3pt), `\ht(frame rule box) - \baselineskip`, `\lineskip`,
the interline glue and the rule box: 22.6 pt to the caption baseline and 15.8
from there to the first code baseline, the last of which the reference
measures as 15.75 bp. At the end the bottom rule is a line of height 0 and
depth `framesep + framerule`, so the last code baseline sits 7.0 pt above the
frame's bottom edge (measured: 6.978 bp) and the next paragraph's baseline
`0.3·baselineskip + \lst@belowskip + \baselineskip` below that.

The frame's *rules* are not drawn — this block model has no rule beside a line
— so only the space they occupy is set. The per-listing limitation says that,
and names `language`, `breaklines`, `showstringspaces`, a tab against
`tabsize`, and every key given that this module does not model
(`backgroundcolor`, `keywordstyle`, `commentstyle` in this fixture). It also
lists what *was* applied, so a reader can tell the two apart.

One thing this made visible that is not about listings: the compiler lowers an
`lstlisting` to a `flushleft` paragraph, and `flushleft` is a `\trivlist`, so
the block carried `\topsep + \partopsep` — 12 pt at an 11pt base — on both
sides. `\lst@Init` opens no list at all; the body is a plain paragraph under a
`\parshape` with `\parskip\z@`. Before that was undone the probe put the first
code baseline 11.95 bp low and everything after it 23.9 bp low.

Measured with `tools/visual-oracle/rank.py` at its current revision (#415) on
both sides, this build against b529e9d:

    fixture            aligned       dx        dy      both   pages
    listings-manual   705 -> 814   49.36 ->  76.04   3.83 -> 71.74   3/3
    corpus total    15073 -> 15182 85.74 ->  86.91  75.04 -> 78.17

`both` (within 0.5 bp on both axes) is 68.97% -> 71.16% corpus-wide, 2.13% ->
51.97% on the fixture: 10396 -> 10804 words. No other fixture moves by a
single word. On the fixture's page 1 every baseline from the caption down now
matches the reference exactly; what is left is page 2's page glue (pdfTeX
shrinks 1.9 pt there and we set none) and `breaklines`, whose per-character
discretionaries we do not insert, so an over-wide `\lstinline` breaks in a
different place.

Gates: `cargo test --release --no-fail-fast` on `crates/render-pipeline`, 62
test binaries, 0 failed (one new, `listings_keys`, six of whose seven tests
fail on today's main — the seventh asserts an absence; the messages main gives
are quoted in the file header); amsmath 59/59 within 0.5 bp, tabular 106/106
(words 0.5 bp, rules 0.1 bp); HW1 and HW2 3 pages / 0 errors; page counts
22/22 across the corpus; zero font-FAILURE diagnostics.

Implementation-Agent: Claude Opus 5 (lane nixos-listings, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)

* render-pipeline tests: the listings suite is re-checked against main at 9d50d31

Implementation-Agent: Claude Opus 5 (lane nixos-listings, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)

* render-pipeline: a body `\lstset` typesets nothing, and a listing with no `basicstyle` says its grid is not set

Two defects a three-variant probe against pdflatex found, neither of which
`fixtures/real-world/listings-manual` could show (its one `\lstset` is in the
preamble and every listing names a typewriter `basicstyle`).

**A body `\lstset` was typeset.** The compiler has no `\lstset`, so a call in
the body had its argument set as ordinary text. A probe with

    \lstset{basicstyle=\ttfamily\footnotesize,frame=single}

between two paragraphs put the line `basicstyle=,frame=single` on the page and
pushed every baseline after it 13.55 bp down: pdflatex sets the paragraph
after the listing at 187.370 bp and we set it at 200.920. `\lstset`
contributes no material at all, so that material is removed, and a paragraph
that was nothing but the key list goes with it. With that undone the probe's
nine baselines all match the reference exactly, across a plain listing, a
`\footnotesize` framed one set by that body `\lstset`, and a numbered one
without a frame.

**The limitation went quiet on the commonest case.** listings sets its fixed
grid whatever the face is; only a monospaced one has a single character width,
which is what lets this module express the fill as one number. The default
(empty) `basicstyle` is the body font, and the reference spreads even
`plain listing, no keys at all` across cells of `0.6em` of `cmr10.95`, opening
at 73.506 bp where we open at 72.000. The "no fixed columns" clause tested
`basicstyle.family.is_some_and(|f| f != Tt)`, which is false when there is no
`basicstyle` at all — so a listing with no keys, the commonest listing there
is, got a limitation that named nothing. It now names the face it has.

Gates unchanged: `cargo test --release --no-fail-fast` on
`crates/render-pipeline` 0 failed (`listings_keys` is 9 tests now, eight of
which fail on main at 9d50d31); amsmath 59/59, tabular 106/106; corpus dx
88.78% / dy 80.62% / 22 of 22 page counts, identical to the previous commit —
neither defect is reachable from the corpus, which is why they needed a probe.

Implementation-Agent: Claude Opus 5 (lane nixos-listings, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)

* render-pipeline: keep both new Item variants after merging main (Lap from listings, Underline from #329)

The merge conflict spanned a closing brace: HEAD's `Item::Lap` arm in
`hash_items` ended after the `=======` marker, so a naive union of the two
sides dropped one `}` and left the function unclosed. Both variants and both
match arms are kept; the discriminants (202 Lap, 12 Underline) do not clash.

cargo test --release --no-fail-fast on crates/render-pipeline: 353 passed, 0 failed.
@GoKubar
GoKubar deleted the agent/daniel-parent/uline-gh312 branch September 16, 2026 04:18
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