manim/example_scenes/customtex.py
Aathish Sivasubrahmanian 6df53cc9f7
Deprecate TexMobject and TextMobject in favour of MathTex and Tex (#391)
* Rename TexMobject to MathTex
Rename TextMobject to Tex
Replace all instances of TexMobject with MathTex and TextMobject with Tex.
Get rid of single-use TexSymbol.
Rename SingleStringTexMobject to SingleStringMathTex.
Add Deprecation warnings to TexMobject and TextMobject.

* Edit __all__ for tex_mobject.py

* Re-add TexSymbol by request of devs.

* Docstring Modifications by @pgbiel

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* Import logger differently, by @leotrs

* Run updated Black on files changed.

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
2020-09-02 09:20:37 +05:30

31 lines
986 B
Python

from manim import *
class TexTemplateFromCLI(Scene):
"""This scene uses a custom TexTemplate file.
The path of the TexTemplate _must_ be passed with the command line
argument `--tex_template <path to template>`.
For this scene, you can use the custom_template.tex file next to it.
This scene will fail to render if a tex_template.tex that doesn't
import esvect is passed, and will throw a LaTeX error in that case.
"""
def construct(self):
text = MathTex(r"\vv{vb}")
# text=Tex(r"$\vv{vb}$")
self.play(Write(text))
class InCodeTexTemplate(Scene):
"""This example scene demonstrates how to modify the tex template
for a particular scene from the code for the scene itself.
"""
def construct(self):
tpl = TexTemplate()
tpl.append_package(["esvect", ["f"]])
config["tex_template"] = tpl
# text=Tex(r"$\vv{vb}$")
text = MathTex(r"\vv{vb}")
self.play(Write(text))