使用\footnotemark 的方法意味着在文本中连续编号,而不管\footnotetext 可能出现在哪里。数字不同;它们浮动,引用它们可能与它们在文本中的放置位置不完全一致。此外,它们是相当重要的文档元素,因此应该优先考虑在文档中找到最适合文档的位置,而不一定是参考位置。
所以,如果您有兴趣让浮动决定它的编号 和 位置,那么您可以使用常规的 \label-\ref 系统,如您的示例所示。一些重命名以满足您的要求:
\documentclass{article}
\usepackage{graphicx}
\newcommand{\figuremark}{\ref}
\newcommand{\figuretext}{\caption}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
See Figures~\figuremark{fig:first}, \figuremark{fig:second} and~\figuremark{fig:third}.
\begin{figure}[ht]
\centering\includegraphics[width=.4\linewidth]{example-image-a}
\figuretext{First figure}\label{fig:first}
\end{figure}
\begin{figure}[ht]
\centering\includegraphics[width=.4\linewidth]{example-image-c}
\figuretext[ToC third figure]{Third figure}\label{fig:third}
\end{figure}
\begin{figure}[ht]
\centering\includegraphics[width=.4\linewidth]{example-image-b}
\figuretext{Second figure}\label{fig:second}
\end{figure}
\lipsum[2-5]
\end{document}
如果您希望浮点数降落在可能的位置(即浮动)但修复编号以匹配您的顺序引用,那么您可以执行以下操作:
\documentclass{article}
\usepackage{graphicx}
\newcommand{\figuremark}[1]{\refstepcounter{figure}\label{#1}\thefigure}
\newcommand{\figuretext}[1]{%
\renewcommand{\refstepcounter}[1]{}% Make \refstepcounter a no-op
\renewcommand{\thefigure}{\protect\ref{#1}}% Figure counter is actually a reference
\caption
}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
See Figures~\figuremark{fig:first}, \figuremark{fig:second} and~\figuremark{fig:third}.
\begin{figure}[ht]
\centering\includegraphics[width=.4\linewidth]{example-image-a}
\figuretext{fig:first}{First figure}
\end{figure}
\begin{figure}[ht]
\centering\includegraphics[width=.4\linewidth]{example-image-c}
\figuretext{fig:third}{Third figure}
\end{figure}
\begin{figure}[ht]
\centering\includegraphics[width=.4\linewidth]{example-image-b}
\figuretext{fig:second}{Second figure}
\end{figure}
\lipsum[2-5]
\end{document}
\figuretext{<label>} 的工作方式与\caption 类似,但您必须指定一个随附的<label>,该\figuremark{<label>} 将用作您的\figuremark{<label>} 的参考。
使用常规\label-\ref 方法的优势(好处)是您的浮动决定发生什么,这就是它应该的样子。 \pagerefs 也将是人们所期望的;也就是说,\pageref 将指向该图,而不是该图被引用的位置。