如何將嵌套腳註與回憶錄結合?

如何將嵌套腳註與回憶錄結合?

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

輸出的正文和第一個腳註中的腳註標記格式錯誤: 兆威輸出

如果沒有這兩個\renewcommands,我們會得到預設輸出,腳註編號錯誤: 在此輸入影像描述

我認為\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}

在此輸入影像描述 在此輸入影像描述

相關內容