11 MathJax

Pressbooks offers two methods to create mathematical equations in your books: MathJax and QuickLaTeX.

MathJax is an open-source JavaScript display engine that translates mathematical markup (LaTeX and MathML) into high resolution, accessible equations that can render in any supported book format on Pressbooks.

MathJax has built-in accessibility. Within the webbook, readers can right-click any equation rendered in MathJax to access additional display options and accessibility features.

Accessibility in MathJa

LaTeX is not required for simple equations where the numbers, symbols, and letters for the equation are available on a standard keyboard and can be entered in a clear manner.

For example:

(a+b)3 = a3 + 3a2b + 3ab2 + b3

You will need to use LaTex for complex formulas and equations.

LaTeX in MathJax

LaTeX is a programming language. It can be used to create formulas and equations in Pressbook. Follow these steps:

  • Translate your formula or equation to LaTeX
  • Wrap the formula with the LaTeX shortcode.

LaTeX shortcodes  are colored to show examples. The formula and the LaTeX shortcodes have to be the same color and style.

  • [la​tex]latex code here[/lat​ex]
  • $latex latex code here$

Example 1:

 

[latex]\left(1+x\right)^n=1+\frac{nx}{1!}+\frac{n\left(n-1\right)x^2}{2!}+\ldots[/latex]

 

[latex]\left(1+x\right)^n=1+\frac{nx}{1!}+\frac{n\left(n-1\right)x^2}{2!}+\ldots[/latex]

 

Example 2:

$latex \left(1+x\right)^n=1+\frac{nx}{1!}+\frac{n\left(n-1\right)x^2}{2!}+\ldots$

 

[latex]\left(1+x\right)^n=1+\frac{nx}{1!}+\frac{n\left(n-1\right)x^2}{2!}+\ldots[/latex]

 

You can use these resources to translate your formula or equation to LaTeX.

  1. An online resource: http://www.sciweavers.org/free-online-latex-equation-editor
  2. Write an equation in Microsoft word and convert it to LaTeX.

Using LaTeX syntax in H5P elements

You can draft equations inside of H5P elements in Pressbooks with MathJax LaTeX. To enable this feature, a new H5P library needs to be installed. Download it here, and upload it through the library admin page on your H5P enabled site.

For H5P elements, use these LaTeX shortcode.

  • \(some LaTeX\)
  • $$some LaTeX$$
  • \[some LaTeX\] 

 

Example in H5P

LaTeX shortcodes are colored to show examples. The formula and the LaTeX shortcodes have to be of the same color and type.

 


""

Pressbooks User Guide

License

Icon for the Creative Commons Attribution 4.0 International License

MathJax Copyright © 2021 by Alaka Pradhan is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book