Share via


LaTeX Math in Office

For a while now it’s been possible to switch Word’s math input mode from UnicodeMath to LaTeX. We didn’t advertise this highly requested feature since it needed more work. I wrote the original conversion routines back in Fall, 2007 and used them in preparing PowerPoint physics presentations since they’re handy for copying equations from Wikipedia articles. But we’ve been involved in many other things which delayed the necessary testing for a shipping product. Next month you’ll be able to use LaTeX math in Office 365 math zones. Word has a new math ribbon with an explicit LaTeX option as shown in the article Linear format equations using UnicodeMath and LaTeX in Word. Here’s an image of the left corner of the Word math ribbon showing LaTeX as the current input format

Formula autobuildup is disabled for LaTeX in Word since it needs some more work. Word adds two new hot keys 1) to build up (ctrl+=) a math zone and 2) to build down (shift+ctrl+=). The hot key alt+= inserts a math zone (or removes one).

LaTeX in PowerPoint and OneNote

Currently, it’s trickier to enable LaTeX in OneNote and PowerPoint since you need to define a new math autocorrect control word to change the input mode. Type alt+= to enter a math zone and on the math ribbon click on the lower right corner of the Tools section. This brings up the Equation Options dialog. Click on Math Autocorrect and in the Replace text box type \TeX and in the With text box type 24C9 alt+x to enter Ⓣ. From then on you can type \TeX<space> in a math zone to switch the input format from UnicodeMath to LaTeX in OneNote and PowerPoint. If you want, you can define \LF as 24C1 alt+x to enter Ⓛ. This control word switches back to UnicodeMath, which we used to call the Linear Format. Note that formula autobuildup is not disabled by default in PowerPoint and OneNote, so you can see how you like it.

Math Autocorrect

Note that the math autocorrect control word \integral enters the mode-locking equation

by building up the UnicodeMath text

1/2π ∫_0^2π▒ⅆθ/(a+b sin θ)=1/√(a^2-b^2)

This won’t build up correctly if LaTeX input is enabled. For PowerPoint and OneNote, you can define your own math-autocorrect control words using LaTeX notation which will build up correctly when LaTeX is enabled. In LaTeX the mode-locking equation is given by

\frac{1}{2\pi}\int_{0}^{2\pi}\frac{d\theta}{a+b\sin{\theta}}=\frac{1}{\sqrt{a^2-b^2}}.

It might be tempting to auto-switch to UnicodeMath build-up if a control-word inserts text with Unicode characters above the ASCII range. But people will probably switch to XeTeX or some other Unicode enabled TeX dialect for which this simple heuristic wouldn’t apply. In fact, Unicode TeX builds up correctly in Office math apps. For example, you can build up

\frac1{2π}∫_0^{2π}\frac{dθ}{a+b\sin{θ}}=\frac1{√{a^2-b^2}}

which is easier to read than the pure ASCII version above. You can insert many Unicode characters from the galleries in the math ribbon.

Control Words

The LaTeX option supports all TeX control words appearing in Appendix B of the UnicodeMath spec. That includes many math operators, Greek letters, and various other symbols. The verbose LaTeX notations like \begin{equation} and \begin{matrix} aren’t supported, but the more concise TeX notations are supported, such as \matrix{…} and \pmatrix{…}. Fractions can be entered in the LaTeX form \frac{…}{…} or in the TeX form {…\over…}. \displaymath is implied if the math zone fills the hard/soft paragraph and currently it can’t be turned on in inline math zones. Unicode math alphanumerics can be entered using control words like \mathbf{}. As for UnicodeMath, you can toggle math bold and math italic using the bold and italic buttons on the Home ribbon. You can enter script, open-face (double struck), and fraktur letters with control words like \scriptX, \doubleX, and \frakturX, respectively. For example, \scriptS enters  as does \mathcal{S}. The article Linear format equations using UnicodeMath and LaTeX in Word contains a list of many supported control words.

More enhancements are likely to be offered in the future. For example, it would be nice to have a Unicode LaTeX build-down option since it’s much easier to read than pure ASCII LaTeX. Also, it’d be nice to offer a formula autobuildup option in Word since it’s easier to see what you’re typing when you don’t have to wade through myriad control words. But the current facility is a big step forward for folks who know LaTeX well.

Comments

  • Anonymous
    July 31, 2017
    This is the best news for a long time from the Office team.Which features of LaTeX are enabled?Does it include environments (Like align, equation, etc...)?Thank You.
  • Anonymous
    August 01, 2017
    The comment has been removed
  • Anonymous
    March 13, 2018
    The conversion group is not visible in version 1708 (build 8431.2215) MS Office 365 ProPlus,is that correct? Therefore Latex nor Unicode is visible.
    • Anonymous
      September 28, 2018
      The LaTeX/Unicode option displays in my current Word version 1810 and has for some time now. Do you repro the problem with a version later than 1708?