Repository navigation
render-pipeline: a verbatim body inside a list is a trivlist inside that list (14/17) - #268
Closed
GoKubar wants to merge 2 commits into
Conversation
…hat list Fixture `10-verbatim-itemize` matches pdfLaTeX exactly; 13 of 17 verbatim fixtures become **14 of 17**, worst 0.006 bp. ## What pdfTeX does, read off `\showoutput` `\@verbatim` is `\trivlist \item\relax … \leftskip\@totalleftmargin`, so a `verbatim` inside an `enumerate` item is a trivlist *inside that list*. The fixture's page, dumped with `\showboxbreadth=200 \showboxdepth=10 \showoutput`, gives this between the item's line and the first verbatim line: ``` \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 \glue(\parskip) 0.0 \glue(\parskip) 0.0 \glue(\baselineskip) 5.88889 \hbox(6.11111+0.0)x345.0 … \glue(\leftskip) 25.00003 ``` Net **12 pt** above, and `\leftskip 25.00003` on every verbatim line. And between the last verbatim line and the next `\item`: ``` \glue 8.0 plus 2.0 minus 4.0 \glue -8.0 plus -2.0 minus -4.0 \glue 8.0 plus 2.0 minus 4.0 \glue(\parskip) 4.0 plus 2.0 minus 1.0 \glue(\parskip) 0.0 ``` net 12 pt again, but **built differently**: 8 pt from `\@endparenv` and 4 pt of the *next item's* own `\parskip`. Two rules follow, and the asymmetry between them is the whole point: * `\@trivlist` sets `\@topsepadd \topsep`, then `\@topsep \@topsepadd`, then **`\advance\@topsep \parskip`**. Inside a list `\parskip` is `\parsep` (`\list` sets `\parskip\parsep`), which article's `\@listi` puts at 4 pt at 10 pt — hence 8 + 4 = 12 above. * `\@endparenv` adds `\@topsepadd`, which was fixed at `\topsep` **before** that `\advance` — so the closing skip carries no `\parskip`: 8, not 12. The pipeline had `env_skip` = `\topsep` (+ `\partopsep`) on both sides, with no `\parskip` term, and lowered verbatim to a *top-level* flush-left paragraph. Measured before: the verbatim lines sat at the page margin (133.768 against pdfTeX's 158.675) and 4 pt too high, with everything after them carrying that 4 pt. ## The change * `EnvOpen` gains `outer_parskip`, the `\parskip` in force where `\begin` was read: zero at the outer level, the enclosing list's `\parsep` inside one, read with the existing `list_stack_at` + `list_seps_with` from the source. * `env_skip` takes it and adds it to the natural amount; `env_after` passes zero, which is what `\@endparenv` does. * A verbatim-family block opening inside a list gets a `ListGeom` with the enclosing margins, no label and no `\parsep`, so `paragraph_block`'s existing `\@totalleftmargin` hang applies to it. The environment sets `\parskip\z@`, which is why `parsep` is zero here and not the list's. ## Scoped to the verbatim family on purpose `verbatim_env_after_begin` restricts this to `verbatim`, `verbatim*` and `lstlisting`. `center`/`quote` inside a list have the same shape of bug and are **worse**, but differently, and nothing in this lane pins them: measured on a scratch `center` inside an `enumerate` item, pdfTeX centres it within the *indented* measure at x 276.663 and sets it 24.0 pt below the item's baseline, while this pipeline sets it flush left at 158.675, 16.0 pt down — 8 pt short, not 4, so the `\parskip` term alone would not fix it and would move it without a fixture to catch the result. Left exactly as it was, and recorded rather than guessed at. ## Gates, control-compared Control is a `git archive` checkout of `eea975c3` measured the same way. | gate | control | this branch | |---|---|---| | `crates/render-pipeline` `cargo test --release --no-fail-fast` | 202 / 0 / 1 | 206 / 0 / 1 | | amsmath oracle corpus | — | 59/59 within 0.5 bp | | real-world corpus: status, pages, diagnostics per fixture/producer | — | identical, entry for entry | | real-world corpus total / font-substitution diagnostics | 203 / 0 | 203 / 0 | | HW1 / HW2 render pages, errors, overfull | — | 3 / 3, 0, 0 | | verbatim fixtures matching pdfLaTeX | 13 of 17 | **14 of 17** | The three left are `15-verbatim-small` and `28-lstinline` (both a compiler change plus a vendor re-pin, which this crate cannot do) and `32-verbatim-microtype` (protrusion on the surrounding roman text). 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
…ent/kabir-claude/verbatim-trivlist-in-list
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
This was referenced Sep 14, 2026
This was referenced Sep 15, 2026
Merged
compiler:
\item[<label>] is a text run — nested math, styles, no silent drops (#676, PR 1 of 2)
#702
Merged
Merged
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #262 (
agent/kabir-claude/verbatim-listings-relanding) — review that one first; this PR's own diff is the last commit, 3 files, +77/−14.crates/render-pipelineonly; no vendor edits, no compiler changes.Fixture
10-verbatim-itemizematches pdfLaTeX exactly. 13 of 17 → 14 of 17, worst 0.006 bp.What pdfTeX actually does
\@verbatimis\trivlist \item\relax … \leftskip\@totalleftmargin, so averbatiminside anenumerateitem is a trivlist inside that list. Dumped with\showboxbreadth=200 \showboxdepth=10 \showoutput, the fixture's page has this between the item's line and the first verbatim line:Net 12 pt above, and
\leftskip 25.00003on every verbatim line. Between the last verbatim line and the next\item:net 12 pt again — but built differently: 8 pt from
\@endparenvplus 4 pt of the next item's own\parskip.That asymmetry is the whole point of this change:
\@trivlistsets\@topsepadd \topsep, then\@topsep \@topsepadd, then\advance\@topsep \parskip. Inside a list\parskipis\parsep(\listsets\parskip\parsep), which article's\@listiputs at 4 pt at 10 pt — so 8 + 4 = 12 above.\@endparenvadds\@topsepadd, fixed at\topsepbefore that\advance— so the closing skip carries no\parskip: 8, not 12.I had it symmetric on the first attempt and fixture 10 then failed the other way: the verbatim lines landed exactly right and everything after them sat 4 pt low. The
\showoutputdump is what settled it.Before / after, measured
The change
EnvOpengainsouter_parskip— the\parskipin force where\beginwas read: zero at the outer level, the enclosing list's\parsepinside one, read from the source with the existinglist_stack_at+list_seps_with.env_skipadds it to the natural amount;env_afterpasses zero, which is what\@endparenvdoes.ListGeomwith the enclosing margins, no label and no\parsep, soparagraph_block's existing\@totalleftmarginhang applies.\@verbatimsets\parskip\z@, which is why theparsephere is zero and not the list's.Deliberately scoped to the verbatim family
verbatim_env_after_beginrestricts this toverbatim,verbatim*andlstlisting.center/quoteinside a list have the same shape of bug but not the same size, and nothing in this lane pins them. Measured on a scratchcenterinside anenumerateitem: pdfLaTeX centres it within the indented measure, first glyph at x 276.663, and sets it 24.0 pt below the item's baseline; this pipeline sets it flush left at 158.675, 16.0 pt down. That is 8 pt short, not 4 — so the\parskipterm alone would not fix it, and applying it would movecenter,quoteandquotationwith no fixture to catch the result. Left exactly as it was; recorded here so the next lane starts from a measurement rather than a hunch.Gates — control-compared
Control is a
git archivecheckout ofeea975c3(this stack's base), built and measured the same way with the same bundled fonts configured.crates/render-pipelinecargo test --release --no-fail-fastThe +4 over the control are #262's tests; no test changed state in either direction.
The three that remain
Inline::Verbatim/Block::Verbatimcarry nostyle, anddeclared_sizeforbids re-deriving sizes from the source (pinb38e1884). Compiler change plus a vendor re-pin.\lstset's argument as prose (11 stray glyphs). Compiler change plus a vendor re-pin.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu