Chapter 14 Mathematics
Since PreTeXt was originally called MathBook XML, you will not be surprised to learn that it has robust support for mathematical formulas. Inside the tags that delimit math environments, your code is basically LaTeX , with the caveat that you must be careful with < and & since they are special symbols for XML. When typing math in your PreTeXt code, use
\lt for <, use
\gt for > (not strictly necessary, but good for symmetry), and use
\amp for &. In HTML, MathJax is used to render math, so PreTeXt generally supports the things that MathJax does “out of the box” (with the addition of
amsmath) without the need for too many additional packages to be loaded.
For inline math, just wrap things in the
<m> tag. For example, \(a^2 + b^2 = c^2\) is produced by
<m>a^2 + b^2 = c^2</m>. We get displayed equations via the
<men> tags; the latter produces a numbered equation.
The code in Listing 14.0.1 produces the following output:
For a collection of equations all aligned at a designated point, use
<mrow>. (There's also
<mdn> for numbered equations.)
The code in Listing 14.0.2 produces the following output:
Because most of the early adopters of PreTeXt have been mathematicians, there are lots of additional features supported in terms of mathematics. See Section 4.9 for further details.