##  Class files

Adding a caption to a floating environment (for images, figure provides a floating environment) is very easy. We can simply add the following command to the figure environment -

\caption{caption text}

We do not need to include the figure number inside the caption, because LaTeX automatically keeps track of the numbering of the figures, and it'll display it while displaying the caption. The following is an example of a caption inside a figure environment.

\begin{figure}[h!]
\caption{A picture of the universe!}
\includegraphics[width=0.5\textwidth]{universe}
\end{figure}

The caption may be put either before or after the image in the figure.

##  Side Captions in a Figure

At times, we might want to put the caption on the side instead of at the top or bottom of the figure. The sidecap package can be used to place a caption next to the figure in such a case (it can also be used for other floating environments). The package uses an environment called SCfigure that can be used after including the package in preamble (\usepackage{sidecap})

\begin{SCfigure}
\caption{This is the same picture of the universe as above, but now the captions appear in the side next to the image}
\includegraphics[width=0.5\textwidth]{universe}
\end{SCfigure}

##  List of Figure

A list of all the figures included in a document can be generated with the following command -

\listoffigures