Skip to content

Commit 8b4fa23

Browse files
committed
Add links and expand mathmpl docstring
1 parent 78bf53c commit 8b4fa23

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

doc/devel/documenting_mpl.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ build the documentation.
5555
Building the docs
5656
-----------------
5757

58-
The documentation sources are found in the :file:`doc/` directory in the trunk.
58+
The documentation sources are found in the :file:`doc/` directory in the main branch.
5959
The configuration file for Sphinx is :file:`doc/conf.py`. It controls which
6060
directories Sphinx parses, how the docs are built, and how the extensions are
6161
used. To build the documentation in html format, cd into :file:`doc/` and run:
@@ -144,7 +144,8 @@ are some formatting and style conventions that are used.
144144
Section formatting
145145
~~~~~~~~~~~~~~~~~~
146146

147-
For everything but top-level chapters, use ``Upper lower`` for
147+
For everything but top-level chapters, use
148+
`sentence case <https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case>`__ ``Upper lower`` for
148149
section titles, e.g., ``Possible hangups`` rather than ``Possible
149150
Hangups``
150151

@@ -342,6 +343,14 @@ Note that the python script that generates the plot is referred to, rather than
342343
any plot that is created. Sphinx-gallery will provide the correct reference
343344
when the documentation is built.
344345

346+
Writing mathematical expressions
347+
--------------------------------
348+
349+
In most cases, you will likely want to use one of `Sphinx's builtin Math
350+
extensions <https://www.sphinx-doc.org/en/master/usage/extensions/math.html>`__.
351+
However, to generate html output in documentation that will correspond to the
352+
same output generated by Matplotlib, use the `matplotlib.sphinxext.mathmpl`
353+
Sphinx extension (See also the :doc:`../tutorials/text/mathtext` tutorial.)
345354

346355
.. _writing-docstrings:
347356

galleries/users_explain/text/mathtext.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
characters will behave differently depending on :rc:`text.usetex`. See the
5858
:ref:`usetex tutorial <usetex>` for more information.
5959
60+
.. note::
61+
To generate html output in documentation that will correspond to the same
62+
output generated by ``mathext``, use the `matplotlib.sphinxext.mathmpl`
63+
Sphinx extension.
64+
6065
Subscripts and superscripts
6166
---------------------------
6267
To make subscripts and superscripts, use the ``'_'`` and ``'^'`` symbols::

lib/matplotlib/sphinxext/mathmpl.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
In most cases, you will likely want to use one of `Sphinx's builtin Math
77
extensions
88
<https://www.sphinx-doc.org/en/master/usage/extensions/math.html>`__
9-
instead of this one.
9+
instead of this one. The Sphinx built-in math directive uses MathJax to
10+
render mathematical expressions, and addresses accessibility concerns that
11+
``mathmpl`` doesn't address.
12+
13+
The ``mathmpl`` Sphinx extension creates a mathtext image in Matplotlib and
14+
shows it in html output. Thus, it is a true and faithful representation of what
15+
you will see if you write a given LaTeX string to Matplotlib (see
16+
:doc:`../tutorials/text/mathtext`).
1017
1118
Mathtext may be included in two ways:
1219

0 commit comments

Comments
 (0)