Skip to content

DOC: clarify usetex versus mathtext #27017

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 1 commit into from
Oct 8, 2023
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
4 changes: 4 additions & 0 deletions doc/users/prev_whats_new/whats_new_3.8.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ This allows users to set the location of the legend in a more flexible and consi
Mathtext improvements
=====================

Improvements are to Mathtext, Matplotlib's native TeX-like mathematics parser
(see :ref:`mathtext`, not to be confused with Matplotlib using LaTeX directly:
:ref:`usetex`).

Boldsymbol mathtext command ``\boldsymbol``
-------------------------------------------

Expand Down
14 changes: 9 additions & 5 deletions galleries/users_explain/text/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
================================

Matplotlib implements a lightweight TeX expression parser and layout engine and
*Mathtext* is the subset of Tex markup that this engine supports. Any string can
be processed as Mathtext by placing the string inside a pair of dollar signs
``'$'``. Mathtext often contains many backslashes ``'\'``; so that the backslashes
do not need to be escaped, Mathtext is often written using raw strings. For
example:
*Mathtext* is the subset of Tex markup that this engine supports. Note that
Matplotlib can also render all text directly using TeX if :rc:`text.usetex` is
*True*; see :ref:`usetex` for more details. Mathtext support is available
if :rc:`text.usetex` is *False*.

Any string can be processed as Mathtext by placing the string inside a pair of
dollar signs ``'$'``. Mathtext often contains many backslashes ``'\'``; so that
the backslashes do not need to be escaped, Mathtext is often written using raw
strings. For example:
"""

import matplotlib.pyplot as plt
Expand Down