Skip to content

fix: latex compilation error on windows#2463

Open
Diogo1703Silva wants to merge 1 commit into
3b1b:masterfrom
motamdaniela:fix/latex-windows-exit-code-#2002
Open

fix: latex compilation error on windows#2463
Diogo1703Silva wants to merge 1 commit into
3b1b:masterfrom
motamdaniela:fix/latex-windows-exit-code-#2002

Conversation

@Diogo1703Silva
Copy link
Copy Markdown

Fix: LaTeX compilation error on Windows (#2002)

Summary

Fixes a Windows-specific bug where full_tex_to_svg() incorrectly raises LatexError even when LaTeX compilation succeeds and the DVI file is produced. This prevented any scene using Tex, MathTex, or Matrix objects from rendering on Windows.

Root cause

TeX Live / TinyTeX on Windows returns a non-zero exit code from subprocess.run() with capture_output=True, even on successful compilation. The old logic treated any non-zero exit code as a failure.

Fix

Added a second condition to the error check in manimlib/utils/tex_file_writing.py:

Before:

if returncode != 0:
    raise LatexError(...)

After:

if returncode != 0 and not dvi_path.exists():
    raise LatexError(...)

A missing DVI file unambiguously indicates genuine compilation failure. If the DVI exists, compilation succeeded regardless of exit code, and the pipeline continues to dvisvgm.

Files changed

  • manimlib/utils/tex_file_writing.py — core fix in full_tex_to_svg()

Preconditions to reproduce the issue

  • Windows OS
  • Master ManimGL 1.6.1
  • Python 3.10.4
  • TeX Live / TinyTeX installed with latex and dvisvgm on PATH
  • Scene using Tex, MathTex, or Matrix objects

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 this pull request may close these issues.

1 participant