Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MathJax not rendering in Sphinx

I have a documentation set in Sphinx reST. I've included sphinx.ext.mathjax in conf.py, and included the line "mathjax_path = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js'". I believe that is all I need to do before adding markup to the rst files. But my equations aren't being rendered. For example,

:math:`a^2 + b^2 = c^2`

comes out of the browser as

\(a^2 + b^2 = c^2\)

No fancy font or anything. The HTML is

<span class="math">\(a^2 + b^2 = c^2\)</span>
like image 615
caduceus Avatar asked Dec 15 '22 04:12

caduceus


1 Answers

You still need to declare the extention to sphinx-doc in the conf.py file.

On the top of the conf.py file, soon after import sys, os under "general configuration" you will see the comments notes about including extentions. For mathjax you need to add it to the listed extension:

 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
 extensions = ['sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinx.ext.ifconfig']

(I've just copy pasted my own, you may have other or no extentions listed there at the moment).

That in combination with the mathjax_path that you have already set should work.

like image 87
FvD Avatar answered Dec 28 '22 07:12

FvD