Skip to content

mathtext: no space after comma in brackets #5813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/matplotlib/mathtext.py
Original file line number Diff line number Diff line change
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading