Skip to content

Commit fbcdd1b

Browse files
committed
Merge pull request matplotlib#5813 from zblz/dec-comma
mathtext: no space after comma in brackets
1 parent 2aa65ad commit fbcdd1b

17 files changed

+2064
-0
lines changed

lib/matplotlib/mathtext.py

+17
Original file line numberDiff line numberDiff line change
@@ -2646,6 +2646,20 @@ def symbol(self, s, loc, toks):
26462646
self._make_space(0.2)] ,
26472647
do_kern = True)]
26482648
elif c in self._punctuation_symbols:
2649+
2650+
# Do not space commas between brackets
2651+
if c == ',':
2652+
for i in six.moves.xrange(1, loc + 1):
2653+
prev_char = s[loc - i]
2654+
if prev_char != ' ':
2655+
break
2656+
for i in six.moves.xrange(1, loc + 1):
2657+
next_char = s[loc + i]
2658+
if next_char != ' ':
2659+
break
2660+
if (prev_char == '{' and next_char == '}'):
2661+
return [char]
2662+
26492663
# Do not space dots as decimal separators
26502664
if (c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit()):
26512665
return [char]
@@ -2819,6 +2833,9 @@ def is_slanted(self, nucleus):
28192833
return nucleus.is_slanted()
28202834
return False
28212835

2836+
def is_between_brackets(self, s, loc):
2837+
return False
2838+
28222839
def subsuper(self, s, loc, toks):
28232840
assert(len(toks)==1)
28242841

Binary file not shown.
Loading

0 commit comments

Comments
 (0)