| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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.
There was a problem hiding this comment.
Seems reasonable.
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, this looks good to me!
Sorry, something went wrong.
|
Lets give @anntzer a few days and then merge this. |
Sorry, something went wrong.
|
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 \sin^n x or in \sin\sqrt x where we may not want one? |
Sorry, something went wrong.
|
@anntzer You're correct; I forgot about those cases. The space before the subscript / superscript can easily be handled by also excluding _ and ^, which is a change I just made. 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 \sqrt. It also means that the thin space should actually be included when there's a subscript / superscript, but it should be included after the subscript / superscript. I verified both of these with TeX. 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. |
Sorry, something went wrong.
|
Sorry, something went wrong.
|
I extended the improvement to include operatorname. However, the tests are going to fail now because the old rendering of $\operatorname{cos} x$ was incorrect. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
With regard to subscript / superscript, I can easily determine in the subsuper parsing function that the nucleus is an operator. However, I can't figure out how to determine how many characters make up the full subscript / superscript expression, so I can't check what follows to determine whether or not a thin space should be inserted. |
Sorry, something went wrong.
There was a problem hiding this comment.
I still approve, but we need to delete the no longer used files.
Sorry, something went wrong.
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. |
Sorry, something went wrong.
Also add tests for it. A thin space should not be inserted in math text between the operator and subscript / superscript.
| Back | FazBrowse Home | New Git URL |
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