# Is this the right way to use Asymptote in LaTeX?

This is the code i have written:

\documentclass[12pt,openany]{book}

\usepackage{asymptote}

\begin{document}

\begin{asydef}
import three;
import solids;
\end{asydef}

\begin{asy}
draw((0,0)--(100,100))

\end{asy}

\end{document}


This is whats written down there:

Package asymptote Warning: file asymptote-1.pdf' not found on input line 15.

(asymptote.aux) )
No pages of output.
Transcript written on asymptote.log.

Sorry, but "MiKTeX Compiler Driver" did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

C:/Users/OEM/AppData/Local/MiKTeX/2.9/miktex/log/texify.log

You may want to visit the MiKTeX project page, if you need help.


I have already downloaded the asymptote package... what have I done wrong? I am merely following the instructions here:

To be honest, I have been using LaTeX for a while now but im still new to Asymptote.......Im desperately trying to draw my first Asymptote graphic ---even a straight line would be good.....but i havent had any progress am i doing everything right? Or have I done everything wrong? Do i draw an Asymptote graphic in LaTeX this way? Thanks!

• Yes, this way works if you add the missing semicolon at the end of the draw command: draw((0,0)--(100,100)); and if you run asy. Assuming that your file name is main.tex, you need to run asy main-1.asy. Could be that your compiler automatically invokes asy, in which case you only need to add the ;. – user121799 Sep 26 '18 at 12:19
• what does it mean to "run asy"? Sorry if it sounds like a stupid question haha – Lee Laindingold Sep 26 '18 at 12:53
• Look in asymptote.log to find the errors from running asymptote. The only thing TeX "knows" is that asymptote didn't produce anything it could include in your document - it doesn't know why asymptote didn't run successfully. – alephzero Sep 26 '18 at 13:43
• asy is a compiler that converts your asymptote code to a graphics that can be included by the TeX file. – user121799 Sep 26 '18 at 15:12
• so，um, how do I “run“ this asy thing? Sorry XP – Lee Laindingold Sep 29 '18 at 7:18

Step 1 (the first latex step):

latex main.tex


Step 2 (the asy step):

asy main-1.asy


Step 3 (the second/final latex step):

latex main.tex
`