[OS X TeX] Fixed epstopdf, which handles %%BoundingBox: (atend) OK.

Peter Dyballa Peter_Dyballa at Web.DE
Sat Feb 4 06:45:15 EST 2006


Am 04.02.2006 um 11:17 schrieb Axel E. Retif:

> I'm still using TeXShop 2.03; its epstopdfwrap has
>
> ----------
> #!/bin/tcsh
>
> # A wrapper to call epstopdf in the correct folder.
> # By Richard Koch, Oct 4, 2001, following similar code by
> # Gerben Wierda
>
> if ("$argv[1]" == "Panther") then
>     set filename = "$argv[4]"
>     /usr/bin/pstopdf "${filename}"
>
> else
>
> set mygspath = "$argv[2]"
> if (-x ${mygspath}/gs) then
> 	setenv PATH "${mygspath}:${PATH}"
> 	rehash
> endif
>
> set filename = "$argv[4]"
> set epstopdfname = "$argv[3]"
> set outputname = "${filename:r}.pdf"
> "${epstopdfname}" -o="${outputname}" "${filename}"
>
> endif
> -------------

The contents of epstopdfwrap has not changed since then.

How epstopdfwrap works:

*Only* when its first argument is 'Panther' then Apple's 'distiller' / 
usr/bin/pstopdf is chosen as convertor. Could be this value is  
determined from the setting of the Distiller on the 'Misc'(?)  
preferences pane, but I would not like to believe this, because there  
is nothing to 'distill' from an EPS file. (I think the other  
distiller setting in the 'programmes' preferences only applies to the  
TeX run in which something could be found that would necessitate the  
operation of some distiller.)

*If* TeXShop determined that the file is not EPS it might pass as  
argument no. 3 another name than epstopdf to epstopdfwrap. Only in  
this case this different script or programme is used as convertor --  
and this convertor needs to understand the syntax '-o=<output file  
name>' and accept a free floating string as the name of the input  
file. There is some chance that I do not interpret the Objective C  
code correctly:

         else if  ([[myFileName pathExtension]  
isEqualToString:@"eps"]) {
             enginePath = [[NSBundle mainBundle]  
pathForResource:@"epstopdfwrap" ofType:nil];
             if (([SUD integerForKey:DistillerCommandKey] == 1) &&  
(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_2))
                 [args addObject: [NSString  
stringWithString:@"Panther"]];
             else
                 [args addObject: [NSString  
stringWithString:@"Ghostscript"]];
             gsPath = [[SUD stringForKey:GSBinPathKey]  
stringByExpandingTildeInPath];
             [args addObject: gsPath];
             tetexBinPath = [[[SUD stringForKey:TetexBinPathKey]  
stringByExpandingTildeInPath] stringByAppendingString:@"/"];
             epstopdfPath = [tetexBinPath  
stringByAppendingString:@"epstopdf"];
             [args addObject: epstopdfPath];
             }

Indeed I do not understand the 'if (([SUD ... ;' clause's meaning  
completely (I can guess this SUD). But checking the output file from  
last night's conversion: it was made with pstopdf, the distiller I  
set! So you're right -- and TeXShop's wrong or I did not read the  
Help correctly.


The TeXShop sources I have and look into are approximately 2.05. I am  
sure I understand that TeXShop determines from the extension of the  
file's name dropped on it the type and then chooses the appropriate  
convertor.


Since epstopdfwrap is a shell script one can edit it. Putting before  
the first 'else':

	echo "$0 used pstopdf as PS->PDF convertor for $filename"

and before the final 'endif':

	echo "$0 used »$epstopdfname -o=${outputname}« to convert $filename  
to PDF"

epstopdfwrap would write into Console what it was doing. To actually  
use epstopdf as EPS->PDF converter it's obviously needed to choose  
Ghostscript as 'distiller!'


I don't think that this is the right behaviour. I think that PS->PDF  
and EPS->PDF are two different cases. While in the PS->PDF case it  
makes some sense to have the choice between Ghostscript's ps2pdf and  
Apple's pstopdf, in the EPS->PDF case there is no choice, only  
epstopdf works correctly and saves the original bounding box (and  
maybe a script with ps2pdf and pdfcrop I can offer one of these days).

--
Greetings

   Pete

The day Microsoft makes something that doesn't suck is the day they  
start selling vacuum cleaners.


------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list