Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Description
Bug summary
As seen, LaTeX does not add a space around the arrows (or =/+-sign) when in subscripts, but mathtext does.
Note that there is no space around\to
but in mathtext,around\rightarrow
in mathtext, while for LaTeX they look exactly the same. (This is because\to
is not listed in_mathtext.Parser._arrow_symbols
, but it should be.)
Code for reproduction
importmatplotlib.pyplotaspltstrings= [r'$\limsup_{x\to\infty}$',r'$\limsup_{x\rightarrow\infty}$',r'$x \to \infty$',r'$x \rightarrow \infty$',r'$\limsup_{x=a+b}$',r'$x=a+b$',r'$A^{a \times b}_{c \Uparrow d}$']fori,sinenumerate(strings):plt.text(0,i*0.15+0.05,s,fontsize=20)plt.text(0.5,i*0.15+0.05,f"${s}$",usetex=True,fontsize=20)plt.axis(False)plt.savefig("spacing.png",dpi=200)
Actual outcome
Expected outcome
No spaces around "spaced operators" in subscript.
Additional information
@devRD is this something you know how to fix?
Related to the failing test in#26173
Operating system
No response
Matplotlib Version
Latest main
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None