Math

Simple Math

For complex math, Atlas supports LaTeX and MathML markup—details on these below. You can also use regular text for writing simple equations and expressions.

You can use regular text for any math you can type using the following:

  • Standard keyboard characters

  • Superscripts and/or subscripts

  • Greek letters (e.g., ∑)

  • Operators or other special characters (e.g., ∫—see Unicode for Special Characters)

For example, you can write the Pythagorean theorem in text, but not the quadratic formula.

Math Markup Languages

Atlas supports two math-specific markup languages: LaTeX and MathML.

LaTeX

LaTeX is a typesetting language particularly suited to scientific works. Atlas's limited support for LaTeX includes its use in passthroughs to mark up complex math equations.

MathML

MathML is a markup language similar to HTML, but with tags specifically for mathematical symbols and equations.

How Does Math Work in Atlas?

If the LaTeX/MathML markup is correct in Atlas, it should render fine in any build format. Note that if you use LaTeX, it is converted to MathML by Atlas during the build process. This is because MathML is easier for ereaders to render.

You will need to put all math markup into passthroughs, as demonstrated in the following examples.

Math in HTMLBook Projects

There are two ways to display math in HTML: inline and block. Inline means that the math is part of the flow of the text, while block means the math will be set on a new line.

Note

Note that LaTeX passthroughs require additional delimeters. You can use either \( ... \) or $ ... $

LaTeX Inline

<span data-type="tex">\( x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \)</span>

LaTeX Block

<div data-type="equation">
<p data-type="tex">\( x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} \)</p>
</div>

MathML Block

++++
<div data-type="equation">
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
  <mrow>
        <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo>
            <mrow>
              <mn>4</mn>
              <mi>x</mi>
            </mrow>
    <mo>+</mo>
    <mn>4</mn>
  </mrow>
    <mo>=</mo>
    <mn>0</mn>
</mrow>
</math>
</div>
++++

MathML Inline

<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><mi>a</mi> <mo>+</mo> <mi>b</mi></math>

Math in Asciidoc Projects

Using math markup in Asciidoc is similar to HTMLBook, but requires different passthroughs.

LaTeX Inline

latexmath:[x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}]

LaTeX Block

[latexmath]
++++
\(
x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\)
++++
Note

As with HTML, $ also works as a delimeter.

MathML Block

<div data-type="equation">
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
  <mrow>
        <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo>
            <mrow>
              <mn>4</mn>
              <mi>x</mi>
            </mrow>
    <mo>+</mo>
    <mn>4</mn>
  </mrow>
    <mo>=</mo>
    <mn>0</mn>
</mrow>
</math>
</div>

MathML Inline

pass:[<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><mi>a</mi> <mo>+</mo> <mi>b</mi></math>]

Math in Docbook Projects

Using math markup in DocBook is similar to HTMLBook, but requires different elements.

LaTeX

Titled formal equation
<equation>
  <title>Derivative</title>
  <mathphrase role="tex">\begin{equation}
  {\frac{dy}{dx} = 2x}
  \end{equation}</mathphrase>
</equation>
Derivative

\({\frac{dy}{dx} = 2x}\)

Block, untitled informal equation
<informalequation>
  <mathphrase role="tex">\begin{equation}
  {\int_{-10}^{10}x^2\,dx}
  \end{equation}</mathphrase>
</informalequation>

\({\int_{-10}^{10}x^2\,dx}\)

Inline equation
<para>The volume of a sphere can be calculated with the formula 
<inlineequation><mathphrase role="tex">$\frac{4}{3} \pi r^3$</mathphrase>
</inlineequation>.</para>

The volume of a sphere can be calculated with the formula \(\frac{4}{3} \pi r^3\).

MathML

Titled formal equation
		<equation><title>Titled formal equation</title><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="block"><mml:mrow><mml:mi>F</mml:mi><mml:mo>=</mml:mo><mml:mi>C</mml:mi><mml:mo>×</mml:mo><mml:mfrac><mml:mn>9</mml:mn><mml:mn>5</mml:mn></mml:mfrac><mml:mo>+</mml:mo><mml:mn>32</mml:mn></mml:mrow></mml:math></equation>
Block, untitled informal equation
	<informalequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="block"><mml:mrow><mml:mi>F</mml:mi><mml:mo>=</mml:mo><mml:mi>C</mml:mi><mml:mo>×</mml:mo><mml:mfrac><mml:mn>9</mml:mn><mml:mn>5</mml:mn></mml:mfrac><mml:mo>+</mml:mo><mml:mn>32</mml:mn></mml:mrow></mml:math></informalequation>
Inline equation
	<para>The following is an inline equation using MathML <inlineequation><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:mo>exp</mml:mo><mml:mo>(</mml:mo><mml:mo>-</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inlineequation></para>