[Tex/LaTex] Which graphics formats can be included in documents processed by latex or pdflatex

epsgraphicsjpegpngtiff

There several types of graphics files. In no particular order .jpeg .eps .pdf .png .tif .jif (and no doubt others). Some work with latex, dvips and some work with pdflatex. How am I supposed to know which?

Just to confuse matters, metapost produces .eps but I can use these with pdflatex as long as I put in a four line incantation.

Can anyone explain this?

Best Answer

Formats that work with LaTeX (dvi mode, using dvips):

  • eps

Formats that work with LaTeX (dvi mode, using dvipdfm(x)):

  • pdf
  • png
  • jpeg
  • eps

Formats that work with pdfLaTeX (pdf mode):

  • eps(*)
  • pdf
  • png
  • jpeg
  • jbig2

LuaTeX can also read

The reason for this way of working is that in dvi mode TeX simply leaves a space for the graphics. eps are included in the output by dvips.

pdfLaTeX includes graphics directly in the pdf, using the features available in that format. The pdf format can include other pdfs (no surprise), png, jpeg, jpeg2000 and jbig2 graphics. Although pdfTeX can't incorporate eps files directly, the set up in a modern TeX system will automatically convert them to pdf, and thus they are supported in practice.

XeTeX always uses the xdvipdfmx driver so has the same outcomes as using dvipdfmx with a classical DVI-based route.


Note that the LaTeX graphics package and associated helper code will search automatically for appropriate file extensions. As a result the extension should be omitted when including a graphic, for example

\includegraphics{foo}

for a file foo.eps. With a recent TeX system this will allow e.g. pdfLaTeX to auto-convert and .eps file to PDF format and find it 'auto-magically'.