Math and Science Formulas Using LaTeX
Pressbooks supports LaTeX code, a typesetting language that is often used to format complex science and math equations, using MathJax built into the software.
How to Add LaTeX Equations
LaTeX can be added using the LaTeX option in the visual text editor when editing a chapter or section, or by writing out shortcodes as shown.
Note: The LaTeX shortcodes below are coloured to show examples. Actual formulas and shortcodes have to be the same color and style.
- [latex]latex code here[/latex]
- $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]
Using LaTeX syntax in H5P elements
You can draft equations inside of H5P elements in Pressbooks with MathJax LaTeX.
For H5P elements, use these LaTeX shortcodes:
- \(some LaTeX\)
- $$some LaTeX$$
- \[some LaTeX\]
Additional Resources
- LaTex in WordPress
- LaTeX reference guides
- MathJax (SPSCC Pressbooks Tutorial)