\DeclareGraphicsExtensions (LaTeX2e unofficial reference manual (November 2018))

Next: \DeclareGraphicsRule, Previous: \graphicspath, Up: Graphics package configuration [Contents][Index]

#### 22.2.2 `\DeclareGraphicsExtensions`

Synopses:

    \DeclareGraphicsExtensions{comma-separated list of file extensions}

Declare the filename extensions to try. This allows you to specify the order in which to choose graphic formats when you include graphic files by giving the filename without the extension, as in `\includegraphics{functionplot}`.

In this example, LaTeX will find files in the PNG format before PDF files.

    \DeclareGraphicsExtensions{.png,PNG,.pdf,.PDF}
      ...
    \includegraphics{lion}   % will find lion.png before lion.pdf

Because the file name `lion` does not have a period, LaTeX uses the extension list. For each directory in the graphics path (see \graphicspath), LaTeX will try the extensions in the order given. If it does not find such a file after trying all the directories and extensions then it reports ‘`! LaTeX Error: File ``lion`' not found`’. Note that you must include the periods at the start of the extensions.

Because GNU/Linux and Macintosh filenames are case sensitive, the list of file extensions is case sensitive on those platforms. The Windows platform is not case sensitive.

You are not required to include `\DeclareGraphicsExtensions` in your document; the printer driver has a sensible default. For example, the most recent `pdftex.def` has this extension list.

    .png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2

You can use this command anywhere in the document. You can use it more than once. Show its value with `\makeatletter\typeout{\Gin@extensions}\makeatother`.

Unofficial LaTeX2e reference manual