TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

 Text Text Text 
 size(5cm); draw(unitsquare); 

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). enter image description here

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

share|improve this question
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

For me, this is as simple as adding a new tool to TeXworks enter image description here

Running pdfLaTeX, the asymptote, the pdfLaTeX again seems to work fine (in the same way you would do pdfLaTeX, BibTeX, pdfLaTeX).

Alternatively, choosing LaTeXmk and building also produces the correct output.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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