MiKTeX 中的渐近线坏了(?)

MiKTeX 中的渐近线坏了(?)

会不会是 MiKTeX 中的 Asymptote 包坏了?

我已经安装了所有更新,并且我的渐近线软件包有版本2.65和我的miktex-渐近线-bin-x64-2.9有版本2.67自从后一个包于 10 月 31 日更新以来,我无法编译任何渐近线文件。

C:\>"c:\Program Files\MiKTeX\miktex\bin\x64\miktex-asy.exe"
Welcome to miktex-asy version 2.67 (to view the manual, type help)
warning [version]: using possibly incompatible version 2.65 of plain.asy
>

如果我尝试编译下面非常简单的示例,我会收到错误消息:

C:\test>"c:\Program Files\MiKTeX\miktex\bin\x64\miktex-asy.exe" hello.asy
warning [version]: using possibly incompatible version 2.65 of plain.asy

    pic.addBox(position,position,min(f),max(f));
              ^
c:\Program Files\MiKTeX/asymptote/plain_Label.asy: 321.15: runtime:

你好文件是:

settings.outformat = "pdf";
defaultpen(fontsize(10pt));
label("Hello world!");

还有其他人有同样的问题吗?我这里遗漏了什么?

感谢您的帮助。

答案1

这可能有助于调试问题。

查看渐近线程序的版本

$ asy --version
Asymptote version 2.87-25 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince]

查看渐近线plain.asy库版本

首先,您可以运行asy -vv以显示plain.asy正在使用哪个文件:

$ asy -vv
kpsewhich --var-value=TEXMFMAIN
kpsewhich --var-value=ASYMPTOTE_HOME
Using configuration directory /home/abc/.asy
Using history /home/abc/.asy/history
Welcome to Asymptote version 2.87-25 (to view the manual, type help)
cd /tmp
Loading plain from /usr/share/texmf-dist/asymptote/plain.asy
Including plain_constants from /usr/share/texmf-dist/asymptote/plain_constants.asy
Loading version from /usr/share/texmf-dist/asymptote/version.asy
Including plain_strings from /usr/share/texmf-dist/asymptote/plain_strings.asy
Including plain_pens from /usr/share/texmf-dist/asymptote/plain_pens.asy
Including plain_paths from /usr/share/texmf-dist/asymptote/plain_paths.asy
Including plain_filldraw from /usr/share/texmf-dist/asymptote/plain_filldraw.asy
Including plain_margins from /usr/share/texmf-dist/asymptote/plain_margins.asy
Including plain_picture from /usr/share/texmf-dist/asymptote/plain_picture.asy
Loading plain_scaling from /usr/share/texmf-dist/asymptote/plain_scaling.asy
Loading simplex from /usr/share/texmf-dist/asymptote/simplex.asy
Loading plain_bounds from /usr/share/texmf-dist/asymptote/plain_bounds.asy
Including plain_scaling from /usr/share/texmf-dist/asymptote/plain_scaling.asy
[...]
warning [version]: using possibly incompatible version 2.85 of plain.asy

您还可以读取上面的输出,并打印出版本文件:

$ cat /usr/share/texmf-dist/asymptote/version.asy
string VERSION="2.85";

将 Asymptote 指向正确位置

就我而言,我正在安装 Arch Linux 的 AUR 包asymptote-git。可以通过以下方式找到文件的正确位置(此说明特定于 Arch Linux,说明因发行版和操作系统而异):

$ pacman -Ql asymptote-git | grep plain
asymptote-git /usr/share/asymptote/plain.asy
asymptote-git /usr/share/asymptote/plain_Label.asy
asymptote-git /usr/share/asymptote/plain_arcs.asy
[...]

然后,我可以通过设置环境变量asy指向正确的位置:ASYMPTOTE_HOME

$ ASYMPTOTE_HOME=/usr/share/asymptote/ asy -vv
kpsewhich --var-value=TEXMFMAIN
kpsewhich --var-value=ASYMPTOTE_HOME
Using configuration directory /usr/share/asymptote/
Using history /usr/share/asymptote//history
Welcome to Asymptote version 2.87-25 (to view the manual, type help)
cd /tmp
Loading plain from /usr/share/asymptote/plain.asy

还有其他地方可以设置搜索路径,如文档中所示:

渐近线包的文档

关于 MikTeX

看来这个问题并不少见(例如https://sourceforge.net/p/asymptote/discussion/409349/thread/e026af8af6/ https://sourceforge.net/p/asymptote/discussion/409349/thread/b87f49efc9/),建议的解决方案始终是手动安装最新版本的 Asymptote。

相关内容