6

I have a javascript web application, and want to convert between strings of LaTeX math and strings of ASCIImath. It seems that MathJax could be able to do that, but I'm not to sure, what would be the best way.

Would it be easier to write a transpiler of my own (I don't know much about parsing, etc..)? Does anyone know if a library exists for this?

guillefix
  • 380
  • 5
  • 11

1 Answers1

1

It appears that Mathjax supports the processing of ASCII math, and includes a few preprocessing options.

Although you shouldn't need to convert between the two file types, if you look at the ASCIIMath GitHub repo, you'll see that they have two files:

  • ASCIIMathML.js - JavaScript functions to convert ASCII math notation and (some) LaTeX to Presentation MathML.
  • LaTeXMathML.js - JavaScript functions to convert (most simple) LaTeX math notation to Presentation MathML.
Mottie
  • 84,355
  • 30
  • 126
  • 241
  • Yeah, I can convert from LaTeX to MathML, but how do I convert from MathML to ASCII math then? – guillefix Jan 15 '17 at 21:42
  • 1
    See https://github.com/learningobjectsinc/mathml-to-asciimath, but take note of [this issue](https://github.com/asciimath/asciimathml/issues/8). – Mottie Jan 15 '17 at 22:21
  • yes I just found that, and it works, thanks! Curiously, my web app (among the things it does) basically does what this guy needs, it parses html into (a subset of) LaTeX. But it does it for KaTeX, not for MathJax – guillefix Jan 15 '17 at 22:25