Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d52726a

Browse files
committed
Do not space symbols in limits
1 parent 00994fd commit d52726a

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

doc/sphinxext/math_symbol_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def render_symbol(sym, ignore_variant=False):
8383
if sym not in (_mathtext.Parser._overunder_functions |
8484
_mathtext.Parser._function_names):
8585
sym = chr(_mathtext_data.tex2uni[sym])
86-
return f'\\{sym}' if sym in ('\\', '|') else sym
86+
return f'\\{sym}' if sym in ('\\', '|', '+', '-', '*') else sym
8787

8888
lines = []
8989
for category, columns, syms in symbols:

lib/matplotlib/_mathtext.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,9 +2149,11 @@ def symbol(self, s, loc, toks):
21492149
# such as ${ -2}$, $ -2$, or $ -2$.
21502150
prev_char = next((c for c in s[:loc][::-1] if c != ' '), '')
21512151
# Binary operators at start of string should not be spaced
2152-
if (c in self._binary_operators and
2153-
(len(s[:loc].split()) == 0 or prev_char == '{' or
2154-
prev_char in self._left_delims)):
2152+
# Also, operators in sub- or superscripts should not be spaced
2153+
if (self._in_subscript_or_superscript or (
2154+
c in self._binary_operators and (
2155+
len(s[:loc].split()) == 0 or prev_char == '{' or
2156+
prev_char in self._left_delims))):
21552157
return [char]
21562158
else:
21572159
return [Hlist([self._make_space(0.2),

0 commit comments

Comments
 (0)