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.

I am sorry if I missed anywhere the obvious answer to my problem, but after searching several hours for a solution I am a bit lost...

I am using Texniccenter and MikTex under Windows Vista to create a pdf document with Latex. Most of my images are in PS format and hence I use the LaTex=>PS=>PDF profile to create my document. If I however try to include a pdf image instead of a ps the document creation is interupted and no final pdf output is created.

My code looks like this:

\usepackage{graphicx}
\usepackage{pdfpages}

\begin{figure}[h!]
\centering
\includegraphics[scale=0.5]{image.pdf}
\caption[]{}
\label{}
\end{figure}

Is there anything obvious that I am missing here ?

share|improve this question

migrated from stackoverflow.com Apr 14 '12 at 19:36

This question came from our site for professional and enthusiast programmers.

    
The LaTeX=>PS step doesn't understand pdf images, and therefore fails. As far as I know, it is not possible to include both PS and PDF images in the same document. You either have to convert the PS/EPS files to PDF of convert the PDF to EPS. –  thundersteele Apr 14 '12 at 16:49
1  
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Apr 14 '12 at 19:40

2 Answers 2

When compiling with pdflatex (via the LaTeX => PDF option) and including graphicx, this automatically loads relevant epstopdf details. As such, (E)PS images should be converted on-the-fly to PDF equivalents. You should notice file.eps and file-eps-converted-to.pdf in your working folder.

So, if you're including both PDF and (E)PS images, use pdflatex.

From the epstopdf README:

epstopdf is a Perl script that converts an EPS file to an 'encapsulated' PDF file (a single page file whose media box is the same as the original EPS's bounding box). The resulting file suitable for inclusion by PDFTeX as an image. The script is adapted to run both on Windows and on Unix-alike systems.

The script makes use of Ghostscript for the actual conversion to PDF. It assumes Ghostscript version 6.51 or later, and (by default) suppresses its automatic rotation of pages where most of the text is not horizontal.

LaTeX users may make use of the epstopdf package, which will run the epstopdf script "on the fly", thus giving the illusion that PDFLaTeX is accepting EPS graphic files.

You may have to include the --shell-escape flag, although it doesn't seem to be required on my system.

share|improve this answer
    
if I use Latex=>pdf I get "unknown file extension .ps" for all my PS images :( –  Christian Apr 14 '12 at 18:31
1  
@Christian: Have you tried some of the options on the UK TeX FAQ: “Unknown graphics extension” –  Werner Apr 14 '12 at 18:36
1  
@Christian You need to make .eps files, usually, as PostScript (.ps) files are not necessarily 'self-contained'. –  Joseph Wright Apr 14 '12 at 19:40
2  
See also Converting eps to pdf and EPS graphics with PDF(La)TeX. It definitely works with MiKTeX 2.8 and later, or TeX Live 2009 and later. Since non-EPS PS files may not have a bounding box specified in the file, they're not automatically suitable for inclusion as figures. But since many PS files are actually conforming EPS files, you may not have that problem in practice. –  Mike Renfro Apr 14 '12 at 23:30
    
Great, it works. Can combine eps and pdf figures through epstopdf. –  victor Apr 17 '12 at 5:53

This is actually an answer to Werner’s one.


This worked fine here (Windows, MiKTeX 2.9) with pdflatex, I needed to load epstopdf after graphicx explicitly:

\documentclass{article}
\usepackage{graphicx,epstopdf}
\begin{document}
\includegraphics[width={\textwidth}]{golfer.eps}
\end{document}

In TeXnicCenter one must add in the LaTeX => PDF output profile to the command line arguments either --enable-write18 or --shell-escape. The former is the original MiKTeX command line option, but the latter works now as well. (These options are BTW described in the epstopdf manual.)

BTW, also related: How to compile a document with EPS images using TeXnicCenter?

If you tend to upvote this answer, then consider the same for Werner’s contribution!

share|improve this answer
    
If epstopdf isn't automatically loaded, you probably have an outdated version of the TeX distribution. Update to MiKTeX 2.9 or use TeX Live 2011 –  egreg Apr 15 '12 at 15:28
    
@egreg: No, I recently had to install MiKTeX 2.9 from scratch. \listfiles tells me: “graphicx.sty 1999/02/16 v1.0f … graphics.sty 2009/02/05 v1.0o … epstopdf.sty 2010/02/09 v2.5”, epstopdf --version on command line “MiKTeX EPS-to-PDF Converter 2.9.3275 (MiKTeX 2.9)”. –  Speravir Apr 15 '12 at 16:12

Your Answer

 
discard

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