10

Do you know any open source tools or libraries (preferably Java, but that's not a strict requirement) in the GNU/Linux world that convert mathematical equations in LaTeX syntax to Content MathML or OpenMath?

I need to convert tons of equations in batch mode, so I'm not looking for interactive apps.

EDIT My focus is on the equations' semantics, so I cannot use Presentation MathML (unless there's a converter from Presentation MathML to Content MathML).

Thanks in advance!

Bolo
  • 11,542
  • 7
  • 41
  • 60

4 Answers4

6

This might be what you are looking for: SnuggleTeX

From the site:
SnuggleTeX is a 100% Java library for converting (a reasonable subset of) LaTeX into XHTML + MathML.

SnuggleTeX can attempt to convert input LaTeX to Content MathML by first creating Enhanced Presentation MathML and then processing that. In many ways, this part of the process is relatively simple since most of the semantic structure has already been inferred (though might not necessarily make any sense).

tstrokes
  • 182
  • 1
  • 1
  • 8
  • Its isn't able to convert even simple math expression like `\int (x+1)^2 dx`. ``` message="Could not handle this Presentation MathML element" ``` – gxyd Jan 17 '19 at 08:05
3

You can also use an online equation editor WIRIS editor which is able to import MathML/Latex and export to MathML/Latex

Jagger
  • 10,350
  • 9
  • 51
  • 93
Greck
  • 580
  • 6
  • 15
2

You may want to have a look at LaTeXML. It converts LaTeX to various XML formats, including OpenMath and content MathML.

But be warned, like all other tools, the conversion from (presentation-oriented) LaTeX to content markup (as in OpenMath and MathML) is heuristic. In particular, in ambiguous situations (e.g. $f(a+b)$, which can mean $f$ applied to $(a+b)$ or $f$ times $(a+b)$) LaTeXML chooses one (usually times).

There are two ways out:
1) use content markup already in the LaTeX source (see http://trac.kwarc.info/sTeX)
2) use a better post-processor for LaTeXML is working on this

rene
  • 41,474
  • 78
  • 114
  • 152
2

Have a look over here, where you can find a perl version.

phimuemue
  • 34,669
  • 9
  • 84
  • 115
  • LaTeXMathML apparently converts to **Presentation MathML** and I'm looking for a converter to **Content MathML** (or another format focused on semantics, e.g. OpenMath). Nevertheless, I didn't know LaTeXMathML, it'll be useful to me in other circumstances, thanks for the link! – Bolo Sep 03 '10 at 06:37