Math support (a.k.a. tex_math_dollars)
Omikhleia opened this issue · 3 comments
We'd need:
- Support for Pandoc's
tex_math_dollars
extension in Lunamark (= jgm/lunamark#50) to extract the formula and invoke the writer. - The path then for SILE has to be clarified
- Either we assume its TeX-like math is kind of OK, though with restrictions (at this time of writing) on the supported syntax subset...
Or we go to the mathml route (which at the time of writing again, seems a bit better in SILE), but that would mean converting the (La)TeX formula to MathML. We are not going, certainly, to reinvent the wheel here1, so likely use something existing, e.g. TEMML, although it implies a dependency on NodeJS and forking an external process... And MathML in SILE also has some restrictions (at the time of writing again, such as sile-typesetter/sile#1604, so I am unsure it's worth the effort going that route.However, SILE math is not even aninputter
, though I've a few doubts regarding the actual implementation, esp. with AST dumping and round-tripping... (#15)
Footnotes
-
The Lua ecosystem is so non-existent that the very choice of Lua for SILE could be questioned. And IMHO, Rust is not even better -- said with a grain of salt, to those in the SILE community who might argue otherwise, heh! 😸 ↩
Blocker: As of 0.14.4, packages markdown and pandocast can no longer be used together in a single document such as the demo/showcase document if they both load the math package... It will hit sile-typesetter/sile#1607, so this will have to wait for resolution...
Other than that, going the "TeX-like math" route seems satisfying enough:
TeX-like math between `$` ("inline mode") or `$$` ("display mode") decently works
Note that $20,000 and $30,000 don't parse as math, while $e^{i\pi}=-1$ does.
There is an important constraint, though: you have to restrict yourself to the syntax subset supported
by SILE. This being said, some nice fomulas may be achieved:
::: {custom-style=center}
$$\pi=\sum_{k=0}^\infty\frac{1}{16^k}(\frac{4}{8k+1}-\frac{2}{8k+4}-\frac{1}{8k+5}-\frac{1}{8k+6})$$
:::
At the time of writing, obtained via the Pandoc AST route -- My quick'n dirty attempt on the Lunamark-native route currently breaks severely on the "note that..." test case. But I spent more time today debugging the blocker issue, and another weird one (worked-around) than seriously trying to implement the pattern right :(
Given that it has its own unique language, can we refactor the math language a bit to be an inputter?