You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX中Asymptote执行失败:无法创建/.asy目录

LaTeX生成Asymptote文件但手动执行Asymptote失败的问题

最初在TeX社区提出此问题未获回复,现重新发布以寻求更广泛帮助,此问题是之前相关问题的进一步探究。

环境与操作步骤

  • Windows操作系统
  • 已成功安装LaTeX、Asymptote和Ghostscript,三者均已添加至系统PATH
  • 编译LaTeX文档时使用了-shell-escape选项

问题现象

LaTeX编译日志显示Asymptote代码已正确执行,成功生成了PDF文件asymptote-latex-1.pdf。但手动单独执行Asymptote处理生成的.asy文件时,却无法正常工作。

尝试的命令

  1. asy "C:\Users\twill\OneDrive\Desktop\ASYMPTOTE\output-directory\asymptote-latex-1.asy"
  2. asy C:\Users\twill\asymptote-latex-*.asy

错误信息

执行上述命令后,Asymptote报错:failed to create directory /.asy.,但LaTeX编译过程中未出现任何与Asymptote相关的错误。

是否有人遇到过类似问题?恳请提供相关见解、排查步骤或解决方案,确保Asymptote能正确处理.asy文件。

感谢帮助。

最小工作示例(MWE)

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

编译日志

This is pdfTeX, Version 3.141592653-2.6-1.40.25 (MiKTeX 23.5) (preloaded format=pdflatex 2023.8.22)  6 NOV 2023 10:25
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**C:/Users/twill/OneDrive/Desktop/ASYMPTOTE/asymptote-latex.tex
(C:/Users/twill/OneDrive/Desktop/ASYMPTOTE/asymptote-latex.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-11>
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/base\size10.clo
File: size10.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
)
\c@part=\count185
\c@section=\count186
\c@subsection=\count187
\c@subsubsection=\count188
\c@paragraph=\count189
\c@subparagraph=\count190
\c@figure=\count191
\c@table=\count192
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen140
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/graphics\keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks17
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphics.sty
Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/graphics\trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/graphics-cfg\graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 107.

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/graphics-def\pdftex.def
File: pdftex.def 2022/09/22 v1.2b Graphics/color driver for pdftex
))
\Gin@req@height=\dimen141
\Gin@req@width=\dimen142
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/asymptote\asymptote.sty
Package: asymptote 2021/12/29 v1.37 Asymptote style file for LaTeX
(asymptote-latex.pre)
\ASYbox=\box51
\ASYdimen=\dimen143
\c@asy=\count193
\AsyStream=\write3
\AsyPreStream=\write4

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/base\ifthen.sty
Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/generic/iftex\ifpdf.sty
Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/generic/iftex\iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
))
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/generic/iftex\ifxetex.sty
Package: ifxetex 2019/10/25 v0.7 ifxetex legacy package. Use iftex instead.
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/generic/catchfile\catchfile.sty
Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO)

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/generic/infwarerr\infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/generic/etexcmds\etexcmds.sty
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
))
\openout4 = `asymptote-latex.pre'.

)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def
File: l3backend-pdftex.def 2023-04-19 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count194
\l__pdf_internal_box=\box52
) (asymptote-latex.aux)
\openout1 = `asymptote-latex.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info:    ... okay on input line 4.

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/context/base/mkii\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count195
\scratchdimen=\dimen144
\scratchbox=\box53
\nofMPsegments=\count196
\nofMParguments=\count197
\everyMPshowfont=\toks18
\MPscratchCnt=\count198
\MPscratchDim=\dimen145
\MPnumerator=\count199
\makeMPintoPDFobject=\count266
\everyMPtoPDFconversion=\toks19
)
(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/epstopdf-pkg\epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 485.

(C:\Users\twill\AppData\Local\Programs\MiKTeX\tex/latex/00miktex\epstopdf-sys.cfg
File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
))
\openout3 = `asymptote-latex-1.asy'.

<asymptote-latex-1.pdf, id=1, 200.75pt x 131.06967pt>
File: asymptote-latex-1.pdf Graphic file (type pdf)
<use asymptote-latex-1.pdf>
Package pdftex.def Info: asymptote-latex-1.pdf  used on input line 11.
(pdftex.def)             Requested size: 200.7495pt x 131.06934pt.
 [1

{C:/Users/twill/AppData/Local/MiKTeX/fonts/map/pdftex/pdftex.map} <./asymptote-latex-1.pdf>] (asymptote-latex.aux)
 ***********
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-11>
 ***********
 ) 
Here is how much of TeX's memory you used:
 1800 strings out of 475503
 31543 string characters out of 5761834
 1916248 words of memory out of 12000000
 23078 multiletter control sequences out of 15000+600000
 558069 words of font info for 36 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 62i,5n,65p,256b,139s stack positions out of 10000i,1000n,20000p,200000b,200000s
<C:/Users/twill/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on asymptote-latex.pdf (1 page, 9798 bytes).
PDF statistics:
 13 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 6 words of extra memory for PDF output out of 10000 (max. 10000000)

内容的提问来源于stack exchange,提问作者user21322925

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 16:47:02