[Tex/LaTex] .eps files and pdflatex

epsepstopdftexstudio

I am trying to include an .eps figure in a document and build with pdflatex:

\documentclass[12pt,a4paper]{report}
\usepackage{graphicx}
\usepackage{epstopdf}
\begin{document}
\includegraphics{figure}    
\end{document}

The error I get is:

sh: epstopdf: command not found

Package pdftex.def Error: File `figure-eps-converted-to.pdf' not found. \includegraphics{figure}

Adding -shell-escape as mentioned in previous posts does not solve the issue. I have reinstalled epstopdf with TeX Live. I am using TeXstudio 2.10.2 on Mac OS X 10.10.5.

Edit:

Apparently, this is an editor-related issue since everything works fine if called from command line.

Best Answer

With TeXLive 2015, eps files should be converted to pdf automatically when using pdflatex. There is no need to load the epstopdf package. The error you are getting suggests that the system is looking for the epstopdf script in the wrong place. According to the user manual, there are various settings that TeXStudio uses when looking for commands of this type. If there is a setting for epstopdf, then do

which epstopdf

in the terminal and paste the result in its place. Failing this, compile the following document with shell escape enabled:

\documentclass{article}
\begin{document}
\immediate\write18{echo $PATH > tmp1}
\immediate\write18{which epstopdf > tmp2} 
\end{document}

(Note that this will destroy any existing files called tmp1 and tmp2 in the current directory.) Then edit your question by adding the contents of the files tmp1 and tmp2.

EDIT

Integrated development environments are the work of Satan. I just downloaded TeXStudio and reproduced exactly the same problem. Using the code above, I determined that it is searching for epstopdf in a nonexistent TeXLive2012 directory. In the file

~/.config/texstudio/texstudio.ini

I found the following:

Tools\Search%20Paths=/usr/local/texlive/2012/bin/x86_64-darwin

I can't find an option to change this from within TeXStudio (someone else who knows the software better than me may know how to do it). I tried editing the file, since I think it should be

Tools\Search%20Paths=/usr/texbin

but when I restarted TeXStudio the .ini file changed back automatically. Here is a workaround (which requires admin privileges). In the terminal:

sudo tsch

and enter your password to make yourself root. Now create the missing directory as follows:

cd /usr/local/texlive
mkdir 2012
cd 2012
mkdir bin
cd bin
mkdir x86_64-darwin
cd x86_64-darwin

Finally, create a symbolic link to the real location of epstopdf:

ln -s `which epstopdf` ./epstopdf

Now when TeXStudio looks for epstopdf it will find the symbolic link leading to the proper location.