@@ -18,8 +18,7 @@ our :file:`sampledoc` project :file:`sphinxext` directory::
18
18
home:~/tmp/sampledoc> mkdir sphinxext
19
19
home:~/tmp/sampledoc> cp ../sampledoc_tut/sphinxext/*.py sphinxext/
20
20
home:~/tmp/sampledoc> ls sphinxext/
21
- apigen.py docscrape_sphinx.py ipython_console_highlighting.py
22
- docscrape.py inheritance_diagram.py numpydoc.py
21
+ apigen.py docscrape.py docscrape_sphinx.py numpydoc.py
23
22
24
23
In addition to the builtin matplotlib extensions for embedding pyplot
25
24
plots and rendering math with matplotlib's native math engine, we also
@@ -36,19 +35,17 @@ file by adding the following. First we tell it where to find the extensions::
36
35
37
36
And then we tell it what extensions to load::
38
37
39
- # Add any Sphinx extension module names here, as strings. They can
40
- # be extensions coming with Sphinx (named 'sphinx.ext.*') or your
41
- # custom ones.
42
- extensions = [
43
- 'matplotlib.sphinxext.mathmpl',
44
- 'matplotlib.sphinxext.only_directives',
45
- 'matplotlib.sphinxext.plot_directive',
46
- 'matplotlib.sphinxext.ipython_directive',
47
- 'sphinx.ext.autodoc',
48
- 'sphinx.ext.doctest',
49
- 'ipython_console_highlighting',
50
- 'inheritance_diagram',
51
- 'numpydoc']
38
+ # Add any Sphinx extension module names here, as strings. They can be extensions
39
+ # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
40
+ extensions = ['matplotlib.sphinxext.only_directives',
41
+ 'matplotlib.sphinxext.plot_directive',
42
+ 'IPython.sphinxext.ipython_directive',
43
+ 'IPython.sphinxext.ipython_console_highlighting',
44
+ 'sphinx.ext.mathjax',
45
+ 'sphinx.ext.autodoc',
46
+ 'sphinx.ext.doctest',
47
+ 'sphinx.ext.inheritance_diagram',
48
+ 'numpydoc']
52
49
53
50
Now let's look at some of these in action. You can see the literal
54
51
source for this file at :ref: `extensions-literal `.
@@ -115,25 +112,18 @@ which is rendered as
115
112
116
113
W^{3 \beta }_{\delta _1 \rho _1 \sigma _2 } \approx U^{3 \beta }_{\delta _1 \rho _1 }
117
114
118
- This documentation framework includes a Sphinx extension,
119
- :file: `sphinxext/mathmpl.py `, that uses matplotlib to render math
120
- equations when generating HTML, and LaTeX itself when generating a
121
- PDF. This can be useful on systems that have matplotlib, but not
122
- LaTeX, installed. To use it, add ``mathmpl `` to the list of
123
- extensions in :file: `conf.py `.
115
+ Recent versions of Sphinx include built-in support for math.
116
+ There are three flavors:
124
117
125
- Current SVN versions of Sphinx now include built-in support for math.
126
- There are two flavors:
118
+ - sphinx.ext.pngmath: uses dvipng to render the equation
127
119
128
- - pngmath: uses dvipng to render the equation
120
+ - sphinx.ext.mathjax: renders the math in the browser using Javascript
129
121
130
- - jsmath: renders the math in the browser using Javascript
122
+ - sphinx.ext. jsmath: it's an older code, but it checks out
131
123
132
- To use these extensions instead, add ``sphinx.ext.pngmath `` or
133
- ``sphinx.ext.jsmath `` to the list of extensions in :file: `conf.py `.
124
+ Additionally, matplotlib has its own math support:
134
125
135
- All three of these options for math are designed to behave in the same
136
- way.
126
+ - matplotlib.sphinxext.mathmpl
137
127
138
128
See the matplotlib `mathtext guide
139
129
<http://matplotlib.sourceforge.net/users/mathtext.html> `_ for lots
0 commit comments