[X-Unix] Converting eps to pdf from commandline

John Harrold john.m.harrold at gmail.com
Tue Sep 15 12:53:28 PDT 2009


Sometime in September, Stroller proposed the following: 

>
> On 8 Sep 2009, at 19:10, John Harrold wrote:
>> ...
>> I'm generating some eps files with latex and I need to convert these  
>> into
>> pdf files.
>
> I'm sorry that this response doesn't directly answer your question, but 
> is there a reason you're producing EPS files with LaTeX?

Yes.

:)

But wait you probably want a more verbose reason, and it's based on my
workflow.  I'm creating figures within matlab which I want to label and
markup. These labels are all in matlab scripts, and the figure generation
is automated. I like to have font consistency between my figures and the
document I'm going to include those figures within (so when I reference the
Greek letter theta with a subscript I and superscript 2 it looks the same
on my figure as it does within the document). To do this I use a script
called 'laprint.m'[a] which basically takes all the textual elements of the
matlab figure and renders them in latex. It produces an eps file. Now say
for example I want to include that figure in a presentation I'm creating
with beamer I need to convert that eps file into a pdf because I'm using
pdflatex to compile my beamer document. If I use the ps2pdf that comes with
fink, then the pdf file that is produced has the bounding box all screwed
up.

> I know different LaTeX distros behave differently - what I remember from 
> last time I used a multiple-step process is that I used a command to 
> produce .dvi files (??) from the .tex output, then dvips or dvipdf [1] to 
> produce a printable file. I see these latter commands appear to be 
> provided by Ghostscript; I do my LaTeX work on Linux, so have no idea of 
> the situation of that package or those commands on MacOS.

I generally use Makefiles for my documents this way I can switch between
tex distributions and explicitly include directories with class or style
files.

> I think my LaTeX distro (texlive) dropped dvi2pdf, but this shouldn't be 
> a big deal, as it's easy to convert PS to PDF.

As noted above, the standard tools really screw up the bounding boxes and
result in images that are pretty useless.

> I'm not clear on the difference between PS & EPS files. My experience of 
> opening EPS (say, Photoshop / Illustrator) is that they often manifest 
> this scaling problem you describe.

Yeah, but for some reason the internal ps2pdf converter preview uses seems
to handle this well.
 
> Anyway, my advice, if you'll forgive it, is to try to avoid the EPS  
> step. I personally just use `rubber` [2], which turns a multiple-step  
> process into a single-step one, and saves me having to read a bunch of  
> uninteresting output as the .dvi file is generated. I simply run `rubber 
> --pdf source.tex` and get a perfect pdf file as a result (in fact I have 
> `alias rubber="rubber --pdf"` in my .bashrc, making the actual command to 
> type even shorter & more intuitive)

I appreciate your advice, and I'll check out rubber.  But using the built
in one (/usr/bin/pstopdf) seems to solve my problem, and fits in well with
my workflow (I can just modify my Makefile to run this on each eps file).
I'll definitely look into rubber (it's always good to have multiple
options).

[a] http://www.uni-kassel.de/fb16/rat/matlab/laprint/

-- 
 John M Harrold              


More information about the X-Unix mailing list