【问题标题】:Is there a latex command \figuremark, analogous to \footnotemark?是否有乳胶命令 \figuremark,类似于 \footnotemark?
【发布时间】:2016-02-06 19:00:26
【问题描述】:

我喜欢用

\footnotemark

\footnotetext{}

(如here 所述) 对于我的脚注,因为它允许我指定脚注的确切位置,同时保持我的乳胶代码的可读性。

是否有一个通用命令可以对数字执行类似的操作?比如:

\figuremark{label_ref}

\begin{figure}
  (my includegraphics, etc.)
  \label{label_ref}
\end{figure}

会给我的人物带来同样的好处。

【问题讨论】:

    标签: latex figure pdflatex


    【解决方案1】:

    使用\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 将指向该图,而不是该图被引用的位置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-15
      • 1970-01-01
      • 1970-01-01
      • 2015-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多