Closed bhpayne closed 4 years ago
Candidates for converters from LaTeX to Content MathML:
https://www2.ph.ed.ac.uk/snuggletex/documentation/generating-content-mathml.html https://www2.ph.ed.ac.uk/snuggletex/UpConversionDemo
Converter written in Perl: https://dlmf.nist.gov/LaTeXML/
This issue is blocked by the need for an Abstract Syntax Tree (AST)
Now supported (experimentally): https://docs.sympy.org/latest/modules/parsing.html#experimental-latex-parsing
My mention is here: https://github.com/sympy/sympy/issues/5418
The merge is here: https://github.com/sympy/sympy/pull/13706
from https://docs.sympy.org/latest/modules/printing.html
import sympy
expr = sympy.parsing.latex.parse_latex(r"\frac {1 + \sqrt {\a}} {\b}")
print(sympy.printing.latex(expr))
bonus: MathML
sympy.printing.print_mathml(expr)
and an expression tree (from https://docs.sympy.org/latest/tutorial/manipulation.html):
sympy.srepr(expr)
visualize the tree using graphviz:
sympy.printing.dotprint(expr)
Converting Latex to SymPy (with user review and intervention as needed) addresses this requirement
Content in the Physics Derivation Graph is currently stored as LaTeX. LaTeX is not meaningful for computer algebra systems, so a semantically meaningful representation like Content MathML or SymPy or Sage would be better.
For new content, manually entry in Content MathML is burdensome. Therefore collecting expressions in LaTeX and converting to Content MathML is preferable.