jgm / typst-hs

Haskell library for parsing and evaluating typst
Other
44 stars 5 forks source link

Typst math formatting issues #38

Closed Doublonmousse closed 9 months ago

Doublonmousse commented 9 months ago

Reproduction : https://github.com/Doublonmousse/pandoc-typst-reproducer/tree/main/formatting

jgm commented 9 months ago

On overline, see jgm/pandoc#9294. This is already fixed, I think (but not in a release).

The others seem valid. For easy reference:

$dot.double(x)$
->
$\overset{¨}{x}$
SHOULD BE:
$\ddot{x}$
$dot(x)$
->
$(\overset{\cdot}{x}$
SHOULD BE:
$dot(x)$
$norm(x)$
->
$\left. \parallel x \right.\parallel$
SHOULD BE:
$\left\| x \right\|$
$tilde(x)$
->
$\overset{\sim{x}}$
SHOULD BE:
$\tilde{x}$
jgm commented 9 months ago

Pandoc's typst reader turns norm(...) into

EDelimited "\8741" "\8741" ...

which it passes to texmath. So, this one may require changes in jgm/texmath.

dot(x) is processed by typst-hs and turned into

math.accent(accent: ⋅, 
                                                 base: text(body: [x])), 

Pandoc's typst reader changes this to an EOver element, which it passes to jgm/texmath. Need to look into where the change must happen. Similar story for the others.

jgm commented 9 months ago

The norm issue has now been fixed in pandoc: commit 1e05f32ead3da5bf8c81f78f2c7ccb2971e69044

jgm commented 9 months ago

tilde, dot, ddot fixed in pandoc 3ef74d1fd2fa7937da841f90d3ff3d8dc87488c8