These days, figures (illustrations) are as important in documents as text. And to TeX, graphics are just like paragraphs: big rectangular things to be fitted into “boxes” on the page. But, unlike text glyphs, graphics don't come from font files; they come in various special file formats that require special handling, distinct from the treatment of text fonts.
The figures, like the glyphs that compose the text, aren't present in the *.dvi file that LaTeX produces. It merely reserves space for them. But they have to wind up in the *.ps file to be printed, and in the *.pdf file to be distributed. And, as the latex program knows nothing about figures, it requires the use of the graphicx package to do the work. So the proper inclusion of these figures in the final document requires still more special considerations, and opportunities for things to go wrong at every stage.
But because graphics are different from text fonts, they can't be handled by TeX's font mechanisms; instead, there are special LaTeX packages to deal with them. But, like fonts, there's still a fundamental difference between device-independent or vector graphics (like PostScript drawings) and raster graphics, which are resolution- or device-dependent. Different mechanisms (and different packages) are needed to include the different kinds of graphic files.
As far as LaTeX and its post-processors are concerned, there are only two main groups of graphics file formats: PostScript (PS), and everything else. PS is so ubiquitous that we'll deal with it first.
Note: all PS files must be “encapsulated” (i.e., they must contain a BoundingBox comment). Most programs that write PS files provide this automatically, even if they name the file *.ps instead of *.eps. But plain PS is easy to convert to EPS.
The same thing is true if you use the Gimp: it uses gs as a plug-in to interpret PostScript. However, Gimp offers a simpler user interface to the PS interpreter.
In fact, almost every command that involves interpreting, displaying, or converting a PostScript file into some other format, actually uses gs to do the work. The only exceptions are xpdf and its associated utilities.
Images created in PostScript are usually vector graphics, made with PostScript's lineto or arc and stroke or fill operators. But PS also supports raster images. So an EPS file may contain either vector or raster graphics.
Furthermore, other raster-graphics formats, such as the PBM/PGM/PPM/PNM family, can be converted to EPS files, as described here. Of course, any raster image converted to EPS is still a raster image.
Now for the non-PS graphics files. These are all raster graphics; you need to keep resolution in mind when dealing with them. The most useful ones are:
What this list boils down to is that you should save photographs in JPEG format, and all rasterized line- and solid-color graphics in PNG format. These are the most compact formats.
Besides the interconversions between EPS and raster graphics discussed on another page, note the conversions mentioned above:
By default, epstopdf observes the BoundingBox, while ps2pdf produces a full-page PDF image; so epstopdf is generally the more convenient choice.
With these tools, you can convert any graphics file either to EPS, or from EPS to something else (usually PNG or PDF).
What is all this important? Because the graphicx package used with the latex command requires all graphics to be in EPS format; while the pdflatex command, perversely, requires graphics to be either JPEG, TIFF, PNG, or PDF — but not EPS.
So if you compile your LaTeX source file with the latex command, you'll have to convert any non-EPS files to EPS format. But, if you use pdflatex, you'll have to convert any EPS files to either PNG or (preferably) PDF format.
The use of the graphicx package is well documented in the graphics guide; try
Finally, there are problems in printing figures on laser printers — particularly if scanned images are the starting point, instead of PostScript. Even if you start with PS, you can have problems in printing grayscale (as opposed to simple black-and-white) images. These matters are so complex that they are taken up on a separate page.
Copyright © 2005, 2006, 2008, 2010 Andrew T. Young
LaTeX formatting page
LaTeX top page
or the website overview page