]> BookStack Code Mirror - hacks/blob - content/mathjax-tex/index.md
Fixed repeated word
[hacks] / content / mathjax-tex / index.md
1 +++
2 title = "Render TeX/LaTeX Mathematics with MathJax"
3 author = "@codemicro"
4 date = 2023-02-27T00:00:00Z
5 updated = 2023-02-27T00:00:00Z
6 tested = "v23.02"
7 +++
8
9 This hack will allow TeX/LaTeX mathematic markup to be rendered within a page on
10 BookStack using [MathJax](https://www.mathjax.org/).
11
12 Inline math can be surrounded with `$` and math blocks can be surrounded with 
13 `$$` or `\[...\]`. Additionally LaTeX environments and `\ref{...}` commands will be processed.
14
15 This can be used with both the WYSIWYG editor and the Markdown editor and will
16 affect everything on a given page, meaning this can be used in titles,
17 book/chapter headings, etc.
18
19 #### Considerations
20
21 - This relies on JavaScript to parse and render content on page load.
22 - This loads the MathJax JavaScript from an external CDN (jsdelivr.net) server.
23 - Math rendering may not work in all areas of the application, notedly:
24   - No rendering in the Markdown live preview.
25   - No rendering in many export formats, including PDF.
26 - This could introduce rendering of Math where not intended.
27
28 #### Options
29
30 It is possible to further [configure MathJax as documented here](https://docs.mathjax.org/en/latest/web/configuration.html).
31
32 #### Code
33
34 {{<hack file="head.html" type="head">}}