-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove need to detect math mode in pgf strings #23442
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4e18ee1
to
f6c48cd
Compare
Support for `^` is inspired from the support for `_` as implemented in underscore.sty, but much simpler because 1) we don't care about hyphenation, 2) we don't care about substituting a real underscore by a rule box when the current font lacks an underscore (there's no real way out if the font has no caret, anyways), and 3) we don't care about the active character ending up in tex `\commands` because the character is only made active in the context of matplotlib-provided strings, not globally.
Note that tex_escape is still being tested by test_minus_signs_with_tex, which explicitly checks support for unicode minus.
jklymak
approved these changes
Jan 26, 2023
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 certainly do not understand all the latex involved. Be good to find someone else who does to take a quick look.
ksunden
approved these changes
Jan 27, 2023
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Jan 27, 2023
ksunden
added a commit
to ksunden/matplotlib
that referenced
this pull request
Jan 27, 2023
anntzer
added a commit
that referenced
this pull request
Jan 27, 2023
Remove unused import of re introduced in #23442
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #23381 (comment) for motivation. Supersedes #23381. @painch Can you check whether this works for you?
Directly support ^% in pgf.
Support for
^
is inspired from the support for_
as implementedin underscore.sty, but much simpler because 1) we don't care about
hyphenation, 2) we don't care about substituting a real underscore by
a rule box when the current font lacks an underscore (there's no real
way out if the font has no caret, anyways), and 3) we don't care about
the active character ending up in tex
\commands
because the characteris only made active in the context of matplotlib-provided strings, not
globally.
Also handle
\displaystyle
and\mathdefault
at the TeX level.Note that tex_escape is still being tested by
test_minus_signs_with_tex, which explicitly checks support for unicode
minus.
Edit: A test fails on the Ubuntu 18.04 texlive (and I can repro this locally) with pdflatex only because the strings get shifted a tiny bit. I'm actually a bit at loss as to why this shift occurs, and especially only with pdflatex on an older texlive. (In particular, I have separately checked the reported text metrics, which did not change; more debugging indicates that it's the
\everymath{\displaystyle}
which seems to very slightly shift the non-math text.) I would be tempted to just skip this test on the old Ubuntu 18.04 texlive (considering that it's just a slight image shift, and that the test still passes on the more recent Ubuntu image...Edit^2: Looks like I can just get away with bumping the test tolerance by 1-per-thousand on old ghostscripts...
PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).