19

As from 2010, TexLive has been converting .eps files directly to pdf file if the compilation is done with PDFLaTeX. Thus a file named

coilsans.eps

will be automatically be converted to a file named

coilsans-eps-converted-to.pdf

However I find that the conversion is done if the .eps file is located in the root directory as the main .tex file. If the .eps files happen to be located in another folder, then PdfLaTeX complains e.g.

! Package pdftex.def Error: File `../test/classi-eps-converted-to.pdf' not  found.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.130 ...ludegraphics[scale=1]{../test/classi.eps}
                                              }
? 

Process has been terminated ...

How to instruct PDFLaTeX to search in the right directories?

Werner
  • 603,163

2 Answers2

15

Add the option -shell-escape to your compilation options.

Alternatively, instead of having the EPS images in a folder at the same level (but in a different subdirectory), you could just place it in a subdirectory of your root .tex file. Then pdflatex will not complain about the conversion and inclusion of EPS files.

Werner
  • 603,163
  • @ Werner Thanks. Does -shell-escape is to be put after pdfLaTeX.exe like in pdfLaTeX -shell-escape myfile.tex ? Actually I have the file in a folder in my tex root directory. Even if I have {/test/classi.eps}, PdfLaTeX still complains. 1 vote up. – yCalleecharan Dec 28 '11 at 07:52
  • @yCalleecharan: Yes, pdflatex -shell-escape myfile.tex. I was able to reproduce your error if I included ../test/XX.eps, but had no problems with inclusion of test/XX.eps under pdflatex. The -shell-escape option solved it in both cases. The problem deals with "restricted mode," which led me to this thread. I found that I had the shell_escape = p setting in my texmf.cnf file. – Werner Dec 28 '11 at 08:00
  • @ Werner I have the texmf.cnf file also as yours with shell_escape = p in C:\texlive\2011\texmf\web2c. My mistake was to put {/test/classi.eps} and not just {test/classi.eps}. Thanks. It works now. – yCalleecharan Dec 28 '11 at 08:13
  • 1
    (Old question, but...) Can anybody explain why shell-escape is necessary only if eps files are in subdirectories? – Ross Sep 04 '18 at 03:00
  • @Ross: You mean it works if the EPS files are in the main folder, but not in subfolders? – Werner Sep 04 '18 at 05:10
  • That was my interpretation of the OP's problem - "However I find that the conversion is done if the .eps file is located in the root directory as the main .tex file. If the .eps files happen to be located in another folder, then PdfLaTeX complains". – Ross Sep 04 '18 at 05:12
  • @Ross: I'd imagine path searching requires external application. – Werner Sep 04 '18 at 15:20
  • It seems to me that your answer is saying shell-escape is the solution to OP's problem, which is all about figure placement in subdirectories. I thought shell-escape had to do with converting eps to pdf in general. – Ross Sep 04 '18 at 15:23
  • @Ross: Indeed it does. shell-escape allows access to the command shell for running external programs. See What does --shell-escape do? – Werner Sep 04 '18 at 15:26
  • So how does that help with OP's question? (This is my point of confusion all along!) OP was already able to convert - "the conversion is done", but only if they are not in subdirectories. – Ross Sep 04 '18 at 15:30
1

Try this kind of folder structure. I had the same error but overcome by using like this.

\chapter{Introduction}
\ifpdf
    \graphicspath{{Introduction/IntroductionFigs/PNG/}{Introduction/IntroductionFigs/PDF/}{Introduction/IntroductionFigs/}}
\else
    \graphicspath{{Introduction/IntroductionFigs/EPS/}{Introduction/IntroductionFigs/}}
\fi
Anthon
  • 314