I wonder if there is some free solutions for typing math formulas the LaTeX way in Microsoft Word document (Office 2007)?
-
Does the internal formula writer not work for you? It's pretty handy whenever I go to do integrals and/or summations.– kobaltzSep 28, 2011 at 4:58
-
6It is very slow compared to Latex.– TimSep 28, 2011 at 5:46
-
10Wouldn't it be simple to write everything in LaTeX?– N.N.Sep 28, 2011 at 8:55
-
2Cross-site duplicate of Embed LaTeX math equations into Microsoft Word– Tobias KienzlerOct 22, 2012 at 13:28
-
@N.N. I can not answer for Tim, but sadly I have to write an article in Word. Haven't used the software in the last 9 years...– user641880Apr 5, 2018 at 13:05
10 Answers
If you are running Office 365 version 1707 or later, the Equation Editor allows you to convert LaTex into the native format. See the first part of this answer.
In older versions of Office, the Equation Editor can understand certain LaTeX components. However, it builds the equation as you go, and you cannot convert an entire LaTeX equation. See the second part of this answer if you are running:
- WinWord 2007, 2010, 2013, and 2016
- MacWord 2011 and 2016
On Office 365 version 1707 or later
Put the Equation Editor into LaTeX mode. In the Equation Editor Design ribbon, go to the Conversions group and click LaTeX.
Type the LaTeX.
Open the Convert dropdown menu and click Current - Professional.
The LaTeX will be processed into the Equation Editor's native format.
You can also convert back to LaTeX to edit the equation.
- Open the Convert dropdown menu, and then click Current - Linear.
- The equation is converted back to LaTeX format. Note: This is not your original LaTeX source, because it has been round-tripped through the Equation Editor's internal format.
- Open the Convert dropdown menu, and then click Current - Professional.
You have to use the dropdown menu because the Convert button doesn't toggle automatically between Linear and Professional. It keeps the last-used command.
There are some limitations. For example, the Office 365 Equation Editor does not understand the \begin and \end commands. See the Microsoft documentation for examples and possible workarounds:
On Office 2007-2016 (Mac Office 2011-2016)
Very few people realize that the built-in equation editor in Word 2007 actually understands LaTeX-style equation entry. Simply insert a new equation, and then type LaTeX into it. As you type, Word will build up a graphical representation of the equation.
Once it appears in the GUI, you can no longer edit it as LaTeX. Word does not have an embedded TeX processor -- it's just doing pattern matching to convert simple LaTeX syntax into the native equation format. You should therefore not expect to get perfect fidelity for super-complex LaTeX equations. However, it's enough for probably anyone but a mathematician, and it's a lot faster than clicking elements with the mouse.
The Word 2007 equation editor also has a linear equation entry format, which is fairly intuitive and does not require familiarity with LaTeX. For example, typing in (a+b)/(c+d)
will result in a nicely-formatted fraction.
Notes:
Many scientific journals will not accept Word documents with the new equation format -- even if you save as .doc instead of .docx.
This doesn't turn Word into LaTeX. It just does the equations themselves, and nothing else. You don't even get equation numbering.
-
4Key point is LaTeX style, as usual ms has their own 'best' way of doing things. +1 for the post, it does make it easier if you are stuck with word.– BAROct 1, 2013 at 3:59
-
1
-
2Hi, I am not sure I am doing it right. I try to use latex style for fraction:\frac{}{} but it doesn't work out in the equation field.– jxhycSep 21, 2015 at 6:55
-
-
3
Write your Math formulas in LaTeX → Transform the LaTeX formulas in MathML Code → Copy/Paste the MathML Code in Word (after paste click CTRL and then T). Voila!
EXAMPLE:
Lets take for example this Formula:
This is the LaTeX source Code from the above Formula:
0 \leq \lim_{n\to \infty}\frac{n!}{(2n)!} \leq \lim_{n\to \infty} \frac{n!}{(n!)^2} = \lim_{k \to \infty, k = n!}\frac{k}{k^2} = \lim_{k \to \infty}\frac{1}{k} = 0.
Now open a Editor and put the above source code between the signs $$ $$ like this:
<!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>
$$ 0 \leq \lim_{n\to \infty}\frac{n!}{(2n)!} \leq \lim_{n\to \infty} \frac{n!}{(n!)^2} = \lim_{k \to \infty, k = n!}\frac{k}{k^2} = \lim_{k \to \infty}\frac{1}{k} = 0.$$
</body>
</html>
Save the file as .html file and open it with a browser like Chrome.
Right Click on the Formula and Choose Show MathML As → MathML Code.
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mn>0</mn>
<mo>≤<!-- ≤ --></mo>
<munder>
<mo form="prefix" movablelimits="true">lim</mo>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo stretchy="false">→<!-- → --></mo>
<mi mathvariant="normal">∞<!-- ∞ --></mi>
</mrow>
</munder>
<mfrac>
<mrow>
<mi>n</mi>
<mo>!</mo>
</mrow>
<mrow>
<mo stretchy="false">(</mo>
<mn>2</mn>
<mi>n</mi>
<mo stretchy="false">)</mo>
<mo>!</mo>
</mrow>
</mfrac>
<mo>≤<!-- ≤ --></mo>
<munder>
<mo form="prefix" movablelimits="true">lim</mo>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo stretchy="false">→<!-- → --></mo>
<mi mathvariant="normal">∞<!-- ∞ --></mi>
</mrow>
</munder>
<mfrac>
<mrow>
<mi>n</mi>
<mo>!</mo>
</mrow>
<mrow>
<mo stretchy="false">(</mo>
<mi>n</mi>
<mo>!</mo>
<msup>
<mo stretchy="false">)</mo>
<mn>2</mn>
</msup>
</mrow>
</mfrac>
<mo>=</mo>
<munder>
<mo form="prefix" movablelimits="true">lim</mo>
<mrow class="MJX-TeXAtom-ORD">
<mi>k</mi>
<mo stretchy="false">→<!-- → --></mo>
<mi mathvariant="normal">∞<!-- ∞ --></mi>
<mo>,</mo>
<mi>k</mi>
<mo>=</mo>
<mi>n</mi>
<mo>!</mo>
</mrow>
</munder>
<mfrac>
<mi>k</mi>
<msup>
<mi>k</mi>
<mn>2</mn>
</msup>
</mfrac>
<mo>=</mo>
<munder>
<mo form="prefix" movablelimits="true">lim</mo>
<mrow class="MJX-TeXAtom-ORD">
<mi>k</mi>
<mo stretchy="false">→<!-- → --></mo>
<mi mathvariant="normal">∞<!-- ∞ --></mi>
</mrow>
</munder>
<mfrac>
<mn>1</mn>
<mi>k</mi>
</mfrac>
<mo>=</mo>
<mn>0.</mn>
</math>
Now Copy/Paste the MathML Code in Word 2013 (or 2007) and click sequentially CTRL and then T (Paste Options: keep the text only) or go to the small Ctrl image at the end of the MathML Code you pasted and select the option manually.
-
Seems that the height of brackets becomes all the same after converting. (Consider something like
d \left((a+b)+\frac{1}{c}\right)
. ) Is this the limitation of MathML?– xzczdDec 3, 2015 at 11:55 -
1
-
1This is the best answer because all latex formula can be together in one HTML file. You have the possibility to change EASILY the latex formula in Notepad++ to change it if necessary and to manually copy/paste the MathML version from Chrome in Word document. The problem with Microsoft is that it is not able to accept a paste/copy of latex equation.– schlebeNov 7, 2019 at 8:10
-
I suggest that this answer is updated to match the current example at mathjax.org/#gettingstarted i.e. new urls, configuration option, and [ ] delimiters instead of $$ $$– ernstklSep 23, 2020 at 6:33
-
This solution allows converting block objects like matrices. I use temml.org to convert from Latex to MathML. The code from Temml does not contain the opening tag so you need to add "<math xmlns="w3.org/1998/Math/MathML">" at the beginning of the code (and in some cases the close tag "</math>" at the end of the code. Mar 23 at 23:16
I've created LatexToWordEquation based on answers.
It is a Word AddIn.
The source code I've pushed to Github. Link here
If you prefer you can download the installer directly from here.
Note: This is an active download link that will immediately download the file when you click on it.
How to do it
-
5Welcome to Super User. People are security conscious and get concerned when clicking a link immediately downloads an unknown file. It's a good idea to include a notice on live download links. BTW, readers are likely to be reluctant to download an unknown file, particularly from a new user. So don't take it personally if the link doesn't get much action. Regardless, thanks for trying to help with this question. Nov 27, 2015 at 17:29
-
3I tested it in Word 2016. Unfortunately, pressing the button does nothing. Do I need to install anything in order for this solution to work?– randersMay 3, 2016 at 16:03
-
2
-
Tried this, but can't get it to change my text. Doesn't work mate. Is there anything else I have to download?– KarthikApr 2, 2021 at 6:51
-
Does not work. I think it is just for the basic equations, which can be re-written in word. Not recommended.– Ayaz49Apr 25, 2021 at 17:57
@Devid's answer is excellent, but I had difficulty with the specific instructions. Here's what worked for me. Do Devid's steps through copying the MathML code.
Then, insert a blank equation. In Word 2013, switch to Print Layout view (View tab on the ribbon). On the Insert tab, choose Equation. You will see Type equation here
selected.
On the Home tab, select the Paste dropdown, then Paste Special (or just hit CTRLALTV). Select Unformatted Unicode Text.
The equation should then fill in mostly correctly, as in Devid's last picture.
One more thing - in the picture, the "lim" commands are italicized, where they were not in the original. To fix that, for each "lim," put the cursor just after the "m" and hit Space to cause Word to check "lim" against its table of functions and adjust the formatting. (Then delete the extra space that created.)
I prefer TeXsword over Latex in Word (TeXsword download). It has all the features of Latex in Word, plus gives handling of equation references. And it doesn't require the Internet connection, which I see as a feature not a limitation: MikeTeX isn't that big after all, and having the LaTeX locally allows you typing your document when traveling.
You can use Latex in Word.
It 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. As far as I know, this is the only free alternative to the paid programs like Aurora and TexPoint.
For Office 2007, go to Latex in Word Project Page on Source Forge, and click on Word 2007 under Files.
LaTeX in Word is a GPL-licensed tool that allows equations to be used in Microsoft Word documents. The client-side of the program is implemented as VBA macros in the document "LaTeXinWord_v_0_3_1.docm" along with instructions. Hence, this file contains the source code, implementation, and documentation.
I wrote a tools for Generating MathML, I improved the code form Devid, and add some functions for easy editing. Here is the Code:
<!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>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
<script>
function SelectText(element) {
var doc = document
, text = doc.getElementById(element)
, range, selection
;
if (doc.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
$(document).ready(function(){
$("#latexContent").val("$$ $$");
$('#latexContent').bind('input propertychange', function() {
$("#myoutput").text($("#latexContent").val());
// MathJax.Hub.Queue(["TypeseTextt",MathJax.Hub,"myoutput"]);
MathJax.Hub.Typeset("myoutput")
});
$("#btnShowMathML").click(function(){
var con = $(".MJX_Assistive_MathML").html();
$("#myMathml").text(con);
SelectText("myMathml");
});
$("#btnClear").click(function(){
$("#latexContent").val("$$ $$");
$("#myoutput").html("<p style='color: grey; font-style: italic;'> The LaTeX will display here ! </p>");
$("#myMathml").text("");
});
});
</script>
</head>
<body>
<center>
<p> Enter LaTeX here! </p>
<textarea id="latexContent" rows="5" cols="100"> </textarea>
<button id="btnClear" type="button">clear</button>
<button id="btnShowMathML" type="button">Show The MathML</button> </br></br>
<span id="myoutput">
<p style="color: grey; font-style: italic;"> The LaTeX will display here ! </p>
</span> </br>
<span id="myMathml"> </span>
</center>
</body>
</html>
When coping MathML to Word, make sure copy pure text, using key Ctrl+Alt+V (or first copy it to notepad then copy it to word).
The default server for LaTeX in Word appears to no longer be running. If you're forced to use Word (for instance, to collaborate with the less technically oriented) I'd use TeXsword as suggested by Adam already. You'll need to install a standalone MikTex distribution, but it is an easy install these days. It works with my Word 2016. It still doesn't look as good as a real bona fide LaTeX document, but it is easier to use and more malleable than the equation editor in Word.
-
Please don't post an answer to agree with another answer or confirm that it worked. The site's Q&A format reserves answers for solutions to the question, and each answer should contribute another solution. The way to indicate that an answer is useful is to invest a little time in the site and you will gain sufficient privileges to upvote answers you like. Jan 17, 2017 at 17:51
-
1I wanted to comment that it works in newer versions of word (to answer Devid's question), but did not have the privileges to do so. Jan 18, 2017 at 14:58
-
Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Super User way of saying thank you.– DavidPostill ♦Jan 23, 2017 at 21:55
Microsoft Office ProPlus Version 1902 with activated LaTeX Format.
The following macro changes all LaTeX formulae delimited by pairs of $
within the current Selection of the Word document to Word formulae:
Sub LaTeX()
If Selection.Start < Selection.End Then
Set myRange = ActiveDocument.Range(Selection.Start, Selection.End)
Do While myRange.Find.Execute(FindText:="$*$", Forward:=True, MatchWildcards:=True) = True
ActiveDocument.OMaths.Add Range:=myRange
ActiveDocument.OMaths.BuildUp
Set myRange = ActiveDocument.Range(myRange.Start, Selection.End)
Loop
End If
End Sub
This is a feasibility study and not intended for production. The macro can easily be fooled by stray $
signs in the text.
That is also the main reason for delimiting the action of the macro to the current selection.
Furthermore it does not handle display equation environments like equation
or align
.
Answer mentioned above is correct but there is a also shortcut builtin which is math auto correct. It is much like LaTeX. By default its inactive but you can activate it and is really helpful if you want to write big equations. For eg if you want to type H2 than you just have to type H_2 etc and many more options are available like for superscript character following caret (^) sign will be converted as superscript. Many such shortcuts are covered in this video or you can simply search for How to insert mathematical equation (like LaTeX) in Ms-Office: Tips and tricks on youtube.
This method will be especially helpful if you are a fast at typing. Moreover it will save your time which is lost while switching between keyboard and mouse and searching proper option in word.
-
Taoyue mentioned that in his answer two years ago, with screenshots. Dec 6, 2014 at 0:05