Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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). 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
2  
@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
show 3 more comments

1 Answer

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
add comment

Your Answer

 
discard

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.