Skip to content

MAINT: update the list of sphinx math extensions, and use mathjax by default #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['matplotlib.sphinxext.mathmpl',
'matplotlib.sphinxext.only_directives',
extensions = ['matplotlib.sphinxext.only_directives',
'matplotlib.sphinxext.plot_directive',
'matplotlib.sphinxext.ipython_directive',
'IPython.sphinxext.ipython_directive',
'IPython.sphinxext.ipython_console_highlighting',
'sphinx.ext.mathjax',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.inheritance_diagram',
'ipython_console_highlighting',
'numpydoc']


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

Expand Down
48 changes: 19 additions & 29 deletions extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ our :file:`sampledoc` project :file:`sphinxext` directory::
home:~/tmp/sampledoc> mkdir sphinxext
home:~/tmp/sampledoc> cp ../sampledoc_tut/sphinxext/*.py sphinxext/
home:~/tmp/sampledoc> ls sphinxext/
apigen.py docscrape_sphinx.py ipython_console_highlighting.py
docscrape.py inheritance_diagram.py numpydoc.py
apigen.py docscrape.py docscrape_sphinx.py numpydoc.py

In addition to the builtin matplotlib extensions for embedding pyplot
plots and rendering math with matplotlib's native math engine, we also
Expand All @@ -36,19 +35,17 @@ file by adding the following. First we tell it where to find the extensions::

And then we tell it what extensions to load::

# Add any Sphinx extension module names here, as strings. They can
# be extensions coming with Sphinx (named 'sphinx.ext.*') or your
# custom ones.
extensions = [
'matplotlib.sphinxext.mathmpl',
'matplotlib.sphinxext.only_directives',
'matplotlib.sphinxext.plot_directive',
'matplotlib.sphinxext.ipython_directive',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'ipython_console_highlighting',
'inheritance_diagram',
'numpydoc']
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['matplotlib.sphinxext.only_directives',
'matplotlib.sphinxext.plot_directive',
'IPython.sphinxext.ipython_directive',
'IPython.sphinxext.ipython_console_highlighting',
'sphinx.ext.mathjax',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.inheritance_diagram',
'numpydoc']

Now let's look at some of these in action. You can see the literal
source for this file at :ref:`extensions-literal`.
Expand Down Expand Up @@ -115,25 +112,18 @@ which is rendered as

W^{3\beta}_{\delta_1 \rho_1 \sigma_2} \approx U^{3\beta}_{\delta_1 \rho_1}

This documentation framework includes a Sphinx extension,
:file:`sphinxext/mathmpl.py`, that uses matplotlib to render math
equations when generating HTML, and LaTeX itself when generating a
PDF. This can be useful on systems that have matplotlib, but not
LaTeX, installed. To use it, add ``mathmpl`` to the list of
extensions in :file:`conf.py`.
Recent versions of Sphinx include built-in support for math.
There are three flavors:

Current SVN versions of Sphinx now include built-in support for math.
There are two flavors:
- sphinx.ext.pngmath: uses dvipng to render the equation

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

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

To use these extensions instead, add ``sphinx.ext.pngmath`` or
``sphinx.ext.jsmath`` to the list of extensions in :file:`conf.py`.
Additionally, matplotlib has its own math support:

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

See the matplotlib `mathtext guide
<http://matplotlib.sourceforge.net/users/mathtext.html>`_ for lots
Expand Down
114 changes: 0 additions & 114 deletions sphinxext/ipython_console_highlighting.py

This file was deleted.