Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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>

a<x<a+δ1⇒f1x-L1<L1-L22⇒L1-L1-L22<f1x<L1+L1-L22⇒L1+L22<f1(x) 

It should look like this:

https://skydrive.live.com/redir?resid=8FEA31C0ACCF70F0!135

enter image description here

share|improve this question
    
A quick google would have led you to this –  Seamus Dec 5 '12 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 '12 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 '12 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. –  Loop Space Dec 5 '12 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. –  David Carlisle Dec 5 '12 at 17:29

2 Answers 2

up vote 9 down vote accepted

The XSLT at

http://code.google.com/p/web-xslt/source/browse/trunk/pmml2tex/

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

share|improve this answer
1  
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 '12 at 16:56
    
Wow ! freaking awesome ! How did you do that ?! –  Kasper Dec 5 '12 at 17:04
    
@KasperPeulen, well I have used LaTeX and MathML before:-) –  David Carlisle Dec 5 '12 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. –  David Carlisle Dec 5 '12 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 '12 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.

share|improve this answer
    
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 '12 at 0:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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