为什么 autoref 在引用时会在“图形”文本的位置显示空白

为什么 autoref 在引用时会在“图形”文本的位置显示空白

我目前正在写硕士论文,遇到了一个小问题。

我创建了一个由三个小图组成的图,每个小图都有自己的子文本,将图渲染为 4.1a、4.1b 和 4.1c。当通过 \autoref 命令引用这些图时,我得到的结果为 (4.1a),而预期结果应该是 (图 4.1a)。

之前引用独立图时,引用工作正常。图 4.1出现在我的图表列表中,并且参考文献确实参考了正确的图表。

为什么会发生这种情况?我该如何解决?

图示:

\begin{figure}[H]
\centering
\subfloat[\centering The evolution of the Figma market share in comparison to competitors following its release.]{\includegraphics[width=0.40\textwidth]{figures/prototype/tools/PrototypingNEW.PNG}
\label{fig:figmaevolution}
}
\qquad
\subfloat[\centering Figma's market share for UI Prototyping, in comparison to the market in which it competes. ]{\includegraphics[width=0.49\textwidth]{figures/prototype/tools/Prototyping2NEW.PNG}
\label{fig:figmafourtimes}
}
\qquad
 \subfloat[\centering Results from each individual surveyed category, showing Figma as the clear collective victor. ]{\includegraphics[height=0.55\textwidth]{figures/prototype/tools/FigmaDominance.PNG}
\label{fig:figmadominance}
}
\caption{Results of UX/UI Survey 2020. Displays Figmas relative market share and versatility.}
\label{fig:figmafigure}
\end{figure}

答案1

无论您做什么,都必须删除,\stepcounter{fig:figmafigure}因为此指令会引发错误消息。

看起来您正在使用该subfig软件包。如果这个假设正确,您需要提供说明

\providecommand{\subfigureautorefname}{Figure}

以便判断\autoref在处理时应该使用哪个前缀\autoref{fig:figmaevolution}。并且,放置子图的\label指令里面零件[...]

也就是说,您可能希望使用cleveref包及其用户级宏\cref来代替\autoref。 For\cref可以做几乎任何事\autoref,而且更好。例如,\cref可以接受多个参数,而\autoref不能;请参阅下面的应用程序示例代码。

顺便说一句,我看不出使用双花括号来括起\includegraphics语句的合理理由;单花括号就可以了。最后但并非最不重要的是,你必须放置\label{fig:figmafigure} \caption{}figure如果您打算在文档的某处交叉引用整个内容。

在此处输入图片描述

\documentclass{book} 
\usepackage{subfig}
\usepackage[demo]{graphicx} % remove 'demo' option in real document
\usepackage[justification=centering]{caption} % optional

\usepackage{hyperref}
\providecommand{\subfigureautorefname}{Figure} % <-- new
\hypersetup{colorlinks,allcolors=blue} % optional

\usepackage[nameinlink,noabbrev,capitalize]{cleveref} % optional
\begin{document}

\setcounter{chapter}{4} % just for this example
\setcounter{section}{1} % just for this example
\begin{figure}[ht!]     % '[ht!]' is safer than 'H'
\centering

\subfloat[Evolution of Figma's market share in comparison to its competitors', following its release.%
   \label{fig:figmaevolution}]%
   {\includegraphics[width=0.475\textwidth]{figures/prototype/tools/PrototypingNEW}}% % no need to specify '.png' extension
\hfill  % "\hfill" is better (and more robust!) than "\qquad"
\subfloat[Figma's market share for UI Prototyping, in comparison to the market in which it competes.%
   \label{fig:figmafourtimes}]%
   {\includegraphics[width=0.475\textwidth]{figures/prototype/tools/Prototyping2NEW}}

\subfloat[Results from each individual surveyed category, showing Figma as clear collective victor.%
   \label{fig:figmadominance}]%
   {\includegraphics[height=0.55\textwidth]{figures/prototype/tools/FigmaDominance}}

\caption{} \label{fig:figmafigure}
%% \stepcounter{fig:figmafigure}  % this instruction throws an error 
\end{figure}

A cross-reference to \autoref{fig:figmaevolution}.

Cross-references to \cref{fig:figmaevolution,fig:figmadominance}.
\end{document}

相关内容