You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
What subset of LaTeX is rendered without 'usetex'? #14766
It would be great to have a description of the exact subset of LaTeX that is rendered by the default version of matplotlib (with usetex=False).
And it would also be useful to have an explicit statement about some commonly used packages that are NOT supported. In particular, many of the queries about LaTeX in matplotlib, both here and on stackexchange, reflect users' (incorrect) expectation that the American Mathematical Society packages are built in. Many scientific papers begin with
\usepackage{amsmath, amsthm, amssymb, amsfonts}
so that writers are not aware that tools that they use all the time are not actually part of the base distribution of LaTeX. (It would be great if a future release of matplotlib could include the functionality in these packages -- but I realize that is harder than it sounds because matplotlib's fast and compact built-in renderer is hand crafted).
Where would you expect to see this info? A PR doing this would be great. OTOH I’m not sure making AMS packages a default is a good idea unless we really think the vast majority of folks who want Latex in their plots also want the AMS packages. There is an Rc entry to allow different packages to be loaded. So maybe an example that shows the use of the AMS packages?
I'm not sure the AMS package(s) are included by default on any/all latex distributions. Meaning, if AMS is included in the default preamble it might break some/many existing scripts.
Surely, making the need to include AMS package(s) in the preamble in case certain commands are needed more transparent is desireable. Any PR in that direction would be helpful or sure.
I think the main burden is to inform people consistently about the difference between the inbuilt "MathText" and the external latex functionality and the difference between the two. Personally I would consider the docs to be quite clear about it, on the other hand, people who are just discovering those tools are probably more firm on spotting inconsistencies and hence possible improvements in the docs on that matter.
I posted this issue as a followup to a conversation with @alexrudy and other members of the matplotlib team at SciPy 2019. It turns out that some members of the team themselves have had to find personal kludges to get some of the missing AMS functionality.
The amsmath package is the second-most frequently used LaTeX package among the people participating in this tex.stackexchange thread, so it's not surprising that there are so many matplotlib related issues (above). (I suspect that amssymb, amsfont, and amsthm are almost always included when people use amsmath)
I think the maplotlib folks felt that it would be a no-brainer to include this functionality if it were easy. Turns out not to be at all easy, hence @alexrudy's query about what specific AMS functionality would be most valuable.
The thing I'd like most is \underline. It is a common notational convention to use $\underline{x}$ and $\overline{x}$ for the smallest and largest possible values of variable $x$ (\overline exists in the base distribution but \underline does not).
Other commonly used features are the \text command and various extra over and underline like commands like \varlimsup.
The one thing that team-mpl thought MIGHT be fairly easy was inclusion of a larger (or maybe complete) set of the symbols and other font items, for example the stuff in the amssymb package. One other thing that might be easy is the expanded set of predefined operators like \cot and \liminf.
Responses to other comments:
"There is an Rc entry to allow different packages to be loaded." That only works with usetex=True, which requires installation of the whole giant latex package -- which can a crippling requirement for example for a notebook on MyBinder.
Sorry for closing -- am on a flight and turbulence bumped my finger. Continuing responses:
@ImportanceOfBeingErnest: "I'm not sure the AMS package(s) are included by default on any/all latex distributions. Meaning, if AMS is included in the default preamble it might break some/many existing scripts."
The ams packages are part of all of the "required" component of all the major distributions (TeXLive, MikTeX, etc)
Glad to see this is reviving! Actually it dovetails with something I'm working on right now with @camriddell and @DrDrij and @MridulS. We're trying to build an as-compact-as-possible distribution of some software tools that include LaTeX, and it has been a real struggle to figure out what must be included, what should be included, and what can be included.
In one of my papers, for example, I use the character '\thorn' which is included in several LaTeX font bundles but in pacakages not in most base distributions. (It's an old Norse/Icelandic character that encapsulates the sound we make when we say words like "thunder" and "thor".) I'd dearly love to use this in an online MathJax compatible version of my paper, but the steps to figuring out how to make it work robustly across platforms and distributions are ... daunting.
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
jklymak commentedon Jul 13, 2019
Where would you expect to see this info? A PR doing this would be great. OTOH I’m not sure making AMS packages a default is a good idea unless we really think the vast majority of folks who want Latex in their plots also want the AMS packages. There is an Rc entry to allow different packages to be loaded. So maybe an example that shows the use of the AMS packages?
ImportanceOfBeingErnest commentedon Jul 14, 2019
I'm not sure the AMS package(s) are included by default on any/all latex distributions. Meaning, if AMS is included in the default preamble it might break some/many existing scripts.
Surely, making the need to include AMS package(s) in the preamble in case certain commands are needed more transparent is desireable. Any PR in that direction would be helpful or sure.
I think the main burden is to inform people consistently about the difference between the inbuilt "MathText" and the external latex functionality and the difference between the two. Personally I would consider the docs to be quite clear about it, on the other hand, people who are just discovering those tools are probably more firm on spotting inconsistencies and hence possible improvements in the docs on that matter.
anntzer commentedon Jul 14, 2019
I think the list of supported commands is at https://matplotlib.org/tutorials/text/mathtext.html
alexrudy commentedon Jul 14, 2019
We talked at SciPy about adding some things from AMS to mathtext – what might be most useful here?
llorracc commentedon Jul 14, 2019
I posted this issue as a followup to a conversation with @alexrudy and other members of the matplotlib team at SciPy 2019. It turns out that some members of the team themselves have had to find personal kludges to get some of the missing AMS functionality.
The amsmath package is the second-most frequently used LaTeX package among the people participating in this tex.stackexchange thread, so it's not surprising that there are so many matplotlib related issues (above). (I suspect that amssymb, amsfont, and amsthm are almost always included when people use amsmath)
I think the maplotlib folks felt that it would be a no-brainer to include this functionality if it were easy. Turns out not to be at all easy, hence @alexrudy's query about what specific AMS functionality would be most valuable.
The thing I'd like most is \underline. It is a common notational convention to use$\underline{x}$ and $\overline{x}$ for the smallest and largest possible values of variable $x$ (\overline exists in the base distribution but \underline does not).
Other commonly used features are the
\textcommand and various extra over and underline like commands like \varlimsup.The one thing that team-mpl thought MIGHT be fairly easy was inclusion of a larger (or maybe complete) set of the symbols and other font items, for example the stuff in the amssymb package. One other thing that might be easy is the expanded set of predefined operators like \cot and \liminf.
Responses to other comments:
llorracc commentedon Jul 14, 2019
Sorry for closing -- am on a flight and turbulence bumped my finger. Continuing responses:
@ImportanceOfBeingErnest: "I'm not sure the AMS package(s) are included by default on any/all latex distributions. Meaning, if AMS is included in the default preamble it might break some/many existing scripts."
@anntzer: "I think the list of supported commands is at https://matplotlib.org/tutorials/text/mathtext.html"
oscargus commentedon Jun 10, 2023
After a bit of digging (and thinking that all supported commands are actually listed), I've realized the following. The symbol lists are based on https://github.com/matplotlib/matplotlib/blob/main/doc/sphinxext/math_symbol_table.py
An obvious improvement would be to base parts of this list on the information already in the parser
matplotlib/lib/matplotlib/_mathtext.py
Lines 1721 to 1790 in 5f29763
Also, just running
math_symbol_table.pywill print out which symbols are defined but not documented.llorracc commentedon Jun 10, 2023
Glad to see this is reviving! Actually it dovetails with something I'm working on right now with @camriddell and @DrDrij and @MridulS. We're trying to build an as-compact-as-possible distribution of some software tools that include LaTeX, and it has been a real struggle to figure out what must be included, what should be included, and what can be included.
In one of my papers, for example, I use the character '\thorn' which is included in several LaTeX font bundles but in pacakages not in most base distributions. (It's an old Norse/Icelandic character that encapsulates the sound we make when we say words like "thunder" and "thor".) I'd dearly love to use this in an online MathJax compatible version of my paper, but the steps to figuring out how to make it work robustly across platforms and distributions are ... daunting.
github-actions commentedon Aug 17, 2026
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!