该\autoref
命令没有为子浮点数内部的子图提供“图形”标签名称。有答案如何控制标签编号,但标签名称我很幸运找不到答案。我正在采取一种变通方法,\newcommand
在序言中识别,如下面的 MWE 所示,但我希望看到对 hyperref/subfig 包行为的更多控制。
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{hyperref}
\usepackage{subfig}
%Command to add Figure word to the autoref command
\newcommand\sfigautoref[1]{Figure~\autoref{#1}}
\begin{document}
\begin{figure}
\centering
\subfloat[]{
\includegraphics{figa}
%\caption{atest}
\label{a}
}
\subfloat[]{
\includegraphics{figb}
%\caption{btest}
\label{b}
}
\end{figure}
Now this \sfigautoref{a} works, although the link is just on the number a direct use of \texttt{\textbackslash autoref\{text\}} use with controlled behaviour is preferred.
Thanks all in advance,
\end{document}
答案1
请参阅 hyperref 手册第 18 页。请注意,也被(bad)\subfigurename
使用。\subfloat
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{hyperref}
\usepackage{subfig}
\let\subfigureautorefname=\figurename
\begin{document}
\begin{figure}
\centering
\subfloat[\label{a}]{
\includegraphics{figa}
}
\subfloat[\label{b}]{
\includegraphics{figb}
}
\end{figure}
Now this \autoref{a} works as expected.
\end{document}