10

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[export]{adjustbox} %for large figures
\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.

  • 1
    Can you find the converted pdf file in that folder? – Sigur May 31 '14 at 17:17
  • 1
    Probably you need to launch pdflatex with the --shell-escape switch if you're under TeX Live, or --enable-write18 under MiKTeX. – Bernard May 31 '14 at 17:37
  • 4
    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). – Joseph Wright May 31 '14 at 17:44
  • 3
    The path of the image looks odd, it starts with /.., do you really mean the parent of the root? – Heiko Oberdiek May 31 '14 at 20:46
  • 2
    @user3589557: Don't include the extension. – Martin Schröder May 31 '14 at 23:32
12
  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.

2

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

1

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. ![Screen-shot of TeXstudio configuration

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}
0

try to set a path and just add

\graphicspath{{./example/}}

then something like

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

example

This was the eps heart used as 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[export]{adjustbox} %for large figures
\usepackage{upgreek}
\usepackage{microtype}
\usepackage{setspace}
\singlespacing
\usepackage[defaultlines=4,all]{nowidow}
\graphicspath{{./figures/}}
\begin{document}

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

\end{document}
0

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.

0

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

-4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.