5

I am using \begin {figure}-\end {figure} for one figure and \begin {figure} \subfigure{} \end {figure} for multiple figures joined on a page. (By using \usepackage{subfigure}) When I refer the \subfigure (multiple figure in one figure label, referring number shows wrong. for example, it should be Figure (5), but it shows Figure (3.1)
This is one of my subfigure code.

\begin{figure}{
\centering
\caption{Validation of Revolving by Categories}
\subfigure [Frequency of Revolving (Promotional Cash)]{
    \includegraphics[scale=0.8]{category_a1.png}}
\subfigure [Conditional Expectation (Promotional Cash)]{
    \includegraphics[scale=0.8] {category_a2.png}}
\subfigure [Frequency of Revolving (Regular Cash Withdrawal)]{
    \includegraphics[scale=0.8]{category_b1.png}}
\subfigure [Conditional Expectation (Regular Cash Withdrawal)]{
    \includegraphics[scale=0.8]{category_b2.png}}
\subfigure [Frequency of Revolving (Retail Transactions)]{
    \includegraphics[scale=0.8]{category_c1.png}}
\subfigure [Conditional Expectation (Retail Transactions)]{
    \includegraphics[scale=0.8]{category_c2.png}}

}
%\scriptsize{Notes. (a) depicts }


\label{fig:revol}
\end{figure}
  • 1
    Don't use subfigure package. It is obsolete and the new one is subfig package. Use subcaption package that provides the same functionality. – user11232 Aug 7 '14 at 4:07
3

subfigure package is obsolete. Use subfig package instead. I prefer using subcaption package which provides subfigure environment.

\documentclass[12pt,demo]{elsarticle}
%%%\usepackage{subfig} do not use load this package

\usepackage{subcaption} %%% 

\begin{document}

\begin{figure}
\centering
\begin{subfigure}{.4\textwidth}
    \includegraphics[scale=0.8]{category_a1.png}
    \caption{Frequency of Revolving (Promotional Cash)}
    \label{subfig:cash}
\end{subfigure}
\begin{subfigure}{.4\textwidth}
    \includegraphics[scale=0.8] {category_a2.png}
    \caption{Conditional Expectation (Promotional Cash)}
    \label{subfig:pcash}
\end{subfigure}
\begin{subfigure}{.4\textwidth}
    \includegraphics[scale=0.8]{category_b1.png}
    \caption{Frequency of Revolving (Regular Cash Withdrawal)}
    \label{subfig:frwith}
\end{subfigure}
\begin{subfigure}{.4\textwidth}
    \includegraphics[scale=0.8]{category_b2.png}
    \caption{Conditional Expectation (Regular Cash Withdrawal)}
    \label{subfig:cewith}
\end{subfigure}
\begin{subfigure}{.4\textwidth}
    \includegraphics[scale=0.8]{category_c1.png}
    \caption{Frequency of Revolving (Retail Transactions)}
    \label{subfig:frtra}
\end{subfigure}
\begin{subfigure}{.4\textwidth}
    \includegraphics[scale=0.8]{category_c2.png}
    \caption{Conditional Expectation (Retail Transactions)}
    \label{subfig:cetra}
\end{subfigure}
\caption{Validation of Revolving by Categories}
\label{fig:revol}
\end{figure}

Refer to figure~\ref{fig:revol}
\end{document}

enter image description here

  • For examples using subfloat from subfig package, refer to its manual or this site. If you need any help feel free to ping. It is almost same as your example in the question with \subfigure replaced by \subfloat – user11232 Aug 7 '14 at 4:22
3

The causes of the incorrect number in the cross-reference to the figure as a whole are (i) the incorrect use of {...} to encase the material after \begin{figure} and (ii) the fact that the \label{fig:revol} statement does not occur immediately after the corresponding \caption statement (viz., \caption{Validation of Revolving by Categories}). Instead, the statement \label{fig:revol} is deferred until after various subfigures, each with their own implicit caption statements, have been processed. Hence LaTeX ends up associating the label with one of the subfigures instead of with the figure as a whole.

The figure environment does not take an explicit argument that needs to be delimited in curly braces. Get rid of the braces and/or -- I recommend and -- place the \label statement immediately after the associated \caption statement, and the problem with the incorrect cross-reference is solved.

A separate matter: as @HarishKumar has already noted in his separate answer, the subfigure package is considered obsolete. Use either subfig or subcaption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.