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

Commite01241c

Browse files
committed
Merge pull request#5020 from zblz/fix-asy-unc
mathtext: Add `-` to spaced symbols, and do not space symbols at start of string
2 parentsa4eb0c6 +acf73c2 commite01241c

File tree

47 files changed

+3755
-3077
lines changed

Some content is hidden

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

47 files changed

+3755
-3077
lines changed

‎lib/matplotlib/mathtext.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ class Parser(object):
20832083
corners.
20842084
"""
20852085
_binary_operators=set('''
2086-
+ *
2086+
+ * -
20872087
\\pm\\sqcap\\rhd
20882088
\\mp\\sqcup\\unlhd
20892089
\\times\\vee\\unrhd
@@ -2499,10 +2499,21 @@ def symbol(self, s, loc, toks):
24992499
raiseParseFatalException(s,loc,"Unknown symbol: %s"%c)
25002500

25012501
ifcinself._spaced_symbols:
2502-
return [Hlist( [self._make_space(0.2),
2503-
char,
2504-
self._make_space(0.2)] ,
2505-
do_kern=True)]
2502+
# iterate until we find previous character, needed for cases
2503+
# such as ${ -2}$, $ -2$, or $ -2$.
2504+
foriinsix.moves.xrange(1,loc+1):
2505+
prev_char=s[loc-i]
2506+
ifprev_char!=' ':
2507+
break
2508+
# Binary operators at start of string should not be spaced
2509+
if (cinself._binary_operatorsand
2510+
(len(s[:loc].split())==0orprev_char=='{')):
2511+
return [char]
2512+
else:
2513+
return [Hlist( [self._make_space(0.2),
2514+
char,
2515+
self._make_space(0.2)] ,
2516+
do_kern=True)]
25062517
elifcinself._punctuation_symbols:
25072518
return [Hlist( [char,
25082519
self._make_space(0.2)] ,
Binary file not shown.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp