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”

  1. Thanks…!

    Just wondering: what is going wrong here that including an .eps does not work?

    (I had to generate the .pdf-files for my images using a pdf-printer, since ps2pdf chocked on the .ps-file that PSP created.)

    Regards,
    – Mark

  2. hi i included that package \usepackage{epstopdf} and i am using kile in suse 11 and still i am getting errror msg like these

    PDFLaTeX] pra.tex => pra.pdf (pdflatex)
    [PDFLaTeX] finished with exit status 70
    pra.tex:0: Shell escape feature is not enabled.
    [PDFLaTeX] 0 errors, 1 warning, 0 badboxes

    [ViewPDF] The file /home1/user009/Desktop/giri-latex/pra.pdf does not exist; did you compile the source file?

    Please help me……..

  3. Thanks for the tip!

    Only one observation:

    To use epstopdf you need to enable system commands via \write18

    Then you need to set shell_escape to ‘t’ (true) in
    /etc/texmf/texmf.cnf, otherwise the epstopdf command won’t run an the pdf won’t be genarated.

    I had to do this under Ubuntu, the default is set to false.
    Another option is to run the pdflatex command with ‘-shell-escape’

  4. (/opt/local/share/texmf-dist/tex/latex/oberdiek/epstopdf.sty

    Package epstopdf Warning: Graphics driver file `pdftex.def’ not found.

    )

    What does it mean??? How can I fix this?
    Why is it so efforts demanding the inclusion of a .eps?

  5. Definitely is a good solution indeed !

    However, make sure of that fact that you need to use \usepackage{graphicx} or \usepackage[pdftex]{graphicx}, before \usepackage{epstopdf}, else you will get ‘eps’ as an un-identifiable format.

  6. Hello,

    I am quite new to latex environment. I am using TexShop on a Mac an recently had problems with inserting a figure:

    \begin{figure}[h]
    \centering
    \includegraphics[width=16cm,draft=true]{//Users/PhD/LATEX THESIS/FIGURES THESIS/FIGURES THESIS CHAPTER 2//All data coverage SLP.pdf}
    \caption{Data coverage (\%) ICOADS SLP for four time periods}
    \label{fig:fig2.1}
    \end{figure}

    The figure is inserted, everything looks fine apart of the fact that on the top of the figure you can see the file name: //Users/PhD/LATEX THESIS/FIGURES THESIS/FIGURES THESIS CHAPTER 2//All data coverage SLP.pdf

    I really need to get rid of it somehow, but I did not manage.

  7. Hi,
    I am trying to use the following commands to attach an eps file as a figure in my document. But the figure becomes so small in the pdf file. How this can be solved?

    \begin{figure}
    \centering
    \includegraphics[width=2.2in,angle=-90]{Fig1.eps}\\
    \caption{A sample line graph using colors which contrast well both on screen
    and on a black-and-white hardcopy}\label{Fig:1}
    \end{figure}

  8. Thanks a lot, that works perfectly, and very simple! When I added it after all the other packages it worked, and before the others it didn’t work, probably good to add i after the other graphics packages.

  9. Note for dot users:
    You can also generate a pdf right away, so you don’t need this convert step. This seems to work fine:

    $ dot -Tpdf nfa.dot > nfa.pdf

  10. I get this error when i eps images with pdflatex with epstopdf package added

    Package epstopdf Warning: Shell escape feature is not enabled.
    ……….
    ………
    Package pdftex.def Error: File `1-eps-converted-to.pdf’ not found.

  11. hello
    i am having problem in including an .eps file in latex.
    i wrote the code :

    \begin{figure}[ht!]
    \centering {\includegraphics[width=3.3in]{ocs.eps}}
    \caption{OCS}
    \label{fig: ocs}
    \end{figure}

    but its showing error:

    ! Argument of \Gin@iii has an extra }.

    \par
    l.23 …g {\includegraphics[width=3.3in]{ocs.eps}}

    ?

    please help me

  12. I’ve been using TexWorks for a while now but have never been able to make .eps images work. I think this is due to, in a large part, the fact that I cannot find WHERE to save the images so Tex knows where to get them… I apologize if this is an obvious question, but I haven’t been able to find an answer!

Leave a Reply