Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Tried to address when half of a \begin{array}...\end{array} type tex string shows up as an argument to TexString

Grant Sanderson1df53ef6e932
diff --git a/mobject/svg/tex_mobject.py b/mobject/svg/tex_mobject.py
index ff7f77e9e..518461207 100644
--- a/mobject/svg/tex_mobject.py
+++ b/mobject/svg/tex_mobject.py
@@ -99,6 +99,15 @@ class SingleStringTexMobject(SVGMobject):
if num_lefts != num_rights:
tex = tex.replace("\\left", "\\big")
tex = tex.replace("\\right", "\\big")
+
+ for context in ["array"]:
+ begin_in = ("\\begin{%s}" % context) in tex
+ end_in = ("\\end{%s}" % context) in tex
+ if begin_in ^ end_in:
+ # Just turn this into a blank string,
+ # which means caller should leave a
+ # stray \\begin{...} with other symbols
+ tex = ""
return tex
def remove_stray_braces(self, tex):