Instructions for pdflatex Graphics Interface 2006
June 7-9, 2006
Quebec City, Quebec, Canada

The best way to generate a PDF file from LaTeX sources is to use the free tool pdflatex, which we highly recommend. This system is built upon pdftex, an enhancement of TeX which can generate resolution-independent, searchable PDF directly. If you also include the standard hyperref LaTeX package when compiling your document, the resulting PDF will automatically have a hierarchical table of contents and citations, footnotes and cross-references will be hyperlinked. You can also reference Web URLs and have a web browser automatically come up when a hyperlink is clicked in the Acrobat reader. This is all demonstrated in the source for the example file available in the GI author's kit. See the TeX User's Group's web site for documentation on hyperref and pdflatex.

The rest of this section is included to help you set up your LaTeX 2e documents in a form suitable for pdflatex. If you do not have pdflatex, obtain and install the teTeX distribution. This is in fact available as a Linux package and is the default distribution on many Linux installations. If you have a Linux system set up, it may already be there, along with all the image conversion tools you'll need. If you're running Windows, the MiKTeX package installs easily and also has all you'll need.

The main issue with modifying LaTeX 2e files into a form suitable for pdflatex is that images must be included using the graphics package, not the obsolete epsf or psfig packages. As a first step, invoke the graphics package in your preamble:


Note that a [dvips] option to the above lets you output DVI files instead of PDF. We won't go into that too much as DVI isn't our goal, PDF is. To include images, instead of using


or whatever, use


Note that the format suffix is optional, and the width and height are automatically inferred from the file. For files that do not have a built-in physical size, the size is inferred by using the image resolution defined in the pdftex.cfg file, which also defines useful things like page size. If a format suffix is not provided for a graphic, pdflatex will first look for a file a file called filename.png. If such a file does not exist, then filename.jpg will be searched for, then if that file does not exist, filename.pdf will be searched for. It's usually more flexible to not include the suffix. Put it in only if you want to force the use of a certain file.


The teTeX distribution includes a tool, epstopdf, to convert EPS files to PDF, and you can also do this with the latest version of ghostview or with Abode Acrobat, Illustrator, or Photoshop. Several public-domain packages (such as ImageMagick) now support PNG files; see the PNG web site for pointers and conversion tools; Photoshop and many other commercial packages now also support PNG. In a pinch, you can use JPEG images for 24-bit images, just set the quality level to 100%.

If you are generating DVI (i.e. you are using the [dvips] option) then latex will search for EPS files rather than PNG, JPEG and PDF files for images. Even in this case it is best to leave off the suffix when you include images, so you don't have to change your source other than the option on the \usepackage{graphics} line in the preamble.

Unfortunately, your image file probably isn't exactly the size you want, especially if the physical size was inferred from the resolution of the image. The graphics package provides a few commands to scale or resize the image. The scalebox command scales a box, and you use it like this:


where a scale_factor of 1 will leave the box untouched, 0.5 will halve its dimensions, and so forth. Typically you'll put an includegraphics command in the box, like this:


The resizebox command resizes a box, possibly non-uniformly. That is, the aspect ratio of the box is not necessarily fixed. This command is handy if you don't know (or care) what the original physical size of the graphic was. You use it like this:


Sometimes, however, you don't know exactly how tall or wide you want the image. A very common task would be to resize a box so it's as wide as your text, but keeps the same aspect ratio. You can achieve this effect by substituting "!" for either of width or height in the resizebox command (but not both!), so if you wanted an image that was 8cm tall, but otherwise with the original aspect ratio, you'd do this:


or, if you wanted to have your image be as wide as a column of text, and retain its aspect ratio, you'd use this:


Of course, you might also want to center your images, put them in floats, attach captions, etc. A complete template is

	An example caption.