Repository navigation
render-pipeline: \url and \nolinkurl are set in the typewriter family - #378
Merged
Merged
Conversation
…mily
`\url{...}` was coming out in **roman**. The compiler already sets
`TextFamily::Mono` on the runs it splits a URL into
(`parser::push_url_text`), but the pipeline does not read that field: it
re-derives NFSS from the source, scanning for `\texttt`/`\ttfamily` over
their braced argument (`style_intervals`). `\url` was not in that table, so
every URL was set in the body font.
Measured against pdflatex (TeX Live 2025, 11pt `article`, T1,
`\setbox0=\hbox{...}\the\wd0`), `\url{https://example.org/flashtex/emission-notes}`:
| | pdflatex | before | after |
|---|---|---|---|
| `\url` | 243.80995pt | 211.42pt (roman) | **243.31010pt** |
| `\texttt`, same string | 243.30995pt | 243.310pt | 243.310pt |
14 of 20 `\url`/`\nolinkurl` box widths over six URLs now match pdflatex to
**0.0002 pt**. The six that do not are exactly the ones containing a hyphen:
url.sty puts a **0.5pt kern after every `-`** (`\url{a-b}` 17.47511pt vs
`\texttt{a-b}` 16.97511pt; `a-b-c` is 1.0pt wider — measured, two hyphens),
which is a compiler-side change and is not in this PR.
Two things make this a separate entry rather than a `text_font_command` row:
- **The argument is opaque.** url.sty makes every character of a URL
"other", and the compiler re-reads those bytes raw (`parser::url_argument`),
so `%`, `#`, `_` and `\` inside a URL are literal. The style scan used to
read them as LaTeX: a `%` in `\url{.../a%20b}` started a comment and
swallowed the rest of the line, so a `\textbf{}` after the URL on that
line silently lost its style. `url_argument_end` mirrors the compiler's
brace rules byte for byte.
- **The interval covers the whole command**, backslash through closing
brace, because the compiler gives every run of a split URL the span of the
entire `\url{...}` and the style is looked up at `span.start`.
Corpus (`tools/visual-oracle/rank.py`, full `fixtures/real-world`, same
binary directory before and after): **2 pages better, 0 worse, 58
unchanged**. `hyperref-toc` p3 max delta 426.113 -> 214.222 bp, reflowed
2 -> 1, aligned 228 -> 230; `listings-manual` p1 max delta 401.629 -> 87.319
bp, reflowed 21 -> 17.
Isolating the document's other divergence (its `[demo]` `\includegraphics`,
which pdflatex reserves 281.85587pt x 100pt for and this engine does not
reserve at all — a graphicx gap, not a hyperref one) by substituting that
exact box, `hyperref-toc` p2 words within 0.5 bp go 179 -> 191 of 193
aligned and p3 max |dy| 16.105 -> 2.595 bp.
Gates: render-pipeline 241 passed / 0 failed; amsmath 59/59; tabular
106/106; HW1 and HW2 3 pages each with 0 errors and 0 overfull; zero
font-FAILURE diagnostics.
pdflatex is an oracle only and is never in the product path.
Implementation-Agent: Claude Opus 5 (lane nixos-hyperref, 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
…tation (#398) `\verb`/`\verb*`, the `verbatim`/`verbatim*` environments, `lstlisting` and `\lstinline` were set in the roman body face. The compiler already marked them mono (`Inline::Verbatim`, `Block::Verbatim`), but the pipeline re-derives NFSS by scanning the source and none of the three tables in `style_intervals` listed them -- the same bug class PR #378 fixed for `\url`. Three things were wrong, not one, and the family alone fixes only the first. 1. **Face.** `literal_spans` finds every verbatim construct and `style_intervals` gives it a `Family(Tt)` interval over the whole command, skipping its bytes rather than scanning them. The skip matters on its own: a `%` inside `\verb|100%|` used to start a comment and eat the styles of the rest of the line, and a lone `{` in a listing corrupted the group stack that decides where a declaration ends. 2. **Ligatures and kerns.** Verbatim runs under `\@noligs`, `\texttt` does not, so this cannot ride on the family. `TextStyle::literal` now marks the text; it suppresses the pipeline's source-level `tex_ligatures` pass *and* the font's own program (`tfm::literal_run`, `Shaper::shape_literal`, `ShapeOptions` for the OpenType path). `ectt` does carry the `--` ligature, and `\ttfamily` is right to use it. 3. **Blanks.** A verbatim blank is `\@vobeyspaces`' control space: rigid (the typewriter families set `\fontdimen3`/`\fontdimen4` to zero, so interword glue in that style is already rigid), never breakable, and preceded by `\leavevmode` -- without that empty box the glue opening an indented line is discardable (TeX §879) and every listing lost its indentation. Measured against pdflatex (TeX Live 2025, oracle only), 12pt article, T1, `ectt1200`, every character 6.1735pt: \verb"ftxc --version" 86.4289 pt ours 86.4289 \ttfamily ftxc --version 80.2554 pt ours 80.2554 (ligature kept) \verb|x--y| 24.69397pt = 4 characters \ttfamily x--y 18.52048pt = 3 characters verbatim body "a b-c" 30.86746pt ours 30.8675 A four-line indented `verbatim` block matches the oracle to 0.0044 bp on every word, baselines included. Real-world corpus (22 documents, aligned words within 0.5 bp): dx 84.5% -> 85.0%, dy 65.2% -> 65.7%, both 58.7% -> 59.5%. twelvept-plain dx 78.0 -> 84.2%, dy 68.3 -> 82.4%, both 53.4 -> 73.2%; listings-manual dx 42.7 -> 48.4%. No fixture regressed. The `\verb` limitation is gone and the block one now names what is actually missing (the `listings` keys), instead of claiming there is no monospaced face. Gates: render-pipeline 258 tests / 54 suites green, amsmath 59/59, tabular 106/106, HW1 and HW2 3 pages 0 errors, zero font-FAILURE diagnostics. Implementation-Agent: Claude Opus 5 (lane nixos-verbatim-face, linux-primary) Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit) Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu Co-authored-by: Claude Opus 5 <[email protected]>
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.
\url{...}was coming out in roman. The compiler already setsTextFamily::Monoon the runs it splits a URL into(
parser::push_url_text), but the pipeline does not read that field: itre-derives NFSS from the source, scanning for
\texttt/\ttfamilyovertheir braced argument (
style_intervals).\urlwas not in that table, soevery URL was set in the body font.
Measured against pdflatex (TeX Live 2025, 11pt
article, T1,\setbox0=\hbox{...}\the\wd0),\url{https://example.org/flashtex/emission-notes}:\url\texttt, same string14 of 20
\url/\nolinkurlbox widths over six URLs now match pdflatex to0.0002 pt. The six that do not are exactly the ones containing a hyphen:
url.sty puts a 0.5pt kern after every
-(\url{a-b}17.47511pt vs\texttt{a-b}16.97511pt;a-b-cis 1.0pt wider — measured, two hyphens),which is a compiler-side change and is not in this PR.
Two things make this a separate entry rather than a
text_font_commandrow:"other", and the compiler re-reads those bytes raw (
parser::url_argument),so
%,#,_and\inside a URL are literal. The style scan used toread them as LaTeX: a
%in\url{.../a%20b}started a comment andswallowed the rest of the line, so a
\textbf{}after the URL on thatline silently lost its style.
url_argument_endmirrors the compiler'sbrace rules byte for byte.
brace, because the compiler gives every run of a split URL the span of the
entire
\url{...}and the style is looked up atspan.start.Corpus (
tools/visual-oracle/rank.py, fullfixtures/real-world, samebinary directory before and after): 2 pages better, 0 worse, 58
unchanged.
hyperref-tocp3 max delta 426.113 -> 214.222 bp, reflowed2 -> 1, aligned 228 -> 230;
listings-manualp1 max delta 401.629 -> 87.319bp, reflowed 21 -> 17.
Isolating the document's other divergence (its
[demo]\includegraphics,which pdflatex reserves 281.85587pt x 100pt for and this engine does not
reserve at all — a graphicx gap, not a hyperref one) by substituting that
exact box,
hyperref-tocp2 words within 0.5 bp go 179 -> 191 of 193aligned and p3 max |dy| 16.105 -> 2.595 bp.
Gates: render-pipeline 241 passed / 0 failed; amsmath 59/59; tabular
106/106; HW1 and HW2 3 pages each with 0 errors and 0 overfull; zero
font-FAILURE diagnostics.
pdflatex is an oracle only and is never in the product path.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu