Account for edge case where \{ is used in Tex

This commit is contained in:
Grant Sanderson 2022-01-18 10:04:01 -08:00
parent 2488b9e866
commit 8e9b4d8563

View file

@ -132,7 +132,11 @@ class SingleStringTex(VMobject):
Makes Tex resiliant to unmatched braces
"""
num_unclosed_brackets = 0
for char in tex:
for i in range(len(tex)):
if i > 0 and tex[i - 1] == "\\":
# So as to not count '\{' type expressions
continue
char = tex[i]
if char == "{":
num_unclosed_brackets += 1
elif char == "}":