diff --git a/manimlib/mobject/svg/mtex_mobject.py b/manimlib/mobject/svg/mtex_mobject.py index bab1e73d..43d72103 100644 --- a/manimlib/mobject/svg/mtex_mobject.py +++ b/manimlib/mobject/svg/mtex_mobject.py @@ -1,6 +1,6 @@ from __future__ import annotations -import itertools as it +import re from manimlib.mobject.svg.string_mobject import StringMobject from manimlib.utils.tex_file_writing import display_during_execution @@ -78,13 +78,44 @@ class MTex(StringMobject): # Parsing @staticmethod - def get_command_pattern() -> str: - return r""" + def get_command_matches(string: str) -> list[re.Match]: + # Group together adjacent braces + pattern = re.compile(r""" (?P\\(?:[a-zA-Z]+|.)) |(?P