Embed LaTeX math equations into Microsoft Word

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

Now, let's say some Philistines 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.

-
I'm not sure, but Pandoc might help you. It doesn't support MSOffice format out of the box, but I know it can export to RTF or ODT, so you could use OpenOffice/LibreOffice to save them to the proper doc/docx format. –  Paulo Cereda Aug 8 '11 at 17:52
Thanks! That seems like it would have been useful for the original conversion. –  badroit Aug 8 '11 at 19:14
Word 2007 has better math typesetting than LaTeX, so there's no need to embed anything. Press Alt+= and have fun. –  Philipp Aug 8 '11 at 20:27
@Philipp: "better than TeX" is a very blatant assertion, it has some nice features but nothing ground breaking and it has its share of problems too. –  Khaled Hosny Aug 9 '11 at 1:28

If you're going completely free/open source, then I guess dropping MS Word for something like OpenOffice Writer might also be considered. For this, there's OOoLaTeX. From the OOoLaTeX SourceForge project webpage:

OOoLatex is a set of macros designed to bring the power of LaTeX into OpenOffice. It contains two main modules: the first one, Equation, allows to insert LaTeX equations into Writer and Impress documents as png or emf images while the second one, Expand, can be used for simpler equations to expand LaTeX code into appropriated symbol characters and insert them as regular text.

This should work as a cross-platform alternative.

Back to MS Word, a number of work-arounds exist using MS Powerpoint. Copy-and-paste the resulting equation (from Powerpoint) across the Office Suite.

The first is via TeX4PPT. The maintainer(s) suggest it provides an alternative to TeXPoint that is faster:

TeX4PPT is designed following the philosophy of TeXPoint, to enable PowerPoint to typeset sentences and equations using the power of TeX. It differs from TeXPoint in that it uses a native DVI to PowerPoint converter, providing extremely fast conversion. Additionally, the result is set using native truetype fonts under windows, providing the highest fidelity.

TeX4PPT seems to be a little lagging in up-to-date support, since "a compatible version for PP2007 will be forthcoming" (from the website).

The second is via Iguanatex. From the homepage:

IguanaTex is a PowerPoint plug-in which allows you to insert LaTeX equations into your PowerPoint presentation. It is distributed completely for free.

The third is via MyTeXPoint. From the homepage:

Free simplified version of TeXPoint. Partly compatible with the original TeXPoint. It has integrated screenshot tool to copy equations and pictures right from the screen. Supports Microsoft Powerpoint (tested with version 2007 and 2005). Compatible with Microsoft Office 2010.

If you're stuck with an old version of MS Word (for whatever reason), older - free - versions of TeXPoint still exist. I haven't tested any of the choices listed below, but it's worth a shot:

The last version of TeXPoint (v1.5.4) apparently works for all versions, but it is much older the current, non-free version (v3.3.1), so it probably doesn't provide the latest functionality.

For a complete list of formula editors across many platforms and compatibility criteria (including compatibility with TeX), consider viewing the Wikipedia entry on formula editors.

-
Thanks for all the pointers! I actually have OpenOffice, but I can't use it in this case... editing a document collaboratively with MS-heads and the slightly different interpretation of formatting causes... issues. :) –  badroit Aug 8 '11 at 19:22
@badroit: I just found MyTeXPoint and added it to my answer. It mentions "partial compatibility" with TeXPoint. –  Werner Aug 8 '11 at 19:25

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>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<title>tex texample</title>
<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:

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

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.

-
Then, here is the one click solution: github.com/idf/LaTex2Word-Equation –  Daniel 2 days ago

For the Mac, there is the wonderful LaTexiT application which allows you to quickly generate latex fragments and export them in a variety of formats, including PDF. You can store fragments in libraries, so keeping equations organized isn't too hard. This isn't quite the same as editing them directly from within the Word document, but it's pretty close.

I use this regularly for including LaTeX into Powerpoint (if I'm not using Beamer) and InDesign (which I use for posters.)

I don't know if there's an equivalent program for Windows.

-

I found a fairly new opensource project that might help you. It's called LaTeX in Word. According to description:

Latex in Word provides macros for Microsoft Word that allow the use of LaTeX input to create equations images in both inline and display modes without having to install any software on the local computer. All of the LaTeX processing happens on a remotes server. All the user needs is Microsoft Word!

If you really get ambitious, you can set up your own server for even faster equation editing. It requires a little work, but it's not too hard.

Similar macros for other word processors will hopefully be added in the future.

It's available in the project area at SourceForge. I think it's worth a shot.

BONUS: Some screenshots! =P

Seems to be a very interesting approach.

-
It would be nice if there was some actual documentation. It doesn't even say that it's Windows only, as far as I can see. Isn't Word 2007 quite old now? –  Alan Munn Aug 8 '11 at 18:51
@Alan: indeed. =) Lack of documentation is a major issue. This project seems to be implemented as a set of VBA macros, so I suppose the 2007 version might work with Office 2010 as well. I can't tell if the docm file is also fully OpenOffice compliant (if so, there's a slight chance of a possible multiplatform support, but not official). =) On a sidenote, my dad is stuck with Word 2003. Yikes! –  Paulo Cereda Aug 8 '11 at 19:00
Looks nice... precisely what I need... except for the server part. The people who don't like LaTeX would also not like me sending content from the doc to external parties. They really are no fun. (In general, requiring a server to build LaTeX fragments seems a bit weird... why not just hook up to a local Miktex or similar installation?) –  badroit Aug 8 '11 at 19:19
@badroit: Seconded! The server part would scare any potential user. =P –  Paulo Cereda Aug 8 '11 at 19:22
@badroit - Then try sourceforge.net/projects/texsword . It uses local MikeTex installation + handles equation numbering nicely. –  Adam Ryczkowski Feb 27 '14 at 22:47

For me MathJax has been the way to go as per David Carlisle's suggestion. The one addition I would make is that Microsoft Word by default brings across the formatting of the page displaying the MathML code. I don't think the addition of <?xml version="1.0"?> was doing anything for me except making me go via an editor that doesn't have any formatting to copy.

Instead I have found it quicker to simply copy and paste the MathML from the "show MathML as/MathML Code" window then tap Ctrl then T (or alternately click the relevant buttons in the small menu that appears at the bottom right of the text you've pasted). This tells Word to only pay attention to the text itself at which point it realises that this is the code for a formula and displays it correctly. This is also quicker than going via a text editor.

Sorry for not making this a comment to David Carlisle's answer, apparently I lack the reputation to do so.

-

The above suggestion are really good. But there are similar options like latex built in latest version of MS Word right from 2007 version. I don't know about previous of office. Here is a video (https://www.youtube.com/playlist?list=PLbTE-xLDPxtBP-TE2fS1MysSqFCkHh1N3 )which gives details of most of the common features.

-
Can we define macros in Equation Editor? –  Symbol 1 Sep 23 '14 at 16:42
You can't compare the possibilities of mathematics in LaTeX with MS Word. MS Word just can't do what LaTeX can ... –  Kurt Sep 23 '14 at 16:51