5

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.

8
  • The usage is explained on page 82 of the manual (texdoc asymptote). Probably the latexmk method is the easiest one.
    – egreg
    Commented Feb 12, 2012 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
    Commented Feb 12, 2012 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
    Commented Feb 12, 2012 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
    Commented Feb 12, 2012 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
    Commented Feb 12, 2012 at 16:17

1 Answer 1

7

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .