4. Text-MObjects

TextMobjects or Text Mathematical Object, defined in manim/manimlib/mobject/svg/tex_mobject.py, are another classifications of mobject (the other one that we came across was VMobject aka Vectorized Mathematical Object).

Glossing over simplicity, TextMobjects converts the string to latex formatted text which is then shown on the Scene. To create a TextMobject:

display_text = TextMobject(“<String>”)

Type out the following code and run it

For most part, TextMobjects have the same properties as VMobjects (i.emove_to, rotation, transform etc). I’ll not be going over them one by one, as it’s just a matter of changing variables, However, I’ve attached a code snippet containing all of the above operations. Play around with it and you’ll find it’s pretty straightforward.

PS: Don’t forget to change the class name before rendering.

If you get an error stating: Exception: Latex error converting to dvi. See log output above or the log file: ... It means there’s some problem with the latex installation. See if all the packages mentioned here are installed

Adding equations

Adding equations is trivial if you know latex. All you have to do is put your latex equation in TextMobject and render.