Skip to content

render-pipeline: re-land literal verbatim, and verbatim* paints the visible space (10/17 -> 13/17) - #262

Closed
GoKubar wants to merge 4 commits into
mainfrom
agent/kabir-claude/verbatim-listings-relanding
Closed

GoKubar wants to merge 4 commits into
mainfrom
agent/kabir-claude/verbatim-listings-relanding

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Based on main eea975c3, not stacked. crates/render-pipeline only; no vendor edits, no compiler changes, no font commits.

10 of 17 verbatim fixtures → 13 of 17, worst 0.006 bp. Every number here was measured on this host against pdflatex TeX Live 2025.

First, the thing that has to be said out loud

PR #187 was closed without merging. literal, Item::LiteralSpace, fixtures/verbatim/ and tests/verbatim_oracle.rs are not on main — git ls-tree -r origin/main | grep verbatim finds nothing. #183 (the typewriter fonts) and #188 (the \lstinline lexing) did merge, so main has the substrate and the compiler half but not the renderer half.

So the first two commits here are #187's two commits, cherry-picked. They needed three conflict resolutions against material main has gained since: Item::ColorBox in the incremental cache's non-cacheable set, TextStyle::color in its hash, and the exact rule for a blank inside macro replacement text (the literal-space branch runs first — a literal space is a character position either way). Nothing else changed. Re-verified on this base: the same 10 fixtures match, worst 0.006 bp.

Oracle provenance: checked, not assumed

The committed references were produced with MacTeX 2026; this host has TeX Live 2025. #187 spot-checked one fixture. All seventeen were regenerated here with fixtures/verbatim/oracle.py and compared against the committed files:

01-verbatim-basic     1p  194g  worst 0.00000 bp, rules equal
02-verbatim-ligatures 1p  164g  worst 0.00100 bp, rules equal
...
14-verbatim-pagebreak 2p 1587g  worst 0.00100 bp, rules equal
32-verbatim-microtype 1p  241g  worst 0.00000 bp, rules equal

All 17 reproduce to ≤ 0.001 bp with identical rule sets and page counts. That is what makes the local \showoutput measurements below directly comparable with the committed data, and it is recorded in the test's module doc so the next person does not have to redo it.

1. verbatim*/\verb* — no font is needed, and #187's stated blocker is wrong

#187 left fixtures 05 and 06 with: "The bundled OpenType Latin Modern has no visiblespace glyph — pdfTeX draws it from the Type 1 ec font — so this needs a shaper special case and a glyph to draw."

The glyph is there. Every bundled Latin Modern face carries it at U+2423 OPEN BOX; the CFF charset names it uni2423, not visiblespace, which is why looking for it by name found nothing. Measured through FontSet:

face gid outline bounds
lmmono10-regular.otf 602 y −132..240, x_max 480
lmmono9-regular.otf 602 y −133..241, x_max 480
lmmono12-regular.otf 602 y −131..240, x_max 471
lmmonolt10-bold.otf 602 y −129..249, x_max 482
lmroman10-regular.otf 612 y −105..252, x_max 458

…and the same in lmmono8, lmmono10-italic, lmmonoslant10, lmmonocaps10. A test asserts it per face so the claim cannot rot back. No font was bundled, no provenance question arises, and this is not a reportable limitation.

Painting it moves nothing, either. In every bundled typewriter design Cork slot 32 is exactly as wide as the font's interword space, with zero stretch and zero shrink:

TFM slot 32 a \fontdimen2 stretch shrink
ectt1000 5.24871826 pt 5.24871826 5.24871826 0 0
ectt0900 4.72384644 4.72384644 4.72384644 0 0
ectt1200 6.17349243 6.17349243 6.17349243 0 0
ec-lmtt10 5.24999619 5.24999619 5.24999619 0 0
ec-lmtt9 4.72500515 4.72500515 4.72500515 0 0

(A roman face is different — ecrm1000 slot 32 is 4.99878 pt against a 3.33252 pt space — which is why the invariant is measured per face rather than assumed. The star forms are always typewriter, so that case cannot arise here.) A second test pins it.

