Next: How do I place
Up: Working with Figures
Previous: Working with Figures
Inserting and labelling figures
- To refer to a figure, use the following syntax:
Amazing results are shown in Figure \ref{fig:Stupendous}.
- to insert a figure using the graphics package:
\usepackage{graphicx} % or you might try
\usepackage{graphics} or \usepackage[dvips]{graphics}
\begin{figure}
\begin{center}
\includegraphics[height=7in,width=5in,angle=90]{file.eps}
\caption{\small \sl
This figure shows results of Nobel prize winning importance.}
\label{fig:Stupendous}
\end{center}
\end{figure}
I've read that you can include a pdf or jpeg file directly using the
\includegraphics command. The source I saw said that
if your file is file.jpg, make a file.jpg.bb with the Bounding box
line from the eps version of the jpeg file. Supposedly you can then
just do \includegraphics{file.jpg}, but
this has not worked when I tried it and compiled with Latex (Latex
complained about not being able to find a bounding box), though I
have successfully included pdf files and jpeg files when using pdflatex
and \usepackage[pdftex]{graphics}.
- to insert a figure using the psfig package:
\input psfig % in preamble
\begin{figure}
\centering \psfig{file=file.ps,width=5in,height=3in}
\caption{\small \sl
This figure shows results of Nobel prize winning importance.}
\label{fig:Stupendous}
\end{figure}
% note that \psfig can be used with eps files
- to insert a figure using the epsf package:
\usepackage{epsf} % in preamble
\begin{figure}
\begin{center}
\epsfxsize=6in {\epsfbox{file.eps}}
\caption{\small \sl
This figure shows results of Nobel prize winning importance.}
\label{fig:Stupendous}
\end{center}
\end{figure}
- inserting pdf and jpeg figures when using pdflatex works nicely
\usepackage{pdftex}
\usepackage{graphicx}
\begin{figure}
\begin{center}
\includegraphics[scale=0.85]{file.pdf}
# or file.jpg; do not use .jpeg extension (at the
least, this causes problems when using Lyx and foiltex)
\end{center}
\end{figure}
- With the \begin{figure} command, you can
include an argument such as \begin{figure}[htbp].
This tells Latex to try to put the figure first 'here', then
at the 'top' of the page, then at the 'bottom' and
finally on the next 'page'. The letters can be in any order
you wish and any of them can be left out. If you put an !
before the first letter, it tells Latex to try really hard to follow
your wishes, e.g., \begin{figure}{!h}.
- You may need to make sure Latex knows to only include the clipped
portion of the figure (the portion inside the bounding box). This
is the case if you're using a figure imported from powerpoint, for
example. The syntax is
\psfig{file=file.ps,clip=}
\epsfbox{file.eps,clip=}
\includegraphics[clip]{file.eps}
Next: How do I place
Up: Working with Figures
Previous: Working with Figures
Chris Paciorek
2006-04-02