Skip to content

fix(spec): render \lVert and \rVert as a double bar - #227

Open
Don-Yin wants to merge 1 commit into
mitex-rs:mainfrom
Don-Yin:fix-lvert-rvert-double-bar
Open

Don-Yin wants to merge 1 commit into
mitex-rs:mainfrom
Don-Yin:fix-lvert-rvert-double-bar

Conversation

@Don-Yin

@Don-Yin Don-Yin commented Oct 18, 2026

Copy link
Copy Markdown

\lVert and \rVert used to render as a double bar (they were define-sym("||"), same as \Vert). Since #172 (0.2.5) they are math.class("opening" / "closing", "||"), and there "||" is a plain string, so Typst sets two separate | glyphs and the pair doesn't grow with \left … \right.

This passes the bar.v.double symbol instead and leaves the opening/closing classes from #172 as they are. It is spelled math.bar.v.double because sym is shadowed by the helper from prelude.typ, and std. only exists from Typst 0.12 (CI pins 0.10.0).

#import "@preview/mitex:0.2.7": mi
#mi(`\lVert x \rVert \quad \Vert x \Vert \quad \left\lVert \frac{a}{b} \right\rVert`)

With Typst 0.14.2, the text of the compiled PDF has two | around the x for \lVert … \rVert before, and one ‖ (U+2016) after, like \Vert. In the render, the \left\lVert \frac{a}{b} \right\rVert bars used to stay small next to the fraction and now stretch like \left\Vert.

Checks:

  • typst query packages/mitex/specs/mod.typ "<mitex-packages>" (what the spec-gen build script runs) on Typst 0.10.0, 0.11.1, 0.12.0, 0.13.1, 0.14.2 and 0.15.1: only the lVert / rVert scope entries differ, and the string || there becomes U+2016.
  • cargo test --workspace --no-fail-fast passes before and after with Typst 0.10.0 on PATH, as in CI. The Rust tests don't exercise the Typst scope, so there is no snapshot to add or update.
  • The clippy job is already failing on main (chunks_exact lint in crates/mitex/tests/cvt/testset.rs); unrelated to this change.

\lvert / \rvert use the same string pattern ("|") and, on Typst 0.13 and later, don't stretch inside \left … \right either. I left them alone to keep this focused; happy to include them here or follow up.

`math.class("opening", "||")` passes a plain string, which Typst lays out
as two separate `|` glyphs instead of the double bar (U+2016) that `\Vert`
gets from the `||` shorthand, and the pair does not stretch with
`\left ... \right`. Use `math.bar.v.double` instead (`sym` is shadowed by
the helper in prelude.typ, and `std` only exists since Typst 0.12).
@Don-Yin

Don-Yin commented Oct 31, 2026

Copy link
Copy Markdown
Author

Gentle ping on this when someone has a moment. It still merges cleanly on current main, and I'm happy to fold the \lvert / \rvert fix in here too if you'd rather have it in one PR.

This branch has not been deployed

No deployments
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