Math in your ebooks using KaTeX

GitBook (1.1.0) now supports KaTeX as a replacement to MathJax, giving you beautiful pre-rendered math that is eBook compatible!

KaTeX

It was already possible to add math to your books using the MathJax plugin. In fact, since version 1.0.0, the editor would preview realtime renders of your equations.

GitBook includes parsing of TeX delimited by $$:

The quadratic formula is $$-b \pm \sqrt{b^2 - 4ac} \over 2a$$

Up until now, rendering TeX required loading MathJax (heavy), this did not work well for eBooks. However, last month Khan Academy introduced KaTeX, a fast math typesetting library capable of pre-rendering TeX.

KaTeX is a great initiative, so we decided to build a KaTeX GitBook plugin that leverages KaTeX to pre-render TeX markup. You can add this plugin directly from the editor using the menu Book > Plugins > New Plugin and by entering katex, you will need to run the installation process using the menu Book > Plugins > Install Plugins to make your changes effective.

Using latest version of GitBook (1.1.0, now available on gitbook.io), you will now be able to leverage the KaTeX plugin across all your ebooks (epub, mobi and pdf).

Have feedback on this post? Let @GitBookIO know on Twitter, or contact us.