The change is therefore three narrow things:

  • ids.rs declares Cork slot 32 as U+2423, which is what t1enc.def says (\DeclareTextSymbol{\textvisiblespace}{T1}{32}). It had been falling through the printable-ASCII rule and reading as a blank. for_char(' ') now answers None: T1 has no space character, because TeX sets interword space as glue and never asks a font for one. Measured before changing it — an instrumented shape_tfm logging every run containing a space, over the entire render-pipeline suite, never fired once. Nothing depended on the old reading.
  • adapter.rs gains visible_space_ranges, a source scan for the bodies of verbatim* and \verb*, next to the existing scan for font commands and for the same reason: the compiler's Block::Verbatim keeps no star, and its VerbatimLine::text spells the star form with U+00B7, which pdfTeX never sets. Item::LiteralSpace gains visible.
  • typeset.rs sets a visible literal space as the character U+2423 through the ordinary word path, so it goes through the TFM, the face's cmap and the same run machinery as its neighbours. The unstarred form is still the empty box.

Fixture 05 goes 162 glyphs → the reference's 172, and matches.

2. The interword space after an inline \verb was being dropped

Found while fixing 05, and the worse bug of the two. \verb|a b| then set then flush against the b: measured b at 186.0166 and the next glyph at 191.2470 — a gap of exactly one 5.2304 bp glyph width, no space at all, against pdfTeX's 7.9601.

#187 advanced prev_end past the closing delimiter (that is what fixed \verb|x y|Z being 3.32 pt too wide) but left after_control_word set, because the compiler's span for a \verb genuinely is a control word. That flag applies TeX's skip-blanks-after-a-control-word rule, which is right for \AA and \today and wrong here: TeX ate those blanks before \@sverb read the delimiter, and the reader now stands after the closing delimiter, where a blank is an ordinary interword space.

Not subtle in effect. With those spaces gone the paragraph packed, and fixture 06's first line came out 12.61 pt overfull, two lines where pdfTeX sets three. Two scratch fixtures isolated it (replace the last \verb with plain text → still wrong; keep one \verb in plain prose → line structure already matched pdfTeX exactly), which is what pointed at the gap rule rather than at the visible space.

3. An overfull verbatim line left an empty line behind it

\obeylines' \par inside \@verbatim ends each line with TeX's own \penalty10000 \parfillskip \penalty-10000 (tex.web §816), and LaTeX's \\ is \@gnewline's \nobreak \hfil \break. The pipeline emitted the fil glue and the forced break but not the infinite penalty between them, so the glue was itself a legal breakpoint. For a line that fits, breaking at the forced break is free and nothing shows; for a line too wide for the measure — exactly what fixture 13 tests — breaking at the glue avoids the overfull badness and wins, and the forced break then emits an empty line. Measured: short at y 190.555 instead of 178.600, one baselineskip low, taking everything after it along. One \penalty10000 before the fil.

Gates — control-compared

The control is a git archive checkout of this branch's own base eea975c3, built and measured the same way with the same bundled fonts configured. Not a stale report, and not a moving main.

gate control this branch
crates/render-pipeline cargo test --release --no-fail-fast 202 passed / 0 failed / 1 ignored 206 / 0 / 1
amsmath oracle corpus — 59 / 59 within 0.5 bp
real-world corpus: status, pages and diagnostics per fixture/producer — identical, entry for entry
real-world corpus total diagnostics 203 203
real-world corpus font-substitution diagnostics 0 0
HW1 / HW2 render pages 3 / 3 3 / 3, 0 errors, 0 overfull
verbatim fixtures matching pdfLaTeX 10 of 17 13 of 17

The +4 are this lane's own tests (the oracle, its accounting test, and the two new font/metric invariants). No other test changed state in either direction: both failing sets are empty and the passing sets differ by exactly those four names.

The four that remain, each with what was actually measured

