Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added case_sensitive option to highlight_by_tex

Grant Sandersonedf577c81e9e
diff --git a/mobject/tex_mobject.py b/mobject/tex_mobject.py
index 8401f5b77..650362f0b 100644
--- a/mobject/tex_mobject.py
+++ b/mobject/tex_mobject.py
@@ -141,9 +141,15 @@ class TexMobject(SVGMobject):
self.submobjects = new_submobjects
return self
- def get_parts_by_tex(self, tex, substring = True):
+ def get_parts_by_tex(self, tex, substring = True, case_sensitive = True):
def test(tex1, tex2):
- return tex1 == tex2 or (substring and tex1 in tex2)
+ if not case_sensitive:
+ tex1 = tex1.lower()
+ tex2 = tex2.lower()
+ if substring:
+ return tex1 in tex2
+ else:
+ return tex1 == tex2
tex_submobjects = filter(
lambda m : isinstance(m, TexMobject),