[OS X TeX] Shell escape and MacTeX 2009
Herbert Schulz
herbs at wideopenwest.com
Tue Apr 6 15:08:22 EDT 2010
On Apr 6, 2010, at 1:21 PM, Robert Morelli wrote:
> 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 ...
>
Howdy,
Yeah... it's surprising and annoying even though there were reasonable reasons for the changes. When TeX Live 2009 (TL from now on) was in process there was an attempt to have the graphicx/s package autoload the epstopdf package if pdftex was being used in pdf mode. This was being done to make eps inclusion in pdflatex documents a bit more transparent. Unfortunately, because there no longer was a conscious decision to use the epstopdf package and therefore knowing that you have to have shell-escape enables for that document, that also meant that the default behavior of pdftex would have to be changed to allow some sort of limited shell-escape by default. Many folks don't like having shell-escape enabled, especially by default, for security reasons and there were ways to get around the limited nature of the proposed shell-escape so that never happened. Because the proposal would automatically do foo.eps->foo.pdf behind the users back in spite of possibly having a foo.pdf that was created in some other way it was decided that the default behavior would be foo.eps->foo-eps-converted-to.pdf. Also, if you don't use an extension in the \includegraphics command, the eps extension was appended to the list of extensions the graphicx/s package searches for rather than prepending. That meant that an existing foo.pdf would always be found before the updated foo.eps. Fortunately, as far as I'm concerned, the maintainers of the epstopdf package created a way to change the default behavior by creation of the file I mentioned before.
Hope that wasn't too long winded.
> 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 pdflatex,
> then run asy on a generated file, then run pdflatex again (like BibTeX). However,
> 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.
>
> \makeatletter
> \def\asy at fig@count{\z@}
> \newenvironment{asyalt}{}{}
>
> \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{%
> \if#1#3
> \ifx\relax#2
> \def\asy at next{\asy at mdfivetrue}%
> \else
> \def\asy at next{\asy at compare@two at mdfive@i#2\asy at nil#4\asy at nil}%
> \fi
> \else
> \def\asy at next{\asy at mdfivefalse}%
> \fi
> \asy at next}
>
> \def\asy at compile{%
> \ifpdf
> \immediate\write18{asy -f pdf \asy at fig@filename}
> \else
> \immediate\write18{asy \asy at fig@filename}
> \fi}
>
> \def\asyalt{%
> \@tempcnta=\asy at fig@count\relax
> \advance\@tempcnta\@ne
> \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}
>
> \def\endasyalt{%
> \endverbatimwrite%
> \ifx\asy at fig@filename at tmp\relax
> \asy at compile
> \else
> \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}
> \else
> \immediate\write18{mv \asy at fig@filename at tmp\space\asy at fig@filename}
> \asy at compile
> \fi
> \fi
> \includegraphics{\jobname-asy-fig-\asy at fig@count}}
Rather than trying to work my way through that code... what command steps would you run if you were going to do this manually via the command line? It may be possible to do something that extends the epstopdf package to do the conversion (whatever that may be) or use latexmk to automate the process (I use latexmk within TeXshop) or some combination of both.
Good Luck,
Herb Schulz
(herbs at wideopenwest dot com)
More information about the MacOSX-TeX
mailing list