Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitb7ef642

Browse files
committed
Merge pull request#4887 from tacaswell/fix_mathtext_accents
FIX: mathtext accents
2 parents78bb82c +a6682a8 commitb7ef642

File tree

83 files changed

+7080
-6639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+7080
-6639
lines changed

‎lib/matplotlib/mathtext.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,8 +2107,8 @@ class Parser(object):
21072107
\\subseteq\\supseteq\\cong\\Join
21082108
\\sqsubset\\sqsupset\\neq\\smile
21092109
\\sqsubseteq\\sqsupseteq\\doteq\\frown
2110-
\\in\\ni\\propto
2111-
\\vdash\\dashv\\dots'''.split())
2110+
\\in\\ni\\propto\\vdash
2111+
\\dashv\\dots\\dotplus\\doteqdot'''.split())
21122112

21132113
_arrow_symbols=set('''
21142114
\\leftarrow\\longleftarrow\\uparrow
@@ -2190,6 +2190,7 @@ def __init__(self):
21902190
p.simple=Forward()
21912191
p.simple_group=Forward()
21922192
p.single_symbol=Forward()
2193+
p.snowflake=Forward()
21932194
p.space=Forward()
21942195
p.sqrt=Forward()
21952196
p.stackrel=Forward()
@@ -2223,6 +2224,7 @@ def __init__(self):
22232224
unicode_range="\U00000080-\U0001ffff"
22242225
p.single_symbol<<=Regex(r"([a-zA-Z0-9 +\-*/<>=:,.;!\?&'@()\[\]|%s])|(\\[%%${}\[\]_|])"%
22252226
unicode_range)
2227+
p.snowflake<<=Suppress(p.bslash)+oneOf(self._snowflake)
22262228
p.symbol_name<<= (Combine(p.bslash+oneOf(list(six.iterkeys(tex2uni))))+
22272229
FollowedBy(Regex("[^A-Za-z]").leaveWhitespace()|StringEnd()))
22282230
p.symbol<<= (p.single_symbol|p.symbol_name).leaveWhitespace()
@@ -2297,8 +2299,10 @@ def __init__(self):
22972299
|Error("Expected \operatorname{value}"))
22982300
)
22992301

2300-
p.placeable<<= (p.symbol# Must be first
2301-
|p.accent# Must be second
2302+
p.placeable<<= (p.snowflake# this needs to be before accent so named symbols
2303+
# that are prefixed with an accent name work
2304+
|p.accent# Must be before symbol as all accents are symbols
2305+
|p.symbol# Must be third to catch all named symbols and single chars not in a group
23022306
|p.c_over_c
23032307
|p.function
23042308
|p.group
@@ -2498,13 +2502,15 @@ def symbol(self, s, loc, toks):
24982502
return [Hlist( [self._make_space(0.2),
24992503
char,
25002504
self._make_space(0.2)] ,
2501-
do_kern=False)]
2505+
do_kern=True)]
25022506
elifcinself._punctuation_symbols:
25032507
return [Hlist( [char,
25042508
self._make_space(0.2)] ,
2505-
do_kern=False)]
2509+
do_kern=True)]
25062510
return [char]
25072511

2512+
snowflake=symbol
2513+
25082514
defunknown_symbol(self,s,loc,toks):
25092515
# print "symbol", toks
25102516
c=toks[0]
@@ -2560,9 +2566,9 @@ def c_over_c(self, s, loc, toks):
25602566
r'bar' :r'\combiningoverline',
25612567
r'grave' :r'\combininggraveaccent',
25622568
r'acute' :r'\combiningacuteaccent',
2563-
r'ddot' :r'\combiningdiaeresis',
25642569
r'tilde' :r'\combiningtilde',
25652570
r'dot' :r'\combiningdotabove',
2571+
r'ddot' :r'\combiningdiaeresis',
25662572
r'vec' :r'\combiningrightarrowabove',
25672573
r'"' :r'\combiningdiaeresis',
25682574
r"`" :r'\combininggraveaccent',
@@ -2577,6 +2583,11 @@ def c_over_c(self, s, loc, toks):
25772583

25782584
_wide_accents=set(r"widehat widetilde widebar".split())
25792585

2586+
# make a lambda and call it to get the namespace right
2587+
_snowflake= (lambdaam: [pforpintex2uniif
2588+
any(p.startswith(a)anda!=pforainam)]
2589+
) (set(_accent_map))
2590+
25802591
defaccent(self,s,loc,toks):
25812592
assert(len(toks)==1)
25822593
state=self.get_state()
Binary file not shown.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp