Crash Course in LaTeX

Workin' It: Inserting Graphics

Inserting graphics into LaTeX can be quite challenging, especially for those of us who have to live with Windows. The easiest solution I have found works well but you can only create PDF files, not DVI files. Generally this is not a problem.

First, find the graphic you want to insert. It must be in PNG, JPEG (or JPG), PDF, or MPS format. If you are scanning the graphic, you can probably save it directly as a PNG or JPG file. I suggest PNG for diagrams and JPG for photos. If you want to insert and EPS graphic, see below.

Second, save the graphic file to the same directory as the LaTeX source file you are using.

Third, edit your LaTeX source file. Put this in the header:

% Compile only with pdfLaTeX
\usepackage[pdftex]{graphicx}

Then, use this command to insert the picture. (Here the name of the file is insert_me.png)

\includegraphics{insert_me}

You can specify the height or width of the graphic easily. Using either of these commands will resize while maintaining the height/width ratio.

\includegraphics[height=3in]{insert_this}
\includegraphics[width=4cm]{insert_that}

You can use TIFF (or TIF) graphics, but not every TIFF/TIF file will work. To use one, just include the .TIF extension when naming the file:

\includegraphics{insert_me.tif}

A sample TEX file and PNG file are available on the left under "Source Samples." Download the TEX and the PNG to the same directory, then compile using pdfLaTeX to view the result.

For more info, check out the pdfTeX FAQ, available here.

Also, check out this page for tips.


To insert an EPS graphic, follow the same procedure as detailed above. Change the header entry to read

% Compile only with LaTeX
\usepackage{graphicx}

Compile are before, except you first compile using LaTeX (NOT pdfLaTeX) and then convert to a PDF using dvipdf, which is a button on the toolbar of WinEdt. The DVI viewer YAP does not print included EPS graphics correctly, but conversion to PDF with dvipdf works fine.