Skip to content

Commit 60b60fb

Browse files
committed
Merge pull request #5301 from zblz/fix-dot-space
BUG: Dot should not be spaced when used as a decimal separator
1 parent cdea77c commit 60b60fb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/matplotlib/mathtext.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,17 +2503,22 @@ def symbol(self, s, loc, toks):
25032503
break
25042504
# Binary operators at start of string should not be spaced
25052505
if (c in self._binary_operators and
2506-
(len(s[:loc].split()) == 0 or prev_char == '{')):
2506+
(len(s[:loc].split()) == 0 or prev_char == '{' or
2507+
prev_char in self._left_delim)):
25072508
return [char]
25082509
else:
2509-
return [Hlist( [self._make_space(0.2),
2510-
char,
2511-
self._make_space(0.2)] ,
2510+
return [Hlist([self._make_space(0.2),
2511+
char,
2512+
self._make_space(0.2)] ,
25122513
do_kern = True)]
25132514
elif c in self._punctuation_symbols:
2514-
return [Hlist( [char,
2515-
self._make_space(0.2)] ,
2516-
do_kern = True)]
2515+
# Do not space dots as decimal separators
2516+
if (c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit()):
2517+
return [char]
2518+
else:
2519+
return [Hlist([char,
2520+
self._make_space(0.2)],
2521+
do_kern = True)]
25172522
return [char]
25182523

25192524
snowflake = symbol

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy