4

I noticed that pdflatex does not compile the following minimal working example with an eps figure when the additional options are used for the graphics in the \includegraphics part. Without the additional options everything works fine. I tried compiling the source with latex command and everything works fine. I read about these engines and concluded that they are essentially the same program invoked with different options. I really wonder why there are problems with pdf output and not with dvi output. As far as I know these two engines should be using the same format, i.e LaTeX.

I also noticed that I did not have to use epstopdf package. Why is this the case?

\documentclass{article}
\usepackage[pdftex]{graphics}
\usepackage{float}
%\usepackage{epstopdf}

\begin{document}
    \begin{figure}[H]        
% \includegraphics[width=3.25in,height=3.25in]{trial.eps}
         \includegraphics[15,10][34,45]{trial.eps}
    \end{figure}
\end{document}
  • pdflaltex can not natively include eps, latex (or rather dvips) can, so the situations are very different. I would always use the graphicx syntax. – David Carlisle May 28 '16 at 23:15
  • @DavidCarlisle I actually read the following, tex.stackexchange.com/questions/63994/… However, it works without these additional options. I always use the graphicx package actually, yet I got really curious why this happened. – Vesnog May 28 '16 at 23:18
  • It's a bug, can't be in my code, must be somewhere else, I'll look:-) well it'll be graphics.cfg which I can edit these days (a recent change) – David Carlisle May 28 '16 at 23:26
4

The set of file types allowed for image inclusion depends on the driver or back end being used.

"Traditionally" pdflatex does not allow EPS and latex/dvips do not allow pdf and you would have an error about unknown graphics type.

However pdflatex these days calls eps2pdf in the background to convert an EPS file to pdf so it can be included.

However I get

! Undefined control sequence.
<argument> ...onverted-to.pdf image\GPT@AttrShort 

which means probably that no one has ever tried this with the graphics as opposed to graphicx package version.

Probably that's a bug, I'll see what I can do, but really there are no advantages to using graphics rather than graphicx and if you use the graphicx version it all works.

  • I get the same error as well, thanks for your time. I just asked the question out of curiosity about the inner working of LaTeX. By the way why do I not need to use epstopdf package? Is it already taken care by graphics or graphicx package? – Vesnog May 28 '16 at 23:27
  • @Vesnog yes look at the log from your tex file: epstopdf-base is basically included automatically by texlive's graphics.cfg if it detects pdflatex (and at some point it is assuming graphicx syntax so confusing your document that hasn't loaded it, not sure where yet: It's not my code that bit:-) – David Carlisle May 28 '16 at 23:45
2

Graphics inclusion depends on the engine. LaTeX is the format and that's the same for latex and pdflatex. But the engines differ: one is using TeX and one pdfTeX. (Or, rather, one is using pdfTeX in DVI mode and the other pdfTeX in PDF mode.)

When producing DVI, only EPS format images can be included. These can then be understood by the post-processors which normally either display the DVI or produce PS or PDF from the DVI. (A DVI on its own is basically a bunch of little and not-so-little boxes with some information about what should be put into the boxes when displaying the file.)

When producing PDF directly, PDF images are native and EPS images cannot be included directly. They must be converted to PDF first. This can either be done prior to compilation or on-the-fly during compilation. Suitable conversion rules are enabled by default when using graphicx.sty.

It is also advisable not to specify the driver as an option when loading graphicx unless the package is unable to determine the drive automatically. It has no problem with pdfTeX so

\usepackage{graphicx}

is the recommended load line.

Finally, it is better not to specify the file extension unless you specifically need to exclude use of a particular file format.

So,

\documentclass{article}
\usepackage{graphicx}
\usepackage{float}
\begin{document}
    \begin{figure}[H]
         \includegraphics[bb= 15 10 34 45]{tiger}
    \end{figure}
\end{document}

produces

bit of tiger

when compiled with pdflatex.

tiger.eps is a standard image included in major distributions of TeX.

  • what you say is all true and avoids the error but still I think it's a bug that you get an undefined command error on the provided input, I guess I should fix that (looking now....) – David Carlisle May 28 '16 at 23:43
  • @DavidCarlisle I left that to you ... ;) I did not mean to say that it was not a bug. I've never used that syntax and I wouldn't know what it was meant to do. (Well, I do now because I looked it up. But I wouldn't otherwise.) – cfr May 29 '16 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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