Manim's Tex Mobject containing a TikZ picture disappearing unexpectedly

37 Views Asked by At

Here is my code.

from manim import *
class Question(Scene):
    def construct(self):
        mytemplate=TexTemplate()
        mytemplate.add_to_preamble(r"\usepackage{tikz}")
        tex=Tex(r"""\begin{tikzpicture}\draw[color=white](-1,1)rectangle(5,3);\end{tikzpicture}$\sqrt{5}$""",tex_template=mytemplate)
        self.play(Write(tex))
        self.wait(2)
        self.play(FadeOut(tex))

In the rendered video, the rectangle disappeared unexpectedly right after being drawn. The $\sqrt{5}$ remains on the screen however.

I changed the \draw command into \fill, and the filled rectangle stayed on the screen. I also tried to use different colors, but couldn't solve the problem.

0

There are 0 best solutions below