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: 
[la​tex]e^{i \pi} + 1 = 0[/lat​ex]

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.

Chapter entry screen highlighting the LaTeX button and the entry box for the code.

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>
Learn more about MathML from the W3C’s documentation page.

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.

MathJax settings menu from webbook

License

Icon for the Creative Commons Attribution 4.0 International License

University of Arkansas OER Style Guide Copyright © 2023 by Lora Lennertz is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book

Feedback/Errata

Comments are closed.