[OS X TeX] Shell escape and MacTeX 2009

Robert Morelli morelli at flux.utah.edu
Tue Apr 6 14:21:20 EDT 2010

Herbert Schulz wrote:
> % to get old behavior foo.eps->foo.pdf as well as update,prepend
> \epstopdfsetup{program at epstopdf=epstopdf,verbose,update,prepend,prefersuffix=false,suffix=}
OK, that solved that gnuplottex problem. Your help is very much appreciated.

I must say, I find this kind of change baffling. I don't have the 
faintest idea
how I would be expected to know that such a fundamental change had taken
place in one my of latex packages ...

I still have one more problem, but this is harder to describe. I use 
Asymptote to
create technical diagrams. The standard Asymptote distribution doesn't 
seem to
have a feature using shell-escape to automatically generate and include the
diagrams from inline asymptote code. You're expected (I think) to run 
then run asy on a generated file, then run pdflatex again (like BibTeX). 
I found a posting in a forum that had some code that automated the 
process. This
is not an official release, but nevertheless used to work in MacTeX 2008 
but not
in 2009. Here's the code:

% This file was found on the Asymptote forum
%cjorssen [Avatar]  2009-11-15 10:50:29 UTC
% It automatically calls asy using shell escape, but only when the 
figure has changed.

\def\asy at fig@count{\z@}

\newif\ifasy at mdfive
\let\asy at end@first\relax
\let\asy at end@second\relax

\def\asy at compare@two at mdfive#1#2{%
\asy at compare@two at mdfive@i#1\asy at end@first\asy at nil#2\asy at end@second
\asy at nil}
\def\asy at compare@two at mdfive@i#1#2\asy at nil#3#4\asy at nil{%
\def\asy at next{\asy at mdfivetrue}%
\def\asy at next{\asy at compare@two at mdfive@i#2\asy at nil#4\asy at nil}%
\def\asy at next{\asy at mdfivefalse}%
\asy at next}

\def\asy at compile{%
\immediate\write18{asy -f pdf \asy at fig@filename}
\immediate\write18{asy \asy at fig@filename}

\@tempcnta=\asy at fig@count\relax
\xdef\asy at fig@count{\the\@tempcnta}%
\edef\asy at fig@filename{\jobname-asy-fig-\asy at fig@count.asy}%
\IfFileExists{\jobname-asy-fig-\asy at fig@count.asy}%
{% Asy file already exists: need to see if a newer version exists
\edef\asy at fig@filename at tmp{%
\jobname-asy-fig-\asy at fig@count.asy.tmp}%
\def\asy at next{\verbatimwrite{\asy at fig@filename at tmp}}}
{% Asy file does not exist: no problem
\let\asy at fig@filename at tmp\relax
\def\asy at next{\verbatimwrite{\asy at fig@filename}}}%
\asy at next}

\ifx\asy at fig@filename at tmp\relax
\asy at compile
\edef\asy at temp{%
\noexpand\asy at compare@two at mdfive{%
\pdfmdfivesum file{\asy at fig@filename}}{%
\pdfmdfivesum file{\asy at fig@filename at tmp}}}
\asy at temp%
\ifasy at mdfive
\immediate\write18{rm -f \asy at fig@filename at tmp}
\immediate\write18{mv \asy at fig@filename at tmp\space\asy at fig@filename}
\asy at compile
\includegraphics{\jobname-asy-fig-\asy at fig@count}}

More information about the MacOSX-TeX mailing list