-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Include underscore.sty
#20706
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
Include underscore.sty
#20706
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Looks like you based this off an old version of master. Can you update? |
(ooops sorry for hitting the close button) |
I'm not sure vendoring |
Include `underscore.sty` in the LaTeX preamble to take care of underscores
I don't have a super-strong opinion on this, but 1) note that text.latex.preamble is "officially unsupported" (because arbitrary packages can mess up with our tex setup in arbitrary ways), so we may need to change that to something like "officially unsupported, except for the following packages ( |
Sure, you can reproduce w/o pandas, but it is pandas that is inserting this automatically and causing the headache. Presumably most folks who want to use LaTeX for anything know not to put underscores anywhere. As for "officially unsupported" I'm not suggesting we start support mucking with the preamble, just that it is a viable workaround for people who have this problem. I'm not sure the alternative of forcing the use of |
I am weakly in favor of this as it brings the allowed strings when using latex or not in sync. Because our internal mathtex engine only kicks in when in math mode (e.g. fig, ax0 = plt.subplots()
ax0.text(.5, .5, 'a\_b')
ax0.text(.5, .4, 'a\_b', usetex=True)
fig.savefig('/tmp/so.png')
plt.show() renders significantly differently if you are using latex or not. On further consideration I think that my suggestion in #17774 (comment) is wrong and that we can not pre-process strings as we have no way of knowing what the usetex state will be when we actually get to render time. I think the options here are :
I'm inclined to 3 or 4. Pandas is not at fault here, they are just an abundant source of labels with |
Refactored this PR according to what has been decided during the meeting. |
There are two TeX-related test failures. Can you make sense of these? |
Hum... not completely sure what's happening here since I can't reproduce the tests failing on my local machine... However, having a closer look at the
And since all the failing tests have an underscore in the file name like in the error below, I'd suspect this is the problem:
|
Looks like you fixed it, except for a listing error ;-) |
I think(?) the additional dependency needs an api_changes entry? |
Yes, that would be preferred; it should go in the |
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Thanks @kir0ul! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again. |
PR Summary
This PR closes #17774.
It includes the
underscore.sty
package in the LaTeX preamble to take care of underscores.Most of the changes were proposed by @anntzer in #18357 (comment).
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).