From dcbe505b1a07d483c607183e63ebc433c4bbf594 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 12 Feb 2023 14:01:31 +0100 Subject: [PATCH] Don't handle unknown_symbols in `\operatorname`. Explicitly listing unknown_symbol (i.e., `\nonexistingsymbol`) in the `\operatorname` mathtext parser doesn't really matter as the parse action for such symbols is to immediately throw an exception; so we may as well not bother listing them. --- lib/matplotlib/_mathtext.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/matplotlib/_mathtext.py b/lib/matplotlib/_mathtext.py index 46340843f691..b41dca9d6988 100644 --- a/lib/matplotlib/_mathtext.py +++ b/lib/matplotlib/_mathtext.py @@ -1881,8 +1881,7 @@ def csnames(group, names): p.function <<= csnames("name", self._function_names) p.operatorname <<= cmd( - r"\operatorname", - "{" + ZeroOrMore(p.simple | p.unknown_symbol)("name") + "}") + r"\operatorname", "{" + ZeroOrMore(p.simple)("name") + "}") p.group <<= p.start_group + ZeroOrMore(p.token)("group") + p.end_group