5.7.1 \caption

Synopsis:

\caption{caption-text}

or

\caption[short-caption-text]{caption-text}

Make a caption for a floating environment, such as a figure or table environment (see figure or table).

In this example, LaTeX places a caption below the vertical blank space that is left by the author for the later inclusion of a picture.

\begin{figure}
  \vspace*{1cm}
  \caption{Alonzo Cushing, Battery A, 4th US Artillery.}
  \label{fig:CushingPic}
\end{figure}

The \caption command will label the caption-text with something like ‘Figure 1:’ for an article or ‘Figure 1.1:’ for a book. The text is centered if it is shorter than the text width, or set as an unindented paragraph if it takes more than one line.

In addition to placing the caption-text in the output, the \caption command also saves that information for use in a list of figures or list of tables (see Table of contents, list of figures, list of tables).

Here the \caption command uses the optional short-caption-text, so that the shorter text appears in the list of tables, rather than the longer caption-text.

\begin{table}
  \centering
  \begin{tabular}{|*{3}{c}|}
    \hline
    4  &9  &2 \\
    3  &5  &7 \\ 
    8  &1  &6 \\
    \hline
  \end{tabular}
  \caption[\textit{Lo Shu} magic square]{%
    The \textit{Lo Shu} magic square, which is unique among
    squares of order three up to rotation and reflection.}
  \label{tab:LoShu}
\end{table}

LaTeX will label the caption-text with something like ‘Table 1:’ for an article or ‘Table 1.1:’ for a book.

The caption can appear at the top of the figure or table. For instance, that would happen in the prior example by putting the \caption between the \centering and the \begin{tabular}.

Different floating environments are numbered separately, by default. It is \caption that updates the counter, and so any \label must come after the \caption. The counter for the figure environment is named figure, and similarly the counter for the table environment is table.

The text that will be put in the list of figures or list of tables is moving argument. If you get the LaTeX error ‘! Argument of \@caption has an extra }’ then you must put \protect in front of any fragile commands. See \protect.

The caption package has many options to adjust how the caption appears, for example changing the font size, making the caption be hanging text rather than set as a paragraph, or making the caption always set as a paragraph rather than centered when it is short.


Unofficial LaTeX2e reference manual