Subfigures in LaTeX

In \LaTeX documents we refer to figures by using “label” and “\ref” commands. If a figure is comprised of many subfigures, declare label to each subfigure and then we can refer to the subfigure labels. The main figure is referred using the label defined outside the subfigure environment.

In the following example, the figure is comprised of four subfigures. Each subfigure is defined with a label. After all the subfigures, a label is given to entire figure. Now we can refer to entire figure or each subfigure as shown in the following example.

% -------------- SUBFIGURE -1 -------------- %
\includegraphics[width=.45\linewidth] {./rand}   
\label{fig:subfig1} }
% -------------- SUBFIGURE -2 -------------- %
\includegraphics[width=.45\linewidth] {./rand}
\label{fig:subfig2} }%
% -------------- SUBFIGURE -3 -------------- %
\includegraphics[width=.45\linewidth] {./power}
\label{fig:subfig3} }%
% --------------SUBFIGURE -4 -------------- %
\includegraphics[width=.45\linewidth] {./power}
\label{fig:subfig4} }%
\label{myfigure}                            % label to the whole figure
\caption{This is main figure caption }
Now you can refer to subfigures as follows 
Fig.~\ref{fig:subfig1}, Fig.~\ref{fig:subfig2}, Fig.~\ref{fig:subfig3} and Fig.~\ref{fig:subfig4}. 



CTAN subfigure document

Leave a Comment