# How to run Asymptote with TeX Live?

I'm using a clean installation of TeX Live on Windows 7, using TeXworks editor in pdfLaTeX mode. I've tried the following code:

\documentclass{minimal}
\usepackage[pdftex]{graphicx}
\usepackage{asymptote}
\begin{document}
Text Text Text
\begin{center}
\begin{asy}
size(5cm); draw(unitsquare);
\end{asy}
\end{center}
\end{document}


And its produces a .pdf, but with no graphic. I understand that I may have to do a step with the .asy file, but what do I need to do with this .asy file?

For some reason I'm getting this when running the command suggested by Philipp (document is named trial.tex).

Just running the command asy seems to bring up asymptote ok though.

-
The usage is explained on page 82 of the manual (texdoc asymptote). Probably the latexmk method is the easiest one. –  egreg Feb 12 '12 at 11:14
I've read that part of the guide, where do I type the "latexmk -pdf latexusage" command within TeXworks? Forgive my ignorance, I've only been using LaTeX for a day. –  Andy Feb 12 '12 at 11:48
Also, am I right in putting this code in a file named latexmkrc in the same directory as the .tex file i'm working with? sub asy {return system("asy '\$_[0]'");} add_cus_dep("asy","eps",0,"asy"); add_cus_dep("asy","pdf",0,"asy"); add_cus_dep("asy","tex",0,"asy"); If not, where does it go? –  Andy Feb 12 '12 at 12:32
While using latexmk is indeed the easiest solution you should also be able to use asymptote without it. Assuming your main tex document is named latexdoc you have to compile the document once, then execute the following command via the command line: asy latexdoc-*.asy and then compile the document again with LaTeX. –  Philipp Feb 12 '12 at 13:46
@Andy The problem might be in the fact that the Windows shell doesn't do correct "globbing". Try asy trial-1.asy –  egreg Feb 12 '12 at 16:17