Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManimCE 0.19.0 LaTeX environment parameters still wrong #4158

Closed
uwezi opened this issue Feb 6, 2025 · 0 comments · Fixed by #4159
Closed

ManimCE 0.19.0 LaTeX environment parameters still wrong #4158

uwezi opened this issue Feb 6, 2025 · 0 comments · Fixed by #4159

Comments

@uwezi
Copy link
Contributor

uwezi commented Feb 6, 2025

Description of bug / unexpected behavior

In ManimCE 0.18.0 (if I remember correctly) the mandatory parameters of tex_environments could be added directly in the argument's string using braces, then in 0.18.1 a problem started to occur that the first brace was doubled up by Manim. This is still persistent in 0.19.0.

Expected behavior

Manim should not add an additional opening brace in the environments when given in this form:

tex_environment="{minipage}{7cm}"

How to reproduce the issue

Code for reproducing the problem pre ManimCE 0.18.1
class textex_old(Scene):
    def construct(self):
        t1 = Tex(r"This is plain text mode\\ in two centered lines.").to_edge(UP, buff=0)
        self.add(t1)
        t2 = Tex(
            r"This is a longer text block in a so-called minipage environment allowing for justified margins. And just because I can I also throw in some math $E=mc^2$.",
            tex_environment="{minipage}{7cm}"
        ).set_color(YELLOW).scale_to_fit_width(8).next_to(t1,DOWN)
        self.add(t1,t2)

now fails because it creates this LaTeX file (watch out for \begin{{minipage}{7cm}):

\documentclass[preview]{standalone}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{{minipage}{7cm}
This is a longer text block in a so-called minipage environment allowing for justified margins. And just because I can I also throw in some math $E=mc^2$.
\end{{minipage}
\end{document}

since 0.18.1 there are two non-intuitive workarounds:

a) omitting the opening brace in the argument tex_environment="minipage}{7cm}"

class textex_newA(Scene):
    def construct(self):
        t1 = Tex(r"This is plain text mode\\ in two centered lines.").to_edge(UP, buff=0)
        self.add(t1)
        t2 = Tex(
            r"This is a longer text block in a so-called minipage environment allowing for justified margins. And just because I can I also throw in some math $E=mc^2$.",
            tex_environment="minipage}{7cm}"
        ).set_color(YELLOW).scale_to_fit_width(8).next_to(t1,DOWN)
        self.add(t1,t2)

b) giving the parameters in braces at the beginning of the LaTeX string itself:

class textex_newB(Scene):
    def construct(self):
        t1 = Tex(r"This is plain text mode\\ in two centered lines.").to_edge(UP, buff=0)
        self.add(t1)
        t2 = Tex(
            r"{7cm}This is a longer text block in a so-called minipage environment allowing for justified margins. And just because I can I also throw in some math $E=mc^2$.",
            tex_environment="minipage"
        ).set_color(YELLOW).scale_to_fit_width(8).next_to(t1,DOWN)
        self.add(t1,t2)
@uwezi uwezi changed the title ManimCE 0.19.1 LaTeX environment parameters still wrong ManimCE 0.19.0 LaTeX environment parameters still wrong Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant