[texhax] EPS for latex/dvips and PDF for pdflatex

zsdc zsdc at wp.pl
Fri Jun 13 11:01:54 CEST 2003


Thanks to everyone who helped me with my problems in getting embedded 
pictures to work with pdflatex.

> When I was experimenting with pdflatex, I started to read about 
> different file formats, and I fugured out that, like I need Embedded 
> PostScript to embed graphics in PostScript output, I need Embedded PDF 
> to embed graphics in PDF output. So I converted my EPS files to EPDF 
> with "convert" program from ImageMagick, but I was still getting 
> "Unknown graphics extension" error, just like with EPS files, so I 
> gave up, thinking that if I don't know how to embed Embedded PDF into 
> PDF, than I have to do something completely wrong, and it's not only 
> the fault of the file format I use. 

I was converting them correctly (well, GhostScript is much better than 
ImageMagick for that sort of thing, the files I got was of poor quality, 
but they were correct anyway) but I was saving the pictures as file.epdf 
(which I thought was the correct suffix for Encapsulated PDF) instead of 
file.pdf. That's why pdflatex was giving me "Unknown graphics extension" 
error, just like with EPS files.

Now I save them as PDF and not only they work when I use 
\includegraphics{file.pdf}, but also, as many people here told me, when 
I use \includegraphics{file} then latex/dvips uses file.eps and pdflatex 
uses file.pdf, which is great.

So, now everything works just fine. I have one LaTeX source, from which 
I can have PostScript, as well as PDF output with great quality. Thanks 
a lot for your help.

I wrote a little shell script, update-epdfs, which converts every *.eps 
files to .pdf with epstopdf unless the pdf files are already newer than 
eps. You might find it useful:

#!/bin/sh
# 2003-06-13T09:50:02+0200
# update-epdfs by zsdc at wp.pl
# converts eps to pdf files in the working directory using epstopdf
for e in *.eps; do
    [ ! -e $e ] && echo No *.eps files. && exit
    p=`echo $e | sed s/eps$/pdf/`
    [ $p -nt $e ] && echo $p is up to date. && continue
    echo -n "$p epstopdf... "
    epstopdf $e -o=$p >/dev/null 2>&1 && echo Done. || (echo ERROR. && 
rm $p)
done

It's kind of Unix-centric, I guess. If anyone who can't run it would 
like, I can translate it to Perl and post it here as well.

Thanks.
-zsdc.





More information about the texhax mailing list