Skip to content

Commit 116051a

Browse files
committed
[ 1358130 ] Cannot get underscore in mathtext
Fixed. svn path=/trunk/matplotlib/; revision=4238
1 parent 4f28fc1 commit 116051a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

examples/mathtext_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
stests = [
88
r'Kerning: AVA $AVA$',
9-
r'\$100.00 $\alpha$',
9+
r'\$100.00 $\alpha \_$',
1010
r'$\frac{\$100.00}{y}$',
1111
r'$x y$',
1212
r'$x+y\ x=y\ x<y\ x:y\ x,y\ x@y$',

lib/matplotlib/_mathtext_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
r'%' : ('cmr10', 48),
118118
r'\$' : ('cmr10', 99),
119119
r'@' : ('cmr10', 111),
120+
r'\_' : ('cmtt10', 79),
120121
r'\Gamma' : ('cmr10', 19),
121122
r'\Delta' : ('cmr10', 6),
122123
r'\Theta' : ('cmr10', 7),
@@ -2236,6 +2237,7 @@
22362237
'$': 36,
22372238
'{': 123,
22382239
'}': 125,
2240+
'_': 95,
22392241
'imath': 0x131,
22402242
'circumflexaccent' : 770,
22412243
'combiningbreve' : 774,

lib/matplotlib/mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ def __init__(self):
19751975
).setParseAction(self.customspace).setName('customspace')
19761976

19771977
unicode_range = u"\U00000080-\U0001ffff"
1978-
symbol =(Regex(UR"([a-zA-Z0-9 +\-*/<>=:,.;!'@()%s])|(\\[%%${}\[\]])" % unicode_range)
1978+
symbol =(Regex(UR"([a-zA-Z0-9 +\-*/<>=:,.;!'@()%s])|(\\[%%${}\[\]_])" % unicode_range)
19791979
| Combine(
19801980
bslash
19811981
+ oneOf(tex2uni.keys())

0 commit comments

Comments
 (0)