Appendix B: Math and Chemistry Equations
Pressbooks uses the MathJax display engine to render accessible equations. Both LaTeX and MathML can be used. Right/Control click on any of the quadratic equations below to see the accessible content.
You can create LaTeX, MathML and chemistry equations by using these editors:
The Mathpix Snip tool is an extremely useful way to screen grab equations and turn them into LaTeX.
LaTeX
For a Pressbook, your LaTeX equation must be wrapped in shortcode:
[latex]LaTeX eqn[/latex]
or
\[LaTeX eqn\]
or
$$ LaTeX eqn $$
.
However, if you want to create PDF versions of your book for your readers to download, use:
[latex]LaTeX eqn[/latex]
For this reason, we suggest only using [latex]LaTeX eqn[/latex]
for your LaTex equations. This way if you ever decide to make PDF files available for your readers, you will not have to edit your chapters.
Examples
Inline LaTeX
[latex]x=\frac{b\pm\sqrt{b^24ac}}{2a}[/latex]
This is an inline example [latex]x=\frac{b\pm\sqrt{b^24ac}}{2a}[/latex] where the equation is in the sentence.
Sometimes equations can render so small, they’re difficult to read. You can solve this by using \large or \Large or \LARGE at the the beginning of the LaTeX equation.
\large: This is an inline example [latex]\large x=\frac{b\pm\sqrt{b^24ac}}{2a}[/latex] where the equation is in the sentence.
\Large: This is an inline example [latex]\Large x=\frac{b\pm\sqrt{b^24ac}}{2a}[/latex] where the equation is in the sentence.
\LARGE: This is an inline example [latex]\LARGE x=\frac{b\pm\sqrt{b^24ac}}{2a}[/latex] where the equation is in the sentence.
This site lists even more sizes.
Display mode LaTeX
\[x=\frac{b\pm\sqrt{b^24ac}}{2a}\]
or
$$x=\frac{b\pm\sqrt{b^24ac}}{2a}$$
[latex]\large x=\frac{b\pm\sqrt{b^24ac}}{2a}[/latex]
NOTE:
 If you create a page and only use the display mode latex shortcode or $$, it will not render without an empty
[latex][/latex]
somewhere on the page.  Currently for PDF exports, LaTeX must be wrapped in styled p tags to create display mode equations.

[latex]LaTeX Eqn[/latex]
[latex]\large x=\frac{b\pm\sqrt{b^24ac}}{2a}[/latex]
 A slight shortcut is to do this in the Visual editor by highlighting a LaTeX equation and pressing the “Align center” button in the first row of the toolbar. There’s also a keyboard shortcut for this which is revealed when hovering over that button.

MathML
MathML can be used in Pressbooks, but it will only render in display/block mode. If you need inline display, currently you will need to use LaTeX.
Short code is not needed for MathML. Figure 1 is a screen grab which was the only way to display the MathML without it rendering.
The above MathML renders as:
$x=\frac{\u2013b\pm \sqrt{{b}^{2}\u20134ac}}{2a}$By adding display=”block” to the math tag and adding an mstyle tag with fontsize=’2 pt’…
…you get:
$$x=\frac{\u2013b\pm \sqrt{{b}^{2}\u20134ac}}{2a}$$If you use fontsize=’2.1 pt’, you get:
$$x=\frac{\u2013b\pm \sqrt{{b}^{2}\u20134ac}}{2a}$$Note you don’t need the xmlns=“http://www.w3.org/1998/Math/MathML” in the math tag as is shown in Figure 1; Pressbooks does this. You just need the math and /math tags.
Below are helpful resources for MathML.