# Including .eps figure in PDFLatex

This question has been asked a lot, but for reason I cannot get it to work. I'd like to include a .eps image in my document - I am using pdflatex in TeXMaker. Below is the input (I am providing the whole preamble incase there is some interference.

\documentclass[11pt]{article}
\usepackage{times}
\usepackage{graphicx}
\usepackage{epstopdf} %converting to PDF
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\usepackage[parfill]{parskip}
\setcounter{secnumdepth}{5} %how deep sections are numbers
\usepackage{float}
\usepackage[font={sf,footnotesize},labelfont=bf, justification=justified, singlelinecheck=off]{caption}
\usepackage[font=footnotesize]{subcaption}
\usepackage[scaled]{helvet}
\usepackage{titlesec}
\usepackage[T1]{fontenc}
\usepackage{upgreek}
\usepackage{microtype}
\usepackage{setspace}
\singlespacing
\usepackage[defaultlines=4,all]{nowidow}

\includegraphics[scale=1]{/../model_1_2.eps}


The error I get is:

! Package pdftex.def Error: File /model_1_2-eps-converted-to.pdf' not found.See the pdftex.def package documentation for explanation.Type H for immediate help.... .../../model_1_2.eps}

I hope someone can help.

• Can you find the converted pdf file in that folder? May 31 '14 at 17:17
• Probably you need to launch pdflatex with the --shell-escape switch if you're under TeX Live, or --enable-write18 under MiKTeX. May 31 '14 at 17:37
• You've done a couple of things: included an extension in the file name and giving a location 'up' from where your .tex file is. The first thing will mean that LaTeX will be looking for the 'wrong' file after conversion, and the second thing may block auto-conversion from EPS to PDF (security settings dependent). May 31 '14 at 17:44
• The path of the image looks odd, it starts with /.., do you really mean the parent of the root? May 31 '14 at 20:46
• @user3589557: Don't include the extension. May 31 '14 at 23:32

1. You shouldn't add the extension

2. The / at the beginning of the path looks wrong.

You have a better chance with

\includegraphics[scale=1]{../model_1_2}


However:

3. You might not be allowed to work with a file that is one folder up, due to (reasonable) security restrictions disallowing this.

• If you are using linux then install any texlive-font-utils. For debian based any distro like ununtu, just fire below command and everything working fine. sudo apt install texlive-font-utils  Mar 18 '20 at 19:14
• @shivangpatel I don't know how it works, but texlive-font-utils solved similar problem. Thank you, man!! Sep 6 '20 at 19:09

Convert the model_1_2.ps to a PDF file using ps2pdf, and do not use the extension in \includegraphics[]{path/model_1_2}.

I was facing same error for .eps but with TeXstudio.
I was able to solve this error by "configuring paths" for the tool.

The pdflatex uses other tools such epstopdf.exe, but it was unable to find it. Configuring paths solved the issue.

See: Options --> Configure TeXstudio --> Build

And set Commands(\$PATH) correctly to <path>/miktex/bin/

See if similar configuration is required in TeXMaker.

Edit 1 Adding a configuration screenshot and simple working example.

Working example

% Using 'journal' as a document class to compile the .tex file.
% Working is not related to this class.
\documentclass{journal}
\usepackage{epsfig}
\begin{document}
\begin{figure}
\includegraphics{File1}
\end{figure}
\end{document}


try to set a path and just add

\graphicspath{{./example/}}


then something like

\includegraphics[width=1\linewidth]{heart}


example

secondly, if you do not want to use set path for image. just move the fold to the folder and just use

\includegraphics[width=1\linewidth]{model_1_2}


This is the code i used with your code for image name heart.eps saved in folder name figures

\documentclass[11pt]{article}
\usepackage{times}
\usepackage{graphicx}
\usepackage{epstopdf} %converting to PDF
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\usepackage[parfill]{parskip}
\setcounter{secnumdepth}{5} %how deep sections are numbers
\usepackage{float}
\usepackage[font={sf,footnotesize},labelfont=bf, justification=justified, singlelinecheck=off]{caption}
\usepackage[font=footnotesize]{subcaption}
\usepackage[scaled]{helvet}
\usepackage{titlesec}
\usepackage[T1]{fontenc}
\usepackage{upgreek}
\usepackage{microtype}
\usepackage{setspace}
\singlespacing
\usepackage[defaultlines=4,all]{nowidow}
\graphicspath{{./figures/}}
\begin{document}

\includegraphics[width=1\linewidth]{heart}

\end{document}


Possibly a niche answer, but I fixed this by adding ghostscript (gs) to my PATH. An OS which installs packages system-wide, like apt-get or yum, probably won't have this problem; but when using per-project dependencies (in my case with Nix) this might be the cause.

This particular error message was rather unhelpful; but when I tried running epstopdf straight from bash in the same environment (same PATH, etc.) then I got a more informative message saying that gs wasn't found.

Use the graphicx package only Example, \usepackage{graphicx} and in \includegraphics you can use or not the image extension .eps(optional)

According to the answers and the comments above, specifically that of shivang patel, I found the solution:

Just run the following two commands in turn:

sudo apt --fix-broken install
sudo apt install texlive-font-utils


This will install ps2eps which solves the issue.
Important note: I neither removed .eps from the end of the image's file name, nor changed the path of eps images to be the same as that of .tex file.
Finally, I compiled the .tex file in terminal using:

pdflatex -interaction=nonstopmode -src  Presentation.tex


You can use only pdf latex with package below :

\usepackage{auto-pst-pdf}


And you should be add --shell-escape in the pdflatex compillation mode like the next command :

pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

Also, you can use the psfrag (see the explication here) if you want to tag something in the eps file.

see th full code below :

\documentclass[border={0pt 5pt 0pt 0pt}]{standalone}
\usepackage{graphicx}
%\usepackage{psfrag}
\usepackage{auto-pst-pdf}
\begin{document}
\begin{figure}
\includegraphics[width=1.\textwidth]{file.eps}
\end{figure}
\end{document}


Good luck

Pdflatex does not handle PostScript input, i.e., no .ps nor .eps`. Use some tool to translate into PDF, render as PNG. If possible, get directly into PDF.