Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 333f736

Browse files
committed
Merge pull request matplotlib#10 from argriffing/update-math-extensions
MAINT : update the list of sphinx math extensions, and use mathjax by default
2 parents 87a9cc9 + c60f12b commit 333f736

File tree

3 files changed

+23
-148
lines changed

3 files changed

+23
-148
lines changed

conf.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@
2222

2323
# Add any Sphinx extension module names here, as strings. They can be extensions
2424
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
25-
extensions = ['matplotlib.sphinxext.mathmpl',
26-
'matplotlib.sphinxext.only_directives',
25+
extensions = ['matplotlib.sphinxext.only_directives',
2726
'matplotlib.sphinxext.plot_directive',
28-
'matplotlib.sphinxext.ipython_directive',
27+
'IPython.sphinxext.ipython_directive',
28+
'IPython.sphinxext.ipython_console_highlighting',
29+
'sphinx.ext.mathjax',
2930
'sphinx.ext.autodoc',
3031
'sphinx.ext.doctest',
3132
'sphinx.ext.inheritance_diagram',
32-
'ipython_console_highlighting',
3333
'numpydoc']
3434

35-
3635
# Add any paths that contain templates here, relative to this directory.
3736
templates_path = ['_templates']
3837

extensions.rst

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ our :file:`sampledoc` project :file:`sphinxext` directory::
1818
home:~/tmp/sampledoc> mkdir sphinxext
1919
home:~/tmp/sampledoc> cp ../sampledoc_tut/sphinxext/*.py sphinxext/
2020
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
2322

2423
In addition to the builtin matplotlib extensions for embedding pyplot
2524
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::
3635

3736
And then we tell it what extensions to load::
3837

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']
5249

5350
Now let's look at some of these in action. You can see the literal
5451
source for this file at :ref:`extensions-literal`.
@@ -115,25 +112,18 @@ which is rendered as
115112
116113
W^{3\beta}_{\delta_1 \rho_1 \sigma_2} \approx U^{3\beta}_{\delta_1 \rho_1}
117114
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:
124117

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
127119

128-
- pngmath: uses dvipng to render the equation
120+
- sphinx.ext.mathjax: renders the math in the browser using Javascript
129121

130-
- jsmath: renders the math in the browser using Javascript
122+
- sphinx.ext.jsmath: it's an older code, but it checks out
131123

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:
134125

135-
All three of these options for math are designed to behave in the same
136-
way.
126+
- matplotlib.sphinxext.mathmpl
137127

138128
See the matplotlib `mathtext guide
139129
<http://matplotlib.sourceforge.net/users/mathtext.html>`_ for lots

sphinxext/ipython_console_highlighting.py

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)