I'm trying to convert my equations I make in Microsoft Office Word 2013 to LaTeX because I would like to post my equations I make in word at math.stackexchange.com.

I'm able to convert it to MathML. But if I post it here it doesn't really look like it should be. Is it possible to convert MathML to LaTeX?

<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mtable><mml:mtr><mml:mtd><mml:mrow><mml:maligngroup/><mml:mi>a</mml:mi><mml:mo>&lt;</mml:mo><mml:mi>x</mml:mi><mml:mo>&lt;</mml:mo><mml:mi>a</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mrow><mml:mi>δ</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:malignmark/><mml:mo>⇒</mml:mo><mml:mfenced open="|" close="|" separators="|"><mml:mrow><mml:msub><mml:mrow><mml:mi>f</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mfenced separators="|"><mml:mrow><mml:mi>x</mml:mi></mml:mrow></mml:mfenced><mml:mo>-</mml:mo><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub></mml:mrow></mml:mfenced><mml:mo>&lt;</mml:mo><mml:mfrac><mml:mrow><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msub></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:mfrac></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:maligngroup/><mml:malignmark/><mml:mo>⇒</mml:mo><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:mfrac><mml:mrow><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msub></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:mfrac><mml:mo>&lt;</mml:mo><mml:msub><mml:mrow><mml:mi>f</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mfenced separators="|"><mml:mrow><mml:mi>x</mml:mi></mml:mrow></mml:mfenced><mml:mo>&lt;</mml:mo><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mo>+</mml:mo><mml:mfrac><mml:mrow><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msub></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:mfrac></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:maligngroup/><mml:malignmark/><mml:mo>⇒</mml:mo><mml:mfrac><mml:mrow><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mrow><mml:mi>L</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msub></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:mfrac><mml:mo>&lt;</mml:mo><mml:msub><mml:mrow><mml:mi>f</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable><mml:mi> </mml:mi></mml:math>


It should look like this:


enter image description here

  • A quick google would have led you to this
    – Seamus
    Dec 5, 2012 at 16:26
  • I've seen that one, but Sciwriter crashes in windows 7. And pandoc doesn't seem to do MathML to Latex.
    – Kasper
    Dec 5, 2012 at 16:37
  • I was thinking that using mathjax there should be a way to do this. But I've no idea how.
    – Kasper
    Dec 5, 2012 at 16:45
  • 1
    If the system on Maths-SX were set up correctly (and I have no information as to whether it is or isn't) you wouldn't have to do this. MathJaX can accept MathML as its input so you ought to be able to post raw MathML and have it just work. But I expect that the HTML sanitiser on the SE network wouldn't allow that. Shame. Dec 5, 2012 at 16:57
  • 2
    @AndrewStacey just looked at a math.sx page they use <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> so are only configured for tex-like input. Dec 5, 2012 at 17:29

2 Answers 2


The XSLT at


converts MathML to TeX it's been fairly extensively used over the years including generating almost all the images in Chapter 4 of the MathML3 spec (as part of a pipeline Content MathML to Presentation MathML to TeX to images.)

It currently skips maligngroup and produces

enter image description here

From the supplied XML.

It would be trivial to add the extra & by hand to restore the alignment. Changing matrix to aligned and adding two & produces

enter image description here

  • 2
    Ok, thank you very much. I hope this is what I'm looking for. But I've absolutely no idea how to use this. Could you help me? How do I download these files ?
    – Kasper
    Dec 5, 2012 at 16:56
  • Wow ! freaking awesome ! How did you do that ?!
    – Kasper
    Dec 5, 2012 at 17:04
  • 2
    @KasperPeulen, well I have used LaTeX and MathML before:-) Dec 5, 2012 at 17:06
  • 2
    You can download the files by going to code.google.com/p/web-xslt/source/browse/trunk/pmml2tex and looking at each and clicking on "raw file" over on the left. you then need an xslt2 engine (eg saxon) and java -jar saxon9.jar myfile.xml pmml2tex.xsl will produce the tex output. saxon is free but off topic here. Dec 5, 2012 at 17:08
  • Okay, I need to go now. But tonight I'm going to try to get similar results as you got. Thank you very much !
    – Kasper
    Dec 5, 2012 at 17:09

My answer is probably not directly following your question but I think it is useful to mention the Mathtype equation editor. This is a commercial product that plugs into Word and it allows export or conversion to LaTeX equations directly from the word document. This will remove one step from your work flow and may make sense if you need to make many conversions.

  • Using the mathtype converter, I'm able to get very good and quick results. The only problem is that the alignment breaks, but this is quickly restored. Awesome !
    – Kasper
    Dec 6, 2012 at 0:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.