[Tex/LaTex] Embed LaTeX math equations into Microsoft Word

conversionmsword

Let's say I have a (comparatively) lovely-looking document in LaTeX, full of lovingly typeset, (relatively) complex equations.

Now, let's say some barbarians come along one day and decide that the document has to be put into Microsoft Word (2007).

…after the usual mourning period associated with such events, let's say I value my job (more specifically, the bread it provides) enough to get all the text and tables formatted and references organised into the Word document. –…related questions here and here

Now I'm looking at the equations with fear and dread.

One option of course is to just lift screenshots from the original document, but this is painstaking if I need to refer to parts of the equation in the text. Also, I might need to edit equations on the fly.

Anyone know of a free application which allows embedding LaTeX math into MS Word?

I've looked at Aurora and TexPoint which do roughly what I want… they build LaTeX images from source and embed them into the Word document, allowing to edit the source later… but both are commerical.

…any help in these troubling times will be greatly appreciated.

EDIT: Just a note that Aurora offers a 30-day free trial and is working out really nicely… but still, it's not free. Might be a good solution for those with short-term needs, or money.

Best Answer

You should be able to cut and paste mathematics from your web browser to Word (or any of the Micorsoft Office suite). Unfortunately at present you have to make a small edit but any text editor will do for that.

Given

x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

Make a small html file that looks like

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<title>tex texample</title>
</head>
<body>

$$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$

</body>
</html>

View that in a web browser and select "show MathML as/MathML Code" from the right menu:

Select the MathML text from the popup window.

Normally you can paste MathML in to word but for various reasons you need to give Word a hint in this case, so first paste it into a text editor and add the line

<?xml version="1.0"?>

to the start:

enter image description here

Then cut out the edited text and paste it into Word (any version since 2007).

enter image description here

Note the result is a fully editable Word Math Zone, using scalable fonts, not an image.

I used MathJax in a web browser for the initial TeX to MathML conversion as it is the easiest to set up, there are other alternatives. Also, to make it simple, I described the process in terms of cutting and pasting, which works well for one or two expressions but clearly not if you are converting thousands, however the process can be automated in various ways.