Including graphics in a LaTeX document
There are two ways to incorporate images into your LaTeX document,
and both use the graphicx package by means of
putting the command
near the top of the LaTeX file, just after the
The two methods are
In all cases, each image must be in an individual 1-image file;
no animation files or multipage documents.
- include only PostScript images
(esp. ``Encapsulated PostScript'') if your goal is
a PostScript document using dvips
- include only PDF, PNG, JPEG and GIF images
if your goal is a PDF document using pdflatex,
TeXShop, or other PDF-oriented compiler.
Only PostScript images
Most mathematical/scientific graphics software allows you to
save graphics (figures, diagrams, graphs) in PostScript form;
this includes Mathematica, Maple, Matlab, IDL, and xfig
(a marvelous X figure-drawing program).
Even bitmap images like JPEG and PNG files
can be converted to PostScript form with programs like
``xv'' or ``convert''.
Where you want a PostScript image to appear,
use the \includegraphics command, possibly
with scaling or rotation options, e.g.,
Of course, any of these can be inserted into a figure
environment, and/or a centering environment or a framebox.
Then you must compile the document with
latex followed by dvips -Ppdf,
which produces a PostScript document with embedded PostScript images.
You can convert the PostScript document to PDF using
``ps2pdf'' or ``dvipdf''.
Two characteristics which the component
(Encapsulated) PostScript image files must have are
If the PostScript file does not include a bounding box line,
you can insert it using the text editor of your choice.
- no file contains more than one page
- each has a valid BoundingBox line
Only non-PostScript images
The compiler pdflatex (Unix) and TeXShop (Macintosh)
convert LaTeX source directly to PDF, and do not accept PostScript images.
Instead, they take PDF images, as well as bitmap pictures in PNG or
JPEG or GIF format. So to use pdflatex, you must convert any
PostScript images to one of these other forms. For photos, JPEG is best.
For other bitmap images, PNG is best.
For non-bitmap images (e.g., graphs, drawings, stuff with text and symbols)
it is best to convert to PDF, using the command epstopdf
(in the usual TeX bin directory, e.g., /usr/local/tex/bin/epstopdf).
unix> epstopdf myfig.epsproduces
the file myfig.pdf, which can then be used in the command
for compilation with pdflatex or TeXShop.
The possible \includegraphics options with
PDF/PNG/JPEG images are much the same as with PostScript, e.g.,
With PNG or JPEG you should specify an explicit width or height
rather than "scale", since bitmap images have no intrinsic size,
nothing corresponding to Bounding Box information, although
graphicx seems to use 72 pixels per inch as a default size
for bitmap images.