为什么子图显示错误的参考编号?

为什么子图显示错误的参考编号?

我使用 \begin{figure}-\end {figure}来显示一个图形和\begin {figure} \subfigure{} \end {figure}一页上连接的多个图形。(通过使用\usepackage{subfigure})当我引用\subfigure(一个图形标签中的多个图形)时,引用编号显示错误。例如,它应该是图(5),但它显示图(3.1)
这是我的子图代码之一。

\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

subfigure包已过时。请使用subfig包代替。我更喜欢使用subcaption提供subfigure环境的包。

\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}

在此处输入图片描述

答案2

整个图中交叉引用的数字不正确的原因是(i)错误地使用了{...}来包围} 之后的材料,\begin{figure以及(ii)语句\label{fig:revol}不会立即发生相应的\caption语句(即\caption{Validation of Revolving by Categories})。相反,该语句\label{fig:revol}被推迟到已处理了各种子图,每个子图都有自己的隐式标题语句。因此,LaTeX 最终将标签与其中一个子图相关联,而不是与整个图相关联。

环境figure确实不是采取需要用花括号分隔的显式参数。删除花括号和/或——我建议——将该\label语句紧接在关联\caption语句之后,交叉引用不正确的问题就解决了。

另一件事:正如@HarishKumar 在其单独的回答中已经指出的那样,该subfigure软件包已被视为过时。使用subfigsubcaption

相关内容