# Sub-figures using subfloat in LaTeX

📅 2010-Mar-14 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

To include more than one figures inside a figure the subfig package can be used. It provides the subfloat command that is used to specify each of the sub-figures as a figure.

Its usage is shown below in a simple example:

% Package for subfloat
\usepackage{subfig}

% Figure with two sub-figures
\begin{figure}
\centering
\subfloat[]
{
\includegraphics[scale=.5]{fig-1.pdf}
\label{fig:foo-1}
}
\subfloat[]
{
\includegraphics[scale=.5]{fig-2.pdf}
\label{fig:foo-2}
}
\caption{ Two foo figures. }
\label{fig:foo}
\end{figure}

Note that each of the subfigures can be given an optional label which can be used to refer to them in the text of the document.

If you are using TeX Live, in Ubuntu for example, subfig can be found in the texlive-latex-recommended package. Note that I have seen that subfig has problems working with Beamer.