直接引用子图

直接引用子图

我已经写了这段代码。对于图来说还好。问题是关于对子图的引用。

\begin{figure*}[!t]
\normalsize
    \begin{subfigure}[b]{0.48\textwidth}
        \includegraphics[width=\textwidth]{img/sigma-v} \label{fig:Pv-sigma}
        \caption{$P(v)$ trend to the vary of pole $p$.}
        \label{fig:sigma}
    \end{subfigure}%
    ~
    \begin{subfigure}[b]{0.48\textwidth}
        \includegraphics[width=\textwidth]{img/gamma-v} \label{fig:Pv-gamma}
        \caption{$\gamma(v)$ trend to the vary of pole $p$.}
        \label{fig:gamma}
    \end{subfigure}
\vspace*{-2em}
\caption{Trend of model $P(v) = \hat{q} v^\gamma$ to the vary of pole $p$ and speed $v$.}\label{fig:Pv}
\vspace*{-8pt}
\hrulefill
\vspace*{-8pt}
\end{figure*}

The results is in Fig.~\ref{fig:Pv-sigma}, Fig.~\ref{fig:Pv-gamma} e Fig.~\ref{fig:Pv}.

我得到:

结果

有没有一种方法可以直接参考图形和子图,而不需要仅参考图形并手动添加 a、b、c......?

笔记我使用这个包:

\documentclass[conference,a4paper]{IEEEtran}
\usepackage{spconf,amsmath,graphicx,cite}
\usepackage{epstopdf,epsfig,mathtools,caption,subcaption,amsfonts}

错误我使用了双重标签(正如您在答案中所看到的)。

因此,问题不在于交叉引用,而在于这部分代码:

        \includegraphics[width=\textwidth]{img/sigma-v} %\label{fig:Pv-sigma}
        \caption{$P(v)$ trend to the vary of pole $p$.}
        \label{fig:sigma}

代码中标注的地方解决问题。

答案1

您在两个subfigure环境中都添加了额外的(不需要的)标签。例如,您有:

\begin{subfigure}[b]{0.5\textwidth}
    \includegraphics[width=\textwidth]{img/sigma-v} \label{fig:Pv-sigma}
    \caption{$P(v)$ trend to the vary of pole $p$.}
    \label{fig:sigma}
\end{subfigure}%

删除\label{fig:Pv-sigma},这样就剩下一个,即\label{fig:sigma}。然后您就可以成功引用它。当然,其他标签也一样。

因此最后你可以写以下内容:

The results are in Fig.~\ref{fig:sigma}, Fig.~\ref{fig:gamma} and Fig.~\ref{fig:Pv}.

图1

相关内容