Skip to content

Typst writer: preserve lineless fractions - #302

Merged
jgm merged 1 commit into
jgm:masterfrom
Don-Yin:fix-typst-nolinefrac
Oct 20, 2026
Merged

jgm merged 1 commit into
jgm:masterfrom
Don-Yin:fix-typst-nolinefrac

Conversation

@Don-Yin

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

Copy link
Copy Markdown
Contributor

The Typst writer ignores NoLineFrac, so {a \atop b} and \genfrac{}{}{0pt}{}{a}{b} both become a / b and render with a fraction bar.

I render lineless fractions as a two-row matrix without delimiters: mat(delim: #none, a; b). Reusing the matrix cell writer also handles empty numerators and denominators. The existing binom special case and ordinary fractions are unchanged.

I added a Typst writer regression covering \atop, zero-width \genfrac, compound operands, brackets, and empty operands, and corrected two existing expectations that included unwanted bars.

Validation:

  • GHC 9.10.3: the regression fails before the change; cabal test -fexecutable -f-server --test-show-details=direct passes all 3163 tests afterward.
  • Typst 0.14.2: I compiled both examples to SVG and PNG before and after the change. Each had one fraction-bar stroke before and none afterward. I also compiled the compound, bracketed, empty-operand, binomial, and ordinary-fraction cases and checked their rendering; the ordinary fraction retains its bar.

@jgm
jgm merged commit 847ff05 into jgm:master Oct 20, 2026
5 checks passed
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.

2 participants