[Tex/LaTex] numbering several latex figures

floatsnumberingsubfloats

How is it possible to include figure labeling in latex? By labeling I mean that if I import several figures:

\begin{figure}[ht]
    \centering
    \includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure1.pdf}
    \includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure2.pdf}
    \includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure3.pdf}
    \includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure4.pdf}
    \includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure5.pdf}
    \end{figure}

How can I number these figures, such as the first figure as (a) the second as (b) and so on… I would like these to show in the top left corner outside each graphic which I can then refer to in the caption.

Best Answer

You need the subfig or the subcaption package for that. Here is an example using the subfig package:

\documentclass{article}
\usepackage{subfig}

\begin{document}
\begin{figure}
\centering
\subfloat[caption of the subfigure]{\includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure1.pdf}\label{fig:subfig-a}}\\
\subfloat[caption of the subfigure]{\includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure2.pdf}}\\
\subfloat[caption of the subfigure]{\includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure3.pdf}}\\
\subfloat[caption of the subfigure]{\includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure4.pdf}}...
\caption{caption of the whole figure}\label{fig:whole}
\end{figure}
The whole figure is~\label{fig:whole} and the first subfigure is~\label{fig:subfig-a}.
\end{document}

See subcaption vs. subfig: Best package for referencing a subfigure for differences between the two packages

Related Question