Incorrect LaTeX exponent syntax for Typst input in Pandoc conversion
Closed this issue · 4 comments
Explain the problem.
When converting typst to pandoc, I get that the typst code $n(a)^(b)$
is translated into \(n(a)\hat{}(b)\)
and not \(n(a)^{(b)}\)
To reproduce:
echo "\$n(a)^(b)\$" | pandoc -f typst -t latex
Pandoc version?
I am using the online version, which runs 3.1.9
Actually it should be:
\(n(a)^{b}\)
right?
I'll move this to jgm/typst-hs which is where this part of the conversion gets done.
Note that $a^(b)$
works fine, so the problem is something like a precedence nesting issue.
Note to self: typst actually distinguishes between these:
$a_1(x)$
$a_f(x)$
In the first, we have {a_1}(x)
(using {} to indicate grouping)
In the second, a_{f(x)}
.
This fix raised an error in the pandoc test suite, so it's not complete.
$sum_(j = 0)^3 j^2$
Pandoc previously converted it to
\sum_{j = 0}^{3}j^{2}
which did render that way. With this change in typst-hs, however, pandoc produces
\sum_{(j = 0)^{3}}j^{2}
which does not render properly.
More examination is needed to match typst's parsing precedence behavior.
The problem is that our parser is grouping (j=0)^3
as a unit and treating that as the argument to _
.