-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add a helper to generate mathtext error strings. #23255
Conversation
lib/matplotlib/_mathtext.py
Outdated
@@ -1740,71 +1763,57 @@ def set_names_and_parse_actions(): | |||
p.overline = Forward() | |||
p.overset = Forward() | |||
p.placeable = Forward() | |||
p.required_group = Forward() | |||
p.req_group = Forward() |
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.
Is there an important reason for the abbreviation? I'd have gone with required_group and optional_group.
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 makes more of the definitions below fit in a single line (e.g. making the definitions of frac/dfrac/binom and overset/underset more clearly parallel each other). I can undo that if you feel strongly about it, though.
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 prefer the full name, because that's more readable. I think wrapping is not too bad for the mentioned cases:
p.binom <<= cmd(
r"\binom", p.reqired_group("num") + p.reqired_group("den"))
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.
done
This also ensures consistency in the names in the error strings; see e.g. changes in test_mathtext (the contents of `\overline` are indeed a "body", not a "value"). Renaming "simple_group" to "optional_group" is semantically more meaningful.
This also ensures consistency in the names in the error strings; see
e.g. changes in test_mathtext (the contents of
\overline
are indeed a"body", not a "value").
Renaming "simple_group" to "opt_group" is not only to make definitions
of over/underset fit in a single line, but also because the name seems
semantically more meaningful too. (req_group, OTOH, is just for
conciseness.)
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).