I'm a software development engineer in Microsoft Office and have been working mostly on the RichEdit editor since 1994. In this blog I focus on mathematics in Office along with some posts on RichEdit and the early Windows days

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

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.

The article https://support.office.com/en-us/article/Linear-format-equations-using-UnicodeMath-and-LaTeX-in-Word-2e00618d-b1fd-49d8-8cb4-8d17f25754f8?ui=en-US&rs=en-US&ad=US lists limitations. In particular, LaTeX commands of the form \begin{xxx}…\end{xxx} aren’t recognized currently. Math zones can be delimited by \[…\] or \(…\) for display and inline math zones and they can use the TeX $$…$$ and $…$, respectively. Or they can be omitted altogether since Office math zones are defined by character formatting and paragraph marks. We use \mathrm{} for ordinary text embedded in math zones. At present, interequation/intraequation alignment on operators isn’t exposed in LaTeX mode. But it can be added using math context menu commands such as “Align at =”. The LaTeX capability is limited to math zones and doesn’t provide for general pasting of LaTeX documents. Admittedly it would be great to be able to import/export general LaTeX documents, but the current effort is aimed at making it easy for people to enter math with LaTeX.