Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2158fd6

Browse filesBrowse files
jenshnielsenmdboom
authored andcommitted
Merge pull request #4403 from mdboom/whitespace-symbols-mathtext
Fix #4335: mathtext whitespacing commands
1 parent 8a34d46 commit 2158fd6
Copy full SHA for 2158fd6
Expand file treeCollapse file tree

19 files changed

+246
-10
lines changed

‎doc/api/api_changes.rst

Copy file name to clipboardExpand all lines: doc/api/api_changes.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ help figure out possible sources of the changes you are experiencing.
1111
For new features that were added to matplotlib, please see
1212
:ref:`whats-new`.
1313

14+
Changes in 2.0.x
15+
================
16+
17+
* The spacing commands in mathtext have been changed to more closely
18+
match vanilla TeX.
19+
1420
Changes in 1.4.x
1521
================
1622

‎lib/matplotlib/_mathtext_data.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_mathtext_data.py
-2Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/mathtext.py
+12-7Lines 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.
Binary file not shown.
Binary file not shown.
Loading
+97Lines changed: 97 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
+74Lines changed: 74 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
+55Lines changed: 55 additions & 0 deletions
Loading

‎lib/matplotlib/tests/test_mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_mathtext.py
+2-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.