LaTeX mhchem Support in Microsoft 365

Microsoft 365 apps including Word, Excel, and PowerPoint support creating chemical equations and formulas using the LaTeX \ce{...} command from the mhchem package. This document describes what is supported, how the input is interpreted, and what limitations apply.


Overview

The \ce{...} command is parsed as a self-contained chemical expression. The content inside the braces is not tokenized as normal LaTeX math. Instead, it is processed character-by-character using chemistry-specific rules: element symbols are set upright, numbers after elements become subscripts, + and - after elements become charge superscripts, and arrow sequences like -> become reaction arrows.

Basic example

\ce{2 H2 + O2 -> 2 H2O}

Produces: 2 H₂ + O₂ → 2 H₂O


Supported Features

Element symbols

An uppercase letter optionally followed by one or more lowercase letters is recognized as a chemical element and rendered in upright (roman) type.

Input Result
\ce{H} H
\ce{Na} Na
\ce{Ag} Ag

Automatic subscript numbers

A digit immediately following an element symbol (with no intervening space) becomes a subscript.

Input Result
\ce{H2O} H₂O
\ce{C6H12O6} C₆H₁₂O₆
\ce{Fe2O3} Fe₂O₃

Digits following a closing parenthesis or bracket also become subscripts:

Input Result
\ce{Ca(OH)2} Ca(OH)₂
\ce{[Cu(NH3)4]2+} [Cu(NH₃)₄]²⁺

Stoichiometric coefficients

Digits at the start of a formula or after a + operator are rendered as normal-sized numbers (not subscripts). A thin space is automatically inserted between a coefficient and the following element.

Input Result
\ce{2 H2O} 2 H₂O
\ce{3 NO2} 3 NO₂

Fractional coefficients

A digit sequence followed by / and another digit sequence is rendered as a stacked fraction.

Input Result
\ce{1/2 O2} ½ O₂

Charges

A + or - immediately after an element, subscript number, or closing bracket (with no intervening space) is treated as a charge superscript.

Input Result
\ce{Na+} Na⁺
\ce{SO4^2-} SO₄²⁻
\ce{[Ag(NH3)2]+} [Ag(NH₃)₂]⁺
\ce{Fe^3+} Fe³⁺
\ce{Ca^2+} Ca²⁺

Multiple charge signs are accumulated: \ce{Ca^2+} produces a single superscript "2+".

Explicit subscripts and superscripts

The _ and ^ characters work as in normal LaTeX math, with braces for multi-character content.

Input Result
\ce{Fe^{III}} Fe^III
\ce{_{92}^{238}U} ²³⁸₉₂U (isotope notation)

Single lowercase letters in script positions are rendered in math italic; all other script content is upright.

Isotope notation (pre-scripts)

When ^ or _ appears at the start of a formula or after an operator (i.e., with no preceding element), followed by an element symbol, the converter produces pre-script (left-side) notation. Both mass number and atomic number can be specified in either order.

Input Result
\ce{^{227}_{90}Th} ²²⁷₉₀Th
\ce{^{14}C} ¹⁴C
\ce{_{6}^{14}C} ¹⁴₆C

Reaction arrows

Arrow sequences in the input are converted to Unicode arrow characters. Arrows support optional labels above and/or below, specified in brackets immediately after the arrow (no space between arrow and [).

Input Arrow Unicode
-> U+2192
<- U+2190
<-> U+2194
<--> U+27F7
<=> U+21CC

Labeled arrows

\ce{A ->[catalyst] B}
\ce{A ->[fast][slow] B}
\ce{A ->[][slow] B}
  • One bracket: label above the arrow.
  • Two brackets: first is above, second is below.
  • An empty bracket is allowed (e.g., ->[][slow] places "slow" below with nothing above).

Labels are themselves parsed as chemical content, so they can contain elements, subscripts, etc.

Precipitate and gas arrows

A standalone v or ^ surrounded by spaces (or at the start/end of the formula) produces a downward or upward arrow indicating precipitate formation or gas evolution.

Input Result
\ce{BaSO4 v} BaSO₄ ↓
\ce{CO2 ^} CO₂ ↑

Note: The ^ character is only interpreted as a gas arrow when it is separated from adjacent content by spaces and is not followed by a digit or brace (which would indicate a superscript/isotope). For example, \ce{^{14}C} is an isotope, not a gas arrow.

Bonds

A - character that appears between elements (not preceded by a space and not part of an arrow sequence) is rendered as a bond dash (figure dash, U+2012).

Input Result
\ce{H3C-CH3} H₃C‒CH₃

A + preceded by a space and followed by an uppercase letter is treated as an addition operator (not a charge):

Input Result
\ce{Na+ + Cl-} Na⁺ + Cl⁻

Hydrate dot

The * character is rendered as a centered dot (·, U+00B7), used for hydrates.

Input Result
\ce{CuSO4 * 5 H2O} CuSO₄ · 5 H₂O

Equals sign

The = character is passed through as an operator.

Input Result
\ce{A = B} A = B

Parentheses and brackets

(, ), [, and ] are rendered as upright operator characters. Digits immediately following ) or ] become subscripts (see above).

Brace grouping

Content inside {...} is parsed recursively as chemical content. This allows overriding the automatic parsing rules.

Input Result
\ce{{(}Mg{)}} (Mg) — parentheses not treated as grouping

Embedded LaTeX commands

Standard LaTeX commands can be used inside \ce{...} for symbols and spacing:

  • Symbol commands: \Delta, \alpha, \rightarrow, and all other commands from the symbol table produce their corresponding Unicode character.
  • Spacing commands: \,, \;, \:, \!, \quad, and other spacing commands insert the corresponding space.
  • Nested \ce: \ce{...} can be nested within itself.
Input Result
\ce{\Delta H = -286 kJ} ΔH = −286 kJ
\ce{A \, B} A B (with thin space)

Single lowercase variables

A single lowercase letter that is not part of an element symbol and is followed (after optional whitespace) by an uppercase letter is rendered in math italic, treating it as a variable (e.g., a stoichiometric coefficient).

Input Result
\ce{n H2O} n H₂O

All other lowercase text is rendered upright.


Limitations

  1. No state annotations. The mhchem (s), (l), (g), (aq) state abbreviations are not given special formatting. They appear as plain parenthesized text, which is visually acceptable but not semantically marked.

  2. No \bond command. The mhchem \bond{...} command for explicit bond drawing (e.g., \bond{-}, \bond{=}, \bond{#}, \bond{~}, \bond{~-}, \bond{-~-}) is not supported.

  3. No \pu command. The siunitx-style physical unit command \pu{...} (available in mhchem v4) is not supported.

  4. No automatic + spacing. In mhchem, the + between species is automatically spaced. The converter treats + as a standard math operator. Spacing is generally acceptable but may differ slightly from mhchem's native rendering.

  5. No oxidation state formatting. Oxidation states written as Roman numerals in mhchem (e.g., \ce{Fe^{II}}) are rendered as plain superscripts. The small-caps or special formatting that some mhchem configurations apply is not reproduced.

  6. No @{} arrow label syntax. The mhchem v4 syntax for labeled arrows using @>{}>> and similar patterns is not supported. Only the [above][below] bracket syntax is recognized.

  7. No round-trip. Chemical equations created with \ce{...} are converted to standard OMML math (subscripts, superscripts, operators, and arrows). When exported back to LaTeX, the result is standard math notation, not \ce{...} syntax. For example, \ce{H2O} imports to OMML and exports as \mathrm{H}_{2}\mathrm{O}.

  8. Charge disambiguation is heuristic. The converter uses context (preceding element, space, bracket) to decide whether + or - is a charge superscript or an operator. Edge cases may be misinterpreted. Use explicit ^{+} or ^{-} if the automatic detection produces incorrect results.

  9. Limited arrow types. Only ->, <-, <->, <-->, and <=> arrows are recognized. The following mhchem arrow types are not supported:

    Arrow Description
    <=>> Equilibrium favoring right
    <<=> Equilibrium favoring left
    ->> Double-headed right arrow
    <<=>> Full double-arrow equilibrium
  10. No bond types beyond single dash. The converter recognizes - as a single bond. Double bonds (= in mhchem), triple bonds (# in mhchem), and other bond notations (~, ...) are not given special bond rendering. = is treated as an equality operator, not a double bond.


Requirements

Unless otherwise noted, the features described here are supported in Microsoft 365 Version 2605 (Build 20026.xxxxx) for Windows and Version 16.109 for Mac and later.