Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Correct position of the mathtext accent#25210
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks! As the rendering will change, the result images must be updated as well. If I recall correctly, and I may not, there are some edge cases where this actually will not work properly. Probably in the cases where the error is large (like 31 instead of 3-4). I think the current approach works if there is a single character for the hyphen, but not for multicharacter hyphens. So probably one should check that the length of the HList is 1? Related is#23189 although that takes it a bit further to use a character with accent if available. And I realize that there are probably a similar issue there... |
oscargus commentedFeb 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
centered = HCentered([Hbox(sym.width / 4.0), accent_box]) | ||
while isinstance(sym, Hlist): | ||
sym = sym.children[0] |
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.
I'm probably wrong, but shouldn't line 2162 go below the two newly added lines? The way it currently is,sym
is aChar
in case of\dot s
and anHlist
with kerning in case of\dot{s}
, wherebycentered
will be different in those two cases.
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.
Good observation! I believe that as well. (Probably a bit clearer on the changed images.)
Yes this also affects
It doesn't seem this simple. The length of a Hlist is always more than 1 because it includes the char + the kerning amount. Therefore this fix would never have an affect on Hlists. If we want to get the accents on Hlists and chars to line up, we might need to manipulate the amount of kerning that each character gets, which is something I don't yet know how to do. I'm open to suggestions 😺 |
Sorry for letting this slip. I guess I do not really know how to proceed... Ithink the correct way is to check as is done now, just more "careful", to see if there is more than one character or not. However, I also think that another solution, probably better in the long term, but more complicated, is to make sure that the additional kerning is not added for groups consisting of groups and so on (basically |
PR Summary
Fixes#23257. Apply#23257 (comment) to correct the positioning of the accent when mathtext is used in italics.
PR Checklist
Documentation and Tests
pytest
passes)Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst