ネストされた脚注を回想録と組み合わせるにはどうすればよいでしょうか?

ネストされた脚注を回想録と組み合わせるにはどうすればよいでしょうか?

ネストされた脚注を次のように単一のシーケンスで実装したい。ネストされた脚注を 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}

出力には、本文と最初の脚注の両方に、不適切な形式の脚注マークがあります。 mwe出力

2 つの\renewcommands がないと、脚注の番号が間違って付けられたデフォルトの出力が得られます。 ここに画像の説明を入力してください

私は、memoir の (そしておそらく他のマクロも) 変更する必要があると考えています\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}

ここに画像の説明を入力してください ここに画像の説明を入力してください

関連情報