# 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. Saima says:

Thanks! awesome and quick

2. Jingo says:

Thanks a lot! It is really helpful!!!

3. jean says:

I’m quite new on latex and I need to include eps files for a report. I’m trying to make epstopdf work but without any success… I’m beginning to be depressed.
I get the following error:
! Package pdftex.def Error: File state_correlation_diagram-eps-converted-to.pd

Antoine

1. jean says:

Thanks for answering. It is actually in the same folder. Besides, even with the absolute path it doesn’t work.

1. Prem says:

Don’t use underscores in names as it has different meaning in LaTex

1. Mirlan says:

Thank you for the tip about underscores!

1. chon_Thai says:

This is my problem, can you help me please. (Miktex and Win7)

4. J says:

Thank you! I really spent a lot of time to figure this out.
This really helped.

Perhaps this may help!

\usepackage{epsfig}

Goodluck.

1. MFH says:

that did it !
{epstopdf} was not sufficient,
with pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)

THX a lot !!

1. Have to revise my positive answer : on my MikTeX on Win7 neither 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 victory), but blanks instead of figures in the final output.

Thanks a lot in advance if you have any further suggestions.
(e.g. what to do as to get & install the epstopdf executable).

PS: converting by hand is not an option, too many figures (in several papers I continue to receive as editor).
On linux I might be able to write a script (but no clue on the epstopdf command line options ?) but I currently have only access to a Win7 box 🙁 !

1. Ignacio says:

For MikTex Win7 didn’t work at the beggining, then I put both of the packages (\usepackage{epstopdf} \usepackage{epsfig}) AT THE END of the list of packages. That solved the problem, try ti!.

6. 流水浮灯 says:

nice~ elegant solution!

7. Ebrahim K says:

outstanding! exactly what I wanted

8. M.Umar says:

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

9. bal says:

Hi,

epstopdf warning: “Shell escape feature is not enabled.”

Thanks.
Bal

1. Bal says:

Hi Dirk Raffel,

Thanks a lot for your help.
After fixing that error, I got other one “! Package pdftex.def Error: File  Figures/va.pdf’ not found.
I used linux with texlive and also Miktex windows, but not successful.

Thank you.
Bal

Great! It works perfectly with MiKTeX 2.9. Thanks a lot! Radu

Thanks alot
worked fine for me 🙂

12. kahshan says:

Thank you sir, it resolved my problem to 🙂

13. uddin says:

thanks to you.but i face a problem, i can not see the page number at bottom correctly. pls help me to solve the problem.

14. Jon says:

Works like a charm. Thanks!

15. turkiyeli_66@hotmail.com says:

It still does not work, ( I have added the two packages). Is is possible that the reason is that I compile with Latex=>PDF directly?

16. Daniel says:

Thanks.

However, I am experiencing a problem. For certain graphics in .eps format the epstopdf produces a .pdf that contains no image (just a blank pdf page).

Example:

\documentclass[landscape]{article}

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

\end{tikzpicture}
\end{document}

Could you help?

17. Fernando says:

I had the same problem. At first hand the package epstopdf solve the problem, but as I use \psfrag to add some text on the figure these labels will not appear on it.
I read that the using package “graphicx” and “epsfig” should solve the question and I’ve tried them, but no success: the error message “!LaTeX Error: Unknown graphics extension: .eps”.
By the way I’m using TeXworks v. 0.4.4 r1003 MikTeX 2.9 64-bit.

18. sagar says:

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

I am quite new to latex. This is what I have written in latex to add image.But i got ! Package pdftex.def Error: File new-eps-converted-to.pdf’ not found.

19. ant_holl says:

same :'( Error =
(./title.tex
Package epstopdf Info: Source file:
(epstopdf) date: 2006-11-09 16:07:30
(epstopdf) size: 124412 bytes
(epstopdf) Output file:
(epstopdf) Command:
(epstopdf) \includegraphics on input line 15.
runsystem(epstopdf –outfile=crest-eps-converted-to.pdf crest.eps)…disabled.
Package epstopdf Info: Result file: .

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!

20. harsh says:

thanks …………….. it really worked

21. alejo says:

To all the people that have this problem:

even if they are using all the required libraries, the solution is to write the file name without the extension EPS, in this case you should only write:

\includegraphics{some_file_converted}

1. CB says:

Still doesn’t work for me. I’m using TexMaker.

22. girish k says:

Thank you! I really spent a lot of time to fig­ure this out.
This really helped.

23. Anderson says:

Thanks

24. mi says:

thanks a lot. Very quick and accurate. Soved my problem.

25. toni f says:

thanks a lot, this also solved my problem

26. Prakash says:

Thanks very much……

27. dheeraj says:

Thanks very much.…..

28. clear says:

thanks alot, i solved my problem 🙂

29. Katie says:

Hi,
I am using LEd I have tried all the explanations above which have allowed the file to convert with warnings but not errors as if the file is going to work out.
Example:LaTeX /b/c12/cWarning:/b/c0/c Reference twofactions’ on page 12 undefined 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 wondering if I need to resize it or if there is another package I need to be aware of.

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

30. Sebastian says:

Thank you so much bro.

31. omg thanks. took me forever to find this gem. if some people still having problems, some times you have to use ” and/or extension. so, “filename” or “filename”.png for it to find the right path

32. pushpindersnl says:

Thanks a lot it works 🙂 🙂

33. Orosun says:

The three commands below should be sufficient to graphics with .eps extension in TexMaker.
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{epsfig}

34. Mahsa says:

Thanks a lot! It helped 🙂

35. MOULAI M. says:

Thank you very much! It is really helpful

1. MOULAI M. says:

Thank you

36. ddi says:

the problem is: using \usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{epsfig}
enables to use .eps files, but \psfragscan doesn’t find the letters in the plot anymore, so fonts ar not replaced anymore.
any ideas?

37. som says:

Thanks a lot!

38. koki says:

Im trying to include eps file . Im getting a blank box. I tried all the ways given above, I m getting
class amsproc warning: when the draft option is used, the \includegraphics commamd will print blank place holder boxes for the graphics.

39. mattia serrani says:

Thanks a lot, also if I prefer the .eps extensions instead of the .pdf one

40. You’ve no idea how this have helped me! Mucha gracias, that is all I can say!

41. The \include{epstopdf} must come after \include{graphicx} in the preamble!

42. nil says:

Do you know how can I insert a ps file in my latex? It gives me the same error ! LaTeX Error: Unknown graphics extension: .ps.

its really amazing

44. Billys says:

Guys, good evening. I am in hurry, cause i have to finish my thesis till 13 of October so i need some help. I have some plots from Grece and i want to insert them in Latex. I dont know how to make them .eps files. Can someone help me please?

Thanks a lot!

1. Billys says:

plots from Grace***

45. Sufi O Raja says:

Hi,
I used epstopdf and epsfig. But still unable to build a PDF with containing figures. Figure legends are coming in the buil pdf.
Only error: