shiblon / latex-makefile

A Makefile for LaTeX - drop it in, type make, and magic happens.
Other
186 stars 30 forks source link

asymptote support #91

Open shiblon opened 8 years ago

shiblon commented 8 years ago

Originally reported on Google Code with ID 78

I would like to see support for asymptote in the Makefile. Asymptote
(http://asymptote.sourceforge.net/) is a powerful vector graphics language.
It can be used with Latex in two different modes:
-inline source: the preamble uses \include{asymptote}; all you need to do
is running 'asy filename' (between the first and last latex run, as in
'bibtex filename'). As far as I know, this can't be cached and run only if
the images are changed.
-external source: the code for images is in external files with extension
".asy"; running 'asy filename.asy' compiles the images and generates one or
more .eps files. The name is usually filename.eps, but this can be changed
inside the source using the shipout("anotherfilename") instruction. This
works more or less like gnuplot.

When pdflatex is used, asy needs the switch "-f pdf" to produce pdf files.

More information on asy+latex integration on
http://www.scribd.com/doc/7094154/Asymptote-and-Latex-an-Integration-Guide-Dario-Teixeira

Please feel free to contact me if you need any more information.

Thanks for the excellent makefile, and keep up the good work!

Reported by f.poloni on 2010-04-09 08:32:02

shiblon commented 8 years ago
I'm installing asymptote now to see what can be done.  Here are my preliminary thoughts:

1) If I can find something in the .aux or .fls or .log file after the first pdflatex
invocation that indicates that asy 
needs to be run, that should be fairly easy to do for inline graphics

2) For external source, I should just be able to build them like anything else.  That
should be extra simple.  
Obviously, external source would have the disadvantage of not having access to extra
command definitions 
(for notational consistency), so I can see that having the ability to do inline stuff
will be important.

I'm a little concerned about people using the shipout("unexpected_name") approach in
the asymptote source.  
That sounds hard to detect and deal with, and the makefile is definitely not going
to be able to generate 
dependencies for those cases.  I think we'll just say it isn't supported (you can always
create your own make 
rule in Makefile.ini for the odd cases).

Thoughts?

Reported by shiblon on 2010-04-09 16:29:50

shiblon commented 8 years ago
1) If you use asymptote in the embedded mode, on the first run the contents of the
\begin{asy}...\end{asy} sections get copied into a file called documentname.asy,
which you may compile into eps/pdf images with "asy documentname".
I have made a couple of trials, and unfortunately the .log and .aux file are
identical whether the figures are changed (with respect to the last run) or not. The
documentname.asy file gets overwritten, and its timestamp updated, in both cases.
This does not play well with makefiles. Of course this is an Asymptote issue, not
yours. A possible solution would be to compile the .asy file through asymptote anyway
(slow, adds one asymptote+one latex run to every compilation); another one would be
to take a md5sum of the asy file and recompile only if it has changed (a bit kludgy).
I will submit a bug report to Asymptote asking for a notification to be added.

2) support for external .asy files (as in Gnuplot) would be great! I am looking
forward to see it released.

3) For shipout("unexpected name"), I agree with you that you can't do anything about
it inside the Makefile. If one insists on using it, they can set the dependencies
manually in Makefile.ini .

Thanks for the quick replies!

Reported by f.poloni on 2010-04-10 11:26:49

shiblon commented 8 years ago
Thanks for your response.  I finally got asymptote installed (for some reason that also
necessitated replacing 
teTeX with texlive, but I digress - I wanted to get texlive anyway, since that seems
to be what people are using 
these days).

I already check diffs for dependencies in several places in the makefile, so that's
totally doable.  I'll be looking 
into this in the next couple of weeks (work got crazy, so I have to take a breather
from the makefile udpates).

Reported by shiblon on 2010-04-11 01:08:16

shiblon commented 8 years ago
Sorry I haven't gotten to this yet.  I've been swamped at work.  I still intend to look
at it sometime.  Are you 
getting along without native support meanwhile?

Reported by shiblon on 2010-05-14 14:38:43

shiblon commented 8 years ago
Do you have an example asymptote file (not for embedding, but for *.asy -> *.pdf generation)
that you can attach here?  I'd like to play with this, now.

Reported by shiblon on 2011-01-04 15:58:47