You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The simplest way to add text to you animation is to use the :class:`~.Text` class. It uses the Cairo library to render text.
8
+
A newer addition to manim is the :class:`~.PangoText` class, which uses the Pango library.
9
+
10
+
The Text() mobject
11
+
+++++++++++++++++++
12
+
13
+
.. manim:: Example1Text
14
+
:save_last_frame:
15
+
16
+
class Example1Text(Scene):
17
+
def construct(self):
18
+
text = Text('Hello world').scale(3)
19
+
self.add(text)
20
+
21
+
For more examples, see: :class:`~.Text`.
22
+
23
+
The PangoText() mobject
24
+
+++++++++++++++++++++++
25
+
26
+
The :class:`~.PangoText` mobject uses the Pango library to render text. Use this whenever you want to use non-English alphabets like `你好` or `こんにちは` or `안녕하세요` or `مرحبا بالعالم`.
27
+
28
+
1
29
LaTeX
2
-
=================================
30
+
-------------------
31
+
32
+
The Tex() mobject
33
+
+++++++++++++++++++
34
+
Just as you can use :class:`~.Text` to add text to your videos, you can use :class:`~.Tex` to insert LaTeX.
35
+
36
+
.. manim:: ExampleLaTeX
37
+
:save_last_frame:
38
+
39
+
class ExampleLaTeX(Scene):
40
+
def construct(self):
41
+
tex = Tex(r'\LaTeX').scale(3)
42
+
self.add(tex)
43
+
44
+
Note that we are using a raw string (``r'---'``) instead of a regular string (``'---'``).
45
+
This is because TeX code uses a lot of special characters - like ``\`` for example -
46
+
that have special meaning within a regular python string. An alternative would have
47
+
been to write ``\\`` as in ``Tex('\\LaTeX')``.
48
+
49
+
The MathTex() mobject
50
+
++++++++++++++++++++++
51
+
Anything enclosed in ``$`` signs is interpreted as maths-mode:
0 commit comments