-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Vertical positioning in mathtext fraction rendering could be improved #18389
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
Actually I guess on TeX's side it may be worth doing an exegesis of http://brokestream.com/tex.pdf ("TeX the program"), specifically items 744-746? ("The numerator and denominator must be separated by a certain minimum clearance, called clr in the following program. The difference between clr and the actual clearance is 2delta.") Also in your proposed fix the fraction bar of |
I think we do have the minimum clearance via the
Yes, I think my adjustment for things smaller than xheight but with descenders is not quite right. I didn't really confirm their meanings... |
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! |
Bug report
Bug summary
The positioning by mathtext of the numerator, denominator, and fraction bar are less than optimal.
Code for reproduction
Actual outcome
Expected outcome
I think the most commonly noticeable problem is that digits appearing in the denominator tend to bump into the fraction bar. I used to believe that that was due to a discretization problem (i.e. we need to draw the fraction bar over an integer number of pixels to avoid blurring, so if we were supposed to have e.g. 1.5 pixels above and 1.5 pixels below this could get rounded to 2 and 1), which would still be annoying but arguably a reasonable tradeoff against blurring; but actually, rendering at large sizes shows that this is not the case (at size 42 the spaces are still clearly unequal).
The other cases are a bit more artificial, but show other aspects of the problem:
x
in the denominator, likely to make denominators line up across fractions; the denominators are very "jagged" in the mathtext case. TeX also only slightly bumps the height of they
numerator to keep numerators nearly aligned without bumping into the fraction bar, whereas mathtext just pullsy
up by its full descender.+
sign and the center of the=
, whereas mathtext's fraction bar is too low -- even though there's a comment inmathtext.py
explicitly stating "Shift so the fraction line sits in the middle of the equals sign".Matplotlib version
print(matplotlib.get_backend())
): qt5aggThe text was updated successfully, but these errors were encountered: