Skip to content

Commit

Permalink
Merge pull request #5813 from zblz/dec-comma
Browse files Browse the repository at this point in the history
mathtext: no space after comma in brackets
  • Loading branch information
mdboom committed Jan 13, 2016
2 parents acbbfff + 91fcc61 commit 25590c8
Show file tree
Hide file tree
Showing 17 changed files with 2,064 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/matplotlib/mathtext.py
Expand Up @@ -2646,6 +2646,20 @@ def symbol(self, s, loc, toks):
self._make_space(0.2)] ,
do_kern = True)]
elif c in self._punctuation_symbols:

# Do not space commas between brackets
if c == ',':
for i in six.moves.xrange(1, loc + 1):
prev_char = s[loc - i]
if prev_char != ' ':
break
for i in six.moves.xrange(1, loc + 1):
next_char = s[loc + i]
if next_char != ' ':
break
if (prev_char == '{' and next_char == '}'):
return [char]

# Do not space dots as decimal separators
if (c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit()):
return [char]
Expand Down Expand Up @@ -2819,6 +2833,9 @@ def is_slanted(self, nucleus):
return nucleus.is_slanted()
return False

def is_between_brackets(self, s, loc):
return False

def subsuper(self, s, loc, toks):
assert(len(toks)==1)

Expand Down
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 25590c8

Please sign in to comment.