-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Open
Labels
Description
Describe the bug
When I try to grab an element from a fraction with get_parts_by_tex, there's an off by one error
Code:
from manimlib import *
class Test(Scene):
def construct(self):
s = Tex(r"\frac{ 1 }{ 2 }")
s.get_parts_by_tex(r"1").set_color(GREEN)
self.add(s)Wrong display or Error traceback:
Additional context
I think this is because there's a mismatch between the order of the Tex commands vs the order of the svg elements.
tex_commands = ["\\frac", "1", "2"]get_parts_by_tex(1)points to idx value 1 (because "1" is second element intex_commands)svg_map = ["1", "/", "2"](idx value 1 returns the "/")
We need a way to tell manim that when it sees \frac, to make sure the items in the numerator come before the "/"