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.

When using graphicx's \includegraphics you can specify the file extension or not. For generic use and perhaps portability, extensions are commonly dropped. The types of "approved" inclusions and their order of precedence depends on the driver/compiler being used. What are these driver-defaults?

Related: Which graphics formats can be included in documents processed by latex or pdflatex?

share|improve this question
add comment

2 Answers

up vote 22 down vote accepted

pdftex.def

Version 2011/05/28 v0.06e

The list depends on

  • the version of pdftex.def,
  • the version of pdfTeX (temporarily TIFF was available, latest addition is JBIG2),
  • the version of the generated PDF (JBIG2 requires PDF 1.4).

For the current versions (2012) and PDF ≥ 1.4, the list is:

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

The order of the list is not optimal, it is a victim of compatibility.

The list can be extended by package epstopdf that adds .eps to the list and provide means to support further image formats.

dvips.def

Version: 1999/02/16 v3.01i

.eps,.ps,.eps.gz,.ps.gz,.eps.Z

Other supported extensions:

.pcx,.bmp,.msp,.pict,.pntg

dvipdfm.def

Version: 1999/9/6 vx.x (Bug: should be 1999/09/06)

.jpg,.jpeg,.pdf,.png

Also supported are EPS files.

dvipdfmx.def

Version: 1999/02/16 v3.0i

.pdf,.jpg,.jpeg,.png,.bmp,.ps,.eps,.pz,.eps.Z,.ps.Z,.ps.gz,.eps.gz

xetex.def

Version: 2009/11/22 v0.94

.pdf,.eps,.ps,.png,.jpg,.bmp,.pict,.tif,.psd,.mac,.sga,.tga,.gif

vtex.def

Version 2001/10/02 v7.45

.gif,.png,.jpg,.tif,.bmp,.tga,.pcx,.eps,.ps,.mps,.emf,.wmf
(also .tiff, .targa, .jpeg)

Other drivers in the graphics bundle

Version: 1999/02/16 v3.0i

dvipdf.def:  .eps,.ps,.eps.gz,.ps.gz,.eps.Z
dvipson.def: .eps,.ps,.pcx,.bmp (also .tif)
dviwin.def:  .eps,.ps,.wmf,.tif
emtex.def:   .eps,.ps,.pcx,.bmp
pctex32.def: .eps,.ps,.wmf,.bmp
pctexhp.def: .pcl
pctexps.def: .eps.ps
pctexwin.def: .eps,.ps,.wmf,.bmp
tcidvi.def:   <empty> (also .ps,.eps,.PS,.EPS and BMP)
truetex.def:  .eps,.ps (also .tif,.bmp)

List manipulation

I recommend package grfext for manipulating the list of graphics extensions.

  • Extensions can be added: \AppendGraphicsExtensions, \PrependGraphicsExtensions.
  • Extensions can be removed: \RemoveGraphicsExtensions.

For example, prefer vector graphics over bitmap graphics, indenpendent of the driver:

\documentclass{article}
\usepackage{graphicx}
\usepackage{grfext}

\AtBeginDocument{%
  \PrependGraphicsExtensions*{
    .mps,.MPS,.pdf,.PDF,.eps,.EPS,.ps,.PS,
    .png,.PNG,.jpg,.jpeg,.JPG,.JPEG,
    .funny,.foobar
  }%
  \PrintGraphicsExtensions % see .log file
}

\begin{document}
\end{document}

Package grfext prints the list in the .log file (example for pdflatex/TL2011):

Package grfext Info: Graphics extension search list:
(grfext)             [.mps,.pdf,.PDF,.eps,.png,.PNG,.jpg,.jpeg,.JPG,.JPEG,.jbig2,.jb2,.JBIG2,.JB2]

The star form of \PrependGraphicsExtensions only adds the extensions that are supported by the graphics driver.

share|improve this answer
add comment

The defaults are defined in the driver files, not by graphicx itself. A simple way to see them is to use texdef, e.g. texdef -t pdflatex -p graphicx Gin@extensions.

For latex in DVI mode the default extension list is .eps,.ps,.eps.gz,.ps.gz,.eps.Z, for pdflatex and lualatex it is .png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2,.eps and for xelatex it is .pdf,.eps,.ps,.png,.jpg,.bmp,.pict,.tif,.psd,.mac,.sga,.tga,.gif.

share|improve this answer
3  
I have always wondered why .png has precedence over .pdf in pdflatex. I mean, if you have a vector and a bitmap version of the same image, the bitmap version should be preferred? Does anybody have a clue about the rationale behind this? –  Daniel Sep 17 '12 at 19:02
    
@Daniel Compatibility. –  Heiko Oberdiek Sep 17 '12 at 19:16
    
@HeikoOberdiek Yes, but ... compatibility to what? Given that PNG is (historically) newer than PDF and no other driver seems to give PNG precedence over PDF this seems to be quite strange. –  Daniel Sep 18 '12 at 7:50
    
@Daniel Compatibility to older versions of pdftex.def. –  Heiko Oberdiek Sep 18 '12 at 8:02
1  
@Daniel I am the wrong person to ask, because my maintenance does not start from the very beginning. PDF is much more complicate for including. Perhaps PNG was earlier supported by pdfTeX or PDF inclusion was too unstable in early versions of pdfTeX. –  Heiko Oberdiek Sep 18 '12 at 8:35
show 1 more 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.