Note that there are some explanatory texts on larger screens.

plurals
  1. POMathML to LaTeX conversion
    text
    copied!<p>I'm trying to figure out how to convert a MathML representation of a math equation and convert it to the LaTeX representation of that math equation. So for example...</p> <pre><code>&lt;math&gt; &lt;mrow&gt; &lt;mfrac&gt; &lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt; &lt;mrow&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;/mrow&gt; &lt;/mfrac&gt; &lt;/mrow&gt; &lt;/math&gt; </code></pre> <p>... is a simple stacked fraction and it's LaTeX representation would be...</p> <pre><code>\frac{x}{y} </code></pre> <p>I'm guaranteed that the MathML has no presentational markup because I am constructing the MathML string dynamically and I control how/where the MathML elements are inserted; the MathML string is just pure structure of the math equation.</p> <p>So my question is, are there any Java/JavaScript libraries out there that can take a MathML input string, like the one above, and generate the corresponding LaTeX string? I would much rather not have to write this parser myself. If not Java/JavaScript, are any libraries at all that can do this?</p> <p>If not, any suggestions on how to approach this problem of writing my own parser? Where to start, things to consider, resources, etc...?</p> <h2>UPDATE</h2> <p>Thanks to <a href="https://stackoverflow.com/users/541451/optimal-cynic">Optimal Cynic</a>, I was able to use <a href="http://www.tilman.de/programme/mathparser/download_en.html" rel="nofollow noreferrer">this Java library</a> to do what I want. It is not perfect however, but I can easily modify it and make it work well. However, I would still like to see this done in JavaScript. So are there any tools like this written in JavaScript? If not, I'll resort to translating it myself.</p> <p>Note: I am using <a href="http://www.mathjax.org/" rel="nofollow noreferrer">MathJax</a> to render the MathML on the page, but MathJax does not currently support a way to go from MathML to LaTeX. It can only go from LaTeX to MathML.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload