Add LaTeX
Pressbooks uses MathJax to render LaTeX/ AsciiMath/ MathML in the web version, which creates accessible image versions of equations for your EPUB and PDF exports. This means the equations are screen‑reader friendly across formats. You can also use WP QuickLaTeX which is less accessible, but offers more consistent rendering across formats, and the ability to apply site and chapter wide settings.
Configuring MathJax
MathJax should be enabled by default, you can check by going to Settings, then MathJax in your book. If the MathJax option is missing, your book is likely using WP QuickLaTeX instead. To switch back to MathJax go to Plugins where you should be able to select "Deactivate Plugin" on WP QuickLateX.
If you can't see the Plugins menu from your book you may need extra permissions granted. Contact the Library's Pressbooks team for support.
Adding math and scientific notation
You can add LaTeX to your chapter using the Visual Editor:
- Select the Insert LaTeX button in the toolbar.
- This will open a pop-up where you can add your expression e.g.
E = mc^2
- Your expression will be added in the
[latex]…[/latex]shortcode e.g.[latex]E =mc^2[/latex].
Adding LaTeX with delimiters
You can also add LaTeX/ AsciiMath/ MathML by typing the delimiters manually instead of using the Inset LaTeX button:
- Inline:
\( … \),$[latex]…[/latex]$ ,or[latex]…[/latex] - Display:
\[ … \]or$$ ... $$
This is an example of an inline equation \( E = mc^2 \) , you can see there is text on the same line before and after.
\( E = mc^2 \)Using a display delimiter will center your LaTeX on a new line:
\[
\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}
\]
\[\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}\]Using delimiters
Stay consistent with the delimiters you use throughout your Pressbook, e.g. use \( … \) and \[ … \] not \( … \) and $[latex]…[/latex]$. This allows for better compatibility in the future if you need to switch rendering engines from MathJax to WP QuickLaTeX.
Making your math and equations accessible
Avoid using math and equations in headings as they don't style well and can leak code into the table of contents. Keep LaTeX in body content.
MathML has better native compatibility with screen readers than LaTeX. Using MathJax makes LaTeX more accessible by generating accessible images for your EPUB and PDF exports. In the web version of your Pressbook, readers can right-click math to access MathJax's accessibility menu which allows for magnification, and showing in different formats such as MathML and SVG.
It's good practice to spot check how your math looks in the different formats in case your equations look too large or small.
Adjusting the size of math
You can adjust the font size of your math using CSS. From the dashboard of your Pressbook:
- Go to Appearance
- Select Custom Styles and pick Web (you can go to EPUB or PDF separately if you need to adjust them specifically.)
- Add the CSS into the Your Styles box.
Scale all math
/* Bump all equations sitewide (web output) */mjx-container {font-size: 110% !important; /* try 105–120% */}MathJax wraps each expression in <mjx-container>, so changing its font-size scales the entire equation.
Different sizes for inline vs display math (webbook)
EPUB and PDF exports
Pressbooks uses MathJax to render webbook math and then generates images for EPUB/PDF. Your mjx-container CSS doesn’t affect those images. If you need export‑only sizing, target the generated images in the EPUB/PDF Custom Styles panels, e.g.:
/* EPUB/PDF only: nudge MathJax images up globally */img.mathjax {transform: scale(1.10);transform-origin: baseline left;}You can also make display equations a bit larger than inline by scoping to your own wrapper class:
/* EPUB/PDF only: larger block equations where you’ve wrapped them */.equation-block img.mathjax { transform: scale(1.20); }Using math in H5P and TablePress
H5P
You can render LaTeX in H5P. In H5P Content in the side navigation bar and select Libraries. From here you can upload the H5P math display library and start writing math in your H5P content.
TablePress
TablePress allows you to write LaTeX or MathML directly into the table cells, MathJax will render it in the web version and exports.
Troubleshooting
- Nothing renders: Check Settings and MathJax if the option isn't there WP QuickLaTeX may be active. Also make sure you used valid delimiters and syntax.
- Physics commands error: Add
\require{physics}inside the expression. - Weird results in headings or table of contents: Don’t put LaTeX in headings.
If you need support with LaTeX or rendering math in your Pressbook contact the Library's Pressbooks team: pressbooks@library.uq.edu.au
Recommended syntax and patterns
Einstein was right: \(E = mc^2\).Display
\[\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}\]Numbered + reference
\begin{equation}\label{eq:entropy}S = -k \sum_i p_i \ln p_i\end{equation}As shown in \(\eqref{eq:entropy}\), entropy depends on the distribution.Multi-line align
\[\begin{align}F &= ma \\E &= \frac{1}{2}mv^2\end{align}\]Chemistry
\[\ce{2H2 + O2 -> 2H2O}\]Physics
\[\require{physics}\pdv{E}{t} = P\]


