I'm encountering an issue while trying to compile a LaTeX document with an Asymptote figure. I receive the following error message:

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

Additionally, I get the following errors related to missing files:

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"

Can someone help me understand what might be causing this issue and how to resolve it? I've checked the LaTeX document, file paths, and Asymptote code, but I can't seem to pinpoint the problem.

Any guidance or suggestions on how to fix this would be greatly appreciated. Thank you!

MWE: (Credit: 'filename-1.pdf' not found Asymptote)

pen[] p={red,green,blue,magenta};
path g=(0,0){dir(45)}..(1,0)..(1,1)..(0,1)..cycle;


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

Per the answer by @JimHefferon, I have tried to run the following two commands in the command line:

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

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

I've also tried replacing the first command with (removing the pdf):

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

The second one is producing the following error message:

failed to create directory /.asy.
error: could not load module 'C:\Users\twill\OneDrive\Desktop\asymptote-latex-*.asy'
  • I suspect this may not work in OneDrive (except probably on Linux because OneDrive on Linux sucks). Does it work if you try in some regular directory?
    – cfr
    Mar 5 at 4:32

1 Answer 1


The Asymptote documentation says that you should compile the .asy file by hand.

The sample LaTeX file below, named latexusage.tex, can be run as follows:
latex latexusage
asy latexusage-*.asy
latex latexusage
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.
  • Thank you for your answer, I'm just having some trouble getting it to work. I'm running latex C:\Users\twill\OneDrive\Desktop\asymptote-latex in the command line, followed by asy C:\Users\twill\OneDrive\Desktop\asymptote-latex-*.asy but its saying invalid token '\' \usepackage{asymptote} How can i correct my usage of the command line to be able to run this properly? Thank you very much again. Once this is resolved, I'll be more than happy to accept your answer.
    – user279206
    Nov 5, 2023 at 20:10
  • Are you saying that you get that error from "latex C:\Users\twill\OneDrive\Desktop\asymptote-latex" or from "asy C:\Users\twill\OneDrive\Desktop\asymptote-latex-*.asy"? Nov 5, 2023 at 21:56
  • 1
    pardon me, that was incorrect of me, I tried running asy C:\Users\twill\OneDrive\Desktop\asymptote-latex.tex since asy C:\Users\twill\OneDrive\Desktop\asymptote-latex-*.asy wasn't working as expected. That is where the error came from. Please see my edit to the original question. Thanks again for your time and effort!
    – user279206
    Nov 5, 2023 at 21:58
  • To clarify: that specific error occured becaused I used .tex insteal of -*.asy Sorry about that.
    – user279206
    Nov 5, 2023 at 22:07

You must log in to answer this question.