Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f5b109

Browse files
committed
Fix #4335: mathtext whitespacing commands
1 parent 57050f1 commit 9f5b109

12 files changed

+240
-10
lines changed

lib/matplotlib/_mathtext_data.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,6 @@
19461946
'boxminus' : 8863,
19471947
'equiv' : 8801,
19481948
'Lleftarrow' : 8666,
1949-
'thinspace' : 8201,
19501949
'll' : 8810,
19511950
'Cup' : 8915,
19521951
'measeq' : 8798,
@@ -2169,7 +2168,6 @@
21692168
'cdots' : 8943,
21702169
'hat' : 770,
21712170
'eqgtr' : 8925,
2172-
'enspace' : 8194,
21732171
'psi' : 968,
21742172
'frown' : 8994,
21752173
'acute' : 769,

lib/matplotlib/mathtext.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,13 +2431,18 @@ def _make_space(self, percentage):
24312431
self._em_width_cache[key] = width
24322432
return Kern(width * percentage)
24332433

2434-
_space_widths = { r'\ ' : 0.3,
2435-
r'\,' : 0.4,
2436-
r'\;' : 0.8,
2437-
r'\quad' : 1.6,
2438-
r'\qquad' : 3.2,
2439-
r'\!' : -0.4,
2440-
r'\/' : 0.4 }
2434+
_space_widths = { r'\,' : 0.16667, # 3/18 em = 3 mu
2435+
r'\thinspace' : 0.16667, # 3/18 em = 3 mu
2436+
r'\/' : 0.16667, # 3/18 em = 3 mu
2437+
r'\>' : 0.22222, # 4/18 em = 4 mu
2438+
r'\:' : 0.22222, # 4/18 em = 4 mu
2439+
r'\;' : 0.27778, # 5/18 em = 5 mu
2440+
r'\ ' : 0.33333, # 6/18 em = 6 mu
2441+
r'\enspace' : 0.5, # 9/18 em = 9 mu
2442+
r'\quad' : 1, # 1 em = 18 mu
2443+
r'\qquad' : 2, # 2 em = 36 mu
2444+
r'\!' : -0.16667, # -3/18 em = -3 mu
2445+
}
24412446
def space(self, s, loc, toks):
24422447
assert(len(toks)==1)
24432448
num = self._space_widths[toks[0]]
Binary file not shown.
Lines changed: 97 additions & 0 deletions
Loading
Binary file not shown.
Lines changed: 74 additions & 0 deletions
Loading
Binary file not shown.
Lines changed: 55 additions & 0 deletions
Loading

lib/matplotlib/tests/test_mathtext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494
r'$\operatorname{cos} x$', # github issue #553
9595
r'$\sum _{\genfrac{}{}{0}{}{0\leq i\leq m}{0<j<n}}P\left(i,j\right)$',
9696
r"$\left\Vert a \right\Vert \left\vert b \right\vert \left| a \right| \left\| b\right\| \Vert a \Vert \vert b \vert$",
97-
r'$\mathring{A} \stackrel{\circ}{A} \AA$'
97+
r'$\mathring{A} \stackrel{\circ}{A} \AA$',
98+
r'$M \, M \thinspace M \/ M \> M \: M \; M \ M \enspace M \quad M \qquad M \! M$'
9899
]
99100

100101
digits = "0123456789"

0 commit comments

Comments
 (0)