question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception: Latex error converting to dvi. See log output above...

See original GitHub issue

Let me start by saying that I’ve read through all of the other issues on here with the same error message, and have tried each of the fixes, but to no avail.

I was running example scene #1, and:

Traceback (most recent call last):
  File "C:\Users\kaneo\Desktop\manim\manim\manimlib\extract_scene.py", line 155, in main
    scene = SceneClass(**scene_kwargs)
  File "C:\Users\kaneo\Desktop\manim\manim\manimlib\scene\scene.py", line 52, in __init__
    self.construct()
  File "example_scenes.py", line 18, in construct
    title = TextMobject("This is some \\LaTeX")
  File "C:\Users\kaneo\Desktop\manim\manim\manimlib\mobject\svg\tex_mobject.py", line 145, in __init__
    self, self.arg_separator.join(tex_strings), **kwargs
  File "C:\Users\kaneo\Desktop\manim\manim\manimlib\mobject\svg\tex_mobject.py", line 45, in __init__
    self.template_tex_file_body
  File "C:\Users\kaneo\Desktop\manim\manim\manimlib\utils\tex_file_writing.py", line 19, in tex_to_svg_file
    dvi_file = tex_to_dvi(tex_file)
  File "C:\Users\kaneo\Desktop\manim\manim\manimlib\utils\tex_file_writing.py", line 67, in tex_to_dvi
    "See log output above or the log file: %s" % log_file)
Exception: Latex error converting to dvi. See log output above or the log file: C:\Users\kaneo\Desktop\manim\manim\manimlib\files\Tex\cc8b128e228b77ce.log

The ‘log file’ contains:

`\documentclass[preview]{standalone}

\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\usepackage{textcomp}
\usepackage{mathrsfs}
\usepackage{calligra}
\usepackage{wasysym}
\usepackage{ragged2e}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{textcomp}
\usepackage{microtype}
\DisableLigatures{encoding = *, family = * }
%\usepackage[UTF8]{ctex}
\linespread{1}

\begin{document}

\centering This is some \LaTeX

\end{document}`

I’m on windows 10. This same error happens when I make my own custom scripts, but I am able to run example scenes 2 and 4.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:31 (7 by maintainers)

github_iconTop GitHub Comments

14reactions
zombie110yearcommented, Sep 24, 2019

I met the same problem. I’m using Windows 10, and found it caused by TeX engines. In Windows, path seqerator is \ but TeX recognized it as a escape character. eg. ./media\Tex\fjkaljfa.tex will be ./mediaexjkaljfa.tex, the \T, \f have been wiped.

So replace \ to / before calling a TeX executable will solve this problem.

diff --git a/manimlib/utils/tex_file_writing.py b/manimlib/utils/tex_file_writing.py
index 5df24de3..d8bbdad1 100644
--- a/manimlib/utils/tex_file_writing.py
+++ b/manimlib/utils/tex_file_writing.py
@@ -1,6 +1,8 @@
 import os
 import hashlib
 
+from pathlib import Path
+
 from manimlib.constants import TEX_TEXT_TO_REPLACE
 from manimlib.constants import TEX_USE_CTEX
 import manimlib.constants as consts
@@ -39,12 +41,15 @@ def generate_tex_file(expression, template_tex_file_body):
 
 def tex_to_dvi(tex_file):
     result = tex_file.replace(".tex", ".dvi" if not TEX_USE_CTEX else ".xdv")
+    result = Path(result).as_posix()
+    tex_file = Path(tex_file).as_posix()
+    tex_dir = Path(consts.TEX_DIR).as_posix()
     if not os.path.exists(result):
         commands = [
             "latex",
             "-interaction=batchmode",
             "-halt-on-error",
-            "-output-directory=\"{}\"".format(consts.TEX_DIR),
+            "-output-directory=\"{}\"".format(tex_dir),
             "\"{}\"".format(tex_file),
             ">",
             os.devnull
@@ -53,7 +58,7 @@ def tex_to_dvi(tex_file):
             "-no-pdf",
             "-interaction=batchmode",
             "-halt-on-error",
-            "-output-directory=\"{}\"".format(consts.TEX_DIR),
+            "-output-directory=\"{}\"".format(tex_dir),
             "\"{}\"".format(tex_file),
             ">",
             os.devnull
@@ -76,6 +81,8 @@ def dvi_to_svg(dvi_file, regen_if_exists=False):
     where in the dvi
     """
     result = dvi_file.replace(".dvi" if not TEX_USE_CTEX else ".xdv", ".svg")
+    result = Path(result).as_posix()
+    dvi_file = Path(dvi_file).as_posix()
     if not os.path.exists(result):
         commands = [
             "dvisvgm",

Did someone PR it?

5reactions
Emory-Suncommented, Jun 16, 2019

I’m facing the exact same issue; when I try to run python -m manim example_scenes.py WriteStuff -pl, I get “See log output above…” with “Latex error converting to dvi.” However, there is no log file ./media\Tex\e6984177d9d09224.log as indicated, only a .tex file of the same name. I have Tex Live installed and all the appropriate packages (I know this because I successfully managed to compile the .tex file independently). What’s going on?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues with Manim. 'error converting to dvi.' - Stack Overflow
As I said, I have no such .log file, and the corresponding .tex file seems to make no mention of any missing packages....
Read more >
Latex error converting to dvi : r/manim - Reddit
Sorry if this has been asked before but Im currently facing an issue with latex. Exception: Latex error converting to dvi. See log...
Read more >
Source code for manim.utils.tex_file_writing - Docs
"""Interface for writing, compiling, and converting ``.tex`` files. ... See log output above or" f" the log file: {log_file}", ) return result.
Read more >
manim - Bountysource
Exception : Latex error converting to dvi. ... in tex_to_dvi "See log output above or the log file: %s" % log_file) Exception: Latex...
Read more >
manim上显示中文的问题求解答
Exception : Xelatex error converting to xdv. See log output above or the log file: media/Tex/de13cf5ef7f6d002.log ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found