4

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.

lockstep
  • 250,273
KatyB
  • 2,871

2 Answers2

7

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

David Carlisle
  • 757,742
Spike
  • 6,729
0

The easiest way is to put everything in a structure like this :

\begin{figure}[ht]
 \begin{tabular}{c}
    \includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure1.pdf}\\
    (a) Your label of choice\\
    \includegraphics[height = 0.2\textwidth,width=0.8\textwidth]{Figure2.pdf}\\
    (b) Your label of choice\\
 \end{tabular}
 \bigskip
 \caption{Your caption}
\end{figure}

This is what i did in one of my reports and the result is fine. the \bigskip is here to add some space between the last line of the tabular and the caption.

David Carlisle
  • 757,742
s__C
  • 3,186
  • 1
    Use the right tool for the job. In this case, tables aren't it. – You Jun 27 '12 at 09:06
  • depends on the result you're looking for. my example works well for figure with width=\textwidth... – s__C Jun 27 '12 at 09:23
  • 2
    Semantically, subfloats is a better choice. Functionally, I'd say minipages and subfloats are simpler, more flexible and more appropriate. – You Jun 27 '12 at 11:38