|
Document 652
The LaTeX subfig package
Version: 5.5 - Scientific WorkPlace & Scientific Word
The subfig package supports the use of small figures and tables within a
single floating figure or table environment. The package supersedes the
subfigure package but isn't completely compatible with
it.
The package supports the positioning, captioning, and labeling of small
figures and tables and the inclusion of their captions in the list of figures
or tables.
Several options, available through the Options and Packages command on the
Typeset menu, define the placement and caption formatting of all subfigures
and subtables in the document. The options are flexible and allow variations
such as captions for both the entire figure and for each subelement, or a
caption for the entire figure and only a label for each subelement. Commands
in TeX fields in the document body define specific subfigures and subtables.
The package works with the caption package and uses its
features for customizing caption layout. The package also requires the
ragged2e package, which it calls automatically. Subfig
should be compatible with other packages that modify or extend float
environments.
Note that the instructions below differ slightly depending on the kind of file
you create when you typeset. The Output Choice
setting on the Typeset menu affects the way
graphics are generated when you typeset a DVI or PDF file. When the Output
Choice is set to DVI output, the program uses
the original graphics files. When the Output Choice is set to
PDF output or Both DVI
and PDF output, graphics for the PDF file are generated when the
document is saved. These graphics must be available when typesetting the main
document to avoid LaTeX errors and missing graphics in the PDF file.
These instructions don't apply to portable LaTeX documents, because that
document type doesn't use the FRAME macro that defines graphics.
The package is installed in the TCITeX/TeX/LaTeX/contrib/subfig directory. The
file SWSamples/PackageSample-subfig.tex in your program directory illustrates
the use of the subfig package. For more information, see the package
documentation.
Creating subfigures or subtables with the subfig package
-
Add the subfig package to your document and modify the
subfig package options as necessary.
Because the subfig package automatically calls the caption package, it isn't
necessary to add the caption package to your document, but you may add it if
you want to. If you do add the caption package, make sure it appears before
the subfig package in the Packages in Use list.
-
Create a floating environment for subfigures:
-
Place the insertion point where you want the subfigures to appear.
-
Enter an encapsulated TeX field.
-
Type \begin{figure} to specify a
floating graphics environment and press Enter.
-
If you want a caption to apply to all the subfigures in the environment, type
\caption{title} where
title is the caption you want,
and press Enter.
This caption will appear in the list of figures for your document.
-
If you want to create cross-references to the environment,
type \label{x} where
x is the key for the floating
environment, and press Enter.
-
Type \end{figure} and choose
OK.
-
From the Typeset menu, choose
Output Choice and select the typeset output type
you want (DVI output, PDF
output, or Both DVI and PDF output) and choose OK.
-
Prepare each subfigure:
-
Open a new, completely empty document using the Blank - Standard LaTeX Article
shell from the Standard LaTeX shell directory.
-
From the File menu, choose
Document Info and choose the
Save Options tab.
-
Uncheck Store Relative Graphics Paths and choose
OK.
-
From the File menu, choose
Import Picture to import the graphic image you
want as a subfigure.
-
Choose Properties and then choose the
Layout tab.
-
In the Placement area, check
In Line.
-
Make any other modifications you need and then choose
OK.
-
From the Typeset menu, choose
Output Choice and select the same output choice
as for the main document, then choose OK.
-
Save the document.
-
Open the .tex file with an ASCII editor.
-
Find the lines that represent the figure and copy them to the clipboard.
The lines will appear differently depending on your output choice:
-
If you have chosen DVI output, the lines will have an appearance something
like this:
-
If you have chosen PDF output, the lines will have an appearance like this:
-
If you have chosen Both DVI and PDF output, the lines will have an appearance
like this:
-
Return to your original SWP or
SW document and reopen the encapsulated TeX field for
the floating environment.
-
Create the subfigure:
-
Place the insertion point on a new line just below the
\begin{figure} command.
-
Type
\subfloat[entry][caption] where
entry is the subfigure caption as you want it to
appear in the list of figures and caption is the
subfigure caption as you want it to appear in the body of your document.
-
Type {
-
If you want to create cross-references to the subfigure, type
\label{x} where x
is the key for the subfigure.
-
Press Enter and paste the lines representing the figure from the clipboard to
the TeX field.
-
Type } and choose
OK.
-
Repeat steps 4--6 for each subfigure in the floating environment.
-
Create a floating environment for subtables:
-
Place the insertion point where you want the subtables to appear.
-
Enter an encapsulated TeX field.
-
Type \begin{table} to specify a floating table
environment and press Enter.
-
If you want a caption to apply to all the subtables in the environment, type
\caption{title} where
title is the caption you want, and press Enter.
The caption will appear in the list of tables for your document.
-
If you want to create cross-references to the environment, type
\label{x} where x is
the key for the floating environment, and press Enter.
-
Type \end{table} and choose
OK.
-
Prepare each subtable:
-
Open a new, completely empty subdocument.
-
From the Insert menu, choose
Table.
-
Specify the table size and alignment you want and choose
OK.
-
Fill the table with information, formatted as you want.
-
Save the document.
-
Open the .tex file with an ASCII editor.
-
Find the lines that represent the table and copy them to the clipboard.
-
Return to your original SWP or SW
document and reopen the encapsulated TeX field for the floating
environment.
-
Create the subtable:
-
Place the insertion point on a new line below the
\begin{table} command.
-
Type \subfloat[entry][caption] where
entry is the subtable caption as you want it to
appear in the list of tables and caption is the
subtable caption as you want it to appear in the body of your document.
-
Type {
-
If you want to create cross-references to the subtable, type
\label{x} where x is
the key for the subtable.
-
Paste the lines representing the table from the clipboard to the TeX field.
-
Type } and choose
OK.
-
Repeat steps 9--11 for each subtable in the floating environment.
-
Save and typeset compile your document.
Including subfigures and subtables in the lists of figures
and tables
-
On the Typeset toolbar, click
or, from the Typeset menu, choose
Front Matter.
-
Place the insertion point after the Make TOC field.
-
Press Enter and apply the Remove Item Tag.
-
Apply the Make LOF tag and choose OK.
-
Apply the Make LOT tag and choose OK.
-
From the Typeset menu, choose
Preamble.
-
On a new line at the end of the entries, type
\setcounter{lofdepth}{2} to
include subfigure captions in the list of figures or
\setcounter{lotdepth}{2} to include subtable
captions in the list of tables.
-
Choose OK.
Last revised 11/28/06
|