-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
[Bug]: mathtext should distinguish between unary and binary minus #28180
Comments
Good first issue - notes for new contributorsThis issue is suited to new contributors because it does not require understanding of the We do not assign issues. Check the Development section in the sidebar for linked pull If something is unclear, please reach out on any of our communication |
I did some preliminary research and it seems TeX actually does not distinguish between the unary and binary minus symbol. Maybe I was reading an outdated version of the TeXbook, but I cannot find any mention of unary operators. I will keep looking to find out what logic TeX is using to change the spacing for unary operators. |
I have found the issue, the code contains logic to do different spacing for unary minus if the unary minus happens directly after a parenthesis or if the minus is the first character in the equation, but the code does not contain logic to create a unary minus after an equals sign. It is an easy fix, but I am still working on setting up a testing environment to verify my fix. |
Bug summary
TeX inserts a (thin?) space after a binary minus, but not before a unary minus. Typographically, I believe this does look nicer.
mathtext does not distinguish the two cases and always puts in a thin space. It would be nice if it followed tex's behavior.
Code for reproduction
Actual outcome
Compare the spacing before the "b" and the "c": they are different with usetex, but not with mathtext.
Expected outcome
Remove the space in mathtext before the unary minus.
Additional information
Probably involves reading the TeXbook to figure out what is TeX's logic for distinguishing unary and binary minus.
Tagging as good first issue solely because there should be no API design at all, but medium (-hard) difficulty because that'll require both reading the TeXbook and learning about mathtext's implementation. However I would guess there's no "strong" technical blockers either.
Operating system
any
Matplotlib Version
3.10.0.dev137+g9387431ab6
Matplotlib Backend
qtagg
Python version
3.12
Jupyter version
no
Installation
git checkout
The text was updated successfully, but these errors were encountered: