On page 3 of Dario Teixeira's Asymptote and LaTeX, the following simple example is provided:
\documentclass[10pt]{article}
\usepackage{graphicx}
\usepackage{asymptote}
\begin{document}
\begin{figure}
\centering
\begin{asy}
size (3cm);
draw (unitcircle);
\end{asy}
\caption{Embedded Asymptote figures are easy!}
\label{fig:embedded}
\end{figure}
\end{document}
I saved this in a file called example_01.tex and then following the instructions tried to compile by running from the command line:
latex example_01
asy example_01
latex example_01
But asy complains:
error: could not load module `example_01`
I'm using TeXLive 2013 on Mac OS X. Any suggestions about what I need to do or am doing wrong?
UPDATE
I just noticed that there was a example_01-1.asy file in my directory. I ran asy on this and then recompiled my LaTeX file and everything seems to work out fine.
How do I get asy to find the correct files to compile on? In particular, if I have multiple asy environments, is there a straight forward way to get asy to compile each file without me having to do through by hand telling it which files it needs?
Solutions I've tried
Using: make
I can create a makefile as follows:
example_01.dvi : example_01.tex
latex example_01.tex
asy example_01-*
latex example_01.tex
Or
example_01.pdf : example_01.tex
pdflatex example_01.tex
asy example_01-*
pdflatex example_01.tex
Both of which work.
Using: arara
My usual approach is to use arara. Since arara doesn't know asy I have to define my own asy.yaml file which I tried to do as follows:
!config
identifier: asy
name: asy
commands:
- <arara> asy @{getBasename(file)}-*
arguments: []
but the problem with this is that arara doesn't recognize wildcard specifiers for the file name. Any suggestions about how to get arara to recognize wildcards or to get arara to feed the necessary files to asy for it to compile?
arara. Butararadoesn't seem to allow wildcards in the file name. I suppose I could just go withmakeand amakefilesince wildcards are tolerated there. – A.Ellett Jun 30 '13 at 17:52latexmksection of Using Asymptote with pdfLaTeX: opengedit $HOME/.latexmkrcand addsub 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");as in ctan asymptote latexmkrc script. No idea onararawithasyandmakeas well – texenthusiast Jun 30 '13 at 18:05