Caption
It is usually beneficial to include caption to your images. To do so, simply use the command \caption{'text'}
either below or above your figure (usually below for images and above for tables).
Code Block |
---|
\begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \caption{Caption written below figure.} \end{figure} \begin{figure} \centering \caption{Caption written above figure.} \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \end{figure} |
Customized captions
Defining your own caption
If you e.g. want to attach a source to your figures in a specific and consistent manner, a self-defined caption may be an option.
Code Block |
---|
% In setup \newcommand{\source}[1]{\vspace{-4pt}{\hfill \footnotesize{Source: {#1}} } } % In document \begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \caption{Flow around cylinder} \source{Your source} \end{figure} |
Caption package
The plain captions has a typeset as an ordinary paragraph, with no remarkable visual difference from the rest of the text. If you'd like to change this in any way possible, check out the documentation on the caption package.
Info |
---|
Please note that the caption package is only controlling the look & feel of the captions. It does not control the placement of the captions. (But you could do so by using other packages like the floatrow package. |
Following is a short example displaying the caption package.
Code Block |
---|
% In setup \usepackage[font=it,labelfont=bf]{caption} % In document \begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \caption{Flow around cylinder} \end{figure} |
List of figures
A list of figures is included in your document by use of the command \listoffigures
. As descriptions in the list of figures, the caption defined for each figure is used.
Supress caption in list of figures
To supress the Figure #: (or Table #: ), simply write your desired text without using the caption command. However, note that this will remove the figure from your list of figures as well.
Code Block |
---|
\subsection{Caption Supress figure:} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \caption{Caption written using command} \end{figure} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} Caption written without using command \end{figure} |
Specified caption in list of figures
If the figure caption is long, it is often desired to define another caption to be used in the list of figures. To do so, use the caption options \caption['short caption']{'long caption'}
Code Block |
---|
\listoffigures \begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \caption[Short caption]{Long caption} \end{figure} |
Figure environment
The most comman method to included images is using the Figure environment.
Code Block |
---|
\begin{figure}[placement specifier] ... figure contents ... \end{figure} |
Positioning
The placement specifiers available when inserting figures are as shown in the table below. This table is taken from LaTeX Floats, Figures and Captions, so check it out for more detailed information.
Specifier | Permission |
---|---|
h | Place the float here, i.e., approximately at the same point it occurs in the source text (however, not exactly at the spot) |
t | Position at the top of the page. |
b | Position at the bottom of the page. |
p | Put on a special page for floats only. |
! | Override internal parameters LaTeX uses for determining "good" float positions. |
H | Places the float at precisely the location in the LaTeX code. Requires the float package, i.e., \usepackage{float} |
It is also common to use the command \centering
to center the image on the page. For example:
Code Block |
---|
\begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \end{figure} |
Label
To later reference your figure, include a label inside the environment. Note that the label has to be defined after the caption.
Code Block |
---|
\begin{figure}[H] \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \caption{Flow around cylinder} \label{fig:Flow around cyl} \end{figure} As seen in Figure \ref{fig:Flow around cyl} ... |
Although we will not cover them here, there are many other options available when referencing. More information may be found at e.g. LaTeX Lables and Cross-referencing. One of these options are the command \autoref{'label'}
in the package hyperref
.
Code Block |
---|
As seen in \autoref{fig:Flow around cyl} ... |
Size
The size of the image may be specified using a variety of commands. Some of the most used are: \width, \height, \scale
and \angle
.
Code Block |
---|
\begin{figure} \centering \includegraphics[width=0.5\textwidth]{CylinderImage.jpg} \end{figure} \begin{figure} \centering \includegraphics[width=6cm, height=4cm]{CylinderImage.jpg} \end{figure} \begin{figure} \centering \includegraphics[scale=0.65]{CylinderImage.jpg} \end{figure} \begin{figure} \centering \includegraphics[width=0.525\textwidth, angle=45]{CylinderImage.jpg} \end{figure} |
BibTeX Display Table |
---|