From 769e7f42b199f370a40e574ec158a5ab924b081e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Zabalza?= Date: Thu, 22 Oct 2015 12:55:29 +0100 Subject: [PATCH] do not space dot when used as decimal separator fixes --- lib/matplotlib/mathtext.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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