Include EPS files in LaTeX

Recently I wanted to include a directed graph in a LaTeX doc­u­ment. I was run­ning dot on the graph file

$ dot -Tps2 nfa.dot > nfa.eps

to receive the EPS file which I wanted to include in LaTeX. Run­ning TeXShop with pdfla­tex for type­set­ting on a file con­tain­ing

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

how­ever returns the error

! LaTeX Error: Unknown graphics extension: .eps.

This can be resolved by adding

\usepackage{epstopdf}

which allows to con­vert eps images to pdf for use with pdfla­tex. This works perfect. :cool:

103 thoughts on “Include EPS files in LaTeX”

  1. I’m quite new on latex and I need to include eps files for a report. I’m try­ing to make epstopdf work but with­out any suc­cess… I’m begin­ning to be depressed.
    I get the fol­low­ing error:
    ! Pack­age pdftex.def Error: File ‘state_correlation_diagram-eps-converted-to.pd
    f’ not found.

    Please can you help me?

    Thanks in advance.
    Antoine

      1. Thanks for answer­ing. It is actu­ally in the same folder. Besides, even with the absolute path it doesn’t work.

    1. that did it !
      {epstopdf} was not suf­fi­cient,
      with pdf­TeX, Ver­sion 3.1415926–1.40.10 (TeX Live 2009/Debian)

      THX a lot !!

      1. Have to revise my pos­i­tive answer : on my Mik­TeX on Win7 nei­ther of the two do work.
        (Maybe epstopdf would, but it can’t find the executable.)

        IIRC, on my Debian box it finally also did NOT work — there were no more error messages(that’s why I cried vic­tory), but blanks instead of fig­ures in the final output.

        Thanks a lot in advance if you have any fur­ther sug­ges­tions.
        (e.g. what to do as to get & install the epstopdf executable).

        PS: con­vert­ing by hand is not an option, too many fig­ures (in sev­eral papers I con­tinue to receive as edi­tor).
        On linux I might be able to write a script (but no clue on the epstopdf com­mand line options ?) but I cur­rently have only access to a Win7 box :( !

        1. For Mik­Tex Win7 didn’t work at the beg­gin­ing, then I put both of the pack­ages (\usepackage{epstopdf} \usepackage{epsfig}) AT THE END of the list of pack­ages. That solved the prob­lem, try ti!.

  2. Thank you sooo much…It really works…after two hours strug­gled finally I got it from your link. thank you soo much

  3. Hi,
    I got this warn­ing in Kile, please help me to fix it

    epstopdf warn­ing: “Shell escape fea­ture is not enabled.”

    Thanks.
    Bal

      1. Hi Dirk Raffel,

        Thanks a lot for your help.
        After fix­ing that error, I got other one “! Pack­age pdftex.def Error: File ‘ Figures/va.pdf’ not found.
        I used linux with texlive and also Mik­tex win­dows, but not successful.

        Please help me about this.

        Thank you.
        Bal

  4. It still does not work, ( I have added the two pack­ages). Is is pos­si­ble that the rea­son is that I com­pile with Latex=>PDF directly?

  5. Thanks.

    How­ever, I am expe­ri­enc­ing a prob­lem. For cer­tain graph­ics in .eps for­mat the epstopdf pro­duces a .pdf that con­tains no image (just a blank pdf page).

    Exam­ple:

    \documentclass[landscape]{article}

    \usepackage{tikz}
    \usetikzlibrary{chains}
    \usepackage{epstopdf}
    \begin{document}
    \pagestyle{empty}
    \begin{tikzpicture}[
    start chain=going right,
    dia­gram item/.style={
    on chain,
    join
    }
    ]
    \node [
    dia­gram item,
    label=center:Internet
    ] {\includegraphics{cloud}}; <—-this work. If swapped for another image it fails.

    \end{tikzpicture}
    \end{document}

    Could you help?

  6. I had the same prob­lem. At first hand the pack­age epstopdf solve the prob­lem, but as I use \psfrag to add some text on the fig­ure these labels will not appear on it.
    I read that the using pack­age “graph­icx” and “eps­fig” should solve the ques­tion and I’ve tried them, but no suc­cess: the error mes­sage “!LaTeX Error: Unknown graph­ics exten­sion: .eps”.
    By the way I’m using TeX­works v. 0.4.4 r1003 Mik­TeX 2.9 64-bit.

  7. \documentclass{article}
    \usepackage{epsfig}
    \usepackage{epstopdf}
    \usepackage{graphicx}
    \begin{document}
    \begin{figure}[!htb]
    \cen­ter­ing
    \includegraphics{new.eps}
    \caption{Digraph.}
    \label{fig:digraph}
    \end{figure}
    \end{document}

    I am quite new to latex. This is what I have writ­ten in latex to add image.But i got ! Pack­age pdftex.def Error: File ‘new-eps-converted-to.pdf’ not found.
    This error…Please help me about this

  8. same :’( Error =
    (./title.tex
    Pack­age epstopdf Info: Source file:
    (epstopdf) date: 2006-11-09 16:07:30
    (epstopdf) size: 124412 bytes
    (epstopdf) Out­put file:
    (epstopdf) Com­mand:
    (epstopdf) \include­graph­ics on input line 15.
    runsystem(epstopdf –outfile=crest-eps-converted-to.pdf crest.eps)…disabled.
    Pack­age epstopdf Info: Result file: .
    ! Pack­age pdftex.def Error: File ‘crest-eps-converted-to.pdf’ not found.

    with:
    \usepackage{subfigure,epsfig,amstext,floatfig,alltt,fancyhdr,setspace,amsmath}
    \usepackage{epstopdf,epsfig}
    \usepackage{amsmath}
    \usepackage{mathtools}
    \usepackage{amssymb}
    \usepackage{ifsym}
    \usepackage[toc]{glossaries}

    any help would be much appreciated!

  9. To all the peo­ple that have this problem:

    Pack­age pdftex.def Error: File ‘some_file_converted.pdf’ not found.

    even if they are using all the required libraries, the solu­tion is to write the file name with­out the exten­sion EPS, in this case you should only write:

    \includegraphics{some_file_converted}

  10. Hi,
    I am using LEd I have tried all the expla­na­tions above which have allowed the file to con­vert with warn­ings but not errors as if the file is going to work out.
    Example:LaTeX /b/c12/cWarning:/b/c0/c Ref­er­ence ‘twofac­tions’ on page 12 unde­fined on input line 205.

    When I open the pdf file, I have all white boxes with the words {name}eps-coverted-to-pdf. No graphic appears though and I am won­der­ing if I need to resize it or if there is another pack­age I need to be aware of.

    Please help and thank you!

    1. I am also using LEd and found that I could not use eps files and the error mes­sage reads as “I could not locate the file with any of these exten­sions: .png,.pdf … JBIG2,.JB2” . So what I did is I included \usepackage{graphicx}
      \usepackage{epstopdf}
      \usepackage{epsfig} in the pre­am­ble in this order. It works. But once I don’t men­tion it in this order it does not works, I don’t know why. Hope it helps.

  11. omg thanks. took me for­ever to find this gem. if some peo­ple still hav­ing prob­lems, some times you have to use ” and/or exten­sion. so, “file­name” or “filename”.png for it to find the right path

  12. The three com­mands below should be suf­fi­cient to graph­ics with .eps exten­sion in Tex­Maker.
    \usepackage{graphicx}
    \usepackage{epstopdf}
    \usepackage{epsfig}

Leave a Reply