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

Skip to content

Commit c73a5d4

Browse files
committed
tested some mathtext enhancements
svn path=/trunk/matplotlib/; revision=1926
1 parent f705789 commit c73a5d4

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/matplotlib/mathtext.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
from matplotlib import verbose
136136
from matplotlib.pyparsing import Literal, Word, OneOrMore, ZeroOrMore, \
137137
Combine, Group, Optional, Forward, NotAny, alphas, nums, alphanums, \
138-
StringStart, StringEnd, ParseException, FollowedBy
138+
StringStart, StringEnd, ParseException, FollowedBy, Regex
139139

140140
from matplotlib.afm import AFM
141141
from matplotlib.cbook import enumerate, iterable, Bunch
@@ -1257,6 +1257,18 @@ def subsuperscript(self, s, loc, toks):
12571257

12581258
space = FollowedBy(bslash) + (Literal(r'\ ') | Literal(r'\/') | Group(Literal(r'\hspace{') + number + Literal('}'))).setParseAction(handler.space).setName('space')
12591259

1260+
_symbol = Regex("("+")|(".join(
1261+
[
1262+
r"\\[a-zA-Z0-9]+(?!{)",
1263+
r"[a-zA-Z0-9 ]",
1264+
r"[+\-*/]",
1265+
r"[<>=]",
1266+
r"[:,.;!]",
1267+
r"[!@%&]",
1268+
r"[[\]()]",
1269+
])+")"
1270+
)
1271+
12601272
#~ symbol = (texsym ^ char ^ binop ^ relation ^ punctuation ^ misc ^ grouping ).setParseAction(handler.symbol).leaveWhitespace()
12611273
symbol = (texsym | char | binop | relation | punctuation | misc | grouping ).setParseAction(handler.symbol).leaveWhitespace()
12621274

0 commit comments

Comments
 (0)