[Bug]: \,
and \mathrm{\,}
are not identical in Mathtext when using CM and STIX
#23474
Labels
Milestone
Bug summary
Title.
Code for reproduction
Actual outcome
\,
and\mathrm{\,}
do not insert the same amount of space.Expected outcome
\,
and\mathrm{\,}
should insert the same amount of space. This is what LaTeX does (as far as I can tell by eye).Additional information
The difference is too minute to matter. As the MWE shows, the text has to be blown up to huge sizes to manifest it. At normal sizes, it is inconsequential. (Case in point:
test_mathtext.py::test_operator_space
, which compares\sin^2 \cos
with\mathrm{sin}^2 \mathrm{\,cos}
, thereby indirectly comparing\,
and\mathrm{\,}
.)It can have unexpected side-effects, though; see #22852 (comment).
The culprit is the
_make_space
function. For\,
, it returns 1/6 of the advance of an italicised 'm'. For\mathrm{\,}
, it returns 1/6 of the advance of a regular 'm'.matplotlib/lib/matplotlib/_mathtext.py
Lines 1937 to 1948 in 37ccdca
Making the following change does not break any Mathtext tests. (On my system. Though 120 tests get skipped, so I can't be sure.)
Is it worth fixing?
Operating system
Linux Mint 20.2 Uma
Matplotlib Version
3.5.0.dev5379+g37ccdca502
Matplotlib Backend
GTK3Agg
Python version
3.8.10
Jupyter version
6.0.3
Installation
git checkout
The text was updated successfully, but these errors were encountered: