Bug report
Bug summary
Matplotlib's mathtext appears not to take the size of the preceding glyph into account when positioning sub/superscripts.
Code for reproduction
from pylab import *
figtext(.4, .5, r"$\left[\frac{x}{y}\right]^2_n$")
figtext(.5, .5, r"$\left[\frac{x}{y}\right]^2_n$", usetex=True)
Actual outcome

Note that the baseline of the 2 is even lower than the baseline of the x in the mathtext case.
Expected outcome
Something approaching the usetex case.
Matplotlib version
- Operating system: linux
- Matplotlib version: master
- Matplotlib backend (
print(matplotlib.get_backend())): qt5agg
- Python version: 38
- Jupyter version (if applicable):
- Other libraries: