## LaTeX: include eps files in pdflatex

My problem is I have several image files that are in .eps format.

I need to include these images inside a .tex file and then compile it by pdflatex to create a pdf file.

I already knew that if I compile my .tex file using pdflatex it will give me an error because it doesn’t support .eps graphics but only jpeg, png, pdf…

After some search on the net I found an online solution. In this website you can upload your .eps files and as a result you will have your converted .pdf files to download and to use in your .tex file.

The only disadvantage about this online solution is that if you have a lot of files you need to convert, you will have to stay there to upload one by one because it doesn’t support multiple files.

So the next solution is what I prefer.

You need to declare these two package in your preamble:

\usepackage{graphicx}
\usepackage{epstopdf}

then you can include .eps files as any other simple images:

\includegraphics[option]{file_name}

The trick is that when you are compiling by using pdflatex it will check if the corresponding pdf version of the file exists or not. If it does, it will simply use the pdf version, otherwise it will convert the eps version to a pdf version and then use the pdf file.

NB: To compile the .tex file you need to add “-shell-escape” in your command of pdflatex:

pdflatex -shell-escape name_file.tex

Sources: