Skip to content

Backport PR #30119 on branch v3.10.3-doc (Add some types to _mathtext.py) #30142

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
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
6 changes: 3 additions & 3 deletions lib/matplotlib/_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2521,10 +2521,10 @@ def subsuper(self, s: str, loc: int, toks: ParseResults) -> T.Any:
if len(new_children):
# remove last kern
if (isinstance(new_children[-1], Kern) and
hasattr(new_children[-2], '_metrics')):
isinstance(new_children[-2], Char)):
new_children = new_children[:-1]
last_char = new_children[-1]
if hasattr(last_char, '_metrics'):
if isinstance(last_char, Char):
last_char.width = last_char._metrics.advance
# create new Hlist without kerning
nucleus = Hlist(new_children, do_kern=False)
Expand Down Expand Up @@ -2600,7 +2600,7 @@ def subsuper(self, s: str, loc: int, toks: ParseResults) -> T.Any:

# Do we need to add a space after the nucleus?
# To find out, check the flag set by operatorname
spaced_nucleus = [nucleus, x]
spaced_nucleus: list[Node] = [nucleus, x]
if self._in_subscript_or_superscript:
spaced_nucleus += [self._make_space(self._space_widths[r'\,'])]
self._in_subscript_or_superscript = False
Expand Down
Loading