Include EPS files in LaTeX

Recently I wanted to include a directed graph in a LaTeX document. I was running dot on the graph file

$ dot -Tps2 nfa.dot > nfa.eps

to receive the EPS file which I wanted to include in LaTeX. Running TeXShop with pdflatex for typesetting on a file containing

\begin{figure}[!htb]
\centering
\includegraphics[scale=.7]{nfa.eps}
\caption{Digraph.}
\label{fig:digraph}
\end{figure}

however returns the error

! LaTeX Error: Unknown graphics extension: .eps.

This can be resolved by adding

\usepackage{epstopdf}

which allows to convert eps images to pdf for use with pdflatex. This works perfect. 😎

119 thoughts on “Include EPS files in LaTeX”

Leave a Reply