Skip to content

Commit a1926bb

Browse files
azerupibudziq
authored andcommitted
Update documentation for mathjax
1 parent 094c1e7 commit a1926bb

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

book-example/book.toml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
title = "mdBook Documentation"
22
description = "Create book from markdown files. Like Gitbook but implemented in Rust"
33
author = "Mathieu David"
4+
5+
[output.html]
6+
mathjax-support = true

book-example/src/format/mathjax.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
# MathJax Support
22

3-
mdBook supports math equations through [MathJax](https://www.mathjax.org/).
3+
mdBook has optional support for math equations through [MathJax](https://www.mathjax.org/).
44

5-
**However the normal method for indication math equations with `$$` does not work (yet?).**
5+
To enable MathJax, you need to add the `mathjax-support` key to your `book.toml` under the `output.html` section.
66

7-
To indicate an inline equation \\( \int x = \frac{x^2}{2} \\) use
7+
```toml
8+
[output.html]
9+
mathjax-support = true
810
```
9-
\\( \int x = \frac{x^2}{2} \\)
11+
12+
>**Note:**
13+
The usual delimiters MathJax uses are not yet supported. You can't currently use `$$ ... $$` as delimiters and the `\[ ... \]` delimiters need an extra backslash to work. Hopefully this limitation will be lifted soon.
14+
15+
### Inline equations
16+
Inline equations are delimited by `\\[` and `\\]`. So for example, to render the following inline equation \\( \int x dx = \frac{x^2}{2} + C \\) you would write the following:
17+
```
18+
\\( \int x dx = \frac{x^2}{2} + C \\)
1019
```
1120

12-
To indicate a block equation
21+
### Block equations
22+
Block equations are delimited by `\\[` and `\\]`. To render the following equation
1323

1424
\\[ \mu = \frac{1}{N} \sum_{i=0} x_i \\]
1525

1626

17-
use
27+
you would write:
1828

1929
```bash
2030
\\[ \mu = \frac{1}{N} \sum_{i=0} x_i \\]

0 commit comments

Comments
 (0)