This page won't tell you how to turn your work into a picture. You've got to have a .ps or .eps or .tex file in your hands already. There's a million ways to get these---gnuplot, xv, xfig, Maple, Mathematica, matlab, you name it. So once you've got your picture, how do you get it into a LaTeX document? Here's some ways that seem to work:
\label after, in
\caption
picture environment
epsf%!PS-Adobe-2.0
%!PS-Adobe-2.0 EPSF
\documentstyle[epsf]{article}
at the beginning of your source. Or \input{epsf} before
you need it. Then you use the macro \epsffile (notice the
double f) to include your .eps file:
\begin{figure}
\epsffile{foo.eps}
\caption...
\label...
\end{figure}
This puts in the figure, all right. But it just puts it in at its natural
size, and probably way over on the left margin. One thing at a time...
\epsffile, you can specify the height or width
of the incoming figure with
\epsfysize=5in \epsfxsize=4.4cm \epsffile....respectively (notice the "y" and "x" in the middle of these words...) These commands scale the PostScript to the desired dimensions. If you only specify one, the other is changed to keep the shape of the picture. You can probably specify both and stretch the figure around, but this will most likely wreck the label fonts and so on.
%%BoundingBox: 0 0 453 216
| | | |_distance from bottom of page to top of figure
| | |_distance from left side of page to right side of figure
| |_distance from bottom of page to bottom of figure
|_distance from left side of page to left side of figure
Or just do
grep BoundingBox foo.epsIn this example, the figure sits right down in the bottom left-hand corner of the page. The numbers are points with 1pt = 1/72 inches. So this figure is about 6 inches wide and 3 inches high.
Or so you think! The numbers in the Bounding Box are the very outsides of
the region of the page where some PostScript stuff might happen.
gnuplot, for instance, puts a lot of white padding around
plots made with the set term postscript option. So centering
the BoundingBox might not center the stuff that gets printed. To get
around this "bug," you can enter your own BoundingBox dimensions.
Coming up with the four numbers out of the blue is pretty well impossible,
so your best bet is to add and subtract and test out what it looks like.
For instance, to cut off a 1 inch wide band on the left and bottom of
the example above, you would call \epsffile like this:
\begin{figure}
\epsffile[72 72 453 216]{foo.eps}
\caption...
\label...
\end{figure}
This is usually pretty trial and error, but it can be done. You can
try to use Ghostview or BBfig to find some
suitable dimensions.
\begin{center}...\end{center} around, or even inside, the
figure environment, LaTeX,
to quote Jim, blows
chunks. You have to insert a magical \leavevmode in
at the appropriate spot:
\begin{figure}
\epsfxsize=5.5in
\begin{center} <-------------------------- start center
\leavevmode <---------- \leavevmode! |
\epsffile{myhome/foo.eps} |
\end{center} <-------------------------- end center
\caption{...}
\label{...}
\end{figure}
Here's another way to center a Figure, which uses
\centerline
and \hbox rather than \leavevmode. Thanks to
Dave for the idea and the debugging. This example uses
epsf but you can modify it to include
whatever figure format you have.
\begin{figure}[htbp]
\centerline{\hbox{
\epsfxsize=4.0in
\epsffile{path/figure.eps}
}
}
\caption{This is a caption refering to
Dilber and Lewis \protect\cite{D&L:variational}
}
\label{fig:test}
\end{figure}
Notice the \protect in
the caption to cite a reference.
\label and
\caption\label line before the \caption line. You
have two choices:
\label inside the
\caption: you really refer to "Caption 5.2" which is,
of course, associated only with Figure 5.2.
\begin{figure}
...
\caption{\label{myfigure-fig} The caption for this Figure.}
\end{figure}
\label after the
\caption: you refer directly to Figure 5.2
\begin{figure}
...
\caption{The caption for this Figure.}
\label{myfigure-fig}
\end{figure}
picture
Environmentpicture environment is just like any other
LaTeX environment that you
\begin and \end. You can use it to make your
own simple figures, or use it to assemble more complicated figures.
You should have a look at
"figures
within figures" to see the basics of this environment.
The key thing to note is that in the picture
environment, all you can do is \put. But inside the
\put, you can do just about anything.
picture, you can
put lines and arrows, among other
things (see Lamport, p.102ff). As Lamport admits, these objects are
just a bit tricky to use:
lines
\line(x,y){length} <---- notice the mixture of () and {}
where (x,y) gives the slope of the line, and length
gives something like the length. Remember that where the
line starts is given by the \put statement.
x and y set the slope
of the line to x/y. Sounds simple, huh? Except:
x/y must be in its simplest form.
x not equal to 0), then
length is the horizontal component of the line.
Positive x gives a line to the right, negative x
gives a line to the left. If the line is vertical, the length
is the height (both positive and negative) of the line.
arrows
\vector(x,y){length}
Again, the numbers x and y set the slope
of the line to x/y, and the arrow head appears on the
far end, the end away from the \put. For arrows, however
x and y must be integers
between +4 and -4.
You can use these lines and arrows on top of an existing .eps
figure to point features. Just like in
figures within
figures, put can \put down a figure, then an arrow and then
some LaTeX labels or text.
To find out just what coordinates use in the \put, you can
try Ghostview or BBfig.
\put into the picture
environment is plain old LaTeX text.
This is a great way to add LaTeX labels to
figures generated by programs that don't have greek fonts and stuff.
Just as with lines and arrows, you just
find the coordinates of the point where you want
to add something, and
\put(x,y){Put some Mathematical $\Tau\epsilon\chi\tau$ here.}
You cannot rotate the text to make a label for the
y-axis (at least, not with picture.) You might be
able to get something reasonable by \put'ting down
a \shortstack{}, but any math in the label might
look a bit funny.
Ghostview
Guess what? The numbers (68,597) are points, the
default unit of measurement in the picture environment. So all
you have to do is move the cursor around and read off the coordinates. Now,
they might not be quite right, because who knows if the coordinates you use
in the \put point to the middle of the label or what? So you
might have to do some fine-tuning later.
array
(well, what did you expect?). Thanks to
Lynn and
Gerda.
Just open up an array environment
and put figures in as entries. These entries can be
Here is the LaTeX source for this example:
This is the last line before Figure \ref{figtest-fig} starts---it should
be long enough to show the left and right margins.
\begin{figure}[h]
\begin{center}
$\begin{array}{c@{\hspace{1in}}c}
\multicolumn{1}{l}{\mbox{\bf (a)}} &
\multicolumn{1}{l}{\mbox{\bf (b)}} \\ [-0.53cm]
\epsfxsize=2in
\epsffile{figure1.eps} &
\epsfxsize=2in
\epsffile{figure2.eps} \\ [0.4cm]
\mbox{\bf (aa)} & \mbox{\bf (bb)}
\end{array}$
\end{center}
\caption{The caption for Figure \protect\ref{figtest-fig}}
\label{figtest-fig}
\end{figure}
Here is a line of text after Figure \ref{figtest-fig}. It is indented because
of the leading blank line.
$, not \[.
@{\hspace{1in}}.
\multicolumn to try to position the "(a)"
and "(b)" labels. Their vertical position is adjusted with the
[-0.53cm] at the end of the line.
\epsf?size.
array.
\protect in the caption so that a
reference can be made.
The LaTeX for this is the same as the side-by-side figures, except for
...
\framebox{ «--- open a "framebox"
\epsfxsize=2in
\epsffile{figure1.eps}
} & «--- close it
...
Warning: The \framebox is drawn around
the Bounding Box for .eps figures
or around the outside of the region defined in the \begin{
picture} figures. You
may have to adjust the dimensions by hand to make figure sit in the
middle of the box.
The width of the line that draws the \framebox
is set in the preamble by \fboxrule=0.5mm. You could probably
change it each time you used it, too.