TeX and Text¶
There are two commands to create text, TexMobject and TextMobject. In both parameters the text is written in TeX format, but while in TextMobject you write in normal mode, in TexMobject you are writing within the align* environment.
The LaTeX packages that Manim uses are in:
manimlib/tex_template.tex
They are the following by default:
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\usepackage{textcomp}
\usepackage{mathrsfs}
\usepackage{calligra}
\usepackage{wasysym}
\usepackage{ragged2e}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{textcomp}
\usepackage{microtype}
TexMobject¶
-
class
manimlib.mobject.svg.tex_mobject.TexMobject(*tex_strings, **kwargs)¶ Write formulas in TeX mode
- Parameters
*tex_strings (string) -- Formula in TeX code
CONFIGparameters"template_tex_file_body": TEMPLATE_TEX_FILE_BODY, "stroke_width": 0, "fill_opacity": 1.0, "background_stroke_width": 1, "background_stroke_color": BLACK, "arg_separator": " ", "alignment": "",
-
TexMobject.get_tex_string()¶ Return TeX code
-
TexMobject.set_color_by_tex(tex, color, **kwargs)¶ Set the color by specifying the TeX symbol
Note
In case of
TexMobjectit does not work if the radical symbol is used. In case you use indexes and superscripts, write the superscript first.Example:
x^i_j
TextMobject¶
-
class
manimlib.mobject.svg.tex_mobject.TextMobject(*tex_strings, **kwargs)¶ Write texts in TeX mode
- Parameters
*tex_strings (string) -- Text in TeX code
CONFIGparameters"template_tex_file_body": TEMPLATE_TEXT_FILE_BODY, "stroke_width": 0, "fill_opacity": 1.0, "background_stroke_width": 1, "background_stroke_color": BLACK, "arg_separator": " ", "alignment": "\centering"
-
TextMobject.get_tex_string()¶ Return TeX code
-
TextMobject.set_color_by_tex(tex, color, **kwargs)¶ Set the color by specifying the TeX symbol
Note
In case of
TexMobjectit does not work if the radical symbol is used. In case you use indexes and superscripts, write the superscript first.Example:
x^i_j