Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
saranti wants to merge1 commit intomatplotlib:mainfromsaranti:accent

Conversation

saranti
Copy link
Contributor

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

  • Has pytest style unit tests (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

@oscargus
Copy link
Member

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
Copy link
Member

oscargus commentedFeb 14, 2023
edited
Loading

Edit: I looked at the wrong image the first time. Image 39 is indeed a multicharacter accent, so I guess what is said above was somewhat correct.

mathtext_dejavuserif_39

Comment on lines 2162 to +2164
centered = HCentered([Hbox(sym.width / 4.0), accent_box])
while isinstance(sym, Hlist):
sym = sym.children[0]
Copy link
Contributor

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.

saranti reacted with thumbs up emoji
Copy link
Member

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.)

@saranti
Copy link
ContributorAuthor

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.

Yes this also affects_wide_accents like widehat because it strips away all but the first index from the Hlist.

So probably one should check that the length of the HList is 1?

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 😺

@jklymakjklymak added status: needs clarificationIssues that need more information to resolve. status: needs comment/discussionneeds consensus on next step labelsFeb 24, 2023
@sarantisaranti marked this pull request as draftMarch 5, 2023 14:54
@oscargus
Copy link
Member

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\"a and\"{{{{{{a}}}}}} should result in the same Hlist). I am not really sure why the kerning is added as part of the parsing the brackets (if I understand it correctly).

@sarantisaranti deleted the accent branchMarch 23, 2024 05:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@oscargusoscargusoscargus left review comments

@tfpftfpftfpf left review comments

Assignees
No one assigned
Labels
status: needs clarificationIssues that need more information to resolve.status: needs comment/discussionneeds consensus on next steptopic: text/mathtext
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[Bug]: mathtext not always rendering combining accents in the same way
4 participants
@saranti@oscargus@tfpf@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp