-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Rogue mathtext rendered spaces #4333
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
Comments
attn @mdboom Could this be related to the recent spacing changes? |
I get slightly more-reasonable whitespace after the exponent if I enclose the exponent in curly brackets. import matplotlib.pyplot as plt
s = 0.13
plt.figure(figsize=(3,2.5))
plt.figtext(0.1, 0.9-1*s, r"1a. ($a^2$)", size=20)
plt.figtext(0.1, 0.9-2*s, r"1b. ($a^{2}$)", size=20)
plt.figtext(0.1, 0.9-3*s, r"2a. $(a^2)$", size=20)
plt.figtext(0.1, 0.9-4*s, r"2b. $(a^{2})$", size=20)
plt.figtext(0.1, 0.9-5*s, r"3a. $\left(a^2\right)$", size=20)
plt.figtext(0.1, 0.9-6*s, r"3b. $\left(a^{2}\right)$", size=20)
plt.show() |
In that example, I would wonder if the kerning is being turned off for
|
That's an awful-looking example also - spacing screwed up next to the K and the contraction of the spacing in front of the q_0, along with the same spacing before the close bracket. |
Fix #4333: Whitespace after sub/super cluster
@ndevenish , @jason-sachs , @u55 : I have been finetuning the super/subscript spacing in mathtext in PR #4873, and applied a fix suggested by @mdboom to the symbol spacing in PR #4872. Applying these two PRs, the examples mention in this thread render like this:
It would be great if you could take a look at PR #4873 and make any comments you have on how the new script kerning works before it is merged. Thanks! |
Scanned it briefly. You've gone much more in depth than I have -- thanks, I trust your judgment! |
I'm aware that the built in mathtext rendered is not expected to be perfectly identical to tex, but I'm seeing some egregious behavior with spacing that I cannot seem to explain. With:
In both 1.4.2 and a recent development version I get a rogue space before the bracket in all three cases:


Compared with turning
text.usetex
on:Using a negative space (
\!
) fixes the issue rendering with matplotlib, but screws up the latex output.The text was updated successfully, but these errors were encountered: