|
3 | 3 | mdBook has optional support for math equations through
|
4 | 4 | [MathJax](https://www.mathjax.org/).
|
5 | 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 | 6 | >**Note:** The usual delimiters MathJax uses are not yet supported. You can't
|
15 | 7 | currently use `$$ ... $$` as delimiters and the `\[ ... \]` delimiters need an
|
16 | 8 | extra backslash to work. Hopefully this limitation will be lifted soon.
|
@@ -41,3 +33,64 @@ you would write:
|
41 | 33 | ```bash
|
42 | 34 | \\[ \mu = \frac{1}{N} \sum_{i=0} x_i \\]
|
43 | 35 | ```
|
| 36 | + |
| 37 | +## MathJax 2 |
| 38 | + |
| 39 | +To enable MathJax 2, you need to add the `mathjax-support` key to your `book.toml` |
| 40 | +under the `output.html` section. |
| 41 | + |
| 42 | +```toml |
| 43 | +[output.html] |
| 44 | +mathjax-support = true |
| 45 | +``` |
| 46 | + |
| 47 | +## MathJax 3 |
| 48 | + |
| 49 | +To enable MathJax 3, you need to add the `enable` key to your `book.toml` |
| 50 | +under the `output.html.mathjax` section. |
| 51 | + |
| 52 | +```toml |
| 53 | +[output.html.mathjax] |
| 54 | +enable = true |
| 55 | +``` |
| 56 | +>**Note:** Remove or set to the `false` value the `mathjax-support` key |
| 57 | +> under the `output.html` section if you set it previously. |
| 58 | +
|
| 59 | +Additionaly you can set `config` key to select used [configuration][comb-comp]. |
| 60 | +You can select one of: |
| 61 | + |
| 62 | +| Value | Input | Output | Default |
| 63 | +| :-- | :-- | :-- | :-- |
| 64 | +| tex-chtml | tex | chtml | |
| 65 | +| tex-chtml-full | tex | chtml | |
| 66 | +| tex-svg | tex | svg | |
| 67 | +| tex-svg-full | tex | svg | |
| 68 | +| tex-mml-chtml | tex, mml | chtml | yes |
| 69 | +| tex-mml-svg | tex, mml | svg | |
| 70 | +| mml-chtml | mml | chtml | |
| 71 | +| mml-svg | mml | svg | |
| 72 | + |
| 73 | +Use the `source` key to set used MathJax distribution. |
| 74 | +By default the `https://cdn.jsdelivr.net/npm/mathjax@3/es5` value is used. |
| 75 | +If value starts with `/` symbol it will be interpreted relative |
| 76 | +to [source/build](configuration/general.md) directory. |
| 77 | + |
| 78 | +For example to use local MathJax copy for tex input and svg output you can |
| 79 | +do something like: |
| 80 | + |
| 81 | +```console |
| 82 | +$ wget https://github.com/mathjax/MathJax/archive/refs/tags/3.2.2.tar.gz |
| 83 | +$ tar -xf 3.2.2.tar.gz MathJax-3.2.2/es5 |
| 84 | +$ mv MathJax-3.2.2 src/mathjax@3 |
| 85 | +``` |
| 86 | + |
| 87 | +Then add to your `book.toml` file: |
| 88 | + |
| 89 | +```toml |
| 90 | +[output.html.mathjax] |
| 91 | +enable = true |
| 92 | +source = "/mathjax@3/es5" |
| 93 | +config = "tex-svg" |
| 94 | +``` |
| 95 | + |
| 96 | +[comb-comp]: https://docs.mathjax.org/en/v3.2-latest/web/components/combined.html |
0 commit comments