@@ -1935,13 +1935,17 @@ def non_math(self, s, loc, toks):
1935
1935
float_literal = staticmethod (pyparsing_common .convertToFloat )
1936
1936
1937
1937
def _make_space (self , percentage ):
1938
- # All spaces are relative to em width
1938
+ # In TeX, an em (the unit usually used to measure horizontal lengths)
1939
+ # is not the width of the character 'm'; it is the same in different
1940
+ # font styles (e.g. roman or italic). Mathtext, however, uses 'm' in
1941
+ # the italic style so that horizontal spaces don't depend on the
1942
+ # current font style.
1939
1943
state = self .get_state ()
1940
1944
key = (state .font , state .fontsize , state .dpi )
1941
1945
width = self ._em_width_cache .get (key )
1942
1946
if width is None :
1943
1947
metrics = state .font_output .get_metrics (
1944
- state . font , mpl .rcParams ['mathtext.default' ], 'm' ,
1948
+ 'it' , mpl .rcParams ['mathtext.default' ], 'm' ,
1945
1949
state .fontsize , state .dpi )
1946
1950
width = metrics .advance
1947
1951
self ._em_width_cache [key ] = width
0 commit comments