130

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.

8
  • 1
    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. Aug 8, 2011 at 17:52
  • 2
    Word 2007 has better math typesetting than LaTeX, so there's no need to embed anything. Press Alt+= and have fun.
    – Philipp
    Aug 8, 2011 at 20:27
  • 25
    @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. Aug 9, 2011 at 1:28
  • 1
    @Khaled, a few reasons: (1) I already have the equations in TeX from an existing document, (2) I can do new equations the way I like them much quicker in TeX than Word, (3) I'm don't want to invest time figuring out Word's way of doing things for a (hopefully) once-off job. ;)
    – badroit
    Aug 9, 2011 at 23:01
  • 3
    See also superuser.com/q/340650/35237 Oct 22, 2012 at 13:32

17 Answers 17

78

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.

13
  • 10
    Then, here is the one click solution: github.com/idf/LaTex2Word-Equation
    – Daniel
    Apr 16, 2015 at 15:43
  • 5
    And here is the one-click solution for Firefox:addons.mozilla.org/en-GB/firefox/addon/mathml-copy
    – ROLO
    Nov 25, 2015 at 12:19
  • This solution should work for most cases. I tried with $$c_{\!_Y}(x,z)$$, using both one-click and the detailed method by David. For David's method, the version observed in the web browser is correct. However, in both the cases, final version in MS word has an extra subscript which is empty. If I try a simplified version, $$c_{Y}(x,z)$$, it works. So, for complex examples, it may not give expected results. Anyway, the solution is very helpful, thanks!
    – Ruchir
    Oct 6, 2016 at 2:30
  • 1
    @Daniel you are a freaking hero. Apr 22, 2017 at 0:09
  • 1
    @Daniel the chrome extension link is not working chrome.google.com/webstore/detail/latex2word-equation/…
    – user716881
    Jun 22, 2021 at 12:19
45

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.

2
  • 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, 2011 at 19:22
  • 1
    @badroit: I just found MyTeXPoint and added it to my answer. It mentions "partial compatibility" with TeXPoint.
    – Werner
    Aug 8, 2011 at 19:25
22

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.

18

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.

2
  • is this the same as pasting using shift and control v ?
    – baxx
    Oct 14, 2016 at 21:31
  • 2
    Just saw this answer, that was the way it was supposed to work, but between me and a mozilla helper and some emails to contacts in microsoft we couldn't make it work, but you were answering a year later, so perhaps something got fixed when we tried it initially if you did the "no formatting paste" it just pasted in the xml markup verbatim, but perhaps they fixed something.... Jan 13, 2017 at 10:51
17

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.

Get started today by downloading the example Word document from our SourceForge project page. It's easy!

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

BONUS: Some screenshots! =P

Bookmark Edition LaTeX entry

Seems to be a very interesting approach.

6
  • 1
    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, 2011 at 18:51
  • 1
    @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! Aug 8, 2011 at 19:00
  • 1
    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, 2011 at 19:19
  • 1
    @badroit: Seconded! The server part would scare any potential user. =P Aug 8, 2011 at 19:22
  • 1
    @badroit - Then try sourceforge.net/projects/texsword . It uses local MikeTex installation + handles equation numbering nicely. Feb 27, 2014 at 22:47
11

There's is a form on my website where you can write LaTeX formulas and paste the generated MathML code directly into Word:

http://engenharialivre.com/latex-para-word/

It's in Portuguese (because I'm Brazilian), but I believe that you won't find any dificulties to use it.

Thanks to the author of this answer, I had the idea.

Here is a demonstration (click on the GIF in order to get a better view):

Demonstration of LaTeX para Word

6
  • @Jesse This does provide an answer to the question, and it works quite well in my very limited testing. To Douglas, nice work and I hope this catches on! If possible, could you make a Windows program for "offline" usage?
    – darthbith
    Aug 31, 2015 at 18:37
  • @darthbith -- thanks for the double check, i just did. And agreed.
    – Jesse
    Sep 1, 2015 at 1:34
  • @darthbith I've just made the page able to be cached on your browser, so you will be able to use it offline (please reload the page). Please test and inform if you find any bug. Sep 1, 2015 at 19:48
  • Does this work for powerpoint ?
    – Nizar
    Nov 26, 2017 at 21:03
  • @DouglasdeMoura Thanks a lot. This solved my problem. Although I find that some line changes and parentheses sizes were ignored during the conversion, but it worked pretty well. Is there any update on this project ?
    – Avrana
    Jun 27, 2020 at 16:50
9

I've created LatexToWordEquation based on answers.

It is a Word AddIn.

The source code I've pushed to Github. Link here

How to do it

2
  • How to install in MS Word 2007, Window 7
    – Say OL
    Jun 20, 2016 at 4:34
  • doesn't work... Dec 26, 2016 at 15:39
8

Resurrecting this old question, it is now fully supported in Word. So no need for external tools or workarounds. Small caveat: Only in word from Office365!

2
  • This should be all the way on the top, I guess for 90% of the cases this will do the job good enough.
    – aXeL-HH
    Feb 2, 2018 at 10:10
  • Caveat: only in word from office365! Aug 13, 2018 at 16:04
4

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.

2
  • Can we define macros in Equation Editor?
    – Symbol 1
    Sep 23, 2014 at 16:42
  • 2
    You can't compare the possibilities of mathematics in LaTeX with MS Word. MS Word just can't do what LaTeX can ...
    – Mensch
    Sep 23, 2014 at 16:51
4

Adding on Douglas de Moura and David Carlisle's responses, I have found a way to do it on MS Word 2007 without requiring internet.

