-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add overset and underset support for mathtext #18916
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
|
I followed the developer guide for image comparisons, ref, and I pass the tests locally. Is there something I missed, since previous PRs related to |
|
Hey @QuLogic, could you take a look at this too? Thanks :D |
65ddef9 to
9ba09a5
Compare
|
Removed the extra commits |
9ba09a5 to
59f648c
Compare
|
Doc build failure seems due to #19163. @aitikgupta could you please rebase on master to pick up that change, so that docs build cleanly? @anntzer I'd like to have your review as our "master of fonts" 😄. Feel free to turn the request down if you don't have time. |
59f648c to
739898e
Compare
|
I didn't really follow @QuLogic's discussion about alignments, but right now looking at rcParams["text.latex.preamble"] = r"\usepackage{amsmath}"
s = r"$\overset{a}{a}\overset{p}{a}\overset{a}{b}\overset{p}{b}\underset{a}{a}\underset{b}{a}\underset{a}{p}\underset{b}{p}$"
figtext(.5, .6, s, usetex=True)
figtext(.5, .4, s)we get |
|
Looks like what @QuLogic said about
|
|
I would think it would be better if the p's baselines could also be aligned? |
@anntzer Something like this? |
|
Yes (unless someone wants to argue in favor of the previous behavior...). |
|
But thT is still not the same? |
@jklymak I'm not sure I understand, do you mean the baselines do not match? Maybe this will help: |
|
The overset and underset baselines are not aligned |
|
They are not aligned in TeX either, but the spread here is a bit larger than in TeX. Personally, I don't find that too bad. |
|
The spread is a bit larger even for a normal text: We could reduce the gap in the final Just for reference, here is the current version (which is currently in the PR): Should I update the PR to remove the gap? |
|
@aitikgupta I meant the spread of the baselines of the sub/supersets between a and p. Personally I'm ok with both variants in both cases, but I'm not the most critical one here. |
anntzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, and thanks for your patience handling the reviews :) I'll give it a day in case anyone else wants to comment but other than that, anyone can merge.
(Also, you can consider adding a whatsnew entry.)
c786214 to
0a030d3
Compare
|
@timhoffm Given your comment at #19186 (comment), do you want to comment wrt. baseline images? (Everything else looks great to me.) |
|
@anntzer TL;DR For the sake of simplicity, you can just merge with the new baseline images. Here it's "only" a little over 40kB of baseline images and the positioning here is much more complex. I think this should be tested and adding the baseline images is okish. (The alternative would be splitting the tests into a separte PR and keep that open until we have less data heavy ways of doing the test - either with separated baseline images or by only using a subset; probably we don't need all combinations of fonts and output formats?). Btw. what's the status with separating baseline images from the code repo? |
|
I agree positioning matters here much more than for the sqrt PR (for which I agree we could do without the test images...).
Some day I'll have time to get back to it. But that day is not particularly close :( |
|
@aitikgupta Actually let's see whether we can resolve #19186 (comment) first to save a lot of disk space on the baseline images problem. However I don't want you to believe that I'm needlessly temporizing on this so regardless of whether the proposal at #19186 (comment) gets implemented I will make sure this is merged before 3.4 is released (hence the self-assignment). |
anntzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually #19201 turned out to quite simple to implement, so let's decide on that PR first.
QuLogic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For whenever we figure out test images.
anntzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aitikgupta this needs to be rebased to use the new (cheaper) baseline images mechanism. (I can do the rebase if you prefer, just let me know.)
No that's fine, I'll do it |
0a030d3 to
fd5cfbf
Compare
|
I think just rebasing wouldn't work, I'd need to generate the baseline images too? |
|
Yes, sorry I forgot to mention that. |
fd5cfbf to
542ba9b
Compare
|
Is it fine the way it is now? |
anntzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's still stick to a single test, it's also useful to be able to compare the alignment behaviors of over and underset easily.
|
Thanks for the PR :) |
|
Open a separate PR. |








PR Summary
This PR addresses #18241, adds
\oversetand its variant\undersetLaTeX symbol, which looks like this:Also see: http://tex.wikidot.com/snippets:overset-and-underset
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).