pygae / galgebra

Symbolic Geometric Algebra/Calculus package for SymPy :crystal_ball:
https://galgebra.rtfd.io/
BSD 3-Clause "New" or "Revised" License
231 stars 62 forks source link

Sort out scattered LaTeX preambles #521

Open utensil opened 5 months ago

utensil commented 5 months ago

LaTeX preambles are scattered in multiple files, with almost identical contents, some with escaping, some without escaping (in raw string). They are a maintenance nightmare. They should be all put into one place, using raw string.

It would also be nice to figure out how to make LaTeX preambles work for all Sphinx docs, without having to paste them into each doc files, and they will be not-rendered (i.e. shown as raw LaTeX code) at page load, and occupying the majority of the screen, then disappear.

The idea is to remain the ablity to copy-paste from a LaTeX source, then use a light-weight parsing mechanism to make it a JSON that MathJax 3 accepts. There was a preamble plugin in MathJax 2 has the same functionality.

Another nice thing is to ensure they work for all of LaTeX, MathJax 3 and KaTeX. For now, some LaTeX preambles are not rendered correctly in Jupyter Lab but OK on nbviewer (so I settled on whatever makes nbviewer happy). As for KaTeX, \DeclareMathOperator doesn't work and massive error follows, particularly annoying in notebook diff view in VSCode which uses KaTeX and unlikely to change.

utensil commented 5 months ago

Supersedes #399 .