NOT_YET now carries measurements instead of guesses:

  • 10-verbatim-itemize — \@verbatim's \trivlist inside a list. \showoutput gives \leftskip 25.00003 on every verbatim line (the enclosing \leftmargini) and this vertical list above it:
    \glue 12.0 plus 4.0 minus 5.0
    \glue -12.0 plus -4.0 minus -5.0
    \glue 8.0 plus 2.0 minus 4.0
    \glue 4.0 plus 2.0 minus 1.0
    
    net 12 pt = \topsep 8 + the enclosing list's \parsep 4 (\list sets \parskip\parsep; \@trivlist adds \parskip to \@topsep). The pipeline lowers verbatim to a top-level flush-left paragraph, so it sets the lines at the page margin with \topsep alone: 25 pt out and 4 pt up. This wants a pipeline-owned verbatim block, not a patch to the paragraph path.
  • 15-verbatim-small — the size declaration in force. pdfTeX sets the body in CMTT9 (per-character advance 4.7073 bp against CMTT10's 5.2303); the pipeline sets CMTT10. The compiler's Inline::Verbatim and Block::Verbatim carry no style, and declared_size is explicit that the pipeline must not re-derive sizes from the source (pin b38e1884). Compiler change plus a vendor re-pin.
  • 28-lstinline — the compiler typesets \lstset's argument as prose: 126 glyphs against pdfTeX's 115, the extra 11 being basicstyle= at the head of the first line. \lstinline itself is lexed correctly (compiler: lex listings' \lstinline as a raw delimited argument #188, already in the vendored mirror). Compiler change plus a vendor re-pin.
  • 32-verbatim-microtype — protrusion on the surrounding roman text; the verbatim lines are already excluded (microtype's default sets are rm*/sf*).

Measured but deliberately not changed

\begin{center} inside an \item has the same shape of bug as fixture 10 and is worse: pdfTeX centres it within the indented measure starting at x 276.663 and sets it 24.0 pt below the item's baseline; the pipeline sets it flush left at 158.675 and 16.0 pt down. Out of this lane's scope. Recorded here rather than changed unmeasured, because fixing env_skip generally would move center, quote and quotation at the same time and nothing in this lane's corpus pins those.

Review notes

  • fixtures/verbatim/oracle.py is not in this PR. It is the tool that generated the cross-check above and it arrives with the listings oracle material instead, so the two do not both add the same file.
  • The scratch fixtures used to isolate bug 2 are not committed — they exist only to point at the cause, and the two gated fixtures (06, 13) cover the behaviour.

Update: merged with today's main

main moved while this was in flight. The third commit merges it and reconciles two things:

  • render-pipeline fixtures: listings oracle material and TL2025 references #248 merged, putting the 16 listings fixtures (16–31) on main. every_committed_fixture_is_accounted_for refuses a fixture that is neither gated nor listed, so without this the test introduced here would fail the moment it reached main. The 15 new ones go into a separate LISTINGS_NOT_YET, each naming the piece of listings' geometry it needs — the [c]fixed slack rule, the \llap number gutter, \lst@frameInit's rule rectangles, xleftmargin expanded in the basicstyle font, real tab stops, breakindent — from the measured specification, not as placeholders. Two of them record findings worth keeping: fixture 19's reference is byte-identical to 18's, so it does not actually discriminate fullflexible from flexible; and fixture 25 contains no ligature-forming pair at all, so it cannot have been testing what render-pipeline: verbatim, verb and listings as LaTeX sets them #145 thought it was.
  • compiler: a verbatim tab is one space, not an 8-column stop #235 merged, making a verbatim tab one space in the compiler — the same conclusion literal_command_body reached from the pipeline side. Nothing to reconcile.
  • 28-lstinline's reference was added by both sides; main's TL2025 copy is kept, which the cross-check above is exactly the evidence for.
  • The one source conflict is adapter.rs, where main added kern_amount_matches and this branch added literal_command_end/literal_command_body at the same place. Both kept. main's version is also the pattern this lane needs later: it gates a text_kern signature change behind a compiler-package-gating feature so the crate builds against the pinned mirror either way.
  • LiteralBody::starred loses the doc comment claiming the bundled Latin Modern has no visiblespace, and stops being #[allow(dead_code)].

Re-measured on the merge: crates/render-pipeline cargo test --release --no-fail-fast with the bundled fonts configured is 217 passed / 0 failed / 1 ignored, against a git archive control of current main at 213 / 0 / 1. The +4 are this branch's own tests; no other test changed state.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 3 commits September 13, 2026 20:23
…ace NFSS selects

Before this, `\verb` and a `verbatim` body were lowered to ordinary
body-face text with an `unsupported_block` limitation saying so ("the
pipeline has no monospaced face or literal-text block"). The compiler had
already tagged them `TextFamily::Mono`, but the pipeline re-derives
`TextStyle.family` from a byte scan of the source for `\ttfamily`/`\texttt`,
and `\verb|x|`'s bytes carry no such command -- so the tag was dropped and
the text came out roman, with `--` turned into an en dash and ``` `` ```
into an opening quote.

This is the `literal` flag of draft PR #145, rebuilt on main's NFSS model
rather than merged. #145 predates `nfss.rs` (its base, 85ec30c, has neither
`nfss.rs` nor `toc.rs`) and carries its own `Role::Mono` + `MonoMetrics`
font-selection model; merging it would put two fields that can disagree
about one fact into the same struct and would revert main's contents lists.
Only its *test material* is reused here. What is taken is the idea; the
mechanism is new.

`TextStyle` gains `literal: bool`, merged by OR like the other flags and
hashed by the incremental cache. Family selection is unchanged: the
compiler's `TextFamily::Mono` is now routed to `nfss::FamilyKind::Tt` and
everything downstream -- `.fd` shape tables, design-size boundaries,
`ectt`/`ec-lmtt` metrics, `lmmono*` outlines -- is main's existing NFSS
path. There is no second font model.

`literal` changes three things, and deliberately only three:

* **Ligatures.** `Shaper::shape_with(.., literal)` splits the ligature/kern
  run before each of `` ` `` `'` `,` `-` `<` `>`. That is exactly where
  latex.ltx's `\@noligs` puts its `\kern\z@`, so `--` stays two hyphens and
  ``` `` ``` two grave accents. #145 shaped literal text one character at a
  time; splitting only at `\@noligs`'s six characters is what LaTeX actually
  does, and it keeps the ordinary ligatures of a listing set in a roman
  `basicstyle` -- the exact case #145 documents as its one mismatch
  (`25-lst-java-roman`).
* **Spaces.** A space or tab in literal text becomes `Item::LiteralSpace`,
  latex.ltx's `\@xobeysp` = `\leavevmode\nobreak\ `: an empty box one
  interword space wide. It cannot be interword glue, because glue after a
  line break is discarded (tex.web 879) and a verbatim line's indentation
  would vanish with it; and the space must not be *shaped*, because T1 slot
  32 of `ectt` is the visible space, not a blank.
* **Hyphenation.** Never, independently of the family (a roman `basicstyle`
  listing must not acquire hyphens its source does not have). Protrusion and
  expansion need no new rule: microtype's default sets are `rm*`/`sf*`.

Two source-reading fixes fall out:

* `literal_command_body` parses the delimited body of
  `\verb`/`\verb*`/`\lstinline` from the source. The compiler's span is the
  control word alone, so `|x y|` was being read as the *gap* before the next
  token and its space typeset -- `\verb|x y|Z` came out 3.32 pt (one cmr10
  space) too wide. `prev_end` now advances past the closing delimiter.
* Verbatim line text and `\verb` bodies are read from the source bytes, not
  from the compiler's `verbatim_display` string, which expands a tab to an
  8-column stop and renders `\verb*`'s space as U+00B7. LaTeX does neither:
  `\@verbatim` sets a tab as one ordinary space, which is why `<tab>one`
  starts one typewriter width from the margin in pdfTeX and not eight. That
  fixed fixtures 03, 11 and 12 outright. (A compiler-side fix would be
  better still, but this crate builds against a pinned vendor mirror.)

`fixtures/verbatim/` is 17 fixtures with pdfLaTeX **MacTeX 2026** references
taken from #145 -- read-only, never regenerated: this host has TeX Live
2025. `tests/verbatim_oracle.rs` matches glyph origins within **0.1 bp**,
requires equal glyph and page counts, and fails on any
`font_unavailable` / `required_metrics_unavailable` / `ec_metrics_unavailable`
/ `font_outline_substituted` diagnostic.

**10 of 17 match pdfLaTeX exactly**, worst 0.006 bp: 01-basic, 02-ligatures,
03-tabs, 04-blank-lines, 07-T1, 08-lmodern, 09-vmode, 11-11pt, 12-12pt,
14-pagebreak (1587 glyphs across a page break). The other 7 are committed
with their references and each listed in `NOT_YET` with the reason it does
not match yet; a second test asserts every fixture on disk is either gated
or listed, so none can be added and quietly left unmeasured.

The test needs the typewriter faces, which arrive with the bundled-fonts PR
(#183). Until then it prints a SKIP naming that dependency rather than
measuring against a substitution. Verified by staging those files in
temporarily: 2 passed, 0 failed, the 10 fixtures listed above.

* crates/render-pipeline `cargo test --release`, no FLASHTEX_* exports:
  172 passed, 0 failed, 1 ignored (main: 170/0/1; the two new ones are this
  oracle).
* amsmath oracle corpus: 59/59 within 0.5 bp.
* real-world corpus (10 fixtures): 204 diagnostics, 0 font-substitution,
  every fixture's status and page count identical to main. HW1 3 pages,
  HW2 3 pages.

**The listings engine.** #145's `listings.rs` is 1623 lines reimplementing
listings.sty/lstmisc.sty/lstlang1.sty: the key model, the
`\lst@FillFixed`/`\lst@CalcLostSpaceAndOutput` column algorithm, four
language tables, frames, numbers, breaklines. Rebuilding it faithfully is a
body of work in its own right, and none of it can disagree with NFSS until
it exists -- the substrate it needs is `literal` plus typewriter selection,
which is what this change lands. It is not attempted here rather than
half-attempted; the `\lstinline` half is the companion compiler PR.

**`verbatim*` / `\verb*` visible spaces** (fixtures 05, 06). pdfTeX sets
each space as `\char32` of the T1 typewriter font, the `visiblespace` glyph.
The bundled OpenType Latin Modern has no such glyph -- pdfTeX draws it from
the Type 1 ec font -- so this needs a shaper special case *and* a glyph to
draw. `LiteralBody.starred` is parsed and kept for it.

**The `verbatim` environment's `\trivlist` geometry** (fixtures 10, 13, 15):
`\leftskip\@totalleftmargin` inside a list, the overfull box of a too-long
line, and the size declaration in force. Verbatim is still lowered to a
flush-left paragraph with forced breaks; a real verbatim block, which is
what those need, is the natural next step and is what #145 built.

Implementation-Agent: engine-engineer (linux-primary, NixOS PC)
Commit-Executor: engine-engineer via git (Cursor usage limit fallback)
Co-authored-by: GoKubar <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
The compiler's span for a `\verb` is the control word alone on the path
that reaches `Inline::Verbatim` (measured: `A \verb|x y|Z` gives span
68..73, the five bytes of `\verb`), while the lexer's own `TokenKind::Verb`
span covers the delimiters too. Matching the command name at `span.start`
rather than requiring `span.end` to be the end of the control word reads
the same delimited body under either convention, so a vendor re-pin cannot
silently change which bytes are treated as the body.

crates/render-pipeline `cargo test --release --test verbatim_oracle`:
2 passed, 0 failed; the 10 gated fixtures still match pdfLaTeX within
0.006 bp.

Implementation-Agent: engine-engineer (linux-primary, NixOS PC)
Commit-Executor: engine-engineer via git (Cursor usage limit fallback)
Co-authored-by: GoKubar <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…ed fixes

Takes the re-landed `literal` work from 10 of 17 verbatim fixtures matching
pdfLaTeX exactly to **13 of 17**, worst 0.006 bp. Every number below was
measured on this host against pdflatex TeX Live 2025, not estimated.

## The two commits under this one

PR #187 was closed without merging, so `literal`, `Item::LiteralSpace`,
`fixtures/verbatim/` and `tests/verbatim_oracle.rs` are not on main. They are
cherry-picked here unchanged apart from three conflict resolutions against
material main has gained since: `Item::ColorBox` in the incremental cache's
non-cacheable set, `TextStyle::color` in its hash, and the `exact` rule for a
blank inside macro replacement text (the literal-space branch now runs first,
because a literal space is a character position either way).

## Oracle provenance, checked rather than assumed

The committed references were produced with MacTeX 2026 and this host has
TeX Live 2025. Rather than repeat #187's "spot-checked one fixture", all
seventeen were regenerated locally with `fixtures/verbatim/oracle.py` and
compared: **every reference reproduces to 0.001 bp or better, with identical
rule sets and page counts**. Numbers measured here are therefore directly
comparable with the committed files, which is what let the three fixes below
be derived from local `\showoutput` runs.

## 1. `verbatim*`/`\verb*` set the visible space (fixtures 05, 06)

#187 recorded this as blocked: *"the bundled OpenType Latin Modern has no
`visiblespace` glyph -- pdfTeX draws it from the Type 1 ec font -- so this
needs a shaper special case **and a glyph to draw**."*

**That is not true, and no font is needed.** Every bundled Latin Modern face
carries the glyph at **U+2423 OPEN BOX**; the CFF charset names it `uni2423`,
not `visiblespace`, which is what the earlier reading looked for. Measured
through `FontSet`: `lmmono10-regular.otf` gid 602, outline bounds
y -132..240, x_max 480 -- a real outline, in all eight bundled typewriter
faces plus the roman ones. A regression test now asserts this per face, so
the claim cannot rot back.

Nor does painting it move anything. In every bundled typewriter design,
Cork slot 32 is exactly as wide as the font's interword space, with no
stretch and no shrink -- `ectt1000` slot 32 width 5.24871826 pt =
`\fontdimen2` = the width of `a`; likewise `ectt0900`, `ectt1200`,
`ec-lmtt10`, `ec-lmtt9`. (For a roman font they differ: `ecrm1000` slot 32
is 4.99878 pt against a 3.33252 pt space. The star forms are always
typewriter, so that case cannot arise here, but it is why the width is
measured per face rather than assumed.) A second test pins the invariant.

So the fix is three narrow things:

* `ids.rs`: Cork slot 32 is **declared** as U+2423, which is what
  `t1enc.def` says (`\DeclareTextSymbol{\textvisiblespace}{T1}{32}`). It was
  previously falling through the printable-ASCII rule and reading as a
  blank. `for_char(' ')` now answers `None`: T1 has no space character,
  because TeX sets interword space as glue and never asks a font for one.
  Measured before changing it -- an instrumented `shape_tfm` over the whole
  render-pipeline suite never once saw a space character reach TFM shaping,
  so nothing depended on the old reading.
* `adapter.rs`: `visible_space_ranges` scans each document for the bodies of
  `verbatim*` and `\verb*`, alongside the existing scan for font commands
  and for the same reason -- the compiler's `Block::Verbatim` keeps no star,
  and its `VerbatimLine::text` spells the star form with U+00B7, which
  pdfTeX never sets. `Item::LiteralSpace` gains `visible`.
* `typeset.rs`: a visible literal space is set as the character U+2423
  through the ordinary word path, so it goes through the TFM, the face's
  cmap and the same run machinery as its neighbours. The non-starred form is
  still the empty box.

Fixture 05 goes from 162 glyphs to the reference's 172 and matches.

## 2. The interword space after an inline `\verb` was dropped (fixture 06)

Found while fixing 05, and the more serious of the two. `\verb|a b| then`
set `then` immediately after the `b`, with **no space at all**: measured
`b` at 186.0166 and `t` at 191.2470, a gap of exactly the 5.2304 bp glyph
width, against pdfTeX's 7.9601.

`prev_end` was advanced past the closing delimiter by #187 (that is what
fixed `\verb|x y|Z` being 3.32 pt too wide), but `after_control_word` was
left set, because the compiler's span for a `\verb` *is* a control word.
That flag makes the following blank a skipped one -- TeX's blanks-after-a-
control-word rule -- which is right for `\AA` and `\today` and wrong here:
TeX ate those blanks before `\@sverb` read the delimiter, and the reader now
stands after the *closing* delimiter, where a blank is an ordinary interword
space.

The effect was not subtle. With those spaces missing the paragraph packed,
and fixture 06's first line came out **12.61 pt overfull** with two lines
where pdfTeX sets three. It is fixed by not setting the flag for a literal
span.

## 3. An overfull verbatim line left an empty line behind it (fixture 13)

`\obeylines`' `\par` inside `\@verbatim` ends each line with TeX's own
`\penalty10000 \parfillskip \penalty-10000` (tex.web 816), and LaTeX's
`\\` is `\@gnewline`'s `\nobreak \hfil \break`. The pipeline emitted the fil
glue and the forced break but **not the infinite penalty between them**, so
the glue was itself a legal breakpoint. For a line that fits, breaking at
the forced break is free and nothing shows; for a line too wide for the
measure -- the whole point of fixture 13 -- breaking at the glue avoids the
overfull badness and wins, and the forced break then produces an empty line.
Measured: `short` sat at y 190.555 instead of 178.600, one baselineskip low,
and everything after it with it. One `\penalty10000` before the fil fixes it.

## Gates, control-compared

The control is a `git archive` checkout of this branch's own base
(`eea975c3`), measured the same way with the same fonts configured, not a
stale report.

| gate | control | this branch |
|---|---|---|
| `crates/render-pipeline` `cargo test --release --no-fail-fast` | 202 passed / 0 failed / 1 ignored | **206 / 0 / 1** |
| amsmath oracle corpus | -- | **59/59** within 0.5 bp |
| real-world corpus, status + pages + diagnostics per fixture | -- | **identical, entry for entry** |
| real-world corpus total diagnostics | 203 | 203 |
| real-world corpus font-substitution diagnostics | 0 | **0** |
| HW1 / HW2 render pages, errors, overfull | -- | 3 / 3, 0, 0 |
| verbatim fixtures matching pdfLaTeX | 10 of 17 (on #187's branch) | **13 of 17** |

The +4 tests are this lane's own: the oracle, its accounting test, and the
two new font/metric invariants. **No other test changed state in either
direction** -- the failing sets are both empty and the passing sets differ
by exactly those four names.

## The four left, each with its measurement

`NOT_YET` now carries what was actually measured rather than a guess:

* **10-verbatim-itemize** -- `\@verbatim`'s `\trivlist` inside a list.
  `\showoutput` on the fixture gives `\leftskip 25.00003` on every verbatim
  line (the enclosing `\leftmargini`) and 12 pt of glue above it, which is
  `\topsep` 8 pt plus the enclosing list's `\parsep` 4 pt -- `\list` sets
  `\parskip\parsep`, and `\@trivlist` adds `\parskip` to `\@topsep`. The
  pipeline lowers verbatim to a top-level flush-left paragraph, so it sets
  the lines at the page margin with `\topsep` alone: 25 pt out, 4 pt up.
  Wanting a pipeline-owned verbatim block, not a patch here.
* **15-verbatim-small** -- the size declaration. pdfTeX sets the body in
  CMTT9 (per-character advance 4.7073 bp against CMTT10's 5.2303); the
  pipeline sets CMTT10. The compiler's `Inline::Verbatim` and
  `Block::Verbatim` carry no `style`, and `declared_size` is explicit that
  the pipeline must not re-derive sizes from the source (pin `b38e1884`).
  Compiler change plus a vendor re-pin.
* **28-lstinline** -- the compiler typesets `\lstset`'s argument as prose:
  126 glyphs against 115, the extra 11 being `basicstyle=` at the head of
  the first line. `\lstinline` itself is lexed correctly (#188, already in
  the vendored mirror). Compiler change plus a vendor re-pin.
* **32-verbatim-microtype** -- protrusion on the surrounding roman text;
  the verbatim lines are already excluded (microtype's default sets are
  `rm*`/`sf*`).

A measured neighbour worth recording: `\begin{center}` inside an `\item` has
the same shape of bug and is **worse** -- pdfTeX centres it within the
indented measure starting at x 276.663 and sets it 24.0 pt below the item's
baseline; the pipeline sets it flush at 158.675 and 16.0 pt down. Out of
this lane's scope, left alone deliberately rather than changed unmeasured.

Implementation-Agent: engine-engineer (linux-primary, NixOS PC)
Commit-Executor: engine-engineer via git (Cursor usage limit fallback)
Co-authored-by: GoKubar <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…s for them

main has moved on since `eea975c3`, and two of its merges matter here:

* **#248** committed the 16 listings fixtures (`16`..`31`) with TL2025
  references. `every_committed_fixture_is_accounted_for` refuses a fixture
  that is neither gated nor listed with a reason, so without this the test
  this branch introduces would fail the moment it reached main. The 15 new
  ones go into a separate `LISTINGS_NOT_YET`, each naming the piece of
  listings' geometry it needs -- the `[c]fixed` slack rule, the `\llap`
  number gutter, `\lst@frameInit`'s rule rectangles, `xleftmargin` expanded
  in the basicstyle font, real tab stops, `breakindent` -- taken from the
  measured specification rather than written as placeholders. Two of them
  record findings worth not losing: fixture 19's reference is byte-identical
  to 18's, so it does not actually discriminate `fullflexible` from
  `flexible`; and fixture 25 contains no ligature-forming pair at all, so it
  cannot have been testing what #145 thought it was.
* **#235** made a verbatim tab one space in the compiler, which is the same
  conclusion this branch's `literal_command_body` reached from the other
  side. Nothing to reconcile.

`28-lstinline`'s fixture and reference were added by both sides. main's
reference is kept: it was generated with this host's TeX Live 2025, and the
cross-check in this branch's test doc is exactly the evidence that the two
distributions agree on this material to 0.001 bp.

The one source conflict is `adapter.rs`, where main added
`kern_amount_matches` and this branch added `literal_command_end`/
`literal_command_body` at the same place; both are kept. main's version is
also the pattern this lane needs later: it gates a `text_kern` signature
change behind a `compiler-package-gating` feature so the crate builds
against the pinned mirror either way.

`LiteralBody::starred`'s doc comment loses the claim that the bundled
OpenType Latin Modern has no `visiblespace` glyph. It has one, at U+2423,
named `uni2423` in the CFF charset -- which is what the rest of this branch
is about -- and the field is no longer dead.

`crates/render-pipeline` `cargo test --release --no-fail-fast` with the
bundled fonts configured: **217 passed / 0 failed / 1 ignored**, against a
`git archive` control of `origin/main` at **213 / 0 / 1**. The +4 are this
branch's own tests; no other test changed state.

Implementation-Agent: engine-engineer (linux-primary, NixOS PC)
Commit-Executor: engine-engineer via git (Cursor usage limit fallback)
Co-authored-by: GoKubar <[email protected]>
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
The listings engine branched from PR #262 and so did not carry #268
(`\@verbatim`'s `\trivlist` inside a list) or #271 (microtype's verbatim
patch, and `\frenchspacing` inside `\verb`). Merging them makes the stack
linear -- #262 -> #268 -> #271 -> this -- and moves both of their fixtures
into `GATED` alongside the seventeen listings ones.

The only conflict is `tests/verbatim_oracle.rs`'s three lists, resolved by
taking every name both sides gate:

* `GATED` 32 = the 15 verbatim/`\verb` fixtures (`10-verbatim-itemize` and
  `32-verbatim-microtype` from this merge) plus the 17 listings ones.
* `NOT_YET` 2: `15-verbatim-small` keeps the `\showoutput` measurement from
  #271, `25-lst-java-roman` keeps the OT1-slot measurement from the listings
  lane.
* `LISTINGS_NOT_YET`, added in #262 so `main`'s freshly merged #248 fixtures
  were accounted for rather than failing the accounting test, is gone: every
  name in it is now either gated or in `NOT_YET`.

One fixture got better from the merge rather than from either side alone.
**`28-lstinline` goes from 0.062 bp to 0.005 bp**: #271 carries the fix for
the interword space that was being dropped after an inline `\verb` or
`\lstinline` (`after_control_word` stayed set even though `prev_end` had
already advanced past the closing delimiter), and that space is in this
fixture's first line.

Gates, control-compared against a `git archive` checkout of the listings
branch's own base `b7a1e530`, built and measured identically:

| gate | control | merged |
|---|---|---|
| `crates/render-pipeline` `cargo test --release --no-fail-fast` | 217 / 0 / 1 | 229 / 0 / 1 |
| amsmath oracle corpus | -- | 59/59 within 0.5 bp |
| real-world corpus, 22 fixtures x 2 producers | 739 diagnostics | 724 |
| real-world corpus status and page count | -- | identical, every entry |
| real-world corpus font-substitution diagnostics | 0 | 0 |
| HW1 / HW2 render | -- | 3 / 3 pages, 0 errors, 0 overfull |
| verbatim + listings fixtures matching pdfLaTeX | 30 of 34 | **32 of 34** |

The +12 are the listings lane's unit tests. The two corpus entries that
differ are the ones #271 already documents (`twelvept-plain` and
`listings-manual`, both losing `unsupported_block` limitations; the three
`overfull_hbox` in `listings-manual` are pdfLaTeX's own behaviour minus
`breaklines` inside `\lstinline`). The listings engine itself adds no corpus
diagnostic in either direction.

Implementation-Agent: engine-engineer (linux-primary, NixOS PC)
Commit-Executor: engine-engineer via git (Cursor usage limit fallback)
Co-authored-by: GoKubar <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar

GoKubar commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Closed under the old-engine freeze (DESIGN.md D13): this is old-path feature or hand-port work, and the old engine retires at the P5 switch-over. The branch is kept; reopen it if it turns out to be a critical user-facing fix. — kabir-claude (Commander), nightly review 2026-09-30

@GoKubar GoKubar closed this Sep 30, 2026
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