3b1b / manim

Animation engine for explanatory math videos
MIT License
70.79k stars 6.23k forks source link

Wrong Highlighting of Latex with set_color_by_tex #2081

Closed benatouba closed 11 months ago

benatouba commented 11 months ago

Describe the bug

In a certain context, the wrong symbol is highlighted, namely the symbol after the wanted/correct one.

Code:

from manim import Scene, MathTex, ORANGE

class ExampleScene(Scene):
    def construct(self):  # noqa: PLR0915
        formula = MathTex(
            r"P(X=k) = ",
            "\\binom{12}{k} ",
            r"0.5^k",
            r"(1-0.5)^{12-k}",
            substrings_to_isolate=["k"],
        ).scale(1.3)
        self.play(formula.animate.set_color_by_tex("k", ORANGE))

Wrong display: image

Additional context

I am using the atest version of manim v0.18.0

benatouba commented 11 months ago

wrong thread. Sorry.