0

I want to implement the nested footnotes appearing in a single sequence as in Nested footnotes with the memoir class. While the solution given by Werner as an answer to that question does work at first glance, but because it is based on the definitions in the article class it eliminates the multiple footnote feature in memoir (similar to \usepackage[multiple]{footmisc}). The mwe below shows the problem. The correct formatting of the footnote marks can be seen by commenting out the redefinitions of \footnotemark and \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 labeled3'}% \footnote{Another footnote}%

\end{document}

The output has badly formatted footnote marks, both in the main text and in the first footnote: mwe output

Without the two \renewcommands we get the default output which numbers the footnotes wrong: enter image description here

I think \m@makefootnotemark (and maybe other macros) from memoir needs to be modified but its definition (and usage) is too complicated for me to figure out the necessary change by analogy.

ronno
  • 1,325
  • I tried your MWE, changing the \documentclass from memoir to article. The result looked bad to me. Are you sure about what you want to happen? But perhaps I am completely confused. – Peter Wilson May 14 '22 at 18:29
  • @PeterWilson I don't see significant difference with the footnotes by switching from memoir to article. But removing/commenting out the two \renewcommands shows what I want it to look like (except for the incorrect numbering). – ronno May 15 '22 at 14:14
  • Well I see a significant difference. You expect me to twiddle with your MWE. I don't think that I can help you any more. --- GOM – Peter Wilson May 16 '22 at 17:58
  • @PeterWilson Sorry, could you at least describe what difference you're seeing? For me the MWE as written and changing memoir to article both produce output that's like the first screenshot (ignoring the difference in margins and page number placement), whereas I want the appearance to be more like the second screenshot except for the incorrect numbering. – ronno May 16 '22 at 20:51
  • 1
    I was probably being confused. For your original MWE with the \renew... commands there was no difference between memoir and article output. Without the \renew... commands the memoir output put a comma between between multiple footnote markers (like 1,4 or 2,3) but the article output just strung multiple footnote markers together (like 14 or 23). Good luck. – Peter Wilson May 18 '22 at 17:37
  • I completely missed your problem that footnotes should be numbered in order. Apologies but I don't think that I can help, even though it is a interesting problem (for someone much less decrepit). – Peter Wilson May 18 '22 at 18:27

1 Answers1

1

I am not sure if this is reason. I think the \label command introduce space to mess up the multifootnote typing. This is a working example:

\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 labeled3'}% \footnote{Another footnote}% \end{document}

enter image description here enter image description here

Tom
  • 7,318
  • 4
  • 21