Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Changed modification for tex mobjects that begin with a newline, which involved eliminating alignment when a TexMobject creates many SingleStringTexMobject to figure out how to divvy itself up

Grant Sandersonfc28375e4294
diff --git a/manimlib/mobject/svg/tex_mobject.py b/manimlib/mobject/svg/tex_mobject.py
index 881392e7a..60b299e6d 100644
--- a/manimlib/mobject/svg/tex_mobject.py
+++ b/manimlib/mobject/svg/tex_mobject.py
@@ -79,7 +79,8 @@ class SingleStringTexMobject(SVGMobject):
tex = "\\quad"
# To keep files from starting with a line break
- tex = tex.replace("\\\\", "\\quad\\\\")
+ if tex.startswith("\\\\"):
+ tex = tex.replace("\\\\", "\\quad\\\\")
# Handle imbalanced \left and \right
num_lefts, num_rights = [
@@ -174,8 +175,10 @@ class TexMobject(SingleStringTexMobject):
"""
new_submobjects = []
curr_index = 0
+ config = dict(self.CONFIG)
+ config["alignment"] = ""
for tex_string in self.tex_strings:
- sub_tex_mob = SingleStringTexMobject(tex_string, **self.CONFIG)
+ sub_tex_mob = SingleStringTexMobject(tex_string, **config)
num_submobs = len(sub_tex_mob.submobjects)
new_index = curr_index + num_submobs
if num_submobs == 0: