I am trying to run Asymptote code embedded in a tex file. The pdf generated has no asymptote figure but other latex stuff appear. I get a warning that file "filename-1.pdf" not found. I am using Texmaker 5.0.4 with MikTex 2.9. I ran the command PdfLatex+Asymptote+PdfLatex.

Edit: Since a code snippet was asked, I ran this file that Akira Kakuto suggested as filename.tex and I am still getting an error,

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

• would you mind posting what did you try? It is difficult for people to help if they don't know what you tried. May 10, 2020 at 11:38
• @bingung I have now added a code snippet May 11, 2020 at 12:56
• Run pdflatex --shell-escape twice on the input. You may need to edit your editor preferences to add --shell-escape, or run the command in a terminal window. May 11, 2020 at 13:03
• @AlexG I did run it that way but it seems to be still giving the same error. The editor preference now looks like this-imgur.com/a/68dCKuj May 11, 2020 at 13:40
• Editors sometimes break things. Did you try running pdflatex in a terminal (command line window)? (Works for me.) May 11, 2020 at 14:08

I'll show an example by using a sample in the version 2.65:

% filename.tex
% Compile twice as:
% pdflatex -shell-escape filename.tex
% pdflatex -shell-escape filename.tex
%
\documentclass{article}
\usepackage{graphicx}
\usepackage{asymptote}
\begin{document}
\begin{figure}[h]
\centering
\begin{asy}
size(200);
pen[] p={red,green,blue,magenta};
path g=(0,0){dir(45)}..(1,0)..(1,1)..(0,1)..cycle;

• @cookiemonster The setting in 'Quick Build' ---> 'For .asy files' is not relevant if you run a file with .tex extension; it is only relevant when you run files with .asy extension. When you run filename.tex, is a file called filename-1.asy produced? (using pdflatex only) May 11, 2020 at 13:19
• @bingung Yes, using pdflatex, filename-1.asy is being produced. May 11, 2020 at 13:37