Define \mathdefault as a noop in the usetex preamble.#15695
Define \mathdefault as a noop in the usetex preamble.#15695jklymak merged 2 commits intomatplotlib:masterfrom
Conversation
timhoffm
left a comment
There was a problem hiding this comment.
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