[OS X TeX] Is there a better alternative to \DeclareGraphicsExtensions ?

Ramón M. Figueroa-Centeno ramonf at hawaii.edu
Sun Mar 15 18:16:31 EDT 2009


Aloha,

To include TIFF files in a document the TeXShop manual suggests we do the
following:

\documentclass{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `basename #1 .tif`.png}
\begin{document}
\includegraphics{Hello.tif}
\end{document}

That converts all the TIFFs into PNGs (I'm using pdfTeX).

That is very nice, but it does the conversion on every run, which is
unnecessary as we alreday have the PNGs.

A fix is then to change "\includegraphics{Hello.tif}" to
"\includegraphics{Hello}". From then on the PNGs are used.

A better fix is to use \DeclareGraphicsExtensions:
1. In the preamble put "\DeclareGraphicsExtensions{.png,.tif}" The order
matters, PNGs are given preference over TIFFs. If you are using other kinds
of Graphics files then all their extensions must be placed here, one for
each kind of document we are using).
2. Do not specify the suffix when including files, e.g.,
"\includegraphics{Hello}"

With EPS files we do not have this problem. The epstopdf package will handle
things transparently for us; we just don't specify the suffix from the very
beginning, and on the first pass the EPS files get converted to PDFs.

So my question is: is there a better way of doing things so that TIFFs get
treated like EPS files are? Instead of replacing the list of extensions that
graphicx knows, is there a way to append to it?

Thanks,

Ramón





More information about the MacOSX-TeX mailing list