# 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.

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

### Example 1:

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

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

### Example 2:

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

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

## Using LaTeX syntax in H5P elements

If you would like to use LaTeX in H5P elements, email us at digitalscholarship@macewan.ca and we will activate this option for you.

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$