5 ms·
Are there any good tools for generating MathML automatically, or converting LaTeX to MathML? Writing MathML for an expression[1] is a tedious pain in the ass. T
by lmkg 16y ago
Are there any good tools for generating MathML automatically, or converting LaTeX to MathML? Writing MathML for an expression[1] is a tedious pain in the ass. The MathML expansion of a formula ends up being very similar to a verbose parse tree represented in XML, and mathematical notation can be very dense so those trees get large.
[1] This is where the word "non-trivial" usually goes, but not this time.
- kohlhase 16y agoWe use the LaTeXML system [http://dlmf.nist.gov/LaTeXML/ http://dlmf.nist.gov/LaTeXML/], see also http://trac.mathweb.org/LaTeXML http://trac.mathweb.org/LaTeXML for developer-related stuff. LaTeXML can transform (most of) your LaTeX documents to XHTML+MathML which can then be presented in the browser. In the arXMLiv project [http://arxmliv.kwarc.info http://arxmliv.kwarc.info] you can see LaTeXML in action: we have transformed the majority (over half a million articles) of http://arxiv.org http://arxiv.org.
- fiddlosopher 16y agoI wrote a Haskell library, [texmath](http://github.com/jgm/texmath http://github.com/jgm/texmath) that converts LaTeX to MathML; this is used in pandoc and gitit. The library comes with two executables, one a standalone command-line converter, another a CGI program. There's an interactive demo [here](http://johnmacfarlane.net/texmath http://johnmacfarlane.net/texmath). The library just handles standard LaTeX math + AMS extensions. It doesn't yet know how to parse macros.
- _delirium 16y agoSeveral approaches: 1. The semi-official answer seems to be to use a WYSIWYG editor, which seems to be the solution XML proponents take to any syntax problem. ;-) For example, you can export to MathML from OpenOffice's equation editor. 2. If your goal is just to display math in webpages, there are some .js libraries that replace MathML's concrete syntax inline: you write a different syntax directly in your markup, and then it's converted at load time to MathML for browser rendering. The first widely used one was ASCIIMathML (http://www1.chapman.edu/~jipsen/mathml/asciimath.html http://www1.chapman.edu/~jipsen/mathml/asciimath.html), which inspired LaTeXMathML (http://math.etsu.edu/LaTeXMathML/ http://math.etsu.edu/LaTeXMathML/), and possibly others. 3. There are a number of offline translators from TeX math syntax to MathML. I've only ever used Blahtex (http://blahtex.org/ http://blahtex.org/), but there are a ton, in various stages of completeness and maintained-ness. edit: it looks like the original blahtex is abandoned for a few years now, but a maintained descendant is here: http://gva.noekeon.org/blahtexml/ http://gva.noekeon.org/blahtexml/
- nimrody 16y agoThere is also mathjax (http://www.mathjax.org/ http://www.mathjax.org/) which can render MathML if your browser supports it (the actual markup you use is the de-facto standard LaTeX notation). Now I only need something that will let me paste Matlab figures into HTML documents as SVG... (would make for a great research wiki.)
- koenigdavidmj 16y agoI am quite fond of http://golem.ph.utexas.edu/~distler/blog/itex2MML.html http://golem.ph.utexas.edu/~distler/blog/itex2MML.html . It's not exactly the same, but the only glitch that you are likely to hit is that "ab" is not the same as "a b": the first is one variable (MathML has the concept of multiletter variable names), and the second is two variables neighbouring.
- carterschonwald 16y agocheck out pandoc http://johnmacfarlane.net/pandoc/ http://johnmacfarlane.net/pandoc/
- avar 16y agoMediaWiki has a tool that parses LaTeX, sanity checks it, and can spew out LaTeX again or a very limited version of MathML. If anyone out there knows OCaml enough to improve its emitter that would mean MathML for Wikipedia articles in WebKit browser once this comes out.
- wtallis 16y agoWindows 7 has the Math Input Panel, which lets you write equations on a tablet and convert them to MathML. The same recognition engine can be used from OneNote, which I've used to take notes during a lecture and later convert to a decent-looking document.
- dhimes 16y agoI use Open Office, and export. The OO editor is pretty quick for typing math. I then have a couple of scripts that clean things up a bit.