TechPubs @ SLAC: Home (public) | Home (slaconly) | Help Pages | Organization
(slaconly) | Feedback | Search
Quick
Links for Authors: idoc
home | Submission
Instructions | Recent
SLAC Publications | TechPubs Help Pages
| Find a SLAC
Document
This guide is not meant to be a complete introduction to all graphics packages for LaTeX2e. For additional help on working with LaTeX, we recommend A Guide to LATEX: Document Preparation for Beginners and Advanced Users (3rd Edition) by Helmut Kopka, Patrick W. Daly, or search the TUGboat article archives.
This page describes macros for incorporating, resizing, rotating, and placing figures in LaTeX2e, using includegraphics and the graphicx package. Also included are links to the file containing these macros and sample documents you can use as guides.
For more information, check out Using EPS Graphics in LaTeX2e Documents Part 2: Floating figures, boxed figures, captions, and math in figures.
The following code will allow you to incorporate a figure into a LaTeX2e
document. Whenever you are instructed to insert the name of your figure into the
code, be sure to omit the suffix .eps
from the filename.
.tex
file for a LaTeX2e should look like
this:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
.tex
file for a REVTeX should look like this:
\documentclass[twocolumn,showpacs]{revtex4}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\includegraphics{filename.eps}
\caption{Caption
goes here}
\end{figure}
If you need to resize a figure and cannot do it in the original authoring program, the following macro will allow you to do so in LaTeX.
Note: It is best to resize a figure in the original authoring program, as you will have better control over the size and placement of labels.
\begin{figure}
\centering
\includegraphics[width]{filename.eps}
\caption{Caption
goes here}
\end{figure}
To rotate a figure, include the following code in your LaTeX code immediately after the paragraph in which the figure is first mentioned. Insert the rotation amount in the square brackets (example: [angle=90]).
\begin{figure}
\centering
\includegraphics[angle]{filename.eps}
\caption{Caption
goes here}
\end{figure}
To place a figure on a page of its own, use the following code:
\clearpage
\begin{figure}
\centering
\includegraphics{filename.eps}
\caption{Caption
goes here}
\end{figure}
\clearpage
To place a figure on a page:
Note: It is widely recommended at SLAC and elsewhere in the publishing industry that figures appear at the top of a page.
To float figures to other locations on the page, after beginning the figure, specify the float location with the optional location clause until it is in the position you want:
\begin{figure}[location]
Possible values, which may be combined to allow for several possibilities, for the location are:
h
for here
t
for the top of the page
b
for the bottom of the page
p
for saving the figure for a special float page containing
only figures The default value is [tbp]
The sample below is a complete document that includes the code described above for incorporating, resizing, rotating, and placing figures in LaTeX.
To save a sample document to your Unix or PC directory, click on the appropriate link below, and your browser will ask you if you want to Save As.... If you're using a Mac, click and hold, and then choose the Save As... option from the pop-up menu to save the file to your hard drive. You will also need to download the sample EPS figure in order to use the sample document.