Including eps graphics in pdfLaTeX

Traditionally, LaTeX users generate postscript output using dvips. An alternative is to use pdfTeX to generate PDF files directly. The PDF format offers a number of advantages over postscript:

The postscript generated by dvips can be converted to pdf format with the Adobe software or ghostscript, but there are a number of disadvantages in comparison to using pdfTeX. In particular, the files are usually larger, and ghostscript prior to v6.0 converts the type-1 scalable fonts into type-3 bitmaps, resulting in poor appearance when viewing. The type-3 bitmaps will also occur if the dvips isn't configured to use type-1.

The main limitation of pdfTeX is that postscript figures cannot yet be directly imported into documents. Instead, inclusions must be bitmaps (PNG or JPG), a simple format of PDF, or MetaPost output. Some EPS graphics may be converted to PDF and included, but I have had limited success with this approach in the pase. However, I have found that conversion through MetaPost is quite robust for vector graphics. For bitmaps you will want to instead convert to PNG for line-art or JPG for photos.

via pdf

In more recent times, the later versions of epstopdf by Sebastian Rahtz et al. appear to quite successfully perform the translation to pdf directly. This means that the pdf generation process is quite easy:

via mps

I would consider this section now obsolete, and graphics would now be generally be included with pdf as described above. Hovewer, to instead perform the conversion via MetaPost, you will need both pstoedit and metapost. I suggest pstoedit v3.14 or later as it incorporates changes and bug fixes I made. Metapost is found in most TeX distributions. To generate a .mps file from a .eps file, use the following commands:

pstoedit -f mpost -fontmap /usr/local/lib/pstoedit/fontmap.mpost file.eps file.mp 
mpost file.mp 
mv file.1 file.mps

You will need to alter the path to the fontmap.mpost file to suit you installation. The last line is necessary because metapost gives the output file the extension of ".1", while it is more convenient to import it into pdfTeX with an extension of ".mps".

With a little bit of trickery, it is possible to make metapost typeset any mathematics during the conversion. This means that it is possible to include LaTeX equations in graphic editor that does not natively support it (such as Sketch).

The LaTeX File

To import graphics into pdfTeX, the easiest way is to simply use the graphics (or graphicx) package, and no option should now be required. So simply use this at the top:

\usepackage{graphics}

A figure may then be included by a command like:

\includegraphics{file}

If the extension is not specified, LaTeX will find the .eps file, and pdfTeX will find the .mps or .pdf file.

The following is an example of inserting a figure called FigureExample.eps, FigureExample.pdf or FigureExample.mps. If you leave the extension off, usually the best one is chosen automatically.

\begin{figure}[htb!]
\centering%
\includegraphics{FigureExample}
\caption{An Example Figure}
\label{fig:FigureExample}
\end{figure}

In order to keep files small, I recommend using the Times or Helvetica fonts, as these are built-in fonts on pdf readers, and don't need to be included in the file. For example, use the times package (\usepackagetimes in the preamble).