# [OS X TeX] \includegraphics question

Bruno Voisin bvoisin at mac.com
Fri Nov 30 06:51:18 CET 2007

```Le 30 nov. 07 à 00:57, brian at pongonova.net a écrit :

> But I digress:  Your comment led me to digging deeper into the
> logfile, and what I was missing was that the log was being overwritten
> (as mentioned by another poster) because pdfeTeX is being run *twice*:
> Once to generate a .dvi (which, in turn, is displayed by gs) and once
> to generate a .pdf.  The second run overwrites the logfile, so it
> wasn't apparent what was going on.

This is really weird: why would pdfeTeX be run first in DVI mode, and
second in PDF mode?

BTW, this is something specific to recent TeXLive versions: there no
longer separate programs, one tex TeX generating DVI output only
(converted afterwards from DVI to PS by dvips and from PS to PDF by
GhostScript) and the other pdfTeX generating PDF output only. The
default is now pdfTeX, which either runs in PDF mode to produce PDF
output directly, or in DVI mode to produce DVI output. From the man
page of pdftex:

pdfTeX is a version of TeX, with the e-TeX extensions, that
can  create
PDF files as well as DVI files.

In  DVI  mode, pdfTeX can be used as a complete replacement
for the TeX
engine.

The typical use of pdfTeX is with a pregenerated formats for
which  PDF
output has been enabled.  The pdftex command uses the
equivalent of the
plain TeX format, and the pdflatex command uses the
equivalent  of  the
LaTeX format.  To generate formats, use the -ini switch.

The pdfinitex and pdfvirtex commands are pdfTeX's analogues to
the ini-
tex and virtex commands.  In this installation,  if  the
they are symbolic links to the pdftex executable.

In  PDF  mode,  pdfTeX can natively handle the PDF, JPG,
JBIG2, and PNG
graphics formats.  pdfTeX cannot  include  PostScript  or
Encapsulated
PostScript  (EPS)  graphics  files;  first  convert  them  to
PDF using
epstopdf(1).  pdfTeX's handling of its command-line arguments
is  simi-
lar to that of of the other TeX programs in the web2c
implementation.

It's only when tex is invoked from the command line (meaning with the
plain TeX format) that the original TeX is used, as a specific request
from Don Knuth who wants to be sure TeX will give exactly the same
output as before when processing the carefully handcrafted code for
his books. Otherwise, when either latex, pdftex or pdflatex are
invoked, it's actually pdfTeX which is used.

I'm not sure what's actually selects the mode. I think it's the name
under which pdfTeX is invoked: when invoking latex (actually a symlink
to pdftex), pdftex is run in DVI mode; when invoking pdflatex
(actually a symlink to pdftex), pdftex is run in PDF mode.

> So essentially, what I have is my EPS files being used to generate a
> .dvi file (with no intermediate conversion to PDF), and my PDF files
> being used to generate a .pdf file.

Technically, if we're being picky, EPS files are not used to generate
DVI files: DVI files contain only calls to EPS files through
\special's, and it's dvips which processes the \special's to read the
EPS files and incorporate them in its PS output. But that's irrelevant
here.

> While it would be nice to have the EPS files converted to PDF, I
> suppose I'll just have to live with this.
>
> BTW, epstopdf is generting the following error:
>
>    Package epstopdf Warning: Graphics driver file `pdftex.def' not
>
> Would this be a possible reason why EPS files aren't being converted?

epstopdf may have two different meanings:

- The epstopdf Perl script from /usr/texbin. I don't think that's what
you mean.

- The epstopdf.sty LaTeX package, performing automatic conversion of
EPS files to PDF format (through the epstopdf script) during a pdfTeX
run. This package should only be used when running pdfTeX in PDF mode;
otherwise it's pointless and probably harmful. From /usr/local/texlive/
2007/texmf-dist/doc/latex/oberdiek/epstopdf.pdf:

2 Usage
The package is loaded after graphic {s,x}, e.g.:
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
Now images with extension ‘.eps’ are detected and supported:
• Implicitly: \includegraphics{bild}
If bild.eps is present, but bild.pdf is missed, then bild.eps is
converted
to bild.pdf that is then included by pdfTEX. On the next ocurrences or
on the next pdfTEX run, the PDF ﬁle is already available, so the
conversion
step is skipped.
• Explicitly: \includegraphics{bild.eps}
Each time the conversion program is called.

The error message you get seems to indicate you didn't specify the
[pdftex] option to graphicx. But really epstopdf.sty shoudn't be used
when producing DVI output, only when producing PDF output directly.

Without knowing the exact list of LaTeX packages you're using, the
options with which they are loaded and the order in which they are
loaded, and without knowing the exact command-line instructions the
latex-suite amounts to in vim, I can't see what else can be said at
this stage.

Bruno
```