MathJax in Sphinx¶
Using any math on a page causes Sphinx to automatically load MathJax: \(e^{i\pi} = -1\).
If you want to highlight pieces of code with MathJax, too, then you can either:
Use a custom mathjax config script (see the discussion in
recipes/mathjax.rst
, the configuration inconf.py
, and the implementation inrecipes/sphinx/_static/mathjax_config.js
). Math in the following snippet is highlighted using this technique; look for the link tomathjax_config.js
in the<head>
of this webpage:Notation "\mathbb{N}" := nat.
Use a custom script on a single page; this works best if you need MathJax on just one page and you do not need to customize MathJax further. Math in the following Coq snippet is highlighted that way (view the source of this page to see the custom script):
Notation "\mathbb{B}" := bool.