Manim的问题。 “将错误转换为dvi。”

时间:2019-09-03 22:43:09

标签: python animation manim

我正在尝试使用Manim(Youtuber 3Blue1Brown python的库)进行动画处理。我已经安装了必要的软件,包括最新版本的MikTex和python。我可以运行SquareToCircle动画,但是每当我尝试运行任何涉及文本的动画时,都会出现以下错误:

WHERE

没有这样的.log文件,但是在完全相同的文件夹中有一个完全相同名称的.tex文件。 .tex文件读取(在NotePad中打开)


Exception: Latex error converting to dvi. See log output above or the log file: C:\Animation Programs\Manim\manim_3_feb\manimlib\files\Tex\47f78a457bde38f5.log

the following中的某些问题似乎已解决,建议我“在mobject / tex_mobject.py中更改命令= [...]”,但没有“命令”在tex_mobject.py文件中的任何位置进行换行。

我复制了以下函数(显然应该已经存在于文件中,但实际上不存在)并将它们粘贴到tex_mobject.py

\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}

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

但是我仍然遇到相同的错误。

在同一篇文章中,其他人建议您看看参考的.log文件,因为这会让我知道是否缺少任何软件包。如我所说,我没有这样的.log文件,并且相应的.tex文件似乎没有提及任何丢失的软件包。


我将非常感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

该答案现在不再有用,因为Manim已经解决了该问题。因此,这可能是由于两件事: 为了告诉我们什么地方不对,请使用终端转到manimlib文件夹,然后运行以下命令:

latex tex_template.tex

我们区分两个可能的错误:

  1. 已识别出Latex命令,但由于缺少库而无法完成编译,要解决此问题,您可以安装终端指示的丢失软件包。

  2. 不能将LaTeX识别为命令,在这种情况下,肯定无法正确设置PATH变量here is the solution