Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

fix deprecated config.register_tex_template, and change the name of one variable for clarity

leotrse5b01ccacddd
diff --git a/example_scenes/customtex.py b/example_scenes/customtex.py
index ed62ec4d4..4a6ca9fa7 100644
--- a/example_scenes/customtex.py
+++ b/example_scenes/customtex.py
@@ -20,8 +20,8 @@ class ExampleFileScene(Scene):
class ExampleClassScene(Scene):
def construct(self):
tpl = TexTemplate()
- tpl.append_package(["esvect",["f"]])
- config.register_tex_template(tpl)
+ tpl.append_package(["esvect", ["f"]])
+ config['tex_template'] = tpl
#text=TextMobject(r"$\vv{vb}$")
text = TexMobject(r"\vv{vb}")
diff --git a/manim/config.py b/manim/config.py
index 74e6ab793..5ab17cabd 100644
--- a/manim/config.py
+++ b/manim/config.py
@@ -68,19 +68,19 @@ def _parse_config(config_parser, args):
config["right_side"] = config["frame_x_radius"] * constants.RIGHT
# Handle the --tex_template flag. Note we accept None if the flag is absent
- filename = os.path.expanduser(args.tex_template) if args.tex_template else None
+ tex_fn = os.path.expanduser(args.tex_template) if args.tex_template else None
- if filename is not None and not os.access(filename, os.R_OK):
+ if tex_fn is not None and not os.access(tex_fn, os.R_OK):
# custom template not available, fallback to default
logger.warning(
- f"Custom TeX template {filename} not found or not readable. "
+ f"Custom TeX template {tex_fn} not found or not readable. "
"Falling back to the default template."
)
- filename = None
- config["tex_template_file"] = filename
+ tex_fn = None
+ config["tex_template_file"] = tex_fn
config["tex_template"] = (
- TexTemplateFromFile(filename=filename)
- if filename is not None
+ TexTemplateFromFile(filename=tex_fn)
+ if tex_fn is not None
else TexTemplate()
)