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.

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?

share|improve this question
    
Which automation tool you use ? Tools for automating document compilation –  texenthusiast Jun 30 '13 at 17:48
    
@texenthusiast Recently, I've been using arara. But arara doesn't seem to allow wildcards in the file name. I suppose I could just go with make and a makefile since wildcards are tolerated there. –  A.Ellett Jun 30 '13 at 17:52
1  
Refer latexmk section of Using Asymptote with pdfLaTeX: open gedit $HOME/.latexmkrc and add 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"); as in ctan asymptote latexmkrc script. No idea on arara with asy and make as well –  texenthusiast Jun 30 '13 at 18:05
add comment

1 Answer

Converting my comment to answer: But feel free to add/edit

Refer latexmk section of Using Asymptote with pdfLaTeX:

open gedit $HOME/.latexmkrc and

add 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");

as in ctan asymptote latexmkrc script. I have no idea on arara with asy and make as well

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.