-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
mathtext: Finetuning sup/super block to match TeX reference #4873
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
Conversation
Comparing between the Tex and mathtext, It looks like the superscript is On Thu, Aug 6, 2015 at 12:44 PM, Victor Zabalza notifications@github.com
|
Well, it seems that reducing the space after the sub/subscript is not that simple after all: it works well with numbers, but for slanted characters: TeX, of course, handles these beautifully. I'll try to see where the difference in spacing comes from. @WeatherGod: indeed it is, I'll try to match that as well. |
finetuning with cm TeX match superscript height
@zblz Thank you for taking this on! |
So I think I've got it under control now for CM, stix and stixsans fontsets. There were a few challenges with integrals (also related to the This is how a sample looks with this PR in cm: To be compared with the The same sample also looks good for stix and stixsans: |
@tacaswell, @mdboom : I think this is now complete, it would be great if you could review it at some point. Looking at the issue list, this PR will fix the issue with spacing after superscripts reported in #4333. |
I have also added the sub/supercript parameters for Arev Sans, which is checked for by looking at
This could be useful for users using it and if #4636 is accepted. |
clean up, remove unnecesary do_kern=False fix overunder make cm clearer at small sizes
c8fee9e
to
2c67193
Compare
Thanks! I'm happy to merge this once Travis passes. |
hold on. The second to last line has some spacing issues. The "f" and "2" On Mon, Aug 24, 2015 at 10:45 AM, Michael Droettboom <
|
Also, the "prime" symbol in that line is much too close, especially when On Mon, Aug 24, 2015 at 10:49 AM, Benjamin Root ben.v.root@gmail.com
|
Also, our mathtext might be parsing something slightly differently than On Mon, Aug 24, 2015 at 10:49 AM, Benjamin Root ben.v.root@gmail.com
|
@WeatherGod: Yes, the kerning for the f is particularly tight, but it is tight everywhere, as you mention for the regular f and numerals 2 and 9 (and that's why I added them to that line), so it is not an issue with the sub/super script. I tried to minimize it for cm, where it looks pretty good, but did not manage for stix of stixsans. Maybe the kerning for the f should be slightly widened elsewhere to match TeX. I added a modification of the superscript kerning that takes into account how much the last character rises above the x-height to try and mitigate this, but it is tricky: if it is correct for the italic f, it is too wide for, e.g., The prime issue only happens for stix and stixsans, where it seems to match |
9fba51b
to
f1fe6e5
Compare
I fixed a test failure in |
I agree that the stix issues with the prime symbol and some of the other miscellaneous spacing is a separate issue from this PR, and indeed this PR makes things no worse than it was before in that regard. |
Ok, well, let's create some issue tickets for those so that we don't forget to fix them. This is great work @zblz! |
Ok, I created issue #4987 to track the issues I noted above. Great work! Mike, I have not reviewed a single line of code here (I wouldn't know what any of it means anyway). So, I'll leave merging this up to you? |
mathtext: Finetuning sup/super block to match TeX reference
see comments in matplotlib#4873 and matplotlib#4987: Primes in stix and DejaVu are already superscripted, so the TeX way of setting a prime as $f^\prime$ results in doubly-superscripted primes. For consistency with TeX, here we use the CM prime symbol.
see comments in matplotlib#4873 and matplotlib#4987: Primes in stix and DejaVu are already superscripted, so the TeX way of setting a prime as $f^\prime$ results in doubly-superscripted primes. For consistency with TeX, here we use the CM prime symbol.
see comments in matplotlib#4873 and matplotlib#4987: Primes in stix and DejaVu are already superscripted, so the TeX way of setting a prime as $f^\prime$ results in doubly-superscripted primes. For consistency with TeX, here we use the CM prime symbol.
see comments in matplotlib#4873 and matplotlib#4987: Primes in stix and DejaVu are already superscripted, so the TeX way of setting a prime as $f^\prime$ results in doubly-superscripted primes. For consistency with TeX, here we use the CM prime symbol.
As mentioned in #4872, I found that sub/super blocks in mathtext have slightly too much space after them, even after @mdboom fix in #4401. As initial reference, this a TeX rendering of a bunch of sub/superscripts (with E and 5 because they are box-like and separation differences are easier to spot):

The current master renders it as follows:

And with the modifications of this PR, it looks like this:

Summary of changes:
Regression images coming soon!