1

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;
tensorshade(g,p);
dot(g);
\end{asy}
\immediate\write18{asy \jobname*.asy}
\end{figure}
\end{document}
9
  • would you mind posting what did you try? It is difficult for people to help if they don't know what you tried.
    – bingung
    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.
    – AlexG
    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.)
    – AlexG
    May 11, 2020 at 14:08

1 Answer 1

0

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;
tensorshade(g,p);
dot(g);
\end{asy}
\immediate\write18{asy \jobname*.asy}
\end{figure}
\end{document}
6
  • Thank you for your reply. It seems I am still getting the same error. Just to clarify in the "For .asy files" section in Texmaker in "Quick build" it reads as "C:/Program Files/MiKTeX 2.9/miktex/bin/x64/asy.exe" -f pdf -noView %.asy|"C:/Program Files/Adobe/Reader 11.0/Reader/AcroRd32.exe" %.pdf. Is this correct? Apr 14, 2020 at 7:49
  • Sorry, I don't use TeXmaker, and I don't know it. I only showed how to compile in command prompt. Apr 16, 2020 at 22:18
  • Sorry for off topic, but can you please check this tex.stackexchange.com/questions/539040
    – Zombo
    Apr 17, 2020 at 4:38
  • @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)
    – bingung
    May 11, 2020 at 13:19
  • @bingung Yes, using pdflatex, filename-1.asy is being produced. May 11, 2020 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.