渐近线错误:编译期间缺少 PDF 文件

渐近线错误:编译期间缺少 PDF 文件

我在尝试编译带有 Asymptote 图形的 LaTeX 文档时遇到问题。我收到以下错误消息:

Package asymptote Warning: file `asymptote-latex-1.pdf' not found on input line 11.

此外,我还收到以下与丢失文件相关的错误:

The system cannot find the file specified.

Function: CopyFileW

Result: 2

Data: existing="C:/Users/twill/AppData/Local/Temp/mik23382/_src\asymptote-latex.pdf", path="C:/Users/twill/OneDrive/Desktop\asymptote-latex.pdf"

有人能帮我了解导致此问题的原因以及如何解决它吗?我检查了 LaTeX 文档、文件路径和 Asymptote 代码,但似乎无法查明问题所在。

任何关于如何解决此问题的指导或建议都将不胜感激。谢谢!

MWE:(来源:未找到“filename-1.pdf” Asymptote

\documentclass{article}
\usepackage{graphicx}
\usepackage{asymptote}
\begin{document}
\begin{asy}
size(200);
pen[] p={red,green,blue,magenta};
path g=(0,0){dir(45)}..(1,0)..(1,1)..(0,1)..cycle;
tensorshade(g,p);
dot(g);
\end{asy}
\end{document}

日志:

2023-11-05 09:14:21,893-0700 INFO  texify - this process (32336) started by miktex-texworks in directory C:\Users\twill\OneDrive\Desktop with command line: C:\Users\twill\AppData\Local\Programs\MiKTeX\miktex\bin\x64\texify.exe --pdf --synctex=1 --clean asymptote-latex.tex
2023-11-05 09:14:21,893-0700 INFO  texify - running on Windows 10.0.22621
2023-11-05 09:14:21,903-0700 INFO  texify.core - start process: pdflatex --synctex=1 C:/Users/twill/OneDrive/Desktop\asymptote-latex.tex
2023-11-05 09:14:22,468-0700 INFO  texify.core - start process: pdflatex --synctex=1 C:/Users/twill/OneDrive/Desktop\asymptote-latex.tex
2023-11-05 09:14:22,954-0700 ERROR texify.core - The system cannot find the file specified.

2023-11-05 09:14:22,954-0700 ERROR texify.core - Function: CopyFileW
2023-11-05 09:14:22,954-0700 ERROR texify.core - Result: 2
2023-11-05 09:14:22,954-0700 ERROR texify.core - Data: existing="C:/Users/twill/AppData/Local/Temp/mik23382/_src\asymptote-latex.pdf", path="C:/Users/twill/OneDrive/Desktop\asymptote-latex.pdf"
2023-11-05 09:14:22,954-0700 ERROR texify.core - Source: Libraries\MiKTeX\Core\File\win\winFile.cpp:376
2023-11-05 09:14:22,959-0700 FATAL texify - Windows API error 2: The system cannot find the file specified.

2023-11-05 09:14:22,959-0700 FATAL texify - Info: existing="C:/Users/twill/AppData/Local/Temp/mik23382/_src\asymptote-latex.pdf", path="C:/Users/twill/OneDrive/Desktop\asymptote-latex.pdf"
2023-11-05 09:14:22,959-0700 FATAL texify - Source: Libraries\MiKTeX\Core\File\win\winFile.cpp
2023-11-05 09:14:22,959-0700 FATAL texify - Line: 376

根据@JimHefferon 的回答,我尝试在命令行中运行以下两个命令:

pdflatex C:\Users\twill\OneDrive\Desktop\asymptote-latex

asy C:\Users\twill\OneDrive\Desktop\asymptote-latex-*.asy

我也尝试用(删除 pdf)替换第一个命令:

latex C:\Users\twill\OneDrive\Desktop\asymptote-latex

第二个产生以下错误消息:

failed to create directory /.asy.
error: could not load module 'C:\Users\twill\OneDrive\Desktop\asymptote-latex-*.asy'

答案1

Asymptote 文档说您应该手动编译 .asy 文件。

The sample LaTeX file below, named latexusage.tex, can be run as follows:
latex latexusage
asy latexusage-*.asy
latex latexusage
or
pdflatex latexusage
asy latexusage-*.asy
pdflatex latexusage
To switch between using inline Asymptote code with latex and pdflatex you may first
need to remove the files latexusage-*.tex.

相关内容