我在 Windows 10 中安裝了 Anki 和 MikTeX,以使用 LaTeX 建立 anki 抽認卡。我安裝了 MikTeX,因為我讀到它是安裝 dvipng 和 dvisvgm 的最佳方式。
創建抽認卡範例後,當程式嘗試編譯它時,我收到以下錯誤。我不知道如何解決它。有什麼建議麼?
Error executing dvipng.
Generated file: C:\Users\Victor\AppData\Local\Temp\anki_temp\tmp.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6930 64-bit)
entering extended mode
(tmp.tex
LaTeX2e <2018-12-01>
("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex/latex/base\size12.clo"))
("C:\Program Files\MiKTeX 2.9\tex/latex/base\inputenc.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\amssymb.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\amsfonts.sty"))
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsmath.sty"
For additional information on amsmath, use the `?' option.
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amstext.sty"
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsgen.sty"))
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsbsy.sty")
("C:\Program Files\MiKTeX 2.9\tex/latex/amsmath\amsopn.sty"))
No file tmp.aux.
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\umsa.fd")
("C:\Program Files\MiKTeX 2.9\tex/latex/amsfonts\umsb.fd") [1] (tmp.aux) )
Output written on tmp.dvi (1 page, 268 bytes).
Transcript written on tmp.log.
This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson
Sorry, but dvipng did not succeed.
The log file hopefully contains the information to get MiKTeX going again:
C:\Users\Victor\AppData\Local\MiKTeX\2.9\miktex\log\dvipng.log
以下是 dvipng.log 的內容:
2019-02-24 12:47:26,503+0100 INFO dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:47:26,517+0100 INFO dvipng - running 'initexmf' to refresh the file name database
2019-02-24 12:47:29,551+0100 INFO dvipng - running 'initexmf' to create font map files
2019-02-24 12:47:31,582+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:47:31,583+0100 FATAL dvipng - Info:
2019-02-24 12:47:31,583+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:47:31,583+0100 FATAL dvipng - Line: 77
2019-02-24 12:47:31,584+0100 INFO dvipng - finishing with exit code 1
2019-02-24 12:47:37,285+0100 INFO dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:47:37,301+0100 INFO dvipng - running 'initexmf' to refresh the file name database
2019-02-24 12:47:40,429+0100 INFO dvipng - running 'initexmf' to create font map files
2019-02-24 12:47:42,378+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:47:42,378+0100 FATAL dvipng - Info:
2019-02-24 12:47:42,378+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:47:42,378+0100 FATAL dvipng - Line: 77
2019-02-24 12:47:42,379+0100 INFO dvipng - finishing with exit code 1
2019-02-24 12:51:12,899+0100 INFO dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:51:13,009+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:51:13,009+0100 FATAL dvipng - Info:
2019-02-24 12:51:13,009+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:51:13,009+0100 FATAL dvipng - Line: 77
2019-02-24 12:51:13,010+0100 INFO dvipng - finishing with exit code 1
2019-02-24 12:51:13,575+0100 INFO dvipng - starting with command line: dvipng -D 200 -T tight tmp.dvi -o tmp.png
2019-02-24 12:51:13,597+0100 FATAL dvipng - GUI framework cannot be initialized.
2019-02-24 12:51:13,597+0100 FATAL dvipng - Info:
2019-02-24 12:51:13,597+0100 FATAL dvipng - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2019-02-24 12:51:13,597+0100 FATAL dvipng - Line: 77
2019-02-24 12:51:13,598+0100 INFO dvipng - finishing with exit code 1
答案1
我遇到了完全相同的問題,嘗試打開MikTeX console
>Settings
並確保您已檢查Never install missing packages on the fly
.為我工作。
答案2
dvipng -D 200 -T tight tmp.dvi -o tmp.png
在包含它的目錄中的命令提示字元中運行dvi.png
,該目錄儲存在與生成的tmp.tex
. Anki 中的錯誤訊息會告訴你是這樣的。在你的情況下是C:\Users\Victor\AppData\Local\Temp\anki_temp\
。這與 Anki 執行的命令相同,但失敗了,如您在 中看到的dvipng.log
。對我來說,彈出一個窗口,說我缺少庫,需要安裝它們。安裝後,下次執行命令時不會彈出該視窗。這意味著當 Anki 嘗試執行時dvipng
它不會失敗,因為dvipng
不會嘗試打開一個視窗告訴 Anki 安裝庫。