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 cd866e9

Browse filesBrowse files
committed
Merge pull request #5880 from zblz/fix-primes
mathtext: Fix bugs in conversion of apostrophes to primes
1 parent 6d4edf0 commit cd866e9
Copy full SHA for cd866e9
Expand file treeCollapse file tree

17 files changed

+819
-52
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
@@ -2701,12 +2701,15 @@ def subsuper(self, s, loc, toks):
27012701
sub = None
27022702
super = None
27032703

2704-
# Pick all of the apostrophe's out
2704+
# Pick all of the apostrophes out, including first apostrophes that have
2705+
# been parsed as characters
27052706
napostrophes = 0
27062707
new_toks = []
27072708
for tok in toks[0]:
27082709
if isinstance(tok, six.string_types) and tok not in ('^', '_'):
27092710
napostrophes += len(tok)
2711+
elif isinstance(tok, Char) and tok.c == "'":
2712+
napostrophes += 1
27102713
else:
27112714
new_toks.append(tok)
27122715
toks = new_toks
@@ -2761,6 +2764,9 @@ def subsuper(self, s, loc, toks):
27612764
super = Hlist([])
27622765
for i in range(napostrophes):
27632766
super.children.extend(self.symbol(s, loc, ['\prime']))
2767+
# kern() and hpack() needed to get the metrics right after extending
2768+
super.kern()
2769+
super.hpack()
27642770

27652771
# Handle over/under symbols, such as sum or integral
27662772
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
+215-18Lines changed: 215 additions & 18 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.