Math in Pressbooks – MathJax
Pressbooks offers two different methods for rendering mathematical equations in your books: via a native MathJax integration and through the WP QuickLaTeX plugin. MathJax is an open source JavaScript display engine that translates mathematical markup into accessible equations on the web. Pressbooks features a native integration with MathJax that renders math expressions with MathJax in the webbook and creates accessible image versions of equations and other mathematical markup for its EPUB and PDF exports.
Display LaTeX with MathJax
There are two ways to use LaTeX syntax in MathJax:
Shortcode syntax:
[latex]e^{i \pi} + 1 = 0[/latex]
Dollar sign syntax:
$latex e^{i \pi} + 1 = 0$
You can click the LaTeX button in the visual editor to input LaTeX directly or add the syntax delimiters to an expression manually.
Note that equations will not display fully formatted in the editor. However, you can view the webbook or export your files at any time to see how the equations appear. Learn more about LaTeX from their documentation.
Display AsciiMath with MathJax
MathJax is capable of rendering AsciiMath, a client-side markeup language for mathematics. There are two ways to use AsciiMath syntax in MathJax:
Shortcode syntax:
[asciimath]e^{i \pi} + 1 = 0[/asciimath]
Dollar sign syntax:
$asciimath e^{i \pi} + 1 = 0$
AsciiMath can be drafted directly in the visual editor. Learn more about AsciiMath from their website.
Display MathML with MathJax
MathML is an XML-based mathematical markup language. To render MathML with MathJax, input the relevant expression using the Text Editor:
Example:
<math><mrow><mrow><msup> <mi>x</mi> <mn>2</mn> </msup> <mo>+</mo><mrow><mn>4</mn><mo></mo><mi>x</mi></mrow><mo>+</mo><mn>4</mn></mrow><mo>=</mo><mn>0</mn></mrow></math>
Configure MathJax Settings
Click ‘Settings -> MathJax‘ to access your MathJax settings page. If you do not see a MathJax settings option, this usually means that your book is using the WP QuickLaTeX plugin.
The MathJax settings page provides examples of support syntax and allows you to to change the text color of all equations in your book and select the font used when generating images for use in EPUB and PDF exports.
Use MathJax’s Accessibility Features
Within the webbook, readers can right click any equation rendered in MathJax to access additional display options and accessibility features. Options include the ability to magnify any equation on click or hover, the ability to display the math in HTML, SVG, and other formats, and more. Learn more about MathJax’s accessibility features from their documentation.
Feedback/Errata