Math & TeX
GitBook supports math equations and TeX thanks to plugins. There are currently 2 official plugins to display math: mathjax and katex.
Enable a math plugin:
To enable math support, you need to add one of these plugins to your book.json
:
{
"plugins": ["mathjax"]
}
Differences between MathJax and KaTeX
The mathjax
and katex
plugins are different implementations of TeX equation rendering, backed by their respective Open Source libraries: KaTeX and MathJax.
MathJax supports the entire TeX syntax, but the output is not perfect on ebooks (PDF, ePub and Mobi).
KaTeX renders perfectly on all formats (web and ebooks), but doesn’t yet support all the syntax.
Add math to your content:
Here is some inline math: $$a \ne 0$$
A block of math should begin with a new line:
Here is a block of math:
$$
a \ne 0
$$