The steps are as follows:

1) The source files of "MathJax" needs to be downloaded from here: http://docs.mathjax.org/en/latest/installation.html

2) From the MathJax file folder, go to the "test" folder.

3) Create an .html file with the following code:

    <html>
    <head>
    <title>MathJax TeX Test Page</title>
    <!-- Copyright (c) 2010-2017 The MathJax Consortium -->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
      });
    </script>
    <script type="text/javascript" src="../MathJax.js?config=TeX-AMS_HTML-full"></script>

    </head>
    <body>

    <p>
    $$x = \frac{1}{2}$$
    </p>

    </body>
    </html>

where the stuff in $$ is the desired Latex code. Note that this is just reverse-engineered from one of MathJax's sample html codes.

4) Open the created html file in browser, i.e.: Chrome.

5) Right click on equation -> "Show Math As" -> "MathML Code".

6) Copy and paste result to notepad, adding the line

<?xml version="1.0"?>

to the beginning of the MathML code; for my case, I've got this:

<?xml version="1.0"?>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mi>x</mi>
  <mo>=</mo>
  <mfrac>
    <mn>1</mn>
    <mn>2</mn>
  </mfrac>
</math>

7) Then on MS Word 2007, open equation editor (ALT and = keys together), then copy and paste the above result.


So in the end, it is possible to start out with Latex code and end up with an MS Word 2007-compatible equations, all without relying on an internet connection.


EDIT (2018, JAN. 26) As per cengique's answer here, there is also a method for converting the Word 2007 format to the Word 2003's Equation 3.0 format using the free Libreoffice Writer program.

3

I'm not sure that this is right for you, but the opportunity it is always a good idea? Look at the program AnEasyCalc. It allows you to quickly gain formula in RTF format and receive the expression of latex. With this you can use RTF or LaTeX string in RTF editors. The first takes advantage of text representation, but looks like a palliative. The second looks fine, but is inserted as a picture. The main thing is freedom of choice, as always. Good luck)

All details in help and home page.enter image description here

4
  • 1
    Welcome to TeX.SX! You should elaborate on your answer, showing an example and providing screen shot(s)
    – user31729
    Jun 8, 2015 at 20:21
  • 1
    I edited this to tidy up slightly but there are places I can't guess the meaning, especially the first sentence. If this is your programme, you should include a disclaimer. I'm not sure how this is meant to answer the question, either.
    – cfr
    Jul 22, 2015 at 21:20
  • The formula image can be pasted to Word document as an image. The main work is to build the latex string. I suggest getting two views of the formula: RTF and LaTeX. The formula in the upper large field - RTF string. It can be copied into a Word duk and will look as well. She dialed manually as it is done in a text editor. A string
    – Igor
    Jul 22, 2015 at 21:48
  • I apologize so much... I have not yet got used to the local editor. The end of previous comment to be something like : ... It can be copied into a Word doc and will look as well as it looks now. It have to be typed manually as it is may be done in any RTF text editor. A latex string located within tags [LATEX][/LATEX] is generated by the program automaticaly. I understand that my post is related to the topic very approximate. If the moderators consider it inappropriate, it can be removed. In this case, I apologize again.
    – Igor
    Jul 22, 2015 at 22:35
3

I have made good experiences with latex2rtf - a freeware that converts latex source into an rtf-file with all equations nicely typeset. Opening this rtf-file in word works nicely.

3

One neat solution is:

  1. Convert your TeX formula to MathML code using, for example, the website www.mathtowebonline.com (put your formula between $ signs ... e.g. $\sigma = \frac{e^2\nu _f^2}{2}$);

  2. Copy the MathML code into Word and watch the magic happen!

2
  • 1
    Welcome to TeX.SE. Can mathtowebonline.com handle math-related macros defined in packages such as amsmath, amssymb, and mathtools?
    – Mico
    Apr 20, 2017 at 7:28
  • Thanks for pointing that out Mico. I just tried an amsmath example, and the formula conversion works. However the numbering and labeling is inserted in the equation box along the formula, instead of being seperate. Maybe there is a workaround for that as well.
    – Ashkan372
    Apr 20, 2017 at 7:52
2

Use the LaTeX2Word-Equation Chrome Extension. It allows you to select a raw LaTeX equation, copy it, and paste directly into Word.

2

Isn't this what Pandoc is for?

I just checked, and it supports

pandoc file.tex -s -o file.docx

I don't have MS Word on my machine, but I uploaded the document to google docs and it looks usable. If necessary, you can manually make cosmetic adjustments from this point (although I doubt the Philistines would care). If you haven't checked it out, I really recommend it. It allows me to live in the world of markdown and latex, but still be able to produce docx formatted files when necessary. All with a single command!

1

I have been using KlatexFormula on Windows for several years. It can be found at SourceForge. It uses MiKTeX on Windows systems and can export a wide range of formats including PNG, PDF, and SVG which can be inserted in any program.

In your case, I would copy the LaTeX code from your source, paste it into KLatexFormula then save the equation to your preferred image format (I would also save a version in the native format for any future editing).

1

While mathpix snips have a monthly limit in the free plan, this should work for your needs:

1. To extract the equations from your tex-file include in your Preamble:

\usepackage[active,generate=equations,extract-env={equation,align}]{extract}

2. Then copy the equations individually to mathpix app and save:

Pasting latex equations to mathpix

3. Copy to Word

Copy html code to word

4. Repeat

How it is displayed in word

Tested and works even for complex equations.

P.S. Mathpix is in general a great tool, highly recommend

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .