在源内移动脚注文本而不移动标签

在源内移动脚注文本而不移动标签

我经常在文档中写一些相当长的脚注,用于讨论切线或次要问题,而不会打断正文的流程。然而,这会使编辑变得困难,因为文本主体有时会被相当长的注释打断。我想要的是一种将脚注文本(同时仍将其保留在同一文件中)移出脚注标记的方法,而不会破坏脚注的默认放置规则。

我曾尝试使用 \footnotemark 和 \footnotetext,如下所示:

Paragraph containing a footnote\footnotemark and some more text afterward.
   \footnotetext{A very long footnote that now doesn't have to appear in the middle of a 
sentence in my source file.}

但是,这会导致我的脚注文本有时会出现在脚注标记后面的页面上,而不是总是出现在与标记相同的页面上。(当我在一个段落中有多个注释时,情况会变得有点混乱。)

有没有办法将脚注文本与源代码中脚注标记的位置分开,同时让输出看起来好像 \footnote{位于文本中间}?(最好允许每个段落有多个脚注?)如果有明显的答案,请原谅;我已经搜索了一段时间,但还没有找到任何东西。

MWE(编辑以换行):

\documentclass{article}
\begin{document}

A paragraph that has a footnote\footnote{Like this one here but even longer and more 
intrusive so that it makes reading and editing the text very difficult. It probably goes 
on and on and might even have \\ multiple \\ long \\ paragraphs inside of it.} in the 
middle of it. The footnote is placed correctly, but the source is difficult to read and 
edit.

A paragraph with a footnote in the middle of it\footnotemark{} that then continues onto a 
new page. The source is easy to read and edit, but the footnote lands in the wrong place.
\newpage
   \footnotetext{A footnote that I would like to have appear on the same page as the 
footnote mark, but without having the footnote text in the middle of my paragraph in the 
source.}

\end{document}

答案1

一种无需软件包的简单解决方案是在命令中段落外的某个位置定义脚注,并将此命令用作 的参数\footnote。缺点是需要定义命令否则,您将收到未定义的控制序列错误。这也是使用包时的一个问题,sepfootnotes其他答案,尽管在这种情况下只有一个警告而不是错误(但如果在使用它之后定义了脚注,则不会打印脚注)。

为了在使用后定义脚注,可以将其存储在文件中.aux,例如使用globalvals包。这需要对.tex文件进行两次编译,类似于标签和引用。

梅威瑟:

\documentclass{article}
\usepackage{globalvals}
\begin{document}
% simple \def without packages, needs to be defined before use
\def\firstlongnote{Like this one here but even longer and more 
intrusive so that it makes reading and editing the text very difficult. It probably goes 
on and on and might even have \\ multiple \\ long \\ paragraphs inside of it.}

A paragraph that has a footnote\footnote{\firstlongnote} in the 
middle of it. The footnote is placed correctly, but the source is difficult to read and 
edit.

% using the globalvals package, use the footnote first and define later
A paragraph with a footnote in the middle of it\footnote{\useVal{longnote}} that then continues onto a 
new page. The source is easy to read and edit, but the footnote lands in the wrong place.
   \defVal{longnote}{A footnote that I would like to have appear on the same page as the 
footnote mark, but without having the footnote text in the middle of my paragraph in the 
source.}

\end{document}

结果:

在此处输入图片描述

答案2

看起来这个包九月脚注正是您正在寻找的。

根据其文档,该包将脚注(或尾注)的输入与其使用分开。它提供了一个命令来定义注释的内容,以及另一个命令来将注释插入文档。

您可以按任何特定顺序对脚注定义进行分组,可以在序言中、在章节或部分开头、在段落之前,甚至可以在单独的文件中。

此外,您可以互换使用sepfootnotes和标准\footnote在同一文档中加拿大运输安全局

如果九月脚注不适合您,可以通过格式化使源代码更具可读性,特别是如果您有一个高级编辑器。

A paragraph that has a footnote\footnote{%
          Like this one here but even longer and more intrusive
          so that it makes reading and editing the text very difficult.
          It probably goes on and on and might even have \\ multiple
          \\ long \\ paragraphs inside of it.}%
\ in the middle of it. The footnote is placed correctly, but the source is
difficult to read and edit.

此外,如果您使用能够以离散颜色(例如浅灰色)显示脚注内文本的编辑器,您将很容易看到中断的句子继续在哪里。

相关内容