Properly use thin space after math text operator#17890
Properly use thin space after math text operator#17890QuLogic merged 6 commits intomatplotlib:masterfrom mpetroff:fix-mathtext-operator-spacing
Conversation
A thin space should follow a math operator except when it is followed by something like a parenthesis or a bracket. This should fix issue #17852.
tacaswell
left a comment
There was a problem hiding this comment.
Thanks, this looks good to me!
|
Lets give @anntzer a few days and then merge this. |
|
I didn't look super carefully (may be nice to figure out what exactly is TeX's behavior) but I guess this inserts a space in |
|
@anntzer You're correct; I forgot about those cases. The space before the subscript / superscript can easily be handled by also excluding According to p. 170 of the TeXbook, space is always inserted after an operator except when followed by opening / closing atoms (parentheses, etc.) and punctuation. This means that space should be inserted before However, I'm not sure how to put the thin space after the subscript / superscript, since I haven't quite figured out how that code works. |
|
|
I extended the improvement to include |
|
I guess it would be reasonable to just get rid of the single failing test as it's behavior is effectively being tested by the check_figures_equal test. |
|
With regard to subscript / superscript, I can easily determine in the |
tacaswell
left a comment
There was a problem hiding this comment.
I still approve, but we need to delete the no longer used files.
The reference rendering for `$\operatorname{cos} x$` was incorrect. Since this
is also tested with `test_operator_space`, it can be safely dropped.
|
I updated the commit that dropped the test to also drop the corresponding baseline images. |
Also add tests for it. A thin space should not be inserted in math text between the operator and subscript / superscript.

PR Summary
A thin space should follow a math operator except when it is followed by something like a parenthesis or a bracket. This pull request makes said fix and should fix issue #17852.
PR Checklist