figref с подрисунком и скобками

figref с подрисунком и скобками

Я использую 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}.я получаю:

что показано на рис. 16а.

Однако я хочу увидеть

что показано на рис. 16(а).

Я перепробовал все, что смог найти, включая вариации

\usepackage[subrefformat=parens,labelformat=parens]{subfig}

и

\renewcommand{\thesubfigure}{(\alph{subfigure})}

Параметры в первом, похоже, не имеют никакого эффекта с figref. Когда я использую \renewcommand, figrefработает, но подписи на самом рисунке получают двойные скобки, например((а)) Фу.

решение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}

введите описание изображения здесь

Связанный контент