A community-maintained Python framework for creating mathematical animations.
Attempt to read tex_template from config file if needed (#505)
Julian van Doorn129b3bfc249b
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rstindex 8c851adf5..0c5efe7e7 100644--- a/docs/source/changelog.rst+++ b/docs/source/changelog.rst@@ -30,6 +30,7 @@ Command line#. Re-implement GIF export with the :code:`-i` flag (using this flag outputs ONLY a .gif file, and no .mp4 file)#. Added a :code:`--verbose` flag#. You can save the logs to a file by using :code:`--log_to_file`+#. Read :code:`tex_template` from config file if not specified by :code:`--tex_template`.#. Add experimental javascript rendering with :code:`--use_js_renderer`#. Add :code:`-q/--quality [k|h|m|l]` flag and removed :code:`-m/-l` flags.#. Removed :code:`--sound` flagdiff --git a/manim/config/config.py b/manim/config/config.pyindex bb55d47ab..7a3eb432d 100644--- a/manim/config/config.py+++ b/manim/config/config.py@@ -135,8 +135,11 @@ def _parse_config(config_parser, args):config["left_side"] = config["frame_x_radius"] * constants.LEFTconfig["right_side"] = config["frame_x_radius"] * constants.RIGHT- # Handle the --tex_template flag. Note we accept None if the flag is absent- tex_fn = os.path.expanduser(args.tex_template) if args.tex_template else None+ # Handle the --tex_template flag, if the flag is absent read it from the config.+ if args.tex_template:+ tex_fn = os.path.expanduser(args.tex_template)+ else:+ tex_fn = default["tex_template"] if default["tex_template"] != "" else Noneif tex_fn is not None and not os.access(tex_fn, os.R_OK):# custom template not available, fallback to defaultdiff --git a/manim/config/default.cfg b/manim/config/default.cfgindex 7d8b057f8..cc4d7be3a 100644--- a/manim/config/default.cfg+++ b/manim/config/default.cfg@@ -108,6 +108,10 @@ max_files_cached = 100flush_cache = Falsedisable_caching = False+# Default tex_template+# --tex_template+tex_template =+# These override the previous by using -t, --transparent[transparent]png_mode = RGBA