About LaTeX and MathML support in Pages, Numbers, and Keynote

Learn about using LaTeX and MathML with Pages, Numbers, and Keynote, and view some sample equations.

Pages, Numbers, and Keynote support LaTeX and MathML, and support all LaTeX commands that can be converted to MathML with blahtex. Additional supported LaTeX extensions are listed below.

iBooks Author also supports LaTeX and MathML, but the app is no longer updated or available.
Learn more about transitioning from iBooks Author to Pages

Pages, Numbers, and Keynote on iCloud.com don't support LaTeX and MathML.


LaTeX commands

LaTeX generally requires equations to be enclosed in math mode commands such as the examples listed below. To make equation authoring easier, the equation editors in Pages, Numbers, Keynote, and iBooks Author are in math mode by default, so it isn't necessary to add math mode commands to your equations. 

  • \begin{math} … \end{math}
  • \begin{displaymath} … \end{displaymath}
  • \begin{equation} … \end{equation}
  • $ … $
  • $$ … $$
  • \( … \)
  • \[ … \]

To add text to an equation that inherits the paragraph style, use \text{…}. Nesting equations inside \text{...} is not supported.

In math mode, blahtex doesn't fully support non-ASCII unicode characters, but it does accept the full unicode character set in text mode. For more information on specific characters, such as the copyright symbol and characters with accent marks, see the blahtex Manual, 2.22.

Supported LaTeX commands (extensions to blahtex) and MathML elements and attributes are listed below.

LaTeX commands that Pages, Numbers, and Keynote support

Command or symbol
\phantom{}
\color
\cancel
\underrightarrow, \underleftarrow, \underleftrightarrow
\lneq, \gneq, \lvertneq, \gvertneq
\thinspace, \medspace, \thickspace, \negthinspace, \negmedspace, \negthickspace
"\:", "\,", "\;", "\!", "\ "
\lmoustache, \rmoustache
\lgroup, \rgroup
\brace, \brack
\xleftarrow, \xrightarrow
\dddot, \ddddot
\copyright
\pounds
\diagup, \diagdown
\dag,\ddag, \dagger, \ddagger
\owns, \ni
{split}

LaTeX commands that Pages, Numbers, and Keynote doesn't support

Command or symbol Notes
\mathring{}  
\ae, \AE  
\smallint  
\idotsint  
\euro Unicode symbol; works in text mode only
\varGamma  
\cal Use \mathcal{}
\mathml{}  
\center  
[lrc] in \aligned  
\fillin  
\strut  
\vphantom  
\hphantom  
\smash  
\hspace Use "\:", "\,", "\;", or \phantom{}
\mspace  
\centernot  
\buildrelover Use \overset, \underset
\tabular-related environments Limited support for \matrix and \aligned
\sideset  
\pmb, \boldmath, \unboldmath Use \boldsymbol

LaTeX commands that iBooks Author supports

Command or symbol
\phantom{}
\color
\cancel
\underrightarrow, \underleftarrow, \underleftrightarrow
\lneq, \gneq, \lvertneq, \gvertneq
\thinspace, \medspace, \thickspace, \negthinspace, \negmedspace, \negthickspace
"\:", "\,", "\;", "\!", "\ "
\lmoustache, \rmoustache
\lgroup, \rgroup
\brace, \brack
\xleftarrow, \xrightarrow
\dddot, \ddddot

LaTeX commands that iBooks Author doesn't support

Command or symbol Notes
\mathring{}  
\copyright Unicode symbol; works in text mode only
\pounds Unicode symbol; works in text mode only
\ae, \AE  
\smallint  
\diagup, \diagdown  
\idotsint  
\euro Unicode symbol; works in text mode only
\varGamma  
\cal Use \mathcal{}
\mathml{}  
\center  
[lrc] in \aligned  
\fillin  
\strut  
\vphantom  
\hphantom  
\smash  
\dag, \ddag \dagger, \ddagger supported
{split}  
\hspace Use "\:", "\,", "\;", or \phantom{}
\mspace  
\centernot  
\buildrelover Use \overset, \underset
\owns Use \ni
\tabular-related environments Limited support for \matrix and \aligned
\sideset  
\pmb, \boldmath, \unboldmath Use \boldsymbol


LaTeX packages

These LaTeX packages aren't supported:

Package Notes
cancel Use \cancel
ams Use \underrightarrow, \underleftarrow, \underleftrightarrow
centernot  


MathML elements

Use the tables below to learn about the MathML elements that Pages, Numbers, Keynote, and iBooks Author support.

Supported MathML elements

Element Notes
mo  
mi  
mn  
mrow  
menclose Not all forms of enclosing are supported
mtable Not all attributes are supported
mtr  
mtd  
mfrac  
msup  
msub  
msubsup  
munder  
mover  
munderover  
mstack  
msrow  
msgroup  
mscarries  
mscarry  
msline  
mlongdiv  
mpadded  
mspace  
maction Pages, Numbers, Keynote, and iBooks Author support the first MathML child and ignores the rest
mphantom  
mfenced  
mroot  
msqrt  
none  
mstyle  
mtext  
ms  
maligngroup  
malignmark  

Partially supported MathML elements

Element Notes
mlabeledtr Treated as <mtr> with the first child ignored
semantics Treated as row
annotation Effectively ignored

Not supported MathML elements

Element Notes
mmultiscripts  
mprescripts  
mglyph  
merror  
{ContExp} Content MathML elements are not supported.
See which elements are covered by {ContExp}.


MathML attributes

Use the tables below to learn about the MathML attributes that Pages, Numbers, Keynote, and iBooks Author support.

Supported MathML attributes

These MathML attributes are supported by Pages, Numbers, Keynote, and iBooks Author:

Element Attribute Default value inheritable from <mstyle> Values 
(Value syntax if subset of spec)
* mathcolor yes  
mstyle scriptlevel no  
mstyle display no  
mstyle scriptminsize no  
mstyle scriptsizemultiplier no  
mstyle <attributes specified with default value inheritable> n/a  
mo lspace yes  
mo rspace yes  
mo largeop yes  
mo minsize yes  
mo maxsize yes  
mo accent yes  
mo movablelimits yes  
mo symmetric yes  
mo stretchy yes  
mo form yes  
mspace width yes  
mspace height yes  
mspace depth yes  
ms lqoute yes  
ms rqoute yes  
mfrac linethickness yes  
mfrac numalign yes  
mfrac denomalign yes  
mover accent yes  
mover align yes  
munderover accent yes  
munderover underaccent yes  
munder accentunder yes  
munder align yes  
mtable rowalign yes  
mtable columnalign yes  
mtable columnspacing yes  
mtable displaystyle yes  
mtr rowalign yes  
mtr columnalign yes  
mtd rowalign yes  
mtd columnalign yes  
mstack align yes top | bottom | center | baseline | axis
msrow position yes  
msgroup position yes  
msgroup shift yes  
mscarries position yes  
mscarries crossout yes updiagonalstrike | downdiagonalstrike | horizontalstrike | verticalstrike
mscarry crossout yes updiagonalstrike | downdiagonalstrike | horizontalstrike | verticalstrike
msline length yes  
msline position yes  
mpadded height no  
mpadded depth no  
mpadded width no  
mpadded lspace no  
mpadded voffset no  
mfenced open yes  
mfenced close yes  
mfenced separators yes  
maligngroup groupalign yes  
malignmark edge yes  

Partially supported MathML attributes

These MathML attributes are partially supported by Pages, Numbers, Keynote, and iBooks Author:

Element Attribute Default value inheritable from <mstyle> Values
(Value syntax if subset of spec)
Notes
mo, mn, mi mathvariant yes Not supporting initial, stretched, looped, tailed  
mtable align no top | bottom | center | baseline | axis rownumber not supported
menclose notation yes updiagonalstrike | downdiagonalstrike | horizontalstrike | verticalstrike Learn more
mlongdiv longdivstyle no lefttop  

Not supported MathML attributes

Element Attribute Notes
* mathbackground  
mstyle infixlinebreakstyle  
mstyle veryverythinmathspace, verythinmathspace, thinmathspace, mediummathspace, thickmathspace, verythickmathspace, veryverythickmathspace Deprecated in MathML 3.
mi, mn, mo, ms, mstyle, mtext mathsize   
mi, mn, mo, ms, mstyle, mtext dir  
mi, mn, mo, ms, mstyle, mtext fontfamily,  fontweight, fontstyle, fontsize, color, background Deprecated in MathML 3.
mo linebreak   
mo lineleading  
mo linebreakstyle  
mo linebreakmultchar  
mo identalign  
mo identshift  
mo identtarget  
mo identalignfirst  
mo identshiftfirst  
mo identalignlast  
mo identshiftlast  
mo fence Doesn't affect visual layout
mo separator Doesn't affect visual layout
mspace linebreak  
mfrac bevelled  
mtable groupalign  
mtable alignmentscope  
mtable columnwidth  
mtable width  
mtable rowspacing  
mtable rowlines  
mtable columnlines  
mtable frame  
mtable framespacing  
mtable equalrows  
mtable equalcolumns  
mtable side  
mtable minlabelspacing  
mtr groupalign  
mtd rowspan  
mtd columnspan  
mtd groupalign  
mstack stackalign  
mstack charalign  
mstack charspacing  
mlongdiv position  
mlongdiv shift  
mscarries location  
mscarries scriptsizemultiplier  
mscarry location  
msline leftoverhang  
msline rightoverhang  
msline mslinethickness  
msub subscriptshift  
msup superscriptshift  
msubsup superscriptshift  
msubsup subscriptshift  
mrow ltr  
maction selection  
maction actiontype  


Sample equations

   

Basic math

LaTeX Renders as
0.15 \cdot \frac{1}{8}
-22 \div 11

2x + 3y \ge -21

3(b-5) < -6(b+5)

 \left \{ 6 \tfrac{4}{5}, \, \sqrt{49}, \, 6.\overline{3}, 
\, 7\sqrt{5} \right \}

Alignment

LaTeX Renders as
\begin{aligned}
9 && < && 15 && < && 16 \\
\sqrt{9} && < && \sqrt{15} && < && \sqrt16 \\ 
3 && < && \sqrt{15} && < && 4
\end{aligned}
\begin{aligned}
\text{first number} & & \text{second number} \\ 
10 \mbox{\phantom{=digit}} & \cdot & 9 \mbox{\phantom{=digit}}
\end{aligned}


A nice trick for aligning equation elements is to use \mbox{\phantom{space}}. The contents inside the brackets (space) will account for the amount of white space created. In the example above, adding extra characters to =digit gives more white space in between the 10 • 9. 


\begin{aligned}
N &= 0.555\ldots \\ 
{\color{red}10}N &= {\color{red} 10}(0.555\ldots) \\
10N &= 5.555\ldots
\end{aligned}

Color

LaTeX Renders As
\begin{aligned}
N &= 0.555\ldots \\ 
{\color{red}10}N &= {\color{red} 10}(0.555\ldots) \\
10N &= 5.555\ldots
\end{aligned}
\sum_{\color{0A7C10}n=0}^{\color{red}\infty}
a_n x^n

Integrals

LaTeX Renders As
\textstyle \int_{-N}^{N} e^x\, dx
\int_{-N}^{N} e^x\, dx

\textstyle differentiates between inline and display equations.

Matrices

LaTeX Renders As
\begin{matrix}
a & b \\
c & d \\
\end{matrix}
\begin{matrix}
c(1)^{n-1} & \dots & c(1)^2 & c(1) & 1 \\
c(2)^{n-1} & \dots & c(2)^2 & c(2) & 1 \\
\vdots & \ddots & \vdots & \vdots & \vdots \\
c(n)^{n-1} & \dots & 1 & 0 & 0
\end{matrix}

|x| = \begin{cases} \phantom{-} x& \text{if } x 
\geq 0 \\ -x & \text{if } x<0 \end{cases}
R_\theta = \begin{bmatrix} \cos \theta & -\sin 
\theta \\ \sin \theta & \phantom{-} \cos \theta 
\end{bmatrix}

Common equation elements

LaTeX Renders as
\(\Delta S^\circ=\sum S^{\circ }\text{products} - \sum
S^{\circ }\text{reactants}\)
HF(aq) +H_{2}O(l) \rightleftharpoons
H_{3}O^{+} (aq) +F_{-}(aq)
\nabla \times \overrightarrow{\mathbf{B}} -
\frac{1}{C} \frac{\delta
\overrightarrow{\mathbf{E}}}{\delta t} = 4\pi
\rho
x = \frac{- b\pm\sqrt{b^2-4a c}}{2a}

Long form arithmetic

MathML Renders as
<?xml version="1.0"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">
     <mstack>
         <mscarries location='nw'>
             <none/>
             <mscarry crossout='updiagonalstrike' location='n'>
             <mn>2</mn>
         </mscarry>
             <mn>1</mn>
             <none/>
         </mscarries>
         <mn>2,327</mn>
         <msrow> <mo>-</mo> <mn> 1,156</mn> </msrow>
         <msline/>
         <mn>1,171</mn>
     </mstack>
</math> 

 

<math xmlns="http://www.w3.org/1998/Math/MathML">
<mlongdiv>
  <mn> 12 </mn>
  <mn> 16.5 </mn>
  <mn> 198 </mn>
  <msgroup position='1' shift='-1'>
    <msgroup>
      <mn> 12</mn>
      <msline length='2'/>
    </msgroup>
    <msgroup>
      <mn> 78</mn>
      <mn> 72</mn>
      <msline length='2'/>
      <mn> 6.0</mn>
      <mn> 6.0</mn>
    </msgroup>
    <msgroup position='-1'>
<!-- extra shift to move to the right of the "." -->
      <msline length='3'/>
      <mn> 0</mn>
    </msgroup>
  </msgroup>
</mlongdiv>
</math>            

 

<math xmlns="http://www.w3.org/1998/Math/MathML">
   <mstack charspacing="loose">
        <mscarries position="1">
             <mn>1</mn>
        </mscarries>
        <mscarries position="1">
             <mn>1</mn>
             <mn>2</mn>
      </mscarries>
       <mn>435</mn>
       <msrow>
             <mo>×</mo>
             <none/>
             <mn>25</mn>
             </msrow>
             <msline/>
       <mscarries position="2">
             <mn>1</mn>
       </mscarries>
             <mn>2175</mn>
       <msrow position="1">
             <mn>870</mn>
       </msrow>
       <msline/>
            <mn>10875</mn>
       </mstack>
</math>

 

Pages, Numbers, Keynote, and iBooks Author don't support LaTeX for long division and remainders. To work with long division and remainders, you must use MathML. 


Learn more

Information about products not manufactured by Apple, or independent websites not controlled or tested by Apple, is provided without recommendation or endorsement. Apple assumes no responsibility with regard to the selection, performance, or use of third-party websites or products. Apple makes no representations regarding third-party website accuracy or reliability. Contact the vendor for additional information.

Published Date: