-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Define \mathdefault as a noop in the usetex preamble. #15695
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
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.
This should get documentation:
- User facing stating the de-facto way of working (https://matplotlib.org/devdocs/tutorials/text/mathtext.html in the section describing
\mathtext
. - Comments in
make_tex*
that explain the reason for the noop command definition.
This is already documented in https://matplotlib.org/devdocs/tutorials/text/mathtext.html (look up \mathdefault there). Added comments, and also refactored the preamble-getting in to avoid duplicating that between make_tex and make_tex_preview. |
This looks good, but can this also get a test for the breaking case so it doesn't break again? |
This avoids having to strip out \mathdefault (a non-existent latex command) before generating usetex strings, as that's brittle on tickers -- the global usetex flag may change after the ticker is instantiated.
sure... done |
Feel free to re-milestone and back port if we think thats important.... |
Thanks for fixing this! This solution is much simpler than my idea :) |
You are welcome :) |
@meeseeksdev backport to v3.2.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
Define \mathdefault as a noop in the usetex preamble. Conflicts: lib/matplotlib/ticker.py change of a near-by conditional from np.abs -> abs caused conflict
This avoids having to strip out \mathdefault (a non-existent latex
command) before generating usetex strings, as that's brittle on tickers
-- the global usetex flag may change after the ticker is instantiated.
Closes #10317.
(Note that we claim that the semantics of \mathdefault is "match the non-math font", but in usetex mode we previously just stripped it out anyways; making TeX actually use the non-math font in math would be... trickier.)
PR Summary
PR Checklist