我想实现嵌套的脚注以单个序列出现,如下所示嵌套脚注使用 memoir 类。虽然 Werner 给出的答案乍一看确实有效,但因为它基于 article 类中的定义,所以它消除了 memoir 中的多个脚注功能(类似于)。下面的 mwe 显示了这个问题。可以通过注释掉和\usepackage[multiple]{footmisc}
的重新定义来查看脚注标记的正确格式。\footnotemark
\footnotetext
\documentclass{memoir}
\usepackage{letltxmacro}
\newcounter{fnmarkcntr}
\newcounter{fntextcntr}
\makeatletter
\renewcommand{\footnotemark}{%
\@ifnextchar[\@xfootnotemark
{\stepcounter{fnmarkcntr}%
\refstepcounter{footnote}\label{footnotemark\thefnmarkcntr}%
\protected@xdef\@thefnmark{\thefootnote}%
\@footnotemark}}
\makeatother
\LetLtxMacro{\oldfootnotetext}{\footnotetext}
\renewcommand{\footnotetext}[1]{%
\refstepcounter{fntextcntr}
\oldfootnotetext[\ref{footnotemark\thefntextcntr}]{#1}
}
\begin{document}
This text has footnotes%
\footnote{Which contains sub-footnotes\footnotemark% \multfootsep
\footnotemark that should be marked clearly as separate}%
\footnotetext{This footnote should be labeled `2'}%
\footnotetext{This footnote should be labeled `3'}%
\footnote{Another footnote}%
\end{document}
如果没有这两个\renewcommand
s,我们会得到默认输出,其中脚注的编号是错误的:
我认为\m@makefootnotemark
(也许其他宏)来自回忆录)需要修改,但它的定义(和用法)太复杂了,我无法通过类比找出必要的改变。
答案1
我不确定这是否是原因。我认为该\label
命令引入了空格,从而扰乱了多脚注输入。这是一个有效示例:
\documentclass{memoir}
\newcounter{myfn}
\newcounter{tpmyfn}
\makeatletter
\def\footnotemark{\@ifnextchar [\@xfootnotemark%
{\advance\c@myfn1\c@tpmyfn\numexpr\value{myfn}+\value{footnote}%
\protected@xdef\@thefnmark{\thetpmyfn}%
\@footnotemark}}
\def\footnotetext{%
\@ifnextchar [\@xfootnotenext%
{\stepcounter{footnote}\c@myfn0\protected@xdef\@thefnmark{\thempfn}%
\@footnotetext}}
\makeatother
\begin{document}
This text has footnotes%
\footnote{Which contains sub-footnotes\footnotemark\footnotemark that should be marked clearly as separate}%
\footnotetext{This footnote should be labeled `2'}%
\footnotetext{This footnote should be labeled `3'}%
\footnote{Another footnote}%
\end{document}