| 1 |
# MathJax support |
| 2 |
|
| 3 |
mdBook has optional support for math equations through |
| 4 |
[MathJax](https://www.mathjax.org/). |
| 5 |
|
| 6 |
To enable MathJax, you need to add the `mathjax-support` key to your `book.toml` |
| 7 |
under the `output.html` section. |
| 8 |
|
| 9 |
```toml |
| 10 |
[output.html] |
| 11 |
mathjax-support = true |
| 12 |
``` |
| 13 |
|
| 14 |
>**Note:** The usual delimiters MathJax uses are not yet supported. You can't |
| 15 |
currently use `$$ ... $$` as delimiters and the `\[ ... \]` delimiters need an |
| 16 |
extra backslash to work. Hopefully this limitation will be lifted soon. |
| 17 |
|
| 18 |
>**Note:** When you use double backslashes in MathJax blocks (for example in |
| 19 |
> commands such as `\begin{cases} \frac 1 2 \\ \frac 3 4 \end{cases}`) you need |
| 20 |
> to add _two extra_ backslashes (e.g., `\begin{cases} \frac 1 2 \\\\ \frac 3 4 |
| 21 |
> \end{cases}`). |
| 22 |
|
| 23 |
|
| 24 |
### Inline equations |
| 25 |
Inline equations are delimited by `\\(` and `\\)`. So for example, to render the |
| 26 |
following inline equation \\( \int x dx = \frac{x^2}{2} + C \\) you would write |
| 27 |
the following: |
| 28 |
``` |
| 29 |
\\( \int x dx = \frac{x^2}{2} + C \\) |
| 30 |
``` |
| 31 |
|
| 32 |
### Block equations |
| 33 |
Block equations are delimited by `\\[` and `\\]`. To render the following |
| 34 |
equation |
| 35 |
|
| 36 |
\\[ \mu = \frac{1}{N} \sum_{i=0} x_i \\] |
| 37 |
|
| 38 |
|
| 39 |
you would write: |
| 40 |
|
| 41 |
```bash |
| 42 |
\\[ \mu = \frac{1}{N} \sum_{i=0} x_i \\] |
| 43 |
``` |