Skip to content

tex compiler options - PR feedback request. #170

@cobordism

Description

@cobordism

CC @PhilippImhof because of #48

There are things you might want to do in TeX that require a different compiler than just latex or a different format than just dvi.
We already have partial support for this in the form of TexTemplateFromFile.use_ctex.

I have added the option to choose between compilers latex, pdflatex, xelatex, luatex, lualatex and output formats .dvi, .xdv, .pdf.

Further I have allowed you to specify a TexTemplate and compiler to use on a per-SingleStringTexMobject basis. This is already something I needed in the past for the Latex Maths Fonts video at https://vimeo.com/435684836 .

The code is here: https://gitlab.com/co-bordism/manim/-/tree/tex_compilers

I'd welcome any feedback.


Note: These changes should be backward compatible with the exception that users who manually set TexTemplateFromFile.use_ctex = True should now also change the TexTemplateFromFile.tex_compiler option. (@PhilippImhof can you provide feedback here?)

To try it out:

git remote add cobordism https://gitlab.com:co-bordism/manim.git
git pull cobordism tex_compilers 

Example:

from manim import *

tex_compilers = {
        "latex": {
            "command": "latex",
            "output_format": ".dvi",
        },
        "pdflatex": {
            "command": "latex",
            "output_format": ".pdf",
        },
        "xelatex": {
            "command": "xelatex",
            "output_format": ".xdv",
        },
        "xelatex-with-pdf-option": {
            "command": "xelatex",
            "output_format": ".pdf",
        },
        "luatex": {
            "command": "luatex",
            "output_format": ".dvi",
        },
        "lualatex": {
            "command": "lualatex",
            "output_format": ".pdf",
        },
    }

class test(Scene):
    def construct(self):
        for k, v in tex_compilers.items():
            template = TexTemplate(tex_compiler=v)
            text = TextMobject(k, tex_template=v)
            self.play(FadeIn(text))
            self.wait(0.5)
            self.play(FadeOut(text))
        self.wait(3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions