Escolar Documentos
Profissional Documentos
Cultura Documentos
Keith Reckdahl
reckdahl@am-sun2.stanford.edu
Version 2.0
December 15, 1997
Summary
This document explains how to use imported graphics in LATEX 2ε documents.
While reading the entire document is certainly worthwhile, most users should be
able to locate the necessary information by browsing the table of contents on
pages 3-5 or the index on pages 84-86.
While LATEX can import virtually any graphics format, Encapsulated PostScript
(eps) is the easiest graphics format to import into LATEX. For example, eps files
are inserted by specifying
\usepackage{graphicx}
in the document’s preamble and then using the command
\includegraphics{file.eps}
Optionally, the graphic can be scaled to a specified height or width
\includegraphics[height=4cm]{file.eps}
\includegraphics[width=3in]{file.eps}
Additionally, the angle option rotates the included graphic
\includegraphics[angle=45]{file.eps}
The \includegraphics command and the rest of the LATEX 2ε graphics bundle are
covered in Part II of this document.
c Copyright 1995-97 by Keith Reckdahl. All rights reserved. Reproduction and distribution is allowed
under terms of the gnu General Public License.
1
• Since many graphics applications support only ascii text, the psfrag
system allows text in eps files to be replaced with LATEX symbols or
mathematical expressions.
• When an eps graphic is inserted multiple times (such as a logo behind
the text or in the page header) the final PostScript includes multiple
copies of the graphics. When the graphics are not bitmapped, a smaller
final PostScript file can be obtained by defining a PostScript command
for the graphics.
Part IV: The figure Environment
There are several advantages to placing graphics in figure environments. Fig-
ure environments automatically number graphics, allowing them to be ref-
erenced or included in a table of contents. Since the figures can float to
avoid poor page breaks, it is much easier to produce a professional-looking
document.
In addition to general information about the figure environment, this section
describes the following figure-related topics:
• How to customize the figure environment, such as adjusting figure place-
ment, figure spacing, caption spacing, and adding horizontal line be-
tween the figure and the text. Caption formatting can also be cus-
tomized, allowing users to modify the style, width, and font of captions.
• How to create marginal figures and wide figures which extend into the
margins.
• How to produce figures with landscape orientation in a portrait docu-
ment.
• How to place captions beside the figure instead of below or above the
figure.
• For two-sided documents, how to ensure that a figure appears on an odd
or even page. Also, how to ensure that two figures appear on facing
pages.
• How to create boxed figures.
• How to form side-by-side graphics, side-by-side figures, and side-by-side
subfigures.
• How to construct continued figures which can span multiple pages.
2
Contents
I Background Information 6
1 Introduction 6
2 LATEX Terminology 7
3 Encapsulated PostScript 8
3.1 Forbidden PostScript Operators . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 The EPS BoundingBox . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Converting PS files to EPS . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Fixing Non-standard EPS files . . . . . . . . . . . . . . . . . . . . . . . 9
5 Obtaining GhostScript 11
6 Graphics-Conversion Programs 12
6.1 Level 2 EPS Wrappers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.2 Editing PostScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
9 Advanced Commands 17
9.1 The DeclareGraphicsExtensions Command . . . . . . . . . . . . . . . . 18
9.2 The DeclareGraphicsRule Command . . . . . . . . . . . . . . . . . . . . 18
12 Using Subdirectories 26
12.1 TEX Search Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
12.2 Graphics Search Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
12.3 Conserving Pool Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3
13 Compressed and Non-EPS Graphics Files 28
13.1 Compressed EPS Example . . . . . . . . . . . . . . . . . . . . . . . . . . 28
13.2 TEX Search Path and dvips . . . . . . . . . . . . . . . . . . . . . . . . . 29
13.3 Non-EPS Graphic Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
20 Non-Floating Figures 59
20.1 The float Package’s [H] Placement Option . . . . . . . . . . . . . . . . . 60
21 Marginal Figures 61
4
22 Wide Figures 61
22.1 Wide Figures in One-sided Documents . . . . . . . . . . . . . . . . . . . 62
22.2 Wide Figures in Two-sided Documents . . . . . . . . . . . . . . . . . . . 62
23 Landscape Figures 63
23.1 Landscape Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
23.2 Sidewaysfigure Environment . . . . . . . . . . . . . . . . . . . . . . . . . 64
23.3 Rotcaption Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
26 Boxed Figures 70
26.1 Box Around Graphic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
26.2 Box Around Figure and Caption . . . . . . . . . . . . . . . . . . . . . . 71
26.3 Customizing fbox Parameters . . . . . . . . . . . . . . . . . . . . . . . . 72
26.4 The Fancybox Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
27 Side-by-Side Graphics 73
27.1 Side-by-Side Graphics in a Single Figure . . . . . . . . . . . . . . . . . . 74
27.2 Side-by-Side Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
27.3 Side-by-Side Subfigures . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
28 Stacked Graphics 79
30 Continued Figures 81
References 83
Index 84
Acknowledgements
I thank David Carlisle for providing me with a great deal of assistance. I also thank
Donald Arseneau, Robin Fairbairns, Jim Hafner, Piet van Oostrum, and other contrib-
utors to the comp.text.tex newsgroup, whose posts provided much of the information
for this document. Thanks also goes to the many people who provided me with valuable
suggestions and bug reports for this document.
5
Part I
Background Information
1 Introduction
History When TEX was written, PostScript/eps, jpeg, gif, and other graphic formats did
not exist. As a result, Knuth’s dvi format does not have direct support for imported
graphics. However, TEX allows dvi files to contain \special commands which pass
commands to programs which use dvi files. This allows TEX and LATEX to import any
graphic format which is supported by the dvi program being used.
Since dvi files are often converted to PostScript, the best-supported imported-
graphic format is Encapsulated PostScript (eps) which is a subset of the PostScript
language. Inserting eps graphics in LATEX originally required the low-level \special
command. To make graphic-insertion easier and more portable, two higher-level pack-
ages epsf and psfig were written for LATEX2.09. In epsf, the graphics insertion was done
by the \epsfbox command, while three other commands controlled graphic scaling.
In psfig, the \psfig command not only inserted graphics, it also scaled and rotated
them. While the psfig syntax was popular, its code was not as robust as epsf. As a
result, the epsfig package was created as a hybrid of the two graphics packages, with
its \epsfig command using the \psfig syntax and much of the more-robust \epsfbox
code. Unfortunately, \epsfig still used some of the less-robust \psfig code.
LATEX With the release of LATEX 2ε in 1994, the LATEX3 team addressed the general problem
Graphics of inserting graphics in LATEX 2ε . Their efforts produced the “LATEX graphics bundle1 ,”
Bundle which contains totally re-written commands that are more efficient, more robust, and
more portable than other graphics-insertion commands.
The graphics bundle contains the “standard” graphics package and the “extended”
graphicx package. While both packages contain an \includegraphics command, the
packages contain different versions of \includegraphics. The graphicx version uses
“named arguments” (similar to the \psfig syntax) which, although convenient, vio-
late the LATEX syntax guidelines which require that optional arguments be positional.
As a compromise, two versions of \includegraphics were written, with the graphics
package following the LATEX syntax guidelines and the graphicx package using the more-
convenient named arguments. The graphicx \includegraphics supports scaling and ro-
tating, but the graphics \includegraphics command must be nested inside \rotatebox
or \scalebox commands to produce rotating or scaling.
This document uses the graphicx package because its syntax is more convenient than
the graphics syntax. Since both packages have the same capabilities, the examples in this
document can also be performed with the graphics package, although the resulting syntax
may be more cumbersome and slightly less efficient. For a more-detailed description of
the packages, see the graphics bundle documentation [5].
For backward-compatibility, the graphics bundle also includes the epsfig package
which replaces the original LATEX 2ε epsfig package. The new epsfig package defines
the \epsfbox, \psfig, and \epsfig commands as wrappers which simply call the
\includegraphics command. Since these wrappers are less efficient, the wrapped
packaged should be used only for old documents, with \includegraphics used for all
new documents.
Non-EPS In addition to improving eps graphics-inclusion, the LATEX graphics bundle also
Graphics addressed the problem of including non-eps graphic formats such as jpeg and gif.
Since dvi converters generally do not support direct inclusion of most non-eps formats,
these graphics must be converted to eps for insertion into LATEX documents. In many
6
cases, this graphics conversion can be performed on-the-fly by the dvi-to-ps converter.
Section 6 describes graphics-conversion programs while Section 13 describes how to use
non-eps graphics in LATEX.
2 LATEX Terminology
A box is any LATEX object (characters, graphics, etc.) that is treated as a unit (see
[1, page 103]). Each box has a reference point on its left side. The box’s baseline is a
horizontal line which passes through the reference point (see Figure 1). When LATEX
forms lines of text, characters are placed left-to-right with their reference points aligned
on a horizontal line called the current baseline, aligning the characters’ baselines with
the current baseline. LATEX follows the same process for typesetting graphics or other
objects; the reference point of each object is placed on the current baseline.
width
height
Reference
totalheight Point
depth
Baseline
The size of each box is described by three lengths: height, depth, width. The height
is the distance from the reference point to the top of the box. The depth is the distance
from the reference point to the bottom of the box. The width is the width of the box.
The totalheight is defined as the distance from the bottom of the box to the top of the
box, or totalheight=height+depth.
The reference point of a non-rotated eps graphic is its lower-left corner (see left
width
width
Point
G
depth
raph
ics
7
box in Figure 2), giving it zero depth and making its totalheight equal its height. The
middle box in Figure 2 shows a rotated graphic where the height is not equal to the
totalheight. The right box in Figure 2 shows a rotated graphic where the height is zero.
3 Encapsulated PostScript
The PostScript language can describe graphics and text. The PostScript language is
used in conventional PostScript (ps) files to describe multiple-page documents and also
in Encapsulated PostScript (eps) files to describe graphics for insertion into documents.
There are two main differences between PS and EPS files
• EPS files can contain only certain PostScript operators.
• EPS files must contain a BoundingBox line which specifies the size of the EPS
graphic.
8
Thus the gnuplot eps graphic has a lower-left corner with coordinates (50, 50) and an
upper-right corner with coordinates (410, 302). The BoundingBox parameters have units
of PostScript points which are 1/72 of an inch, making the above graphic’s natural width
5 inches and its natural height 3.5 inches. Note that a PostScript point is is slightly
larger than a TEX point, which is 1/72.27 of an inch. In TEX and LATEX, PostScript
points are called “big points” and abbreviated bp while TEX points are called “points”
and abbreviated pt.
9
must be fixed to remove the non-standard extensions. dos versions of Mathemat-
ica 2.x include a utility called either printps.exe or rasterps which removes the
non-standard extensions. On Unix versions of Mathematica 2.x, this can be done
with the psfix utility. Reference your Mathematica documentation or contact
Wolfram Research for more information.
FrameMaker PostScript produced by FrameMaker fails to follow Adobe’s specification
for page independence. PostScript files produced by FrameMaker Version 4 and 5
can be respectively fixed using the scripts
ftp://ftp.irisa.fr/pub/FrameMaker/Filters/fixfm4-1.3.tar.gz
ftp://ftp.irisa.fr/pub/FrameMaker/Filters/fixfm5-2.0.tar.gz
Correction scripts for FrameMaker Version 3 and 4 are also available from
ftp://ftp.frame.com/pub/techsup/framers/platform.ind/filters/fixfm3ps.sh
ftp://ftp.frame.com/pub/techsup/framers/platform.ind/filters/fixfm4ps.sh
10
1. The EPS file contains a long binary preview.
Some applications place a binary preview of the graphics at the beginning of the
eps file. This allows applications (such as dvi viewers) to display the graphics
even though the application cannot interpret PostScript. Currently, relatively few
TEX-related applications use such previews.
If the binary preview is smaller than the line buffer, the \includegraphics com-
mand skips over the preview (this is not the case with \psfig and other obsolete
graphics commands). However, the overfull bufsize error occurs if the binary
preview is larger than the line buffer. There are a couple work-arounds for this
problem
(a) If the preview won’t be used, the problem can be avoided by either deleting
it with a text editor or by preventing the original graphics application from
creating the preview.
(b) Since LATEX reads the eps file to only obtain the BoundingBox param-
eters, LATEX does not read the eps file if the BoundingBox parameters
are provided by the graphics-insertion command (e.g., the bb option to
\includegraphics)
2. The file’s end-of-line characters are corrupted by an improper transfer.
(The problem described in this section does not occur with the latest web2c distri-
bution and some commercial distributions whose TEX are smart enough to identify
all end-of-line characters.)
Different platforms use different end-of-line characters: Unix uses a line feed char-
acter (^J), Macintosh uses a carriage return (^M), while dos/Windows uses a
carriage return and line feed pair (^M^J). For example, if an eps file is transferred
in binary mode from a Macintosh to a Unix machine, the Unix TEX doesn’t see any
^J end-of-line characters and thus thinks the entire file is one big line, overfilling
the line buffer.
If the eps file has no binary sections (e.g., no binary preview and no embedded
graphics) this problem can be avoided by transferring the eps file in text mode.
However, eps files with binary sections must be transferred with binary mode,
since the text mode transfer may corrupt the binary section. However, such binary
transfer results in incorrect end-of-line characters, requiring the BoundingBox
information be provided by the graphics-insertion command (e.g., the bb option
to \includegraphics).
5 Obtaining GhostScript
Ghostscript is a PostScript interpreter which runs on most platforms and is distributed
for free2 by Aladdin Enterprises. This allows PostScript and EPS files to be displayed
on the screen and printed to non-PostScript printers. Aladdin Ghostscript is avail-
able from CTAN/support/ghostscript/aladdin/. It is also available directly from the
Ghostscript home page
http://www.cs.wisc.edu/~ghost/index.html
whose html interface provides better directions than do the ctan ftp sites.
These sites contains pre-compiled Windows/dos/OS/2 and Macintosh executables,
along with ready-to-compile source code for Unix/vms. Also available are graphi-
cal interfaces (GSview for Windows 3.1/95/NT/OS/2, Ghostview for Unix/vms) for
Ghostscript which makes the viewing of PostScript much easier.
2 Although Aladdin Ghostscript is distributed for free, it is not in the public domain. It is copyrighted
and comes with certain limitations such as no commercial distribution. When versions of Aladdin
Ghostscript become approximately one year old, Aladdin releases them as “GNU Ghostscript” whose
use is governed by the less-restrictive GNU Public License.
11
6 Graphics-Conversion Programs
The following freeware and shareware programs convert non-eps graphics to eps. Some
of the programs allow command-line conversion which makes it possible to convert the
graphics on-the-fly during dvips conversion (see Section 13.3).
• ImageMagick is a very good graphics-conversion utility that is distributed for free
from ftp.wizards.dupont.com and other sites. See
http://www.wizards.dupont.com/cristy/ImageMagick.html
In addition to Unix and Linux, it now also runs under Windows NT, Macintosh,
and vms.
• xv is $25 shareware which provides graphics viewing and conversion programs for
X-Windows systems. Note that xv does not provide command-line conversion
capabilities for on-the-fly graphics conversion. For xv information, see
http://www.sun.com/sunsoft/catlink/xv/note.html
an on-line xv manual is available from
http://is.rice.edu/~shel/xv-3.10a/
• DISPLAY is dos freeware which converts between many types of graphic formats.
It is available as disp189a.zip and disp189b.zip from the SimTel archives
http://www.simtel.net/simtel.net/msdos/graphics-pre.html
http://oak.oakland.edu/simtel.net/msdos/graphics-pre.html
Future versions will increment the 189 version number.
• WMF2EPS is a freeware wmf-to-eps conversion program which runs on Win-
dows 95 and NT. It is available from
CTAN/support/wmf2eps/readme.txt
It requires an Adobe-compatible printer driver on your system.
• KVEC is $25 shareware which converts bitmap graphics (bmp, gif, tiff) into
PostScript and other vector formats. KVEC is available for Windows, OS/2, next
and Unix.
http://ourworld.compuserve.com/homepages/kkuhl/
• NetPBM is a maintained and improved version of the unsupported PBMPLUS package.
It runs under Unix, vms, and reportedly even dos.
http://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/
• ImageCommander ($19 shareware) is a graphics-conversion program for Win-
dows 3.1/95/NT which reads many types of graphics formats (gif, jpeg, pict,
wmf, etc) and writes eps and other formats. For more information, see
http://www.jasc.com/
JASC’s Paint Shop Pro painting program ($69 shareware) has the same graphics-
conversion capabilities.
12
• A tiff graphic can be converted to lzw -encoded Level-2 PostScript by using
tiff2ps, whose source is available from
ftp://ftp.sgi.com/graphics/tiff/tiff-v3.4-tar.gz
A tar.Z file is also available. tiff2ps can be compiled on Unix, dos, Mac,
and vms platforms. Although the lzw PostScript files are small, they require a
Level-2 PostScript printer.
13
Part II
The LATEX Graphics Bundle
7 EPS Graphics Inclusion
The best reference for the graphics and graphicx packages is the graphics guide [5] or the
LATEX Graphics Companion [4]. The coverage of the graphicx package in other LATEX
references is sporadic: [2] covers both the graphics and graphicx packages, [1] only covers
the graphics package and [3] describes neither.
14
Table 2: includegraphics Cropping Options
viewport Specifies what portion of the graphic to view. Like a BoundingBox, the area is specified
by four numbers which are the coordinates of the lower-left corner and upper-right
corner. The coordinates are relative to lower-left corner of the BoundingBox. (Added
6/95)
For example, if the graphic’s BoundingBox parameters are 50 50 410 302,
viewport=50 50 122 122 displays the 1-inch square from the lower left of the graphic,
and viewport=338 230 410 302 displays the 1-inch square from the upper right of
the graphic.
The clip option (see Table 3) must be used to prevent the portion of the graphic
outside the viewport from being displayed.
trim An alternate method for specifying what portion of the graphic to view. The four
numbers specify the amount to remove from the left, bottom, right, and top side,
respectively. Positive numbers trim from a side, negative numbers add to a side.
(Added 6/95)
For example, trim=1 2 3 4 trims the graphic by 1 bp on the left, 2 bp on the bottom,
3 bp on the right, 4 bp on the top.
The clip option (see Table 3) must be used to prevent the trimmed portion from
being displayed.
15
\includegraphics[width=\textwidth]{graphic.eps}
scales the included graphic such that it is as wide as the text. The command
\includegraphics[width=0.80\textwidth]{graphic.eps}
makes the included graphic 80% as wide as the text. When the calc package is used,
the following command make the graphic width 2 inches less than the width of text
\includegraphics[width=\textwidth-2.0in]{graphic.eps}
(This requires graphicx version 12/95 or later).
16
8.3 The rotatebox Command
Syntax: \rotatebox[options]{angle}{argument}
The \rotatebox command rotates an object by an angle given in degrees, with a
counter-clockwise rotation being positive. By default, the object is rotated about its
reference point. The \rotatebox options allow the point of rotation to be specified.
1. Specifying the [x=xdim,y=ydim], the object is rotated about the point whose
coordinates relative to the reference point are (xdim,ydim).
2. The origin option specifies one of 12 special points shown in in Figure 3.
Centerlines
[c]
The horizontal position of the origin points is specified by one of three letters:
lcr (which stand for left, center, right, respectively), while the vertical position
is specified by one of four letters: t,c,B,b (which stand for top, center, Baseline,
bottom, respectively). For example
[rb] specifies the bottom-right corner
[lt] specifies the top-left corner
[cB] specifies the center of the graphic’s Baseline
Note that
• The order of the letters is not important, making [br] equivalent to [rb].
• c represents either the horizontal center or vertical center depending what
letter is used with it.
• If only one letter is specified, the other is assumed to be c, making [c]
equivalent to [cc], [l] equivalent to [lc], [t] equivalent to [tc], etc.
9 Advanced Commands
This section describes advanced commands which are needed in the following situations
1. When the specified filename has no extension. For example
\includegraphics{file}
2. When compressed eps graphics are used (see Section 13.1).
3. When non-EPS graphics are used (see Section 13.3).
In these situations, the \DeclareGraphicsRule and \DeclareGraphicsExtensions
commands are needed to control how LATEX deals with files specified in \includegraphics.
17
• The \DeclareGraphicsExtensions command specifies the extensions to attempt
(e.g., .eps, .ps, .eps.gz, etc.) when the specified filename does not have an
extension.
• The \DeclareGraphicsRule specifies a command which operates on the file. The
execution of this command requires an operating system which support pipes. For
example, Unix supports pipes while dos does not.
Making this command a decompression command allows compressed eps graphics
to be used. Making this command a graphics-conversion command allows non-eps
graphics to be used.
Pool Space Specifying no file extension and relying on LATEX to choose the correct extension from
Problems the \DeclareGraphicsExtensions extension list can aggravate pool space problems
(see Section 12.3). If pool space is a concern, \includegraphics{file} should only be
used with a \DeclareGraphicsExtensions command containing a minimal number of
extensions, such as
\DeclareGraphicsExtensions{.eps,.eps.gz}
18
Table 4: DeclareGraphicsRule Arguments
ext The file extension.
type The graphics type for that extension.
sizefile The extension of the file which contains the BoundingBox information for the graph-
ics. If this option is blank, then the size information must be specified by the
\includegraphics command’s bb option.
command The command to be applied to the file. (often left blank). The command must be
preceded by a single backward quote (not to be confused with the more common
forward single quote.) Currently, only dvips allows execution of such a command.
See Section 13 for examples of using this command for use with compressed and non-
eps graphics.
specifies that any file with a .eps.gz extension is treated as compressed eps file, with
the the BoundingBox information stored in the file with a .eps.bb extension, and the
gunzip -c command uncompresses the file. (Since LATEX cannot read BoundingBox
information from a compressed file, the BoundingBox line must be stored in an uncom-
pressed file.)
The \DeclareGraphicsRule allows * to signify any unknown extension. For exam-
ple,
\DeclareGraphicsRule{*}{eps}{*}{}
causes any unknown extension to be treated as an eps file. For example, this causes
file.EPS) to be treated as a an eps file.
Periods In The extension is defined as the portion of the filename after the first period, which
Filenames makes it possible for files ending in eps.gz to be identified as compressed eps files. To
avoid confusion, the base portion of the filename should not contain a period. For ex-
ample, specifying file.name.eps.gz makes \includegraphics look for a graphics rule
associated with the extension name.eps.gz. Since such a graphics rule probably does
not exist, the graphics rule for the unknown extension is used. (Filenames with multiple
periods work if their type happens to be the default type. For example, when files with
unknown extensions are treated as eps, the filename file.name.eps is coincidently
treated correctly.)
Pre-defined For convenience, a default set of graphics rules is pre-defined depending on which
Commands graphics driver is selected4 . For example if the dvips driver is used, the following
graphic rules (defined in dvips.def) are used by default
\DeclareGraphicsRule{.eps}{eps}{.eps}{}
\DeclareGraphicsRule{.ps}{eps}{.ps}{}
\DeclareGraphicsRule{.pz}{eps}{.bb}{‘gunzip -c #1}
\DeclareGraphicsRule{.eps.Z}{eps}{.eps.bb}{‘gunzip -c #1}
\DeclareGraphicsRule{.ps.Z}{eps}{.ps.bb}{‘gunzip -c #1}
\DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{‘gunzip -c #1}
\DeclareGraphicsRule{.ps.gz}{eps}{.ps.bb}{‘gunzip -c #1}
\DeclareGraphicsRule{.pcx}{bmp}{}{}
\DeclareGraphicsRule{.bmp}{bmp}{}{}
\DeclareGraphicsRule{.msp}{bmp}{}{}
\DeclareGraphicsRule{*}{eps}{*}{}
The first two commands define the .eps and .ps extensions as eps files. The next five
commands define extensions for compressed eps files. The next three commands define
extensions for bitmaps (see Section 13.3.2). The last command causes filenames with
unknown extensions to be treated as an eps file.
19
Part III
Using Graphics-Inclusion Commands
10 Horizontal Spacing and Centering
10.1 Horizontal Centering
The placement of the graphic is controlled by the current text justification. To center
the graphic, put it inside a center environment
\begin{center}
\includegraphics[width=2in]{graphic.eps}
\end{center}
If the \includegraphics command is inside an environment (such as minipage or
figure), the \centering declaration centers the remaining output of the environment.
For example
\begin{figure}
\centering
\includegraphics[width=2in]{graphic.eps}
\end{figure}
is similar to
\begin{figure}
\begin{center}
\includegraphics[width=2in]{graphic.eps}
\end{center}
\end{figure}
The \centering syntax is preferred because the \begin{center} syntax produces dou-
ble vertical space above and below the figure due to the space produced by the figure
environment and by the center environment. If extra vertical space is desired, the
commands in Section 18.1 should be used.
Obsolete Bugs in the \psfig and \epsfbox commands made it difficult to produce horizontally-
Syntax centered graphics. The TEX commands \centerline and \leavevmode were used as
work-arounds for bugs in \psfig and \epsfbox. Since the \includegraphics command
is written correctly, the \centerline and \leavevmode are no longer needed, allowing
graphics to be centered with the \centering command or the center environment.
20
\includegraphics{file.eps}\hfill\includegraphics{file.eps}
pushes the graphics to the left and right margins, while
\hfill\includegraphics{file.eps}%
\hfill\includegraphics{file.eps}\hspace*{\fill}
puts equal spacing before, between, and after the graphics. Since \hfill commands
which occur before a linebreak are ignored, the \hspace*{\fill} was needed to supply
the trailing space.
Graphic
Graphic
The first box is rotated 90 degrees and then scaled such that its height is one centimeter.
The second box is scaled such that its height is one centimeter and then it is rotated 90
degrees.
Users must be careful when using the height option, as they often mean the overall
height which is set by the totalheight option (see Figure 1 on Page 7). When the object
has zero depth, the totalheight is the same as the height and specifying height works
fine. When the object has a non-zero depth, specifying height instead of totalheight
causes either an incorrectly-sized graphic or a divide-by-zero error. For importing eps
files, the distinction between height and totalheight is most important when rotating
and then scaling a graphic. For example,
\includegraphics[angle=-45,totalheight=1in]{file.eps}
\includegraphics[angle=-45,height=1in]{file.eps}
The first command scales the rotated graphic such that its total height is 1 inch. The
second command scales the rotated graphics such that the portion above its reference
point is 1 inch tall.
21
produces
Although it may seem strange that the graphics have different sizes, it should make
sense after viewing the BoundingBoxes
Each graphic is scaled such that its rotated BoundingBox is 1 inch tall.
22
In this case, the objects’ reference points (original lower-left corners) are aligned on a
horizontal line. If it is desired to instead have the centers aligned, the origin option of
\includegraphics can be used
\begin{center}
\includegraphics[totalheight=1in]{rosette.eps}
\includegraphics[totalheight=1in,origin=c,angle=-45]{rosette.eps}
\includegraphics[totalheight=1in,origin=c,angle=-90]{rosette.eps}
\end{center}
This aligns the centers of the graphics
Graphic
Graphic
Graphic
23
11.4 Minipage Vertical Alignment
It is often useful to place graphics inside of minipage environments (for example, see
Section 27). When minipages are placed side-by-side, LATEX places them such that their
reference points are vertically aligned. By default, the minipage’s reference point is
vertically centered on its left edge. An optional argument modifies the location of a
minipage’s reference point.
[b] causes the minipage’s reference point to be vertically aligned with the reference
point of the bottom line in the minipage.
[t] causes the minipage’s reference point to be vertically aligned with the reference
point of the top line in the minipage.
Note the [b] does not put the reference point at the bottom of the minipage (unless
the bottom line’s reference point happens to be at its bottom.) Likewise, the [t] does
not put the reference point at the top of the minipage (unless the top line’s reference
point happens to be at its top.)
When the minipage contains only one line, the [b] and [t] options produce the
same results. For example, both
\begin{center}
\begin{minipage}[b]{.25\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\end{minipage}%
\begin{minipage}[b]{.25\textwidth}
\centering
\includegraphics[width=1in,angle=-90]{graphic.eps}
\end{minipage}
\end{center}
and
\begin{center}
\begin{minipage}[t]{.25\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\end{minipage}%
\begin{minipage}[t]{.25\textwidth}
\centering
\includegraphics[width=1in,angle=-90]{graphic.eps}
\end{minipage}
\end{center}
produce Figure 4. In both of these cases, reference point of the minipage is the reference
point (original lower-left corner) of the eps graphic.
Graphic
Graphic
24
11.4.1 Aligning the Bottoms of Minipages
One method for aligning the bottoms of minipages is to make the minipage baseline be
the bottom of the minipage. If a line with zero height and zero depth is added inside
the minipage after the graphics then the [b] option makes the bottom of the minipage
be minipage’s baseline. The command \par\vspace{0pt} creates such a zero-height,
zero-depth line. Since the baseline of this zero-depth line is the bottom of the minipage,
the [b] option now aligns the bottom of the minipage. For example
\begin{center}
\begin{minipage}[b]{.25\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\par\vspace{0pt}
\end{minipage}%
\begin{minipage}[b]{.25\textwidth}
\centering
\includegraphics[width=1in,angle=-90]{graphic.eps}
\par\vspace{0pt}
\end{minipage}
\end{center}
produces Figure 5.
Graphic
Graphic
25
Graphic
Graphic
Figure 6: Minipages with Tops Aligned
12 Using Subdirectories
When importing a large number of graphics files, it may be desirable to store the
graphics files in a subdirectory. For example, when the subdirectory is named sub, one
may be tempted to then include the file file.eps with the following command
\includegraphics{sub/file.eps}
While this syntax works for most Unix and dos TEX distributions, there are problems
with such usage
Inefficiency
Whenever TEX opens a file, the filename is saved in TEX memory. When open-
ing a large number of files, this lost memory may cause a poolsize error (see
Section 12.3). Since specifying subdirectories increases the filename length, it
aggravates this pool space problem.
Unportability
One of LATEX’s advantages is that its files can be used on any platform. However,
embedding the subdirectory in the filename results in the file becoming operating-
system dependent. The file now cannot be used on vms or Macintosh computers
without significant modification.
Instead of embedding the subdirectory in the filename, there are two other options
1. The best method is to modify the TEX search path (see Section 12.1).
2. Another method is to specify sub/ in a \graphicspath command (see Section 12.2).
However, this is much less efficient than modifying the TEX search path.
Both of these options causing \includegraphics to automatically search the graphics
subdirectory, allowing
\includegraphics{sub/file.eps}
to be replaced with
\includegraphics{file.eps}
26
causes /dir1 and /dir2 to be searched after the default directories, while
setenv TEXINPUTS /dir1::/dir2
causes /dir1 to be searched before the default directories and /dir2 to be searched
after the default directories.
Putting // after a directory causes all of its subdirectories to be searched. For
example,
setenv TEXINPUTS /dir1//:/dir2:
causes all the subdirectories (and sub-subdirectories) of /dir1 to be searched. Be careful
in using // as it may slow down the searching if the directory contains many files.
These examples also work for sh shells, although the syntax should be changed to
TEXINPUTS="/dir1:/dir2:"; export TEXINPUTS
When LATEX finds files on the TEX path, it does not include the entire filename in the
dvi file. As a result, old versions of dvips or xdvi which do not search the TEX path
cannot find the file (see Section 13.2).
27
\graphicspath{{dir1/}{dir2/}}
...
\includegraphics{file.eps}
causes \includegraphics to try to open the following files
file.eps
dir1/file.eps
dir2/file.eps
Each of these attempts consumes pool space. Instead of using \graphicspath,
modify the TEX search path.
• Specify the entire filename, do not omit the files extension/suffix (e.g., .eps).
With the default \DeclareGraphicsExtensions (see Section 9.1), the command
\includegraphics{file}
causes \includegraphics to try to open the following files
file.eps
file.ps
file.eps.gz
file.ps.gz
file.eps.Z
This is especially inefficient when used in conjunction with \graphicspath.
Issuing a \DeclareGraphicsExtensions command with a minimal number of
extensions minimizes the inefficiency of omitting the extension.
28
creates the compressed file file1.eps.gz. The -9 (or -best) option specifies
maximum compression.
4. Include the proper \DeclareGraphicsRule command before the \includegraphics
command in the LATEX file. The \DeclareGraphicsRule command informs LATEX
how to treat the particular suffix (see Section 9.2). For example
\documentclass[dvips]{article}
\usepackage{graphicx}
\begin{document}
\DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{‘gunzip -c #1}
\begin{figure}
\centering
\includegraphics[width=3in]{file1.eps.gz}
\caption{Compressed EPS Graphic}
\label{fig:compressed:eps}
\end{figure}
\end{document}
In this particular case, the \DeclareGraphicsRule command is actually not necessary
because it happens to be one of the graphics rules pre-defined in dvips.def. If another
compression program or suffixes were used, the \DeclareGraphicsRule command would
be mandatory. For example, if the BoundingBox file had been stored in file1.bb, the
corresponding \DeclareGraphicsRule would be
\DeclareGraphicsRule{.eps.gz}{eps}{.bb}{‘gunzip -c #1}
29
\AtEndOfPackage{%
\DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}%
{‘gunzip -c ‘kpsewhich -n latex tex #1‘}}
and leaving the existing \ExecuteOptions{dvips} line.
Old dvips Since older versions of dvips do not search the TEX path, dvips cannot find files on
Versions the TEX path. The following command uses kpsewhich to search the TEX search path
for non-compressed eps files for dvips
\DeclareGraphicsRule{.eps}{eps}{.eps}{‘cat ‘kpsewhich -n latex tex #1‘}
(Although the better solution is to update your TEX distribution.)
30
translates file2.gif into eps format (specified by the “eps:” option), sending the
result to standard output (specified by the “-” specification).
Alternatively, one can use the ppm utilities in which giftoppm, ppmtopgm, and
pgmtops convert the gif file to eps via the ppm and grayscale pgm formats. In Unix,
the piping between these programs is specified by the following \DeclareGraphicsRule
command
\DeclareGraphicsRule{.gif}{eps}{.gif.bb}{‘giftoppm #1 | ppmtopgm | pgmtops}
31
to identify and tag all the text in the eps file. Since psfrag 3.0 requires no preprocess-
ing, it does not require any external programs such as perl or ghostscript. psfrag
3.0 only requires a recent LATEX (12/95 or later) and the graphics bundle distributed
with LATEX. Reference [7] provides complete documentation on psfrag 3.0.
An additional benefit of psfrag rewrite is that it now supports compressed eps
graphics. However, the \tex command (described in Section 14.3) cannot be used to
embed LATEX text in compressed graphics.
To use psfrag, create an eps file and then perform the following steps
1. Include \usepackage{psfrag} in the preamble of the LATEX document.
2. In the document, use the \psfrag command to specify the eps text to replace
and the LATEX string to replace it. This makes the specified substitution occur in
any subsequent \includegraphics command issued in the same environment.
3. Use the \includegraphics command as usual.
The LATEX \psfrag command has the following syntax
\psfrag{PStext}[posn][PSposn][scale][rot]{text}
with its arguments described in Table 5.
The posn and PSposn options are one of the 12 points (such as [tl], [br], [cc]) shown
in Figure 3 on page 17. If the optional arguments are not issued, the point defaults to
[Bl]. Any missing letters default to c (e.g., [ ] and [c] are equivalent to [cc], [l] is
equivalent to [lc]). See [7] for examples of various combinations of placement points.
Note that \psfrag matches entire text strings. Thus the command
\psfrag{pi}{$\pi$}
replaces the string pi with π, but does not affect the strings pi/2 or 2pi. Separate
\psfrag commands must entered for these strings.
psfrag cannot perform the replacement unless the entire eps string is constructed
with a single ps command. Some programs break string up into sub-strings or individual
letters in order to perform kerning. For example, Corel Draw produced the following
eps code to place the string “Hello World”
0 0 (Hello W) @t
1080 0 (orld) @t
Since psfrag sees this as two unrelated strings “Hello W” and “orld”, it cannot perform
any replacement of “Hello World”. If the kerning cannot be manually turned off, using
Courier or other monospaced fonts often prevents the kerning. If the kerning cannot be
avoided, only single-character replacement strings can be used.
32
14.1 PSfrag Example #1
The commands
\includegraphics{pend.eps}
include the graphic without any psfrag replacement, producing Figure 7. The com-
mands
\psfrag{q1}{$\theta_1$}
\psfrag{q2}{$\theta_2$}
\psfrag{L1}{$L_1$}
\psfrag{L2}{$L_2$}
\psfrag{P1}[][]{$P_1$}
\psfrag{P2}[][]{\large $P_2$}
\includegraphics{pend.eps}
include the graphic with psfrag replacement, producing Figure 8. The first four \psfrag
commands position the new LATEX text such that its left baseline point corresponds to
the left baseline point of the eps text. The last two \psfrag commands use the [][]
options to position the LATEX text such that its center corresponds to the center of the
eps text. Note that all eps text need not be replaced. For example, the N tag is left
unchanged in Figure 8.
L1 N L1 N
q1 P1 θ1 P1
P2 P2
L2 L2
q2 θ2
places a rectangular white background behind text. See reference [5] for more
details on \colorbox.
With psfrag, \colorbox is useful for placing text at a location where lines or
shading would make it difficult to view the text. Placing a white background
behind the text prevents the drawing from obstructing the text.
33
fcolorbox The \fcolorbox command (also part of the color package) is similar to the
\colorbox command, except that a frame is drawn around the background. The
command \fcolorbox{black}{white}{text} puts a white background with a
rectangular black frame behind text.
The thickness of the frame is controlled by the length \fboxrule and the spacing
between the frame and the text/object is controlled by the length \fboxsep.
Figure 9 and 10 demonstrate the use of these commands with psfrag. Figure 9 shows
the graphic without psfrag substitution. The commands
\psfrag{q1}[][]{\colorbox{white}{$q_1$}}
\psfrag{base}{\fcolorbox{black}{white}{Base}}
\psfrag{Actuator}[l][l]{\shortstack{Hydraulic\\ Actuator}}
\includegraphics{mass.eps}
use psfrag to produce the graphics in Figure 10.
q1 q1 Hydraulic
Actuator
Actuator
base Base
34
14.5 PSfrag Incompatibilities
While psfrag 3.0 has many advantages over version 2, it currently has an incompatibility
with eps files produced by Xfig which contain pattern-filled objects. The psfrag distri-
bution includes the file readme.xfg which describe this incompatibility. A work-around
for this problem is described in Section 14.5.1.
The psfrag distribution also includes the file readme.sem which describes an incom-
patibility between psfrag and the Seminar package. Fortunately, the latest version of
seminar.cls on ctan no longer has this incompatibility.
35
Since the final PostScript file includes the graphics commands only once, the final
PostScript file is much smaller. Note that since the graphics commands are stored
in printer memory while the final PostScript file is being printed, this method may
cause the printer to run out of memory and not print the document.
Although this method results in a small final PostScript file, it still requires LATEX
to find and read the file containing the PostScript commands.
4. Like the previous method, define a PostScript command which draws the graphics,
but include this command in a LATEX box. This results in a small final PostScript
file and only requires LATEX to find and read the file once.
$F2psBegin
...
$F2psEnd
Where ... indicates unlisted commands. The eps file generally contains three parts
1. The header commands which begin with %
2. The Prolog section which starts with
/$F2psDict 200 dict def
and ends with
%%EndProlog
The Prolog defines the commands in the PostScript dictionary used by the eps
file. In this example, the dictionary is named $F2psDict although other names
can be used.
3. The last part contains the commands used to draw the graphics.
Suppose the above eps file is named file.eps. Create the files file.h and file.ps
where file.h contains
/$F2psDict 200 dict def
$F2psDict begin
...
%%EndProlog
/MyFigure {
$F2psBegin
36
...
$F2psEnd
} def
and file.ps contains
%!PS-Adobe-2.0 EPSF-2.0
%%Title: /tmp/xfig-fig017255
%%Creator: fig2dev Version 2.1.8 Patchlevel 0
%%CreationDate: Sun Sep 3 15:36:01 1995
%%Orientation: Portrait
%%BoundingBox: 0 0 369 255
%%Pages: 0
%%EndComments
$F2psDict begin MyFigure end
file.h defines the dictionary and defines the PostScript command /MyFigure, while
file.ps contains the header information and uses the PostScript command defined in
file.h. In particular, it is important that the file.ps header includes the %!PS...
line and the BoundingBox line. The graphics can then be used in the LATEX document
as
\documentclass{article}
\usepackage{graphicx}
\special{header=file.h}
\begin{document}
...
\includegraphics[width=2in]{file.ps}
...
\includegraphics[totalheight=1in]{file.ps}
...
\end{document}
Note that the original file file.eps is not used. Since the graphics commands in
file.h are only included once, the final PostScript file remains small. However, this still
requires LATEX to find and read file.ps whenever the graphics are used. The following
commands save the graphics in a LATEX box to produce a small final PostScript file
while reading file.ps only once.
\documentclass{article}
\usepackage{graphicx}
\special{header=file.h}
\newsavebox{\mygraphic}
\sbox{\mygraphic}{\includegraphics[width=2in]{file.ps}}
\begin{document}
...
\usebox{\mygraphic}
...
\resizebox*{1in}{!}{\usebox{\mygraphic}}
...
\end{document}
Like the previous example, these commands produce a 2-inch wide graphic and another
graphic whose totalheight is 1 inch.
37
\pagestyle{fancy}
\fancyhead[C]{My Paper}
causes the center header field to be “My Paper”, while
\pagestyle{fancy}
\fancyhead[L,R]{\textbf{Confidential}}
causes both the left and right header fields to be “Confidential”. If no L,C,R option
is specified, it applies to all three header fields. Thus \fancyhead{} is used to clear
all the header fields. The \fancyfoot command similarly specifies the left, center, and
right footer fields.
Graphics in The commands in the fancyhdr package can insert graphics in the headers and footers.
Page For example, after splitting the eps file file.eps into the two file file.h and file.ps
Header/Footer as described in Section 15.1, the commands
\documentclass{article}
\usepackage{fancyhdr,graphicx}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[L]{\usebox{\mygraphic}}
\fancyfoot{} % clear all footer fields
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\begin{document}
...
\end{document}
places the graphics at the top left of each “fancy” page with a 0.5 pt horizontal line
drawn under the header. Additionally, the page number is placed at the bottom center
of each page, with no horizontal line drawn above the footer. Note that this does not
affect “plain” pages.
Odd/Even When the [twoside] documentclass option is used, one may want to individually specify
Headings the odd and even page headers/footers. The E,O \fancyhead options specify the even
and odd page headers, respectively. If the E,O options are not specified, the command
applies to both even and odd pages. Likewise the E,O \fancyfoot options specify the
even and odd page footers. For example,
\pagestyle{fancy}
\fancyhead[LE]{My Paper}
\fancyhead[RO]{My Name}
\fancyfoot[C]{\thepage}
places “My Paper” in the upper left of even fancy pages, “My Name” in the upper
right of odd fancy pages, and the page number in the bottom center of all fancy pages.
Replacing the
\fancyhead[L]{\usebox{\mygraphic}}
command in the above example with
\fancyhead[LE,RO]{\usebox{\mygraphic}}
38
places the graphic at the top outside (the left side of even pages, right side of odd pages)
of all fancy pages.
Modifying The \fancyhead commands only apply to pages whose style are “fancy”. Even though
Plain Pages \pagestyle{fancy} causes the document to have a fancy page style, some pages (title
pages, table of contents pages, the first page of chapters, etc.) are still given a plain
pagestyle by default.
The \fancypagestyle command can be used to modify the plain pagestyle. For
example, adding the following code to the above example causes the graphic to also be
placed at the upper left of plain pages.
\fancypagestyle{plain}{%
\fancyhead{} % clear all header fields
\fancyhead[L]{\usebox{\mygraphic}}
\fancyfoot{} % clear all footer fields
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}}
When the twoside documentclass option is used, replacing both of the
\fancyhead[L]{\usebox{\mygraphic}}
commands with
\fancyhead[LE,RO]{\usebox{\mygraphic}}
places the graphic at the top outside of every page (both plain and fancy).
\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\setlength{\unitlength}{1in}
\begin{picture}(0,0)
\put(-2.2,-6){\usebox{\mygraphic}}
\end{picture}}
\fancypagestyle{plain}{%
\fancyhead{}%
\fancyhead[C]{\setlength{\unitlength}{1in}
\begin{picture}(0,0)
\put(-2.2,-6){\usebox{\mygraphic}}
\end{picture}}}
\begin{document}
...
\end{document}
39
The above example places the graphics such that their lower left corner is 2.2 inches
to the left and 6 inches below the center of the header. The graphic position can be
adjusted by changing these two numbers.
Since the header is typeset before the text, this example causes the text to appear
on top of the graphics. Since the footer is typeset after the text, putting the graphics
in the footer causes the graphics to appear on top of the text.
If the contents of file.eps contain vector (not bitmapped) graphics, a much smaller
final PostScript file can be obtained by using the procedure described in Section 15.1.
40
Part IV
The Figure Environment
16 The Figure Environment
When using a word processor, figures appear exactly where the user places them. Since
these figures cannot be split, they often lead to poor page breaks which leave large chunks
of blank space at the bottom of pages. To achieve a professional-looking document, the
author must manually rearrange the figures to avoid these poor page breaks. This
figure-shuffling becomes quite tedious, especially since it must be repeated whenever
the document is modified.
To produce professional-looking documents without the figure-moving drudgery,
LATEX provides floating figures which automatically move to estheticly-pleasing loca-
tions. While these floating figures make it much easier to produce professional-looking
documents, they often bother new users who are used to manual figure placement.
Taking advantage of floating figures requires the following
• Don’t compose text which is dependent on figure placement. Using the
phrase “This figure...” or “The following figure...” requires the figure to be in a
certain location. Using the phrase “Figure 14...” allows the figure to be positioned
anywhere.
• Relax. Some users get quite worried when a figure isn’t placed exactly where
they want it. Figure placement is LATEX’s job; users should generally not worry
about it.
Summary The following pages describe how the LATEX determines float locations which obey type-
of Advice setting rules for a professional-looking document. For convenience, the solutions to the
most-common float-placement problems are listed below.
1. Don’t handcuff LATEX. The more float placement options are given to LATEX, the
better it handles float placement. In particular, the [htbp] and [tbp] work well.
See Section 16.2.
2. Many people find the default float parameters are too restrictive. The following
commands
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
set the float parameters to more-permissive values. See Section 17.2.
3. LATEX allows figures to float to the top of the current page, thus appearing before
the reference in the text. Users who do not like this should use the flafter package.
No commands are necessary, simply include \usepackage{flafter}.
4. To guarantee that a figure does not float past a certain point, use the placeins
package and issue a \FloatBarrier command. See Section 16.3.
Warning, overuse of \FloatBarrier indicates that either the float-placement is
being micro-managed or the float parameters are set incorrectly, neither of which
are good.
41
command. For example, the following commands put the graphic from graph.eps inside
a floating figure
\begin{figure}
\centering
\includegraphics[totalheight=2in]{graph.eps}
\caption{This is an inserted EPS graphic}
\label{fig:graph}
\end{figure}
7 When a figure is placed at the bottom of a page, it is placed below any footnotes on the page.
Although this may be objectionable, there currently is no way to change this arrangement.
42
• The order in which the placement options are specified does not make any differ-
ence, as the placement options are always attempted in the order h-t-b-p. Thus
[hb] and [bh] are both attempted as h-b.
• The more float placement options are given to LATEX, the better it handles float
placement. In particular, the [htbp], [tbp], [htp], [tp] options usually work
well.
• Single-location options [t], [b], [p] [h] are problematic8 . If the figure doesn’t
fit in the specified location, the figure becomes stuck, blocking the subsequent
figures. A “Too Many Unprocessed Floats” error occurs if this logjam of figures
exceeds LATEX’s limit of 18 unprocessed floats (see Section 16.4).
Also see Reference When LATEX “tries” to place a figure, it obeys the following rules
[1, pg 198]. 1. A figure can only be placed in the locations specified by its placement options.
2. The figure cannot cause the page to be overfull.
3. The float must be placed on the page where it occurs in the text, or on a later
page9 . Thus figures can “float later” but cannot “float earlier”
4. Figures must appear in order. Thus a figure cannot be placed until all previous
figures are placed. Two ramifications of this rule are
• A figure can never be placed “here” if there are any unprocessed figures.
• One “impossible-to-place” figure prevents any subsequent figure from being
placed until the end of the document or until LATEX’s float limit is reached.
See Section 16.4.
Similarly, a table cannot be placed until all previous tables are placed. However,
tables can leapfrog figures and vice-versa.
5. The esthetic rules in Section 17 must be followed. For example, the number of
floats on a page cannot exceed totalnumber. Specifying an exclamation point
in the placement options (e.g., \begin{figure}[!ht]) makes LATEX “try really
hard” by ignoring the esthetic rules which apply to text pages (! does not affect
the esthetic rules which apply to float pages).
clearpage
The most basic method for clearing the unprocessed figures backlog is to issue a
\clearpage command, which places all unprocessed floats and starts a new page.
While this is effective, it is undesirable as it generally produces a partially-filled
page.
8 In fact, the [h] option should never be used. It is so bad that recent versions of L
AT X automatically
E
change it to [ht].
9 Since a float can appear at the top of the page where it occurs in the text, it can appear before
its occurrence in the text. If this is objectionable, the flafter package can be used to prevent this. No
command is necessary to activate flafter; just include it in a \usepackage command.
43
FloatBarrier
For most situations, the best method for forcing float placement is the \FloatBarrier
command provided by the placeins package. There are three ways of using placeins
• The \FloatBarrier command causes all unprocessed floats to be processed
immediately. Unlike \clearpage, it does not start a new page.
• Since it is often desirable to keep floats in the section in which they were
issued, the section option
\usepackage[section]{placeins}
redefines the \section command, inserting a \FloatBarrier command be-
fore each section.
Note that this option is very strict. For example, if a new section start in
the middle of a page, the section option does not allow a float from the old
section to appear at the bottom of the page, since that is after the start of
the new section.
• The below option
\usepackage[below]{placeins}
is a less-restrictive version of the section option. It allows floats to be placed
after the beginning of a new section, provided that some of the old section
appears on the page.
afterpage/clearpage
The afterpage package provides the \afterpage command which executes a com-
mand at the next naturally-occurring page break. Therefore, using
\afterpage{\clearpage}
44
3. In rare situations, users with many floats and many \marginpar notes (which use
the same queue), may need a larger unprocessed float queue. Using the morefloats
package increases the size of the unprocessed float queue from 18 to 36.
4. LATEX’s float placement queue is exceeded if more than 18 figures are specified
without any text between them. Possible solutions include
(a) Scatter the figures in the text. This allows enough text to accumulate to
force natural pagebreaks, making it easier for LATEX to process the floats.
(b) Put \clearpage between some of them. This is inconvenient because it
requires some iterations to avoid partially-full pages. (Since
\afterpage{\clearpage}
causes a \clearpage at the next naturally-occurring pagebreak, it does not
help in this situation because the float queue limit is reached before the
pagebreak.)
(c) Since there is no text, the figures don’t need to float. Therefore, the best so-
lution is to use the Section 20 procedure for constructing non-floating figures,
separated by \vspace or \vfill commands to provide vertical spacing.
The three counters in Table 6 prevent LATEX from placing too many floats on a text
page. These counters do not affect float pages. Specifying a ! in the float placement
options causes LATEX to ignore theses parameters. The values of these counters are set
with the \setcounter command. For example,
\setcounter{totalnumber}{2}
prevents more than two floats from being placed on any text page.
45
Table 7: Figure Placement Fractions
\textfraction The minimum fraction of a text page which must be occu-
pied by text. The default is 0.2, which prevents floats from
covering more than 80% of a text page.
\topfraction The maximum fraction of a text page which can be occu-
pied by floats at the top of the page. The default is 0.7,
which prevents any float whose height is greater than 70%
of \textheight from being placed at the top of a page. Sim-
ilarly, if the combined height of multiple t floats is greater
than 60% of \textheight, they all cannot be placed at the
top of a page, even if they number less than topnumber.
\bottomfraction The maximum fraction of a text page which can be occupied
by floats at the bottom of the page. The default is 0.3,
which prevents any float whose height is greater than 40%
of \textheight from being placed at the bottom of a text
page.
\floatpagefraction The minimum fraction of a float page that must be occupied
by floats. Thus the fraction of blank space on a float page
cannot be more than 1-\floatpagefraction. The default
is 0.5.
\textfraction
Setting \textfraction smaller than 0.15 is discouraged as it produces hard-to-
read pages. If a figure’s height is more than 85% of \textheight, it almost
certainly looks better by itself on a float page than squeezed on a text page with
a couple of lines of text below it.
Furthermore, never set \textfraction to zero as permits a text page to have no
text, which confuses LATEX and leads to badly-formatted pages.
\topfraction
Never set \topfraction larger than 1 - \textfraction, as that causes contra-
dictions in the float-placing algorithm.
\bottomfraction
Since “good typesetting style” discourages large bottom figures, \bottomfraction
is generally smaller than \topfraction. Never set \bottomfraction larger than
1 - \textfraction, as that causes contradictions in the float-placing algorithm.
46
\floatpagefraction
If \floatpagefraction is set very small, every float page contains exactly one
float, resulting in excessive whitespace around small p figures.
If \floatpagefraction is larger than \topfraction , [tp] figures may be-
come “stuck.” For example, suppose the height of a [tp] figure is larger than
\topfraction but smaller than \floatpagefraction, it becomes “stuck” because
it is too large to be placed on a text page and too small to be placed on a float
page. To prevent such stuck figures, \floatpagefraction and \topfraction
should satisfy the following inequality:
The 0.05 term is due to the difference in the accounting of vertical space for text
pages and float pages10 . Likewise, if [bp] or [hbp] figures are used, \floatpagefraction
and \bottomfraction should also satisfy
Note that the default values do not satisfy the second inequality, which may
occasionally cause problems with [bp] and [hbp] figures.
The \suppressfloats prevents additional floats from appearing at the top or the bot-
tom of the current page. They do not affect figures with “here” placement or those with
! in the placement options.
Putting \suppressfloats[t] immediately before a figure, prevents that float from
appearing above the place where it appears in the text. The flafter package redefines
LATEX’s float algorithm to prevent this for the entire document.
10 Specifically, \textfloatsep and the other text-page float spacing is counted when comparing a
figure with \topfraction, but the float page spacings are not counted in testing if a figure exceeds
\floatpagefraction. As a result, \textfloatsep divided by \textheight (which is ≈ 0.05) should be
subtracted from \topfraction. See Section 18.1 for information on figure spacing.
47
sets the “nominal” value of \floatsep to be 10 points. To improve page formatting,
the float separation can be as small as 8 points or as large as 13 points.
The lengths listed in Table 9 do not affect the spacing of floats on float pages. Their
spacing is controlled by the lengths listed in Table 10. The fil unit allows infinite
stretchability, similar to the vertical space produced by \vfill. When multiple fil
spaces appear in the same space, they expand proportionally to fill the space.
The @ in the names of the Table 10 lengths mean they are internal commands11 . As
a result, any \setlength command which modifies the lengths must be surrounded by
\makeatletter and \makeatother. For example,
\makeatletter
\addtolength{\@fpsep}{4pt}
\makeatother
increases the space between floatpage floats by 4 points.
Horizontal lines can be automatically drawn between the text and figures which appear
at the top/bottom of the page by redefining the \topfigurerule and \bottomfigurerule
11 To implement its commands, L AT X uses many internal commands which users generally do not
E
need to access. To prevent these internal command names from accidentally conflicting with user-
defined names, L TEX includes a @ in these internal command names. Since LATEX command names can
A
contain only letters, defining a command whose name contains @ are normally not possible. However,
the \makeatletter command causes LATEX to treat @ as a letter, thus allowing @ in command names.
The \makeatother command causes LATEX to revert to the normal behavior of treating @ as a non-letter.
Any user code which accesses or redefines internal commands must be surrounded by \makeatletter
and \makeatother.
48
commands. Although \topfigrule and \bottomfigrule are already defined as LATEX
commands, the strange way in which they are defined requires them to be redefined
with \newcommand instead of \renewcommand.
To avoid disrupting the page formatting, these commands must have a zero height.
Thus drawing 0.4 point line must be accompanied by a 0.4 point vertical backspace.
For example,
\newcommand{\topfigrule}{\hrule\vspace{-0.4pt}}
Since \topfigrule is executed before the \textfloatsep spacing, the above command
provides no spacing between the figure and the line. The following commands provide
5 points of space between the figure and the line.
\newcommand{\topfigrule}{%
\vspace*{5pt}\hrule\vspace{-5.4pt}}
\newcommand{\botfigrule}{%
\vspace*{-5.4pt}\hrule\vspace{5pt}}
The \topfigrule definition first moves 5 points down (into the \textfloatsep spacing)
to provide space between the figure and the line. It then draws a 0.4 point horizontal
line and moves back up 5.4 points to compensate for the previous downward motion.
Likewise, the \botfigrule command draws a 0.4 point line with 5 points of spacing
between the figure and the rule.
Since these commands place 5 points of space between the line and figure, the spacing
between the line and the text is \textfloatsep - 5pt (see Section 18.1).
The line thickness can be changed from the 0.4 point default by using the \hrule
command’s height option
\newcommand{\topfigrule}{%
\vspace*{5pt}{\hrule height0.8pt}\vspace{-5.8pt}}
\newcommand{\botfigrule}{%
\vspace*{-5.8pt}{\hrule height0.8pt}\vspace{5pt}}
Notes on figure rules:
• The \topfigrule and \bottomfigrule affect neither floatpage figures nor “here”
figures (i.e., using the h option). If a “here” figure happens to be placed at the
top or the bottom of the page, no line is drawn.
• The horizontal rules are as wide as the text, even if wider figures (see Section 22)
are used.
• The TEX \hrule command was used instead of LATEX \rule command because
the \rule would generate additional space when \parskip is not zero.
Graphic
49
\begin{figure}
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{10pt}
\centering
\caption{Caption Above Graphic}
\includegraphics[width=1in]{graphic.eps}
\end{figure}
produce Figure 12, which has has no extra space above the caption and 10 points of
space between the caption and the graphic.
Graphic
If a document has all its captions at the top of its floats, the commands
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{10pt}
can be issued in the document’s preamble to affect the caption spacing for all the
document’s captions. If a document contains captions at the top of some floats and at
the bottom of other floats, it may be desirable to define the following command
\newcommand{\topcaption}{%
\setlength{\abovecaptionskip}{0pt}%
\setlength{\belowcaptionskip}{10pt}%
\caption}
Then \topcaption{caption text} produces a caption which is properly spaced for
the top of a float.
Graphic
50
activates the package. The package supports many options which can be included in
the \usepackage command, including
• Notes such as “[Figure 4 about here.]” are placed in approximately where the
floats would have appeared in the text. Such notes can be turned off with the
nomarkers package option
\usepackage[nomarkers]{endfloat}
The text of these notes can be changed by redefining the \figureplace and
\tableplace commands. For example,
\renewcommand{\figureplace}{%
\begin{center}%
[\figurename~\thepostfig\ would appear here.]%
\end{center}
changes the \figureplace text.
• A list of figures is included before the figures and a list of tables is included before
the tables. The nofiglist and notablist package options suppress these lists.
• The fighead and tabhead package options create section headers for the figures
and tables, respectively.
• The figures appear before the tables. The tablesfirst package option reverses
this order.
• A \clearpage command is executed after each figure and table, causing each
float to appear on a page by itself. This can be changed by modifying the
\efloatseparator command. For example,
\renewcommand{\efloatseparator}{\mbox{}}
places an empty \mbox after each float.
Syntax: \usepackage[options]{caption2}
Where the options are described in Table 12.
12 Since the original caption package had some bad side-effects (such as the requirement that it had to
be loaded after other packages) it was totally re-written and renamed caption2. Although the caption2
is technically still a beta version, it is quite stable and performs well.
51
Table 12: caption2 Options
Caption Style normal, Selects the caption style (see Section 19.1).
center,
flushleft,
flushright,
centerlast,
hang, indent
Caption Fontsize scriptsize, Selects the fontsize for the caption label (e.g., “Figure 12:”)
footnotesize, and the caption text.
small,
normalsize,
large, Large
Caption Label Font up, it, sl, Makes the caption label (e.g., “Figure 12:”) have upright,
Shape sc italic, slanted, or small caps shape, respectively. Does not
affect caption text.
Caption Label Font md, bf Makes the caption label (e.g., “Figure 12:”) have a medium or
Series boldface series font, respectively. Does not affect caption
text.
Caption Label Font rm, sf, tt Makes the caption label (e.g., “Figure 12:”) have roman, sans
Family serif, or typewriter font, respectively. Does not affect cap-
tion text.
One-Line Caption oneline, Controls the formatting for one-line captions (see Section 19.3)
Formatting nooneline
indent Same as “normal” style except that the second and subsequent lines are in-
dented by the length \captionindent. Since \captionindent is zero by default,
a command such as \setlength{\captionindent}{1cm} must be used to set the
indentation.
hang Same as “normal” style except that the second and subsequent lines are indented
by the width of the caption label (e.g., “Figure 12:”).
Usually these styles are specified as \usepackage options such as
\usepackage[centerlast]{caption2}
which makes all the captions in the document have centerlast style.
52
Graphic Graphic Graphic
Figure 14: Normal Caption Figure 15: Center Caption Figure 16: Centerlast Caption
Style. Normal Caption Style. Style. Center Caption Style. Style. Centerlast Caption
Normal Caption Style. Nor- Center Caption Style. Center Style. Centerlast Caption
mal Caption Style. Caption Style. Style. Centerlast Caption
Style.
Graphic Graphic
Figure 17: Flushleft Caption Figure 18: Flushright Caption
Style. Flushleft Caption Style. Flushright Caption
Style. Flushleft Caption Style. Flushright Caption
Style. Flushleft Caption Style. Flushright Caption
Style. Style.
Graphic Graphic
Figure 19: Indent Caption Figure 20: Hang Caption
Style. Indent Caption Style. Hang Cap-
Style. Indent Caption tion Style. Hang
Style. Indent Caption Caption Style.
Style. Hang Caption
Style.
53
Graphic
Figure 21: First Caption
\centering
\includegraphics[width=2.5in]{graphic.eps}
\caption{Second Caption}
\end{figure}
causes one-line captions to be left-justified as shown in Figure 22
Graphic
Figure 22: Second Caption
Graphic
Figure 23: Figure Caption Lim-
ited to Two Inches
While the previous example directly set the width of the caption, alternatively the
width can be indirectly set by specifying the spacing between the caption and each
margin. For example, the commands
54
\begin{figure}
\setcaptionmargin{1in}
\centering
\includegraphics[width=2in]{graphic.eps}
\caption{Figure Caption Where There is One Inch of
Spacing between the Caption and Each Margin}
\end{figure}
indent both sides of the caption one inches from the page margins, as shown in Figure 24.
Graphic
Figure 24: Figure Caption Where There is One Inch
of Spacing between the Caption and Each Margin
55
change the delimiter in Figure 25 from the default colon to a period. If additional space
is desired after the period,
\renewcommand{\captionlabeldelim}{.~}
can be used.
Graphic
Figure 25. Caption with New Delimiter
Graphic
56
\begin{figure}
\renewcommand{\captionfont}{\Large \bfseries \sffamily}
\renewcommand{\captionlabelfont}{\small}
\centering
\includegraphics[width=2in]{graphic.eps}
\caption{Test Caption}
\end{figure}
produce Figure 27. In this example, the \small font size in \captionlabelfont over-
writes the \Large font size from \captionfont. However, since \captionlabelfont
does not contain any series or family declarations, the \bfseries and \sffamily dec-
larations carry over to the caption label.
Graphic
\newcaptionstyle{two}{%
\usecaptionmargin\captionfont%
{\centering\bfseries\captionlabelfont\captionlabel\par}
\onelinecaption{\captiontext}{\captiontext}}
define the captionstyles one and two. For captions of more than one line, both of these
styles cause a bold caption label (e.g., Figure 12) placed on a separate line from the
caption text. However, for short captions, style two puts the bold caption label on a
separate line from the caption text, while style one puts them both on a single line
separated by the delimiter. For example, after defining the above caption styles, the
following code
\begin{figure}
\captionstyle{one}
\centering
\includegraphics[width=2in]{graphic.eps}
\caption{First Custom Caption Style}
\end{figure}
\begin{figure}
\captionstyle{two}
\centering
\includegraphics[width=2in]{graphic.eps}
\caption{Second Custom Caption Style}
\end{figure}
produces Figures 28 and 29.
57
Graphic
Figure 28: First Custom Caption Style
Graphic
Figure 29
Second Custom Caption Style
• The \onelinecaption command takes two arguments: the first argument is per-
formed if the caption is one line long, while the second argument is performed if
the caption is more than one line long.
• When writing custom styles, use of commands such as \captionfont and \captionlabelfont
are not required. However, their use is encouraged as it makes the styles more
flexible.
For example, the default \bfseries in the above custom style examples can be
changed by setting \captionlabelfont. If such flexibility is not needed, the
above custom style definitions could be shortened significantly.
13 Some commands (such as \textbf) do not place any data in auxiliary files. Commands which
save data for later use (e.g., \caption saves the caption text for the list of figures) are said to have
moving arguments. Commands which break when used inside a moving argument are called fragile
while commands which do not break when used inside a moving argument are called robust.
58
Graphic
Figure 30: First Line of Caption
Second Line of Caption
or equivalently
\renewcommand{\baselinestretch}{1.6}
in the preamble14 . In addition to doublespaced text, this also produces doublespaced
captions and footnotes. To produce doublespaced text and singlespaced captions and
footnotes, use the setspace package15 .
\usepackage{setspace}
\linestretch{1.5}
A 1.0 linestretch causes single-spaced text, a 1.25 linestretch causes space-and-a-half
spaced text, and a 1.6 linestretch causes doublespaced text.
Regardless of whether setspace is used, the caption2 package’s \captionfont com-
mand can be used to adjust the caption spacing. For example,
\renewcommand{\captionfont}{\linespread{1.6}\normalsize}
produces doublespaced captions, regardless of the document’s text spacing.
20 Non-Floating Figures
As described in Section 16, LATEX allows figures and tables to “float” to improve
the document’s formatting. Occasionally, it is desirable to have a figure appear ex-
actly where it appears in the LATEX source16 . The \caption command can be used
in figure and table environments because these environments define the internal
command \@captype to “figure” and “table”, respectively. By defining \@captype,
the \caption command can be used outside of figure and table environments. A
\makeatletter–\makeatother pair must enclose \@captype to allow @ to be used in a
command name. While this can be done manually each time by
\includegraphics{file.eps}
\makeatletter\def\@captype{figure}\makeatother
\caption{This is the caption}
it is easier to define a command to do this. Including the following commands in the
document’s preamble
\makeatletter
\newcommand\figcaption{\def\@captype{figure}\caption}
\newcommand\tabcaption{\def\@captype{table}\caption}
\makeatother
14 Although it is generally considered poor style, these commands can also be used within a document
to change the interline spacing. When these commands are used within a document, a fontsize command
such as \normalsize must issued after the line-spacing command to put the new spacing into effect.
15 Although the doublespace package also sets line spacing, it has not been properly updated to
LATEX 2ε , causing it to interact with many packages. As a result, setspace should be used instead.
16 Since it may produce large sections of vertical whitespace, preventing figures from floating is gen-
erally considered poor typesetting style. Instead, better results are generally produced by using the
figure environment’s [!ht] optional argument.
59
defines the \figcaption and \tabcaption commands. Using \figcaption creates
figure captions, regardless of whether it appears in a figure environment. Likewise,
\tabcaption creates table caption, regardless of it location. The following commands
This is the text before the figure.
\\[\intextsep]
\begin{minipage}{\textwidth}
\centering
\includegraphics[width=2in]{graphic.eps}%
\figcaption{This is a non-floating figure}
\label{fig:non:float}
\end{minipage}
\\[\intextsep]
This is the text after the figure.
create a non-floating figure. Notes on non-floating figures:
• The minipage environment is needed to prevent a page break between within the
figure.
• The \\[\intextsep] commands start new lines and add vertical space before and
after the figure. Any amount of space can be used, \intextsep (see Section 18.1)
was used to make the non-floating figure spacing consistent with floating figure
spacing.
• Normally, figures are placed on the page in the same order they were submitted to
the figure queue. However, non-floating figures are placed immediately, leapfrog-
ging any unprocessed figures sitting in the figure queue. If this happens, the figures
do not appear in numerical order17 . To avoid these out-of-order figures, force all
floating figures to be processed by issuing a \clearpage or \FloatBarrier com-
mand before the non-floating figure (see Section 16.3).
• The \figcaption and \tabcaption commands are also useful for creating marginal
figures (Section 21), and creating a table beside a figure (Section 29).
17 In these situations, the Table of Figures lists the figures in order of appearance, not in numerical
order.
18 The float package allows users to define new types of floats, such as “Program” or “Algorithm.” It
60
21 Marginal Figures
The \marginpar command places notes in the margin of the document. The marginal
notes are placed in the right margin (or the outside margin for twoside documents) un-
less the \reversemarginpar command is used (as it was in this document). The width
of the marginal column is controlled by the \marginparwidth length, while the horizon-
tal spacing between the text and the marginal notes is controlled by the \marginparsep
length.
Marginal notes are placed such their first line is vertically aligned with the line of
the text which contains the \marginpar command (specifically, the reference point of
the top line of the marginal note is aligned with the current baseline).
Marginal notes are never broken across a page; if a marginal note starts near the
bottom of the page, it continues into the bottom margin. If the previous marginal note
will interfere with a marginal note, LATEX “bumps” the latter marginal note downward.
Marginal notes cannot be bumped to the next page; they are instead bumped into the
bottom margin. As a result, the position of the marginal notes may have to be adjusted
before the final printing to avoid marginal notes near page breaks.
Since the figure environment cannot be used in a marginal note, floating marginal
Graphic figures are not possible. However, the \figcaption command defined in Section 20
can be used to construct a non-floating marginal figure. For example, Figure 31 was
produced by
Figure 31: This is ...to construct a non-floating marginal figure.
a Marginal Figure \marginpar{\centering
\includegraphics[width=\marginparwidth]{graphic.eps}%
\figcaption{This is a Marginal Figure}
\label{fig:marginal:fig} }
For example, Figure~\ref{fig:marginal:fig} was...
The bottom of the graphic in Figure 31 is aligned with the text baseline where the
\marginpar command is located. Notes on marginal figures:
• Since captions for marginal figures generally are narrow, using the caption2 com-
mands \captionstyle{flushleft} or \captionstyle{flushright} may pro-
vide better caption formatting. Additionally, the caption2 command
\renewcommand{\captionfont}{\small}
can be used to decrease the size of the caption font. See Section 19 for caption2
information.
• Like the non-floating figures in Section 20, the marginal figures are placed ahead
of any unprocessed floats. Thus, a \clearpage or \FloatBarrier command must
be issued before the marginal note if one wants to keep the figures in order.
• Marginal notes are placed by the routine which also places figures and tables. If
many figures, tables, and marginal notes are being used, it is possible to exceed
the number of unprocessed floats permitted by LATEX. The morefloats package can
mitigate these problems (see Section 16.4).
22 Wide Figures
Typesetting readability rules limit the number of characters in a line of text. Unless
a large font or two columns are used, these readability rules result in wide margins
(especially when using 8.5 x 11 inch letter paper). Section 21 demonstrated how these
wide margins can be used for marginal figures. Another option is to construct a regular
floating figure which extends into one or both margins. This is done by placing a wide
list environment inside the figure. For example, a narrow environment can be defined
by including the following code in the preamble of your document
\newenvironment{narrow}[2]{%
\begin{list}{}{%
61
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}}%
\item[]}{\end{list}}
For example, any text which occurs between \begin{narrow}{1in}{2in} is indented
by 1 inch on the left side and 2 inches on the right side. When negative lengths are
used, the contents extend beyond the margins.
When marginal notes are used, it may be desired to make the wide figure extend
exactly to the edge of the marginal notes (making the figure width be \textwidth
+ \marginparwidth + \marginparsep). This can be done by defining a new length
\marginwidth and setting it to be \marginparwidth + \marginparsep For example,
\newlength{\marginwidth}
\setlength{\marginwidth}{\marginparwidth}
\addtolength{\marginwidth}{\marginparsep}
then use {-\marginwidth} in the \begin{narrow} argument.
62
\caption{Figure Caption}
\label{fig:wide}
\end{narrow}
}% END ODD-PAGE FIGURE
{% BEGIN EVEN-PAGE FIGURE
\begin{narrow}{-1in}{0in}
\includegraphics[width=\linewidth]{file.eps}
\caption{Figure Caption}
\label{fig:wide}
\end{narrow}
}% END EVEN-PAGE FIGURE
\end{figure}
Since the \pageref command is used as input to \ifthenelse, the figure may not
be properly typeset until LATEX is run enough times to cause the cross-references to
converge.
23 Landscape Figures
In a document with portrait orientation, there are three methods for producing figures
with landscape orientation.
1. The lscape package provides a landscape environment, which treats the left edge
of the paper as the top of the page, causing any text, tables, or figures in the
landscape environment to have landscape orientation.
2. The rotating package provides a sidewaysfigure environment which is similar to
the figure environment except that the figures have landscape orientation.
3. The rotating package provides a \rotcaption command which is similar to the
\caption command except that caption has landscape orientation.
Differences between methods
• Both options 1 and 2 place the landscape figure on a separate page. Option 3
produces an individual float which need not be on its own page.
• While Option 2 produces only rotated figures, the landscape environment in Op-
tion 1 is a general-purpose environment, which can produce landscape pages con-
taining any combination of text, tables, and figures. The landscape environment
can page-breaking capability, so multiple landscape pages can be produced19 .
• The full-page figure produced by Option 2 floats to provide better document for-
matting, while the figure produced by Option 1 cannot float20.
• Since Options 1 and 3 use the figure environment, they can be used in conjunction
with the endfloat package (see Section 18.5).
19 The landscape environment works very well with the longtable package to produce multiple-page
landscape tables.
20 Figures issued in the landscape environment can float within the landscape pages
63
The entire contents of the landscape environment is typeset with landscape orien-
tation. This may include any mixture of text, figures, and tables. If the landscape
environment contains only a figure environment
\begin{landscape}
\begin{figure}
\centering
\includegraphics[width=4in]{graphic.eps}
\caption{Landscape Figure}
\end{figure}
\end{landscape}
the landscape environment produces a landscape figure. Note that since the landscape
environment starts a new page, it may result in a partially-blank page.
21 The rotating package also provides a sidewaystable environment for producing tables with land-
scape orientation.
64
65
Graphic
Figure 33: Sidewaysfigure Figure
\end{minipage}
\begin{minipage}[c]{0.5in}
\rotcaption{Rotcaption Caption}
\label{fig:rotcaption}
\end{minipage}
\end{figure}
produces Figure 34.
22 Since the figure environment defined by the float package places the caption below the body, captions
beside figures cannot be produced with the float package’s figure environment. Other aspects of the
float package can be used as long as the \restylefloat command is not issued.
66
\begin{minipage}[c]{.45\textwidth}
\centering
\includegraphics[width=\textwidth]{graphic.eps}
\end{minipage}
\end{figure}
produces Figure 35. It may be desirable to place a horizontal spacing command such
as \hfill or \hspace{.05\textwidth} between the minipages.
67
When a \caption command is used in the SCfigure and SCtable environments
defined by the sidecap package, the captions are automatically placed to the side of the
contents of the environment. For example,
\usepackage{sidecap}
...
\begin{SCfigure}
\includegraphics[width=3in]{graphic.eps}
\caption{This is a SCfigure}
\end{SCfigure}
produces Figure 36.
Graphic
Figure 36: This is a SCfigure
Putting the graphics in figure environments, might allow the even-page figure from
floating to an odd page. Instead, the \figcaption command defined in Section 20 can
be used to create a figure without using a figure environment.
\makeatletter
\newcommand\figcaption{\def\@captype{figure}\caption}
\makeatother
The \ifthenelse command is then used to place the first graphic on the next even
page. This requires repeating the graphics commands twice, once for the case of the
next page being odd and once for the case of the next page being even. To simplify the
resulting code, a \leftfig command is defined
68
\newcommand\leftfig{%
\vspace*{\fill}%
\centering
\includegraphics{graphic.eps}
\figcaption{This is on the left (even) page.}
\vspace*{\fill}\newpage}
The left-page figures are then created using this newly-defined \leftfig command along
with the \afterpage and \ifthenelse commands
\afterpage{\clearpage%
\ifthenelse{\isodd{\value{page}}}%
{\afterpage{\leftfig}}%
{\leftfig}}
Notes about odd/even page placement:
• To force the figure to a right-hand (odd) page, reverse the order of the \ifthenelse
arguments.
\afterpage{\clearpage%
\ifthenelse{\isodd{\value{page}}}%
{\leftfig}}%
{\afterpage{\leftfig}}
• Using \value{page} instead of \pageref is advantageous because \value{page}
is always correct (\pageref is only correct once the LATEX references have con-
verged).
• When using large figures, it is possible for a pagebreak to occur within the figure
(e.g., between the graphic and the caption). The figure can be forced to stay
together by enclosing it in a minipage environment
\newcommand\leftfig{%
\vspace*{\fill}%
\begin{minipage}{\textwidth}
\centering
\includegraphics{graphic.eps}
\figcaption{This is on the left (even) page.}
\end{minipage}
\vspace*{\fill}\newpage}
• The \afterpage command can sometimes be flaky, in rare cases causing a ”lost
float” error. Removing the \clearpage before the \ifthenelse may help this
situation.
\afterpage{\ifthenelse{\isodd{\value{page}}}%
{\afterpage{\leftfig}}%
{\leftfig}}
• In the above example, the figure uses the entire even page. To place the figure at
the top of the even page, modify or remove the \vspace*{\fill} and \newpage
commands
\newcommand\leftfig{%
\centering
\includegraphics{graphic.eps}
\figcaption{This is at the top of the left (even) page.}
\vspace{\floatsep}}
69
\newcommand\facingfigures{%
\vspace*{\fill}%
\centering
\includegraphics{left.eps}
\figcaption{This is on the left (even) page.}
\vspace*{\fill}\newpage\vspace*{\fill}%
\centering
\includegraphics{right.eps}
\figcaption{This is on the right (odd) page.}
\vspace*{\fill}\newpage}
The facing figures are then created using this \facingfigures command along with
the \afterpage and \ifthenelse commands
\afterpage{\clearpage%
\ifthenelse{\isodd{\value{page}}}%
{\afterpage{\facingfigures}}%
{\facingfigures}}
26 Boxed Figures
The term Boxed Figure usually refers to one of two situations
• A box surrounds the figure’s graphic but not the figure’s caption.
• A box surrounds the figure’s graphic and its caption.
The basic method for boxing an item is to simply place the item inside an \fbox
command, which surrounds the object with a rectangular box. The fancybox package
provides boxes of different styles.
L1 N
q1 P1
P2
L2
q2
70
26.2 Box Around Figure and Caption
To include both the figure’s graphic and its caption, one may be tempted to move the
\caption command inside the \fbox command. However, this does not work because
\caption can only be used in paragraph mode, while the contents of an \fbox command
are processed in LR mode23 .
Since the contents of minipage environments and \parbox commands are processed
in paragraph mode, the \caption command can be included in the \fbox by enclosing
the \fbox contents inside a minipage environment or a \parbox command. Since both
minipages and parboxes require a width specification, there is no direct way to make
the \fbox exactly as wide the graphic and caption.
L1 N
q1 P1
P2
L2
q2
\newsavebox{\mybox}
\newlength{\mylength}
\sbox{\mybox}{\includegraphics[height=3in]{file.eps}}
\settowidth{\mylength}{\usebox{\mybox}}
\begin{figure}
23 L
AT
EX uses three modes: LR mode, paragraph mode, and math mode. See [1, pages 36,103-5].
71
\centering
\fbox{ \begin{minipage}{\mylength}
\centering
\usebox{\mybox}
\caption{Box Around Figure Graphic and Caption}
\label{fig:boxed_figure}
\end{minipage} }
\end{figure}
3. To ensure a one-line caption, the minipage can be made as wide as the caption by
estimating the caption width with a \settowidth command
\newlength{\mylength}
\settowidth{\mylength}{Figure XX: Box Around Figure Graphic and Caption}
\fbox{ \begin{minipage}{\mylength}
...
L1 N
q1 P1
P2
L2
q2
72
\doublebox, \ovalbox, and \Ovalbox which produce other types of boxes.
\shadowbox{Example}
• The frame thickness is \fboxrule.
Example • The shadow thickness is \shadowsize (which defaults to 4 pt).
\Ovalbox{Example}
\Ovalbox is the same as \ovalbox except that the line thickness is
Example
controlled by \thicklines.
Like \fbox, the separation between these boxes and their contents is controlled
by the LATEX length \fboxsep. The length \shadowsize is set with the \setlength
command, as was done for \fboxrule and \fboxsep in Section 26.3. The lines for
\ovalbox and \Ovalbox have thicknesses corresponding to the picture environment’s
\thicklines and \thinlines, which are not lengths and thus cannot be changed with
the \setlength command. The values of \thicklines and \thinlines depend on the
size and style of the current font. Typical values are 0.8 pt for \thicklines and 0.4 pt
for \thinlines. For example, the commands
\begin{figure}
\centering
\shadowbox{ \begin{minipage}{3.5 in}
\centering
\includegraphics[totalheight=2in]{pend.eps}
\caption{Shadowbox Around Entire Figure}
\label{fig:boxed_fancy}
\end{minipage} }
\end{figure}
place a shadow box around the figure’s graphic and caption, as shown in Figure 40.
27 Side-by-Side Graphics
The commands necessary for side-by-side graphics depend on how the user wants the
graphics organized. This section covers three common groupings of side-by-side graphics
1. The side-by-side graphics are combined into a single figure.
2. The side-by-side graphics each form their own figure (e.g., Figure 43 and Fig-
ure 44).
73
L1 N
q1 P1
P2
L2
q2
3. The side-by-side graphics each form a subfigure (e.g., Subfigure 49(a) and Subfig-
ure 49(b)) which are part of a single figure (Figure 49).
This section describes the following two methods for constructing the three types of
groupings
a) Successive \includegraphics commands.
b) Side-by-side minipages, each of which contains an \includegraphics command.
It is very important to understand the material in Section 2 when constructing side-by-
side figures. Side-by-side figures are created by placing boxes (either \includegraphics
or minipages) beside each other on a line.
Graphic
Graphic
Figure 41: Two Graphics in One Figure
74
27.1.2 Using Side-by-Side Minipages
Placing the \includegraphics commands inside minipage environments provides the
user more control over the graphics’ vertical placement. For example
\begin{figure}
\centering
\begin{minipage}[c]{0.5\textwidth}
\centering \includegraphics[width=1in]{graphic.eps}
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
\centering \includegraphics[width=2in]{graphic.eps}
\end{minipage}
\caption{Centers Aligned Vertically}
\end{figure}
produces Figure 42, which has vertically-centered graphics.
Graphic Graphic
Figure 42: Centers Aligned Vertically
75
Graphic Graphic
Graphic
Gr
ap
hic
Figure 45: Box with a Long
Caption
Figure 46: Rotated Box
The alignment of the graphics and the captions can be done separately by creating
two rows of minipages: the first row containing the figures and the second row containing
the captions. For example
\begin{figure}
\centering
\begin{minipage}[b]{.33\textwidth}
\centering
\includegraphics[width=2cm]{graphic.eps}
\end{minipage}%
\begin{minipage}[b]{.33\textwidth}
\centering
\includegraphics[width=2cm,angle=-30]{graphic.eps}
\end{minipage}\\[-10pt]
\begin{minipage}[t]{.33\textwidth}
\caption{Box with a Long Caption}
\end{minipage}%
\begin{minipage}[t]{.33\textwidth}
\caption{Rotated Box}
\end{minipage}%
\end{figure}
produces Figures 47 and 48, which have the graphic baselines aligned and the caption
top lines aligned.
76
Graphic
Gr
ap
hic
\begin{figure}
\centering
\subfigure[Small Box with a Long Caption]{
\label{fig:subfig:a} %% label for first subfigure
\includegraphics[width=1.0in]{graphic.eps}}
\hspace{1in}
\subfigure[Big Box]{
\label{fig:subfig:b} %% label for second subfigure
\includegraphics[width=1.5in]{graphic.eps}}
\caption{Two Subfigures}
\label{fig:subfig} %% label for entire figure
\end{figure}
produces Figure 49. Typing \ref{fig:subfig:a} produces 49(a), typing \ref{fig:subfig:b}
produces 49(b), and typing \ref{fig:subfig} produces 49.
Graphic Graphic
77
27.3.1 Minipage Environments Inside Subfigures
Like other side-by-side graphics, subfigures can be used with minipage environments.
Depending on the situation, this may make it easier to achieve the desired spacing. For
example
\begin{figure}
\subfigure[Small Box with a Long Caption]{
\label{fig:mini:subfig:a} %% label for first subfigure
\begin{minipage}[b]{0.5\textwidth}
\centering \includegraphics[width=1in]{graphic.eps}
\end{minipage}}%
\subfigure[Big Box]{
\label{fig:mini:subfig:b} %% label for second subfigure
\begin{minipage}[b]{0.5\textwidth}
\centering \includegraphics[width=1.5in]{graphic.eps}
\end{minipage}}
\caption{Minipages Inside Subfigures}
\label{fig:mini:subfig} %% label for entire figure
\end{figure}
produces Figure 50, which contains subfigures 50(a) and 50(b).
Graphic Graphic
Since subfigure captions are as wide as the subfigure, the subfigure captions in Fig-
ure 50 are wider than those in Figure 49. This is because the Figure 49 subfigures
contain only the graphics while the Figure 50 subfigures contain minipages of width
0.5\textwidth.
78
• The command \p@subfigure by default is \thefigure
These commands make the default caption labels (a), (b), etc. and the default \ref
labels 12(a), 12(b), etc. See [10] for controlling the size and font of the subfigure labels.
Subfigure 1. To make the caption labels (i), (ii), etc. and make the \ref labels 12i, 12ii, etc.
Examples enter the following commands (preferably in the LATEX file’s preamble)
\renewcommand{\thesubfigure}{\roman{subfigure}}
\makeatletter
\renewcommand{\@thesubfigure}{(\thesubfigure)\space}
\renewcommand{\p@subfigure}{\thefigure}
\makeatother
The \makeatletter command tells LATEX to treat the @ character as a letter,
thus allowing the re-definitions of the internal commands. The \makeatother
command tells LATEX return to the normal behavior of treating the @ character as
a non-letter.
2. To make the caption labels 12.1:, 12.2:, etc. and make the \ref labels 12.1, 12.2,
etc. enter the following commands
\renewcommand{\thesubfigure}{\thefigure.\arabic{subfigure}}
\makeatletter
\renewcommand{\@thesubfigure}{\thesubfigure:\space}
\renewcommand{\p@subfigure}{}
\makeatother
28 Stacked Graphics
In Section 27, side-by-side figures are arranged by placing blocks (either \includegraphics
or minipages) beside each other on a line. Stacked graphics are built in exactly the same
manner. For example,
\begin{figure}
\centering
\begin{minipage}[b]{0.3\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\caption{Caption 1}
79
\end{minipage}%
\hspace{0.04\textwidth}%
\begin{minipage}[b]{0.3\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\caption{Caption 2}
\end{minipage}\\[20pt]
\begin{minipage}[b]{0.3\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\caption{Caption 3}
\end{minipage}%
\hspace{0.04\linewidth}%
\begin{minipage}[b]{0.3\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\caption{Caption 4}
\end{minipage}%
\hspace{0.04\linewidth}%
\begin{minipage}[b]{0.3\textwidth}
\centering
\includegraphics[width=1in]{graphic.eps}
\caption{Caption 5}
\end{minipage}
\end{figure}
produces Figures 51-55. The \\[20pt] after the “Caption 2” minipage creates a line-
break with 20 points of additional vertical spacing.
Graphic Graphic
80
\begin{tabular}{|c|c|} \hline
Day & Data \\ \hline\hline
Monday & 14.6 \\
Tuesday & 14.3 \\
Wednesday & 14.2 \\
Thursday & 14.5 \\
Friday & 14.9 \\ \hline
\end{tabular}
\tabcaption{This is a Table by a Figure}
\label{table:by:fig}
\end{minipage}
\end{figure}
use a figure environment to create Figure 56 and Table 14.
Day Data
Monday 14.6
Tuesday 14.3
Graphic Wednesday
Thursday
14.2
14.5
Friday 14.9
Figure 56: This is a Figure by a Table Table 14: This is a Table by a Figure
Since LATEX allows figure floats to leapfrog table floats, using \tabcaption in a
figure environment may place the table ahead of unprocessed tables. Likewise, using
\figcaption in a table environment may place the figure ahead of unprocessed figures.
If this is objectionable, it can be prevented by putting a \FloatBarrier command
before the figure environment (see Section 16.3).
30 Continued Figures
When two successive figures contain closely-related material, it may be desirable to
label the figures with the same figure number. Since the figure counter contains the
number of the next figure, two figures can be given the same number by decrementing
the figure counter before the figure environment. For example,
\addtocounter{figure}{-1}
\begin{figure}
However, the inability to distinguish between these similarly-numbered figures causes
confusion.
The best way of constructing a continued figure is to use the subfigure package. This
allows the continued figures to be referenced individually as “Figure 12(a)” or collec-
tively “Figure 12”. Since the continued subfigures are in different figure environments,
the figure counter must be decremented with
\addtocounter{figure}{-1}
between the figures, while the subfigure counter must be incremented with
\addtocounter{subfigure}{1}
at the beginning of the second figure environment. For example, the following code
produces two continued subfigures.
\begin{figure}
\centering
\subfigure[First Part]{%
\label{fig:graphics:a}% label for subfigure
\includegraphics[width=\textwidth]{file1.eps}}%
\caption{Large Graphics}%
\label{fig:graphics}% label for figure
81
\end{figure}
\addtocounter{figure}{-1}
\begin{figure}
\addtocounter{subfigure}{1}
\centering
\subfigure[Second Part]{%
\label{fig:graphics:b}% label for subfigure
\includegraphics[width=\textwidth]{file2.eps}}%
\caption{Large Graphics (con’t)}%
\end{figure}
In this example, each of the figure environments contain one subfigure. When each of
the figure environments may contain multiple subfigures (such as in Section 27.3), the
subfigure counter must be properly incremented to account for the subfigures in the
first figure.
Since the continued figures are in separate floats, it is possible (but not likely) for
them to not appear on successive pages. If this happens, the figures can be forced
together by placing a \FloatBarrier command after the last continued figure.
82
References
[1] Leslie Lamport, LATEX: A Document Preparation System, Addison-Wesley,
Reading, Massachusetts, second edition, 1994, ISBN 0-201-52983-1
[2] Helmut Kopka and Patrick Daly, A Guide to LATEX 2ε , Addison-Wesley, Reading,
Massachusetts, 1995, ISBN 0-201-42777-X
[3] Michel Goossens, Frank Mittelbach and Alexander Samarin, The LATEX
Companion, Addison-Wesley, Reading, Massachusetts, 1994, ISBN 0-201-54199-8
[4] Michel Goossens, Sebastian Rahtz, and Frank Mittelbach, The LATEX Graphics
Companion, Addison-Wesley, Reading, Massachusetts, 1997, ISBN 0-201-85469-4
[5] D. P. Carlisle, Packages in the ‘graphics’ bundle (Documents the graphics,
graphicx, lscape, color packages), Available as
CTAN/macros/latex/packages/graphics/grfguide.ps
[6] Tobias Oetiker, The Not So Short Introduction to LATEX 2ε Available as
CTAN/info/lshort/lshort2e.pdf and CTAN/info/lshort/lshort2e.600.ps.
[7] Michael C. Grant and David Carlisle, The psfrag system, version 3, Available as
CTAN/macros/latex/contrib/supported/psfrag/pfgguide.ps
[8] David Carlisle, The ifthen package, Available as
CTAN/macros/latex/base/ifthen.dtx
[9] David Carlisle, The afterpage package, Available as
CTAN/macros/latex/packages/tools/afterpage.dtx
[10] Steven Douglas Cochran, The subfigure package, Available as
CTAN/macros/latex/contrib/supported/subfigure/subfigure.dtx
[11] Harald Axel Sommerfeldt, The caption package, Available as
CTAN/macros/latex/contrib/supported/caption/caption2.dtx
[12] Piet van Oostrum, Page layout in LATEX, Available as
CTAN/macros/latex/contrib/supported/fancyhdr/fancyhdr.tex
[13] Leonor Barroca, The rotating package, Available as
CTAN/macros/latex/contrib/supported/rotating/rotating.dtx
[14] Timothy Van Zandt, Documentation for fancybox.sty, Available as
CTAN/graphics/pstricks/origdoc/fancybox.doc
[15] Donald Arseneau, The placeins package, Available as
CTAN/macros/latex/contrib/other/misc/placeins.sty
[16] The flafter package, Available as CTAN/macros/latex/unpacked/flafter.sty
[17] Don Hosek, The morefloats package, Available as
CTAN/macros/latex209/contrib/misc/morefloats.sty
[18] James Darrell McCauley and Jeff Goldberg, The endfloat Package, Available as
CTAN/macros/latex/contrib/supported/endfloat/endfloat.dtx
83
Index
\abovecaptionskip length, 49 depth, 7
\afterpage command, 44, 68 DISPLAY, 12
\doublebox command, 73
baseline, 7 draft, \includegraphics option, 15
\baselinestretch command, 58
bb, \includegraphics option, 14 endfloat package, 50, 63
\belowcaptionskip length, 49 eps BoundingBox, 8
\bottomfigrule command, 48 epsf package, 6
\bottomfraction command, 45 \epsfbox command, 6, 20
bottomnumber float placement counter, \epsfig command, 6
45
BoundingBox, 8 facing-page figures, 69
boxed figures, 70 fancybox package, 70, 72
bufsize, 10 \fancyfoot command, 38
fancyhdr package, 37–39
calc package, 16 \fancyhead command, 37
caption fancyheadings package, 37
custom style, 57 \fancypagestyle command, 39
delimiter, 55 \fbox command, 70
font, 56 \fboxrule length, 34, 72
linebreaks in, 58 \fboxsep length, 33, 34, 72, 73
one line, 53 \fcolorbox command, 34
style, 52 \figcaption command, 60
width, 54 \figurename command, 50
\caption command, 42, 59 figures
caption2 package, 51, 61 figure environment, 41
options, 52 landscape, 63
\captionfont command, 56, 59, 61 marginal, 61
\captionindent command, 52 non-floating, 59
\captionlabeldelim command, 55 placed on facing pages, 69
\captionlabelfont command, 56 wide, 61
\captionstyle command, 52 fil unit of length, 48
\@captype command, 59 \fill length, 21
\centering command, 20 flafter package, 43, 47
difference from center environment, float package, 60, 66
20 float page, 42
\centerline TEX command, 20 \FloatBarrier command, 44
\clearpage command, 43, 44 \floatpagefraction command, 44, 45
clip, \includegraphics option, 15 \floatsep length, 48
color package, 33 \flushleft command, 61
\colorbox command, 33 \flushright command, 61
compressed graphics, 28 \@fpbot length, 48
converting graphics to EPS, 12 \@fpsep length, 48
converting ps files to eps, 9 \@fptop length, 48
CTAN (Comprehensive TEX Archive Net- fragile commands, 58
work), 2 FrameMaker non-standard eps files, 10
current baseline, 7
ghostscript, 11
\DeclareGraphicsExtensions command, ghostview, 11
14, 17, 18 gif graphics
\DeclareGraphicsRule command, 17– converting to eps, 12
19, 28, 29 using in LATEX, 28, 30
84
graphics bundle, 6 moving arguments, 58
graphics conversion programs, 12
graphics package, 6, 14 named arguments, 6
graphics.cfg file, 29 NetPBM, 12
\graphicspath command, 26, 27 non-eps graphics
graphicx package, 6, 14 converting to eps, 12
GSview, 11 converting to level 2 eps, 12
using in LATEX, 28, 30
header, graphics in, 37 non-floating figure, 59
height, 7
\includegraphics option, 14, 21 \onelinecaptionsfalse command, 53,
\hfill command, 20 58
\hspace command, 20 \onelinecaptionstrue command, 53
origin, \includegraphics option, 14
ifthen package, 62, 67, 68 \Ovalbox command, 73
\ifthenelse command, 62, 67, 68 \ovalbox command, 73
ImageCommander, 12 Oztex, 31
ImageMagick, 12
\includegraphics command, 6, 14 \pageref command, 42
boolean options, 15 Paint Shop Pro, 12
cropping options, 15 PBMPLUS, 12
options, 14 pict graphics
internal commands, 48, 59, 79 converting to eps, 12
\intextsep length, 48, 60 using in LATEX, 30
placeins package, 44
jpeg graphics Please ask a wizard, 10
converting to eps, 12 PostScript
converting to level 2 eps, 12 Level 2 Wrappers, 12
using in LATEX, 28, 30 \protect command, 58
jpeg2ps, 12 \psfig command, 6, 20
psfrag, 31
keepaspectratio seminar package incompatibility, 35
\includegraphics option, 15 xfig incompatibility, 35
kpsewhich, TEX path-searching program,
29 \ref command, 42
KVEC, 12 reference point, 7
\resizebox command, 16
\label command, 42 robust commands, 58
landscape environment, 63 \rotatebox command, 17
landscape figures, 63 rotating package, 63, 64
\leavevmode TEX command, 20 \rotcaption command, 63, 64
level 2 PostScript, 12 rubber length, 20, 47
\linespread command, 58
\listoffigures command, 42 scale, \includegraphics option, 14
lscape package, 63 \scalebox command, 16
SCfigure environment, 67
\makeatletter command, 48, 59, 79 seminar package
\makeatother command, 48, 59, 79 psfrag incompatibility, 35
marginal figures, 61 \setcaptionmargin command, 54
\marginpar command, 45 \setcaptionwidth command, 54
Mathematica non-standard eps files, 9 \shadowbox command, 73
minipage \shadowsize length, 73
aligning bottoms, 25 \shortstack command, 33
aligning tops, 25 sidecap package, 67
vertical alignment, 24 sidewaysfigure environment, 63, 64
morefloats package, 45, 61 sidewaystable environment, 64
85
\special command, 6
\subfigure command, 77
\suppressfloats command, 47
\tabcaption command, 60
TEX search path, 26
TEXINPUTS (TEX search path), 26
\textfloatsep length, 47, 48
\textfraction command, 45
\thicklines line width, 73
\thinlines line width, 73
tiff graphics
converting to eps, 12
converting to level 2 eps, 12
using in LATEX, 28, 30
tiff2ps, 13
Too Many Unprocessed Floats, 43, 44
\topfigrule command, 48
\topfraction command, 44, 45
topnumber float placement counter, 45
totalheight, 7
\includegraphics option, 14, 21
totalnumber float placement counter,
45
trim, \includegraphics option, 15
wide figures, 61
width, 7
\includegraphics option, 14
wizard, Please ask a wizard, 10
WMF2EPS, 12
xfig
psfrag incompatibility, 35
xv, 12
86