0

I would like the sub footnotes to be done automatically (to be able to write \footnote in the \footnote). By using this answer I was able to get the desired result.

But the problem is that the footnote number uses another counter. I would like the sub footnotes to have the same counter as the main footnotes

I tried based on this answer (the desired result being the same) but without success.

Minimal example

\usepackage{bigfoot}
\DeclareNewFootnote{default}
\DeclareNewFootnote{A}
\DeclareNewFootnote{B}

\MakeSortedPerPage{footnoteA} \MakeSortedPerPage{footnoteB}

\makeatletter \let\oldfootnote\footnote \let\oldfootnoteA\footnoteA

\def\footnote{% \refstepcounter{footnote}% \kernel@ifnextchar[{\footnotenew}{\footnotenew[\c@footnote]}% } \def\footnotenew[#1]#2{% \oldfootnote[#1]{\let\footnote\footnoteA#2}% }

\def\footnoteA{% \refstepcounter{footnoteA}% \kernel@ifnextchar[{\footnotenewA}{\footnotenewA[\c@footnoteA]}% } \def\footnotenewA[#1]#2{% \oldfootnoteA[#1]{\let\footnote\footnoteB#2}% } \makeatother

\begin{document}

Some text with a footnote \footnote{% First footnote% \footnote{% Second inner footnote% \footnote{% Third inner footnote% }% }% } Some more text \end{document}

Bernard
  • 271,350
Brinfer
  • 105

1 Answers1

0

If I understand your question correctly, this should achieve what you want. However, Did you test if you have another footnote afterward. The display of the footnotes will not follow the order of their number. Because the the subfootnote was in the individual group of their own. I think using their own counters might be better in this case. Also if you wanna another layer of nested footnote, you need to keep defining the next \DeclareNewFootnote (e.g. footnoteC) . In general, I think you shouldn't use \footnote to generate a nested footnotes. It's better to use \footnotemark and \footnotetext.

\documentclass{article}
\usepackage{bigfoot}
\DeclareNewFootnote{default}
\DeclareNewFootnote{A}
\DeclareNewFootnote{B}
\DeclareNewFootnote{C}

\MakeSortedPerPage{footnoteA} \MakeSortedPerPage{footnoteB} \MakeSortedPerPage{footnoteC}

\makeatletter \let\oldfootnote\footnote \let\oldfootnoteA\footnoteA \let\oldfootnoteB\footnoteB

\def\footnote{% \stepcounter{footnote}% \kernel@ifnextchar[{\footnotenew}{\footnotenew[\c@footnote]}% } \def\footnotenew[#1]#2{% \oldfootnote[#1]{\let\footnote\footnoteA#2}% } \def\footnoteA{% \stepcounter{footnote}% \kernel@ifnextchar[{\footnotenewA}{\footnotenewA[\c@footnote]}% } \def\footnotenewA[#1]#2{% \oldfootnoteA[#1]{\let\footnote\footnoteB#2}% } \def\footnoteB{% \stepcounter{footnote}% \kernel@ifnextchar[{\footnotenewB}{\footnotenewB[\c@footnote]}% } \def\footnotenewB[#1]#2{% \oldfootnoteB[#1]{\let\footnote\footnoteC#2}% } \makeatother

\begin{document} Some text with a footnote \footnote{% First footnote% \footnote{% Second inner footnote% \footnote{% Third inner footnote% }% }% } Some more text\footnote{% Another footnote% \footnote{% Another second inner footnote% \footnote{% Another third inner footnote% }% }% } \end{document}

enter image description here enter image description here

Edit: According to your comment:

\documentclass{article}
\usepackage{etoolbox}
\usepackage{bigfoot}
\DeclareNewFootnote{default}
\DeclareNewFootnote{A}
\DeclareNewFootnote{B}
\DeclareNewFootnote{C}

\MakeSortedPerPage{footnoteA} \MakeSortedPerPage{footnoteB} \MakeSortedPerPage{footnoteC}

\makeatletter \let\oldfootnote\footnote \let\oldfootnoteA\footnoteA \let\oldfootnoteB\footnoteB \patchcmd{\MFL@makemark}{#2{#1}}{\setcounter{#1}{1}}{}{} \renewcommand{\thefootnoteA}{\arabic{footnote}.\arabic{footnoteA}} \renewcommand{\thefootnoteB}{\arabic{footnote}.\arabic{footnoteA}.\arabic{footnoteB}}

\def\footnote{% \footnotenew% } \def\footnotenew#1{% \oldfootnote{\let\footnote\footnoteA#1}% } \def\footnoteA{% \footnotenewA% } \def\footnotenewA#1{% \oldfootnoteA{\let\footnote\footnoteB#1}% } \def\footnoteB{% \footnotenewB% } \def\footnotenewB#1{% \oldfootnoteB{\let\footnote\footnoteC#1}% } \makeatother

\begin{document} Some text with a footnote\footnote{% First footnote% \footnote{% Second inner footnote% \footnote{% Third inner footnote% }% }% } Some more text\footnote{% Another footnote% \footnote{% Another second inner footnote% \footnote{% Another third inner footnote% }% }% } \end{document}

enter image description here enter image description here

Tom
  • 7,318
  • 4
  • 21
  • Thank you very much for this answer, I can see the problem. Is it then possible to put, for the nested footnote, values like 1.1, 2.1 (<main_footnote_counter>.<nested_footnote_counter>) – Brinfer Jun 15 '22 at 08:19
  • @Brinfer see my edits. – Tom Jun 15 '22 at 09:38