From 7d89a388a188a6181d2df498ff8c2fb001f3389d Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Fri, 6 Oct 2023 08:03:55 -0700 Subject: [PATCH] DOC: clarify usetex versus mathtext [ci doc] --- doc/users/prev_whats_new/whats_new_3.8.0.rst | 4 ++++ galleries/users_explain/text/mathtext.py | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/users/prev_whats_new/whats_new_3.8.0.rst b/doc/users/prev_whats_new/whats_new_3.8.0.rst index ab5a0dce85da..8c34252098db 100644 --- a/doc/users/prev_whats_new/whats_new_3.8.0.rst +++ b/doc/users/prev_whats_new/whats_new_3.8.0.rst @@ -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`` ------------------------------------------- diff --git a/galleries/users_explain/text/mathtext.py b/galleries/users_explain/text/mathtext.py index 067a332aa54a..27aad440dcb5 100644 --- a/galleries/users_explain/text/mathtext.py +++ b/galleries/users_explain/text/mathtext.py @@ -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