Skip to content

Commit 43b5455

Browse files
committed
fix no nucleus in mathtext
1 parent 341d481 commit 43b5455

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/matplotlib/mathtext.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2791,7 +2791,8 @@ def subsuper(self, s, loc, toks):
27912791
# create new Hlist without kerning
27922792
nucleus = Hlist(new_children, do_kern=False)
27932793
else:
2794-
last_char.width = last_char._metrics.advance
2794+
if isinstance(nucleus, Char):
2795+
last_char.width = last_char._metrics.advance
27952796
nucleus = Hlist([nucleus])
27962797

27972798
# Handle regular sub/superscripts

lib/matplotlib/tests/test_mathtext.py

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
r'$xyz^kx_kx^py^{p-2} d_i^jb_jc_kd x^j_i E^0 E^0_u$', # github issue #4873
102102
r'${xyz}^k{x}_{k}{x}^{p}{y}^{p-2} {d}_{i}^{j}{b}_{j}{c}_{k}{d} {x}^{j}_{i}{E}^{0}{E}^0_u$',
103103
r'${\int}_x^x x\oint_x^x x\int_{X}^{X}x\int_x x \int^x x \int_{x} x\int^{x}{\int}_{x} x{\int}^{x}_{x}x$',
104+
r'testing$^{123}$',
104105

105106
]
106107

0 commit comments

Comments
 (0)