diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index 90e45a3c4d75..78c9f4f75f81 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -2504,17 +2504,22 @@ def symbol(self, s, loc, toks): break # Binary operators at start of string should not be spaced if (c in self._binary_operators and - (len(s[:loc].split()) == 0 or prev_char == '{')): + (len(s[:loc].split()) == 0 or prev_char == '{' or + prev_char in self._left_delim)): return [char] else: - return [Hlist( [self._make_space(0.2), - char, - self._make_space(0.2)] , + return [Hlist([self._make_space(0.2), + char, + self._make_space(0.2)] , do_kern = True)] elif c in self._punctuation_symbols: - return [Hlist( [char, - self._make_space(0.2)] , - do_kern = True)] + # Do not space dots as decimal separators + if (c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit()): + return [char] + else: + return [Hlist([char, + self._make_space(0.2)], + do_kern = True)] return [char] snowflake = symbol