footception 帖子 (脚注:脚注内的脚注内的脚注) 描述了如何递归地添加脚注。我试图制作一个嵌套的脚注,将其放置在与调用脚注相同的脚注装置中,但编号出现了问题。以下是演示该问题的 MWE:
\documentclass{article}
\begin{document}
This is a footnote\footnote{Here is a footnote within the footnote\footnotemark{}. And here is another one\footnotemark{}.}
\footnotetext{This footnote should be labeled `2'}
\footnotetext{This footnote should be labeled `3'}
\end{document}
输出如下:
请注意错误的脚注编号。如何纠正?我想使用自动脚注枚举,因此应避免使用\footnotemark[2]{}
和等临时解决方案。\footnotetext[2]{}
主要编辑#1:
该软件包bigfoot
由乔恩作为该问题的解决方案;但是,虽然bigfoot
允许构建多个脚注设备并允许从上级设备向下级设备进行评论,但下面的 MWE 表明bigfoot
无法允许设备内脚注(以及从下级设备向上级设备进行脚注):
\documentclass{article}
\usepackage{fullpage}
\usepackage{bigfoot}
\DeclareNewFootnote{default}
\DeclareNewFootnote{B}[alph]
\MakeSortedPerPage{B}
\begin{document}
This text has a footnote in the default apparatus%
\footnote{Here.}%
as well as an alphabetical apparatus%
\footnoteB{Here.}.
\verb+bigfoot+ allows subordinate footnotes from a superior apparatus to an inferior apparatus%
\footnote{Like this\footnoteB{See.}.}, but not from an inferior apparatus to a superior apparatus%
\footnoteB{Like this\footnote{Error.}.}. %
Likewise, \verb+bigfoot+ forbids making a nested footnote from one apparatus to the same apparatus%
\footnote{Like this\footnote{Error}.}\footnoteB{And like this\footnoteB{Error}.}. %
A quick look at \verb+bigfoot.sty+ shows this to be true: \textit{``Higher-placed footnotes can't be anchored %
in inferior ones.''} This means one cannot call a footnote from an inferior to superior apparatus or even from %
one apparatus to the same apparatus. I am particularly interested in footnoting from one apparatus to the same %
apparatus. I do not want multiple apparatus \footnote{Yes this is the correct plural\footnote{Fail.}.}.
\end{document}
为了方便起见,我将输出发布为 .tif 图像:
答案1
重新定义方式\footnotemark
和\footnotetext
操作是可能的。以下是其中一种可能性:
\documentclass{article}
\usepackage{letltxmacro}% http://ctan.org/pkg/letltxmacro
\newcounter{fnmarkcntr}\newcounter{fntextcntr}
\makeatletter
\renewcommand{\footnotemark}{% Taken from article.cls
\@ifnextchar[\@xfootnotemark
{\stepcounter{fnmarkcntr}% added
\refstepcounter{footnote}\label{footnotemark\thefnmarkcntr}% modified
\protected@xdef\@thefnmark{\thefootnote}%
\@footnotemark}}
\makeatother
\LetLtxMacro{\oldfootnotetext}{\footnotetext}% store \footnotetext in \oldfootnotetext
\renewcommand{\footnotetext}[1]{%
\stepcounter{fntextcntr}% step to next "footnotemark"
\oldfootnotetext[\ref{footnotemark\thefntextcntr}]{#1}%
}
\begin{document}
This is a footnote\footnote{Here is a footnote within the footnote\footnotemark. And here is another one\footnotemark.}
\footnotetext{This footnote should be labeled '2'.}
\footnotetext{This footnote should be labeled '3'.}
\end{document}
这个想法是重新定义\footnotemark
使用\refstepcounter
而不是并通过某个计数器(在上述情况下)\stepcounter
为每次使用应用标签。然后,对于每次连续使用,都会提取适当的标签并将其放置在可选参数中。这需要两次编译才能使引用正确。\footnotemark
fnmarkcntr
\footnotetext{<text>}
\oldfootnotetex[..]{<text>}
也可以\footnotemark
使用etoolbox
而不是复制原始定义article.cls
。
警告:此方法与以下方法不兼容hyperref
。