From 759351e3ce7b1fd12d101de6e654a6e77071faf5 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 2 Aug 2020 23:21:58 +0200 Subject: [PATCH 1/3] Correctly remove support for \stackrel. This was done incompletely in c4d3cd4, after which `\stackrel{x}{y}` just behaved (incorrectly) like `xy`. --- lib/matplotlib/_mathtext.py | 8 -------- lib/matplotlib/tests/test_mathtext.py | 4 ---- 2 files changed, 12 deletions(-) diff --git a/lib/matplotlib/_mathtext.py b/lib/matplotlib/_mathtext.py index 75ea1e08361b..6d9043c16a3b 100644 --- a/lib/matplotlib/_mathtext.py +++ b/lib/matplotlib/_mathtext.py @@ -2059,7 +2059,6 @@ def __init__(self): p.accentprefixed = Forward() p.space = Forward() p.sqrt = Forward() - p.stackrel = Forward() p.start_group = Forward() p.subsuper = Forward() p.subsuperop = Forward() @@ -2144,12 +2143,6 @@ def __init__(self): | Error(r"Expected \dfrac{num}{den}")) ) - p.stackrel <<= Group( - Suppress(Literal(r"\stackrel")) - - ((p.required_group + p.required_group) - | Error(r"Expected \stackrel{num}{den}")) - ) - p.binom <<= Group( Suppress(Literal(r"\binom")) - ((p.required_group + p.required_group) @@ -2206,7 +2199,6 @@ def __init__(self): | p.group | p.frac | p.dfrac - | p.stackrel | p.binom | p.genfrac | p.sqrt diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py index 1b4d3336f19e..6f4607acf47d 100644 --- a/lib/matplotlib/tests/test_mathtext.py +++ b/lib/matplotlib/tests/test_mathtext.py @@ -218,8 +218,6 @@ def test_fontinfo(): (r'$\hspace{foo}$', r'Expected \hspace{n}'), (r'$\frac$', r'Expected \frac{num}{den}'), (r'$\frac{}{}$', r'Expected \frac{num}{den}'), - (r'$\stackrel$', r'Expected \stackrel{num}{den}'), - (r'$\stackrel{}{}$', r'Expected \stackrel{num}{den}'), (r'$\binom$', r'Expected \binom{num}{den}'), (r'$\binom{}{}$', r'Expected \binom{num}{den}'), (r'$\genfrac$', @@ -242,8 +240,6 @@ def test_fontinfo(): 'hspace with invalid value', 'frac without parameters', 'frac with empty parameters', - 'stackrel without parameters', - 'stackrel with empty parameters', 'binom without parameters', 'binom with empty parameters', 'genfrac without parameters', From 1fa3727c69949d5bcf7ca729dac76f566c41560d Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 20 Sep 2020 18:32:12 -0400 Subject: [PATCH 2/3] DOC: fix typo on API change note for stackrel --- doc/api/prev_api_changes/api_changes_3.1.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/prev_api_changes/api_changes_3.1.0.rst b/doc/api/prev_api_changes/api_changes_3.1.0.rst index dcdde2ddeef6..45b118db946d 100644 --- a/doc/api/prev_api_changes/api_changes_3.1.0.rst +++ b/doc/api/prev_api_changes/api_changes_3.1.0.rst @@ -727,7 +727,7 @@ Mathtext changes Deprecations ~~~~~~~~~~~~ -- The ``\stackrel`` mathtext command hsa been deprecated (it behaved differently +- The ``\stackrel`` mathtext command has been deprecated (it behaved differently from LaTeX's ``\stackrel``. To stack two mathtext expressions, use ``\genfrac{left-delim}{right-delim}{fraction-bar-thickness}{}{top}{bottom}``. - The ``\mathcircled`` mathtext command (which is not a real TeX command) From 930eaac1d0bd0f045caff27e89f85cca6b3097eb Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 20 Sep 2020 19:48:58 -0400 Subject: [PATCH 3/3] DOC: remove stackrel from example code --- tutorials/text/mathtext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/text/mathtext.py b/tutorials/text/mathtext.py index 7b5b078b4fa2..709f1df4956b 100644 --- a/tutorials/text/mathtext.py +++ b/tutorials/text/mathtext.py @@ -97,7 +97,7 @@ .. math:: - \frac{3}{4} \binom{3}{4} \stackrel{}{}{0}{}{3}{4} + \frac{3}{4} \binom{3}{4} \genfrac{}{}{0}{}{3}{4} Fractions can be arbitrarily nested::