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.

problems with tex_to_dvi in tex_mobject.py

See original GitHub issue

Hi all, run extract_scene.py -p curves.py in python jupyter notebook. I got always following error which I don’t manage to solve. Traceback (most recent call last): File "C:\Users\Koen\manim\extract_scene.py", line 200, in main handle_scene(SceneClass(**scene_kwargs), **config) File "C:\Users\Koen\manim\scene\scene.py", line 48, in __init__ self.construct(*self.construct_args) File ".\curves.py", line 126, in construct anim = SlideWordDownCycloid("Brachistochrone") File ".\curves.py", line 67, in __init__ word_mob = TextMobject(list(word)) File "C:\Users\Koen\manim\mobject\tex_mobject.py", line 54, in __init__ self.template_tex_file File "C:\Users\Koen\manim\mobject\tex_mobject.py", line 255, in tex_to_svg_file dvi_file = tex_to_dvi(tex_file) File "C:\Users\Koen\manim\mobject\tex_mobject.py", line 297, 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\Koen\manim\files\Tex\-91855429.log Does anyone know how to deal with this error?

many thanks from a bit frustrated person

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
nickredsoxcommented, Jun 4, 2017

I had to change the commands = […] in mobject/tex_mobject.py

def tex_to_dvi(tex_file):
    result = tex_file.replace(".tex", ".dvi")
    if not os.path.exists(result):
        commands = [
            "latex", 
            "-interaction=batchmode", 
            "-halt-on-error",
            "-output-directory=" + TEX_DIR,
            tex_file,
        ]
        exit_code = os.system(" ".join(commands))
        if exit_code != 0:
            latex_output = ''
            log_file = tex_file.replace(".tex", ".log")
            if os.path.exists(log_file):
                with open(log_file, 'r') as f:
                    latex_output = f.read()
            if latex_output:
                sys.stderr.write(latex_output)
            raise Exception(
                "Latex error converting to dvi. "
                "See log output above or the log file: %s" % log_file)
    return result

def dvi_to_svg(dvi_file, regen_if_exists = False):
    """
    Converts a dvi, which potentially has multiple slides, into a 
    directory full of enumerated pngs corresponding with these slides.
    Returns a list of PIL Image objects for these images sorted as they
    where in the dvi
    """
    result = dvi_file.replace(".dvi", ".svg")
    if not os.path.exists(result):
        commands = [
            "dvisvgm",
            dvi_file,
            "-n",
            "-v",
            "0",
            "-o",
            result,
        ]
        os.system(" ".join(commands))
    return result
6reactions
sometimescaseycommented, Nov 14, 2018

Two cents - ran into this today, I recommend looking at the log file as this indicates an error or missing font/package in LaTeX, not a problem with manim. Look for an error like this in the log file:

! LaTeX Error: File `dsfont.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.

In my case I had two missing tex packages to install: physics and doublestroke. I followed the install instructions here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TextMobject is not defined in Manim - python - Stack Overflow
I found this just in case in the file whatsnew.rst. TexMobject is renamed to Tex , TextMobject is renamed to TexText.
Read more >
latex autoexpansion is only possible with scalable fonts
Solution 1 You have to load a scalable font like lmodern: \usepackage [T1]{fontenc} \usepackage{lmodern} Copy or install the cm-super fonts. Solution 2 To...
Read more >
manim Writing Bengali in Manim - Python - GitAnswer
I want to write Bangla through Manim. But after writing the text and compiling it causes errors. I've attempted to solve the problem...
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