
我想實現以單一序列出現的巢狀腳註,如下所示嵌套腳註與回憶錄課。雖然維爾納給出的解決方案作為該問題的答案乍一看確實有效,但由於它基於文章類中的定義,因此消除了回憶錄中的多個腳註功能(類似於\usepackage[multiple]{footmisc}
)。下面的 mwe 顯示了問題。透過註解掉\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}