Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I run Andrew Robert's import.tex in MikTeX I get an error message saying that the image file is not found:

! LaTeX Error: File `chick' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.21   \includegraphics{chick}

?

I have put the image file (in this case chick.eps) in the same folder as import.tex.

share|improve this question
4  
You are probably use pdflatex instead of latex. The former is actually recommended but doesn't support EPS graphics but only JPG, PNG and PDF. –  Martin Scharrer Nov 7 '11 at 0:09
    
Also, it appears that the file downloaded form the web site is called chick1, or chick2, etc and not chick so check the name. I got the error after downloading the file and hence noticed the different name then the file is importing. –  Peter Grill Nov 7 '11 at 0:18
    
Thanks Martin. The problem was indeed that I am using pdflatex (that's default in miktex's texworks). I followed the instructions here to convert the eps to a pdf during the compilation. –  Sverre Nov 7 '11 at 0:38
    
Also, the pdflatex in TeX Live 2010 and 2011 can automatically convert EPS graphics to their PDF equivalent. –  Mike Renfro Nov 7 '11 at 1:00
1  
@MartinScharrer: No. TeX Live has a list of save programm calls. So the default shell_escape = p at texmf.cnf together with repstopdf (the restricted/save variant of epstopdf) at the shell_escape_commands (that is default too) is enough. –  Schweinebacke Nov 7 '11 at 10:18
show 6 more comments

3 Answers

up vote 9 down vote accepted

You are probably use pdflatex instead of latex. The former is actually recommended but doesn't support EPS graphics but only JPG, PNG and PDF. You should convert the EPS to PDF using e.g. epstopdf. Newer versions of pdflatex from TeX Live should do this conversion automatically by running a restricted version (for safety reasons) called repstopdf.

share|improve this answer
    
You should never use convert to convert EPS to PDF. First of all, this would convert the EPS to a bitmap (embedded to a PDF). In case of JPGs embedded to EPS, they would be decompressed and the PDF would become very large. So please use repstopdf to convert EPS into PDF. This is, what TeX Live since 2010 would do on-the-fly and out of the box, if the defaults shell_escpape = p and the entry repstopdf for variable shell_escape_commands at the default texmf.cnf are not changed. –  Schweinebacke Nov 18 '11 at 8:18
    
@Schweinebacke: Sorry, too early in the morning. I didn't had a coffee yet. I meant epstopdf but wrote convert. I use the latter very often for all raster images. –  Martin Scharrer Nov 18 '11 at 8:24
    
Don't be angry but I've written a more detailed answer … –  Schweinebacke Nov 18 '11 at 8:58
    
No problem at all. –  Martin Scharrer Nov 18 '11 at 9:04
add comment

Using MiKTeX you have to use the recommended graphics format depending on the engine you are using.

So, if you are using latex—mostly at a queue latex→dvips→pstopdf—you can only use EPS, PCX, BMP, MSP, PICT or PNTG, all of them with different file extensions and sometimes with additional endings. EPS is the most recommended file format with latex→dvips, because the dimensions of EPS may be detected by graphics/graphicx itself. For the other file formats you need additional bb-files with the dimensions or to use option boundingbox.

If you are using pdflatex with direct PDF output, you can only use PDF, JPEG, PNG and MPS. (Note: MPS is a subtype of EPS generated by MetaPost and needs parts of ConTeXt to be installed.)

With TeX Live since 2010, support for on-the-fly conversion of EPS to PDF has been added. This should be activated out if the box. The conversion consists in three parts:

  1. A graphics.cfg file, that supports file extensions .ps and .eps even, if pdflatex with direct pdf output is used.
  2. LaTeX package epstopdf, that uses shell escapes to convert eps to pdf on the fly using repstopdf.
  3. A texmf.cnf with settings shell_escpape = p and shell_escape_commands = repstopdf.

Because of this, you may use EPS with pdflatex and direct PDF output, if you are using TeX Live since 2010.

With MiKTeX you may use on-the-fly conversion, too. In this case you have to load LaTeX package epstopdf on your own (see the manual for more information) and you have to set command line option --enable-write18 at call of pdflatex. If you call pdflatex from within a LaTeX editor, have a look at the editor or the profile settings and the editor manual to find out, where you may add this command line option.

You may test the on-the-fly conversion using:

\begin{filecontents*}{\jobname.eps}
%!
%%BoundingBox:100 100 172 172
100 100 moveto
72 72 rlineto
72 neg 0 rlineto
72 72 neg rlineto
stroke
100 100 moveto
/Times-Roman findfont
72 scalefont
setfont
(A) show
showpage
\end{filecontents*}
\documentclass{article}
\usepackage{graphicx}
\usepackage{ifpdf}

\begin{document}
\ifpdf
  You are using pdf\LaTeX. If you see the picture, on-the-fly conversion does work!
\else
  You need to use pdflatex to test the on-the-fly conversion! You may see the
  original eps file without conversion now:
\fi

\includegraphics{\jobname.eps}
\end{document}

Instead of using on-the-fly conversion you may simply convert every EPS to PDF using epstopdf. In this case you may remove extra white space around the picture using pdfcrop.

Note, that sometimes the conversion to PDF results in PDFs with bad Bounding Box. In this case, you should search for %%PageBoundingBox at the PS file and copy the four dimensions at this line to the line %%BoundingBox at the begin or end of the file (replacing the values you'd find there). On-the-fly conversion will be use these new values at next run of pdflatex. If you are using manual conversion, don't forget to do it again.

To convert PDF to EPS the usage of pdftops --eps is recommended. This is a command line utility from xpdf. Note, that this is available not only for Linux, but for Windows too. Alternative you may use pdf2ps, a ghostscript command line utility. But the results may be not a good as the results of pdftops.

share|improve this answer
    
I miss the epstopdf loading. Let me point to Including pdf figures in Latex document using TexnicCenter. –  Speravir Mar 8 at 1:59
add comment

For what its worth, I tried all the above methods and none worked. Eventually, I found that TeXstudio was calling repstopdf and not epstopdf. repstopdf was symlinked to epstopdf under /usr/texbin. I removed the repstopdf symlink and recreated it to point to the same file that epstopdf was symlinked to after which it worked.

cd /usr/texbin
rm repstopdf
ln -s ../../texmf-dist/scripts/epstopdf/epstopdf.pl repstopdf

I am running TeXstudio v2.6.6 on Mountain Lion/Mac.

share|improve this answer
    
I'm also having the same problem with TeXstudio (v2.7.0 on OSX Mavericks 10.9.2). I tried it in Latexian and there was no problem, so it's definitely a TeXstudio issue. Your solution didn't work for me, unfortunately... –  GTF Apr 3 at 15:58
    
Ok, problem solved within TeXstudio's preferences. It has its own internal $PATH variable, which was set to an old (and no longer installed) TeXLive. Changing this to the current version fixed the problem. –  GTF Apr 3 at 16:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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