Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d0186ac

Browse filesBrowse files
committed
Merge pull request #5880 from zblz/fix-primes
mathtext: Fix bugs in conversion of apostrophes to primes
2 parents c259a55 + 736138b commit d0186ac
Copy full SHA for d0186ac
Expand file treeCollapse file tree

17 files changed

+694
-61
lines changed

‎lib/matplotlib/mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mathtext.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,12 +2852,15 @@ def subsuper(self, s, loc, toks):
28522852
sub = None
28532853
super = None
28542854

2855-
# Pick all of the apostrophe's out
2855+
# Pick all of the apostrophes out, including first apostrophes that have
2856+
# been parsed as characters
28562857
napostrophes = 0
28572858
new_toks = []
28582859
for tok in toks[0]:
28592860
if isinstance(tok, six.string_types) and tok not in ('^', '_'):
28602861
napostrophes += len(tok)
2862+
elif isinstance(tok, Char) and tok.c == "'":
2863+
napostrophes += 1
28612864
else:
28622865
new_toks.append(tok)
28632866
toks = new_toks
@@ -2912,6 +2915,9 @@ def subsuper(self, s, loc, toks):
29122915
super = Hlist([])
29132916
for i in range(napostrophes):
29142917
super.children.extend(self.symbol(s, loc, ['\prime']))
2918+
# kern() and hpack() needed to get the metrics right after extending
2919+
super.kern()
2920+
super.hpack()
29152921

29162922
# Handle over/under symbols, such as sum or integral
29172923
if self.is_overunder(nucleus):
Binary file not shown.
Loading

‎lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_31.svg

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_mathtext/mathtext_cm_31.svg
+214-17Lines changed: 214 additions & 17 deletions
Loading
Binary file not shown.
Loading

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.