Include EPS graphics in pdflatex

June 18, 2009

It’s a shame that pdflatex supports jpg, png, pdf… graphic type but not EPS while latex supports EPS but not the others. From my previous post, there is an easy way to convert EPS to pdf.  But it is just annoying that every time you want to include an eps graphic you have to do the conversion manually. After googling, I found out that there is a way to let pdflatex do the conversion for you. Here is how. Read the rest of this entry »


Convert EPS to PDF: problem of bounding box

June 17, 2009

When you save a multiple plots/subfigures figure as an eps file in matlab, the bounding box might not be properly defined. People who use pdflatex need to convert EPS to PDF. The undefined bounding box will cause problems if you use epstopdf to convert EPS to PDF. This problem is shown in the first row in the picture below. The top-left figure is the eps file without properly defined bounding box. Because of this, epstopdf simply printed a letter size pdf file that only contains part of the figure as shown in the top-right figure. You can try to use the option –exact

epstopdf --exact bad.eps

It will probably generate an warning msg like “Warning: BoundingBox not found!” and the resulting pdf is still wrong. One way to fix this problem is to use epstool

epstool --copy --bbox bad.eps --output good.eps

The bbox option tells epstool to generate a (correct) bounding box for the eps file. With a correctly defined bounding box, you can easily convert an eps file to a pdf file.

epstopdf --exact good.eps

The results are shown in the 2nd row of the picture below. epstopdf generated an pdf file in the same size as the eps file.
pic