3b1b / manim

Animation engine for explanatory math videos
MIT License
62.66k stars 5.81k forks source link

Allow Custom `tex_templates.yml` File #2090

Closed icedcoffeeee closed 6 months ago

icedcoffeeee commented 9 months ago

Motivation

I wanted to be able to create a custom tex_templates.yml file and reference the tex template from the custom_config.yml, without changing any source files.

Proposed changes

Test

  1. Create custom_config.yml:
    tex:
    template_file: "custom_tex_templates.yml"
    style:
    tex_template: "custom"
  2. Create custom_tex_templates.yml
    custom:
    description: ""
    compiler: xelatex
    preamble: |-
    \usepackage[english]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage{fontspec}
    \setmainfont{Times New Roman}[Ligatures=NoCommon]
    \linespread{1}
  3. Test File:
    class Test(Scene):
    def construct(self):
        self.add(TexText("Hello World"))
  4. The new text is now in Times New Roman font. Test
icedcoffeeee commented 6 months ago

Closing as unplanned