A community-maintained Python framework for creating mathematical animations.
Always use ``/`` when calling LaTeX (#3061)
Naveen M Kc4eeb2efb817
diff --git a/manim/utils/tex_file_writing.py b/manim/utils/tex_file_writing.pyindex 5423c80c8..6afa7ed5b 100644--- a/manim/utils/tex_file_writing.py+++ b/manim/utils/tex_file_writing.py@@ -129,8 +129,8 @@ def tex_compilation_command("-interaction=batchmode",f'-output-format="{output_format[1:]}"',"-halt-on-error",- f'-output-directory="{tex_dir}"',- f'"{tex_file}"',+ f'-output-directory="{tex_dir.as_posix()}"',+ f'"{tex_file.as_posix()}"',">",os.devnull,]@@ -146,8 +146,8 @@ def tex_compilation_command(outflag,"-interaction=batchmode","-halt-on-error",- f'-output-directory="{tex_dir}"',- f'"{tex_file}"',+ f'-output-directory="{tex_dir.as_posix()}"',+ f'"{tex_file.as_posix()}"',">",os.devnull,]@@ -229,10 +229,10 @@ def convert_to_svg(dvi_file: Path, extension: str, page: int = 1):"dvisvgm","--pdf" if extension == ".pdf" else "","-p " + str(page),- f'"{dvi_file}"',+ f'"{dvi_file.as_posix()}"',"-n","-v 0",- "-o " + f'"{result}"',+ "-o " + f'"{result.as_posix()}"',">",os.devnull,]diff --git a/tests/module/mobject/text/test_texmobject.py b/tests/module/mobject/text/test_texmobject.pyindex 4585a82fe..c45681fad 100644--- a/tests/module/mobject/text/test_texmobject.py+++ b/tests/module/mobject/text/test_texmobject.py@@ -33,6 +33,19 @@ def test_tex():assert Path(config.media_dir, "Tex", "f2e45e6e82d750e6.svg").exists()+def test_tex_temp_directory(tmpdir, monkeypatch):+ # Adds a test for #3060+ # It's not possible to reproduce the issue normally, because we use+ # tempconfig to change media directory to temporary directory by default+ # we partially, revert that change here.+ monkeypatch.chdir(tmpdir)+ Path(tmpdir, "media").mkdir()+ with tempconfig({"media_dir": "media"}):+ Tex("The horse does not eat cucumber salad.")+ assert Path("media", "Tex").exists()+ assert Path("media", "Tex", "f2e45e6e82d750e6.svg").exists()++def test_percent_char_rendering():Tex(r"\%")assert Path(config.media_dir, "Tex", "3f48edf8ebaf82c8.tex").exists()