Repository navigation
compiler: \|/\Vert/\lVert/\rVert are U+2016, not two \mids - #265
Merged
Merged
Conversation
`math.rs` spelled every double bar as the two-character string `"∣∣"` — two U+2223 VERTICAL LINEs, `\mid`'s character — with the note "Symbol has no double bar U+2016: two real verticalbar glyphs." That is a base-14 Symbol-face workaround, and it reaches layout, not only painting. `\Vert` and `\mid` are different symbols in plain.tex: `\Vert` is `\delimiter"26B30D`, so cmsy `"6B` at text size and the cmex `"0D` extensible recipe once it grows; `\mid` is `"26A30C`, cmsy `"6A` and cmex `"0C`. Measured against pdfTeX 3.141592653-2.6-1.40.27 (TeX Live 2025) by `\showbox`, in a 10pt `article`: | | pdfTeX | before | after | | --- | --- | --- | --- | | `\|` text size | one 5.00002pt cmsy `"6B` | two 2.77779pt bars (5.55558pt) | one 5.00002pt bar | | `\Bigg\|` | 5 × cmex `"0D`, 3.33333→**5.55557**pt wide | 5 × cmex `"0C`, 3.33333pt | 5 × cmex `"0D`, 5.55557pt | | `\big\|` | 2 × `"0D` | 2 × `"0C` | 2 × `"0D` | so a grown `\|` was **2.22224pt too narrow** at 10pt (2.43335 at 10.95, 2.66667 at 12) and a text-size one 0.55556pt too wide, in the box that every following atom is positioned from — not a painting difference. `\mid`, `\lvert`, `\rvert` and `\parallel` are untouched. `math-layout` already distinguishes the two correctly: `cm::delimiter_slot` maps U+2016/U+2225 to `(Symbol "6B, "0D)` and `|`/U+2223 to `(Symbol "6A, "0C)`, and `default_class` leaves U+2016 Ord (`\Vert`) while U+2225 is Rel (`\parallel`). Nothing there needed changing; the compiler was handing it the wrong character. The base-14 justification no longer applies either: `export::glyph_of` consults `lm_math::advance` before `SYMBOL_ENCODING`, so U+2016 exports from the pinned Latin Modern Math resource exactly as `\parallel`'s U+2225 already does. Its advance (398 units, read from the pinned `latinmodern-math.otf` by `tests/lm_math_binding.rs`) joins the table. Three tests in a new `math::double_bar_tests` pin the identity, that `\mid`/`\lvert`/`\rvert` still give U+2223, and that U+2016 stays exportable. `cargo test --release` on `crates/compiler`: 472 passed, 0 failed (control on this same base 469 passed, 0 failed — the 3 new tests; the failing set is empty on both). The generated `docs/user/compiler.md` and `supported/supported-latex.json` are regenerated by `crates/compiler/scripts/render_supported_latex.sh`; the only drift is `\lVert`/`\rVert`'s glyph. `crates/render-pipeline` builds against `vendor/compiler`, so this is inert in the pipeline until that pin moves; the end-to-end numbers above were taken with the same edit applied to the vendored copy locally and reverted, never committed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu Implementation-Agent: engine-engineer (delimiter lane, linux-primary) Commit-Executor: Claude Code direct (Cursor usage limit fallback)
GoKubar
force-pushed
the
agent/linux-delims/vert-identity
branch
from
September 14, 2026 01:46
1f6531a to
cae15f0
Compare
GoKubar
marked this pull request as ready for review
September 14, 2026 01:51
GoKubar
added a commit
that referenced
this pull request
Sep 14, 2026
vendor: re-pin compiler past #265 so \| stops rendering as two \mid glyphs
GoKubar
added a commit
that referenced
this pull request
Sep 14, 2026
…wn field A math cluster's `hit_rect` took its width from the laid-out TeX box and its height from the painted outline's ink (`face.bounds(gid).y_max/y_min`). Text clusters and stacked extensible delimiters already reported the box, so the producer answered differently on three paths -- and nothing anywhere said which of the two a cluster rectangle is. Not the schema (which carries one `description` in the whole file, at the top level), not `docs/contracts/`, not a doc comment. Three lanes read a delimiter's height out of it, got the ink, and reported engine defects against boxes that were exact (#265, #266 and their #2 comment). Against pdfTeX `\showbox`, 10 pt `article`: | | pdfTeX box | before (ink) | after | |---|---|---|---| | `\Bigg(` | 30.00029 | 29.90000 | 30.00029 | | `\Bigg[` | 30.00029 | 30.00000 | 30.00029 | | `\bigg(` | 24.00022 | -- | 24.00022 | | `\Big(` | 18.00017 | -- | 18.00017 | | `\big(` | 12.00011 | -- | 12.00011 | | cmmi10 `a` | 4.30554 | 4.53000 | 4.30554 | `[` and `\{` measured "exact" in the same runs only because their flat outlines fill their boxes to 0.0003 pt; `(`'s round ends stop 0.1 pt short, which is the whole "the paren chain specifically is 0.33% short" report. The other half -- "`\left|`/`\Bigg|` never grow" -- was one cmex extension piece's 12.02 pt of ink inside its correct 6.00006 pt box, because the OpenType bar is drawn to be overlapped. **The representation, not a patched number.** `Cluster::hit_rect` named a purpose; it is now `box_rect`, which names the measurement, and the painted outline travels beside it as `ink_rect: Option<Rect>`. The wrong reading is structurally unavailable rather than documented against: - the field that was ambiguous no longer exists, and ink has only one place to live -- an `Option`, so there is no box-shaped value to mistake for it; - the math path reads `boxes[gi]` from math-layout's own box tree, indexed rather than `get(..).unwrap_or(ink)`, so no silent fallback restores the old answer; - the same conflation in the *width* is gone: one `adv` fed both the painted glyph's advance and the cluster's width, so an `\overbrace` piece reported its 10.02 pt painted advance as the width of a 4.50005 pt TeX box. Now `paint_adv` goes to `Glyph::advance_x` and `g.width` to `box_rect`; - `Rect` says in its own doc that it carries no unit of meaning and the field holding it decides. The one path still deriving a height from ink is the OpenType text fallback (`shape::shape_otf`, when a font's TFM metrics are unresolvable): there is no TeX box there to report, and `box_rect`'s doc now says so instead of leaving it to be discovered. **Consumers, mapped by reading every use site.** Hit testing (`GlyphRunRenderer.swift:550`, whose own comment is "Nothing is measured on the consumer side"), the caret highlight and its whole-cluster fallback (`PreviewV2View.swift:1213`/`:1215`, filled beside a caret bar drawn from `caret.top`/`caret.height`) and the scroll target (`CaretFollow.swift:322`, whose tests assert `height > 0`) all want the box: ink makes a space unhittable -- `RenderingV2.swift:717` permits `height == 0` and `rendering-core/src/hit_test.rs:218` then drops the rect -- and a `.` a one-point-tall target. It is also v1/v2 parity: the v1 pane already hit-tests on CoreText `ascent + descent`. Only `formulaBox` (`MathCaretHighlight.swift:66`) and the hover crop (`MathHoverPreview.swift:54`, which pads by 4 pt) want ink, and they get `ink_rect`. No consumer reads a cluster height as a measurement. **Wire.** The default shape is unchanged: `hit_rects` keeps its name, shape and required status, and only its math values move. `$defs.rect` and `$defs.cluster.hit_rects` gain the definition that was never written down; `ink_rect` is an optional property behind `protocol/proposals/display-list-v2-ink-rect.md`, capability `display-list-v2-ink-rect`, producer switch `display::Wire { ink_rects }`, off by default -- so `additionalProperties: false`, rendering-core's `deny_unknown_fields` and `scripts/check_rendering_v2.py` keep passing untouched. It is refused next to `display-list-v2-delta`: `dl2-canon-1` does not cover `ink_rect`, so a reused page could keep a stale one; that needs `dl2-canon-2`. `rendering-abi.md` gains a row for each. **Vendor.** No vendor change. The height and depth the painter needs are recovered by `typeset::math_glyph_boxes`, a pre-order walk of the same public `MathBox` tree `ml::positioned_runs` flattens, pinned glyph-for-glyph by `math_glyph_boxes_line_up_with_the_flattened_run`. The fix is also made at its source -- `crates/math-layout`'s `PositionedGlyph` now carries `height` and `depth` beside `width` -- so the next `vendor/math-layout` re-pin retires the walk. Gates, NixOS linux-primary, bundled apps/mac/Fonts, `CARGO_BUILD_JOBS=4`, zero **font-failure** diagnostics (`font_unavailable`, `required_metrics_unavailable`, `ec_metrics_unavailable`, `tfm_missing`, `math_font_unavailable`, `math_metrics_opentype`) -- not zero diagnostics of any kind. Each against a control build of the same base, 5e6c65b (re-measured after #274 re-pinned vendor/compiler under this branch; the same numbers held at the original base 8a5ac44). | gate | control | this change | |---|---|---| | amsmath oracle | 59/59 within 0.5 bp | 59/59 | | render-pipeline | 213 passed, 0 failed, 1 ignored | 219 passed, 0 failed, 1 ignored | | render-pipeline failing SET | empty | empty (identical) | | math-layout | 66 passed, 0 failed | 66 passed, 0 failed | | fixtures/real-world (22) | pages + per-code diagnostics | identical | | HW1 / HW2 | 3 pages, 0 overfull, 0 errors | unchanged | Both builds rendered all 22 fixtures and the whole `display_list` envelope was compared: 5 are byte-identical, and the other 17 differ in `cluster.hit_rects` and `cluster.carets` and in nothing else -- not one glyph origin, advance, rule, font resource, page dimension, item count or diagnostic. Of the 4,494 clusters whose rectangle moved, 0 changed `x` or `width`; every difference is vertical, which is the ink-to-box correction. `apps/mac` is not in this lane and is untouched; two of its assertions read real-producer math geometry and will move. Flagged there on #2, with `ink_rect` as the field `formulaBox` and the hover crop should adopt. Implementation-Agent: Claude Opus 5 (engine lane, linux-primary / NixOS) Commit-Executor: Claude Opus 5 via Claude Code (direct-agent Git execution under the observed-Cursor-limit user override) Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 14, 2026
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.
math.rsspelled every double bar as the two-character string"∣∣"— two U+2223 VERTICAL LINEs, which is\mid's character — under the note "Symbol has no double bar U+2016: two real verticalbar glyphs." That is a base-14 Symbol-face workaround, and #227 flagged it as reaching the pipeline. It reaches layout, not only painting.\Vertand\midare different symbols in plain.tex.\Vertis\delimiter"26B30D: cmsy"6Bat text size, the cmex"0Dextensible recipe once it grows.\midis"26A30C: cmsy"6A, cmex"0C. They differ in width at every size, and the width is the box every following atom is positioned from.The same file already spelled
\begin{Vmatrix}and one\left\|path as U+2016 (math.rs:363,math.rs:1059), so the crate was internally inconsistent; this makes the other five sites agree with those two.Measured against pdflatex (TeX Live 2025)
pdfTeX 3.141592653-2.6-1.40.27,
\showboxof\hbox{$\displaystyle …$}in a 10 ptarticle. FlashTeX columns are the v2 display list's delimiter advance — the TeX box width — and the painted cluster's extent.|text size"6B, 5.00002 pt wide\big|"0D, 5.55557 pt, box 12.00012"0C, 3.33333, ink 12.00012\Bigg|"0D, 5.55557 pt, box 30.00030"0C, 3.33333, ink 30.00031\left|over a nested frac"0D, box 24.00024"0C, 3.33333, ink 24.00024Since the vertical-assembly painting landed, the heights were already right; what was wrong is the glyph identity and the width. A grown
\|was 2.22224 pt too narrow per delimiter, and a text-size one 0.55556 pt too wide and drawn as two thin bars with a gap instead of one double bar.Every body size × package set (
{none, amsmath, lmodern, amsmath+lmodern}× 10/11/12 pt), delimiter advance after the fix against pdfTeX's:||\Bigg|\mid,\lvert,\rvertand\parallelare untouched and still give U+2223 / U+2225.What did not need changing
math-layoutalready distinguishes the two correctly —cm::delimiter_slotmaps U+2016/U+2225 to(Symbol "6B, "0D)and|/U+2223 to(Symbol "6A, "0C), andmathlist::default_classleaves U+2016 Ord (\Vert) while U+2225 is Rel (\parallel). Sweeping\left<d>\vcenter to <n>pt{}\right.over 1–40 pt for all eight delimiters at all three cmex sizes, its growth chain is byte-exact against pdfTeX's already; that is now pinned by a companion tests-only PR. The compiler was handing it the wrong character.The base-14 justification no longer applies either:
export::glyph_ofconsultslm_math::advancebeforeSYMBOL_ENCODING, so U+2016 exports from the pinned Latin Modern Math resource exactly as\parallel's U+2225 already does. Its advance — 398 units, read from the pinnedlatinmodern-math.otfbytests/lm_math_binding.rs— joins that table.Gates
Base
dab10bb1. Each measured against a control build of that same base,FLASHTEX_FONT_DIRS/FLASHTEX_TFM_DIRSatapps/mac/Fonts.cargo test --releaseoncrates/compiler: 447 passed, 1 failed; control 444 passed, 1 failed. The 3 extra are this PR's newmath::double_bar_tests; the one failure is the same on both —generated_artifacts_are_current, which fails onmainuntouched becausesupported/coverage.mdcarries a hand-written block the generator does not emit. Identical failing set, and not this PR's.cargo test --releaseoncrates/render-pipeline: 115 passed, 1 failed — control 115 passed, 1 failed, the same pre-existingenumitem_nosep_noitemsep_and_explicit_keys_match_pdflatex. Identical failing set.fixtures/real-worldentries keep their status, page count and every diagnostic code and count — the per-fixture diagnostic summary is byte-identical control vs fix.font_unavailable,required_metrics_unavailable,ec_metrics_unavailable,font_outline_substituted,tfm_missing,math_font_unavailable).The generated
docs/user/compiler.mdandsupported/supported-latex.jsoncome fromcrates/compiler/scripts/render_supported_latex.sh; the only drift is\lVert/\rVert's glyph.Vendor note
crates/render-pipelinebuilds againstvendor/compiler, so this is inert in the pipeline until that pin moves. Every end-to-end number above was taken with the identical five-site edit applied to the vendored copy locally, then reverted; no vendor change is in this branch —git diff dab10bb1 --statis four files, all undercrates/compilerplus the two generated artifacts.Found while measuring, not fixed here
\Verton its own is not a supported math command: it parses only as a fence name inDELIMITER_COMMANDS, so a bare$\Vert$raises "\Vert is not supported in math mode" while$\|$works. Adding it means a new inventory row, so it is left for its own change.\lvert/\rvertare classedRel(they resolve to\mid's U+2223, which is a relation). amsmath declares them\mathopen/\mathclose, so their surrounding spacing is wrong. Separate from the identity fix; not touched here so this PR cannot move any spacing.generated_artifacts_are_currentis red onmainitself, as above. Worth a lane.Draft: the pipeline half needs a
vendor/compilerre-pin before any of this is visible in rendered output.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu