Languages

iBooks Author: About LaTeX and MathML support

Learn about using LaTeX and MathML with iBooks Author, and view some sample equations.

LaTeX and MathML are supported by iBooks Author beginning with version 2.0. iBooks Author supports all LaTeX commands that can be converted to MathML with blahtex. Additional supported LaTeX extensions are listed below.

Note: LaTeX generally requires equations to be enclosed in math mode command such as the examples listed below. To make equation authoring easier, iBooks Author's equation editor is 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}
  • $ … $
  • $$ … $$
  • \( … \)
  • \[ … \]

If you want to add text to an equation in iBooks Author that inherits the paragraph style, use \text{}. Nesting equations inside \text{...} is not supported.

In math mode, blahtex accepts only ASCII characters; however, blahtex accepts non-ASCII characters 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

These additional LaTeX commands (extensions to blahtex) are supported in iBooks Author:

\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

These LaTeX commands are NOT supported:

\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  
\mathml{}  
\left  
\right  
\center  
[lrc] in \aligned  
\fillin  
\strut  
\vphantom  
\hphantom  
\smash  
\dag, \ddag \dagger, \ddagger supported
{split}  
\hspace Use "\:", "\,", "\;", or \phantom{}
\mspace  
\xleftarrow, \xrightarrow  
\centernot  
\buildrelover Use \overset, \underset
\owns  
\tabular-related environments Limited support for \matrix and \aligned
\sideset  
\pmb  

These LaTeX packages are NOT supported:

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

MathML elements

These MathML elements are supported in iBooks Author:

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 iBooks Author supports the first MathML child and ignores the rest
mphantom  
mfenced  
mroot  
msqrt  
none  
mstyle  
mtext  
ms  
maligngroup  
malignmark  

These MathML elements are partially supported:

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

These MathML elements are NOT supported in iBooks Author:

Element

Notes

mmultiscripts  
mprescripts  
mglyph  
merror  
{ContExp} Content MathML elements are not supported. See http://www.w3.org/TR/MathML3/appendixa.html for details of which elements are covered by {ContExp}

MathML attributes

These MathML attributes are supported by iBooks Author:

* 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  

These MathML attributes are partially supported by iBooks Author:

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 https://developer.mozilla.org/en/MathML/Element/menclose
mlongdiv longdivstyle no lefttop  

These MathML elements are NOT supported:

Element

Attribute

Notes

* mathbackground  
mstyle infixlinebreakstyle  
mstyle veryverythinmathspace, verythinmathspace, thinmathspace, mediummathspace, thickmathspace, verythickmathspace, veryverythickmathspace Depreciated 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 Depreciated 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

0.15 \bullet \frac{1}{8} basic1
-22 \div 11 basic2
2x + 3y \ge -21 basic3
3(b-5) < -6(b+5) basic4
\left \{ 6\frac{4}{5}, \sqrt{49}, 6. \overline{3}, \sqrt57  \right \} basic5

Alignment

\begin{aligned}
9 && < && 15 && < && 16 \\
\sqrt{9} && < && \sqrt{15} && < && \sqrt16 \\
3 && < && \sqrt{15} && < &&4
\end{aligned
}

alignment

\begin{aligned}
\mbox{first number} & & \mbox{second number}
\\
10 \mbox{\phantom{=digit}} & \cdot &
9 \mbox{\phantom{=diiigit}} &\end{aligned
}

Note: 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 =diigit gives more white space in between the 10 • 9. 

alignment2

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

alignment3

Color

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

alignment3
\sum_{\color{0A7C10}n=0}^{\color{red}\infty} a_n x^n color2

Integrals

\textstyle \int\limits_{-N}^{N} e^x\, dx integral
\int\limits_{-N}^{N} e^x\, dx integral2

Note: \textstyle differentiates between inline and display equations.

Matrices

\begin{matrix}
a & b \\
c & d \\
\end{matrix
}
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
}
matrix2

Note: LaTeX offers several tags that can be used to create matrices. iBooks Author supports only the matrix tag. The following tags are unsupported: cases, vmatrix, bmatrix, pmatrix, aligned. 

Common equation elements

\(\Delta S^\circ=\sum S^{\circ }products - \sum S^{\circ }reactants\) real
\(HF\left( aq\right) +H_{2}O\left( l\right) \rightleftharpoons H_{3}O^{+}\left( aq\right) +F_{-}\left( aq\right)\) real2
\nabla \times \overrightarrow{\mathbf{B}} -\frac{1}{C} \frac{\delta \overrightarrow{\mathbf{E}}}{\delta t} = 4\pi \rho real3
x={-b\pm\sqrt{b^2-4ac} \over 2a} real4

Long form arithmetic

<?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>
            
long1
<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>
            
long2
<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>3</mn> </mscarries>
  <mn>435</mn>
  <msrow> <mo>×</mo> <none/> <mn>25</mn> </msrow>
  <msline/>

  <mscarries position="2"> <mn>1</mn> </mscarries>
  <mn>2185</mn>
  <msrow position="1"><mn>874</mn></msrow>
  <msline/>

  <mn>10925</mn>
</mstack>
</math>
            
long3

Note: iBooks Author doesn't support LaTeX for long division and remainders. To work with long division and remainders, you must use MathML. 

Important: Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. Apple assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. Apple provides this only as a convenience to our users. Apple has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and Apple assumes no responsibility in this regard. Please understand that a third-party site is independent from Apple and that Apple has no control over the content on that website. Please contact the vendor for additional information.
Last Modified: Jul 29, 2014
Helpful?
Yes
No
  • Last Modified: Jul 29, 2014
  • Article: HT5321
  • Views:

    973
  • Rating:
    • 20.0

    (1 Responses)

Additional Product Support Information

Start a Discussion
in Apple Support Communities
See all questions on this article See all questions I have asked