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 need to prepare a PDF and PS file from the same latex source but got stuck on including figures. When using pdflatex I can insert a png file like:

\includegraphics[scale=0.6]{figure.png}

However, this does not work when producing the PS file. To produce PS I need to set the bounding box and set the scale differently. For the same figure my code looks like this:

\includegraphics[scale=0.073,bb=0 0 2200 1510]{figure.png}

Now I'd like to switch between these two versions depending on the output I want to produce: PS or PDF. Is there any way to determine the output automatically so I can use a conditional clause like ifthenelse to switch between the commands?

Do you know any easier way to include png files in PS and PDF?

share|improve this question
    
There's an ifpdf package, but how are you including a png when producing postscript? –  TH. Aug 16 '11 at 12:24
    
I use MiKTeX; it just works. And ifpdf does the trick! Thanks. –  Jacek Aug 16 '11 at 12:31
add comment

1 Answer

do not use an extension, nearly all drivers can detect the mode automatically and will then use the image depending to the used command pdflatex or latex. The mode can be detected inside a document with:

\usepackage{ifpdf}

\ifpdf
  do something pdf specific
\else
  do something non-pdf specific
\fi
share|improve this answer
    
But this does not solve the issue and also when not using the extension latex complains it can't find file 'figure'... –  Jacek Aug 16 '11 at 12:21
3  
for latex you need an eps version of the figure –  Herbert Aug 16 '11 at 12:39
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.