![带节号的图形编号,子图问题](https://linux22.com/image/268979/%E5%B8%A6%E8%8A%82%E5%8F%B7%E7%9A%84%E5%9B%BE%E5%BD%A2%E7%BC%96%E5%8F%B7%EF%BC%8C%E5%AD%90%E5%9B%BE%E9%97%AE%E9%A2%98.png)
我将论文中的图形编号改为章节样式编号:
\numberwithin{figure}{section}
这很好,但以下 MWE 中仍然存在唯一的问题:
\documentclass[english,12pt]{article}
\usepackage{float}
\usepackage{subfigure}
\begin{document}
\begin{figure}[H]
\centering
\subfigure[First temperature cycle. We measured additionally at +1$^{\circ}$C.]{
\includegraphics[width=0.98\textwidth]{./figures/mu_vs_v_1st.pdf}
\label{fig:mu_vs_v_1st}
}\\
\subfigure[Second temperature cycle. Note the difference to the first cycle of 1$^{\circ}$C in the highest temperature measured.]{
\includegraphics[width=0.98\textwidth]{./figures/mu_vs_v_2nd.pdf}
\label{fig:mu_vs_v_2nd}
}
\label{fig:mu_vs_v}
\end{figure}
\end{document}
在这里我得到了整个图形的章节样式编号(图 5.3 - 该图是第 5 节中的第三个图形),但我得到了图 7(a)和 7(b)以便直接参考子图(该图是整个论文中的第七个)。
我应该如何更改才能使子图也获得图 5.3(a) 和 5.3(b)?提前致谢!
答案1
您可以重新定义\p@subfigure
哪些控件用于对子图的交叉引用的前缀:
\documentclass[english,12pt]{article}
\usepackage[demo]{graphicx}
\usepackage{float}
\usepackage{amsmath}
\usepackage{subfigure}
\numberwithin{figure}{section}
\makeatletter
\renewcommand\p@subfigure{\thefigure}
\makeatother
\begin{document}
\section{Test Section}
A reference to subfigures~\ref{fig:mu_vs_v_1st} and~\ref{fig:mu_vs_v_2nd}
\begin{figure}[H]
\centering
\subfigure[First temperature cycle. We measured additionally at +1$^{\circ}$C.]{%
\includegraphics[width=0.98\textwidth]{./figures/mu_vs_v_1st.pdf}
\label{fig:mu_vs_v_1st}%
}\\
\subfigure[Second temperature cycle. Note the difference to the first cycle of 1$^{\circ}$C in the highest temperature measured.]{%
\includegraphics[width=0.98\textwidth]{./figures/mu_vs_v_2nd.pdf}
\label{fig:mu_vs_v_2nd}
}
\caption{test figure with subfigures}
\label{fig:mu_vs_v}
\end{figure}
\end{document}
选项demo
只是graphicx
用黑色矩形替换实际图形;不是在实际文档中使用该选项。
顺便说一句,subfigure
这是一个过时的软件包。你应该考虑使用subfig
或者subcaption
反而。
使用该subfig
包还有一个额外的好处:您不需要重新定义,\p@subfigure
因为包内部已经为您完成了这项工作:
\documentclass[english,12pt]{article}
\usepackage[demo]{graphicx}
\usepackage{float}
\usepackage{amsmath}
\usepackage[listofformat=subparens]{subfig}
\numberwithin{figure}{section}
\begin{document}
\section{Test Section}
A reference to subfigures~\ref{fig:mu_vs_v_1st} and~\ref{fig:mu_vs_v_2nd}. And another reference to subfigures~\ref{fig:mu_vs_v}\subref{fig:mu_vs_v_1st} and~\ref{fig:mu_vs_v}\subref{fig:mu_vs_v_2nd}
\begin{figure}[H]
\centering
\subfloat[First temperature cycle. We measured additionally at +1$^{\circ}$C.\label{fig:mu_vs_v_1st}]{%
\includegraphics[width=0.98\textwidth]{./figures/mu_vs_v_1st.pdf}}\\
\subfloat[Second temperature cycle. Note the difference to the first cycle of $1^{\circ}$C in the highest temperature measured.\label{fig:mu_vs_v_2nd}]{%
\includegraphics[width=0.98\textwidth]{./figures/mu_vs_v_2nd.pdf}}
\caption{test figure with subfigures}
\label{fig:mu_vs_v}
\end{figure}
\end{document}