
我將 IEEEtran 與 subfigure 和 一起使用\figref
。
\begin{figure}
\centering
\subfloat[Foo.\label{fig:test-foo}]{\includegraphics[width=0.4\textwidth]{foo}} \\
\subfloat[Bar.\label{fig:test-bar}]{\includegraphics[width=0.4\textwidth]{bar}}
\caption{Foo and Bar.}
\label{fig:test}
\end{figure}
當我使用時which is shown in \figref{fig:test-foo}.
我得到:
如圖16a所示。
不過,我想看看
如圖16(a)所示。
我已經嘗試了我能找到的一切,包括各種變體
\usepackage[subrefformat=parens,labelformat=parens]{subfig}
和
\renewcommand{\thesubfigure}{(\alph{subfigure})}
第一個選項似乎對 沒有任何影響figref
。當我使用\renewcommand
,figref
有效,但圖中的標題本身有雙括號,例如((a)) 富。
答案1
嘗試以下操作:
\documentclass{IEEEtran}
\usepackage{graphicx}
\usepackage[labelformat=simple]{subfig} % <---
\renewcommand{\thesubfigure}{(\alph{subfigure})} % <---
\newcommand\figref[1]{Fig.~\ref{#1}} % <---
\begin{document}
\begin{figure}
\centering
\subfloat[Foo.\label{fig:test-foo}]{\includegraphics[width=\columnwidth]{example-image-a}} \\
\subfloat[Bar.\label{fig:test-bar}]{\includegraphics[width=\columnwidth]{example-image-b}}
\caption{Foo and Bar.}
\label{fig:test}
\end{figure}
\ldots which is shown in \figref{fig:test}, particularly in \figref{fig:test-foo}
\end{document}