Tiny cleanup

This commit is contained in:
Grant Sanderson 2022-12-29 18:52:13 -08:00
parent 0f9adbf91c
commit 7df12c68dc

View file

@ -15,7 +15,7 @@ def num_tex_symbols(tex: str) -> int:
# First, remove patterns like \begin{align}, \phantom{thing},
# \begin{array}{cc}, etc.
pattern = "|".join(
r"(\\" + s + ")" + r"(\{\w+\})?(\{\w+\})?(\[\w+\])?"
rf"(\\{s})" + r"(\{\w+\})?(\{\w+\})?(\[\w+\])?"
for s in ["begin", "end", "phantom"]
)
for tup in re.findall(pattern, tex):