我的 \ref 子图打印“6.8 (a)”,这是正确的。但如果我只想将对子图的引用打印为“(a)”,该怎么办?
这是我的代码:
\begin{figure}[!htbp]
\centering
\subfigure[naive approach]{
\includegraphics[width = .43 \textwidth ]{Graphics/5Implement/featuremaps/intr12/z_ground.png}
\label{fig:a}
}
\subfigure[xyr approach]{
\includegraphics[width = .43 \textwidth ]{Graphics/5Implement/featuremaps/intr12/z_pre.png}
\label{fig:b}
}
\caption{I want to ref the image as "a", this is the 6.8 Figure but as the caption of it own, there is no need to mention 6.8 like \ref{fig:a}}
\label{fig:The_figure_itself_is_6.8}
\end{figure}
答案1
看起来您正在使用该subfigure
软件包。该软件包提供了可用于实现排版目标的subfigure
命令。\subref
在旁边:该subfigure
软件包已弃用。不要使用它。相反,请使用subfig
或subcaption
软件包。真的。如果您需要生动的证据来说明为什么建议避免使用该subfigure
包,仔细查看以下示例中的第一个交叉引用标注:图号未显示为“6.8”,而是显示为“8”。啊。
\documentclass{article}
\usepackage[demo]{graphicx} % omit 'demo' option in real doc.
\usepackage{subfigure} % for \subfigure macro
\counterwithin{figure}{section} % just for this example
\begin{document}
\setcounter{section}{6} % just for this example
\setcounter{figure}{7}
\begin{figure}[!htbp]
\subfigure[Naive approach]{%
\includegraphics[width=.47\textwidth]{a.png}
\label{fig:a}
}%
\hfill
\subfigure[Sophisticated approach]{%
\includegraphics[width=.47\textwidth]{b.png}
\label{fig:b}
}
\caption{Two images}
\label{fig:6.8}
\end{figure}
\noindent
As shown in figure \ref{fig:a}, \dots
\noindent
As shown in panel \subref{fig:a} of figure \ref{fig:6.8}, \dots
\end{document}