Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

A solution that resolves LaTeX's inability to properly number nested footnotes has the side effect of abolishing comma delination of sequential footnotes (a feature provided by the footmisc package), as shown below (note the missing comma between footnote 2 and 4): enter image description here

    \documentclass{article}

    \usepackage[multiple]{footmisc}
    \usepackage{letltxmacro}% http://ctan.org/pkg/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]{%
      \stepcounter{fntextcntr}%
      \oldfootnotetext[\ref{footnotemark\thefntextcntr}]{#1}
    }

    \begin{document}
    This text has multiple sequential footnotes, but comma delination is disrupted %
    if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
    \footnote{Here is another footnote.\footnotemark{}}%
    \footnotetext{This is the nested footnote.}%
    \footnote{Here is the third (non-nested) footnote.}.%
    \end{document}

Could someone please help me to resolve this problem, so that proper comma delination, per the footmisc package is possible? Many thanks.

share|improve this question
    
The quickest solution is to modify the line as \oldfootnotetext[\ref{footnotemark\thefntextcntr}\textsuperscript{,}]{#1}. But probably it won't fix the spacing issue. –  percusse Dec 28 '11 at 9:30
    
Thanks percusse. I tried this, but it also places commas when only a single footnote is used, which is undesirable. Another interesting behavior is that it also places commas in the main text at the point a footnote is called for each nested footnote within that footnote. I'm not sure why it exhibits this latter behavior. Cheers. –  user001 Dec 28 '11 at 11:41

3 Answers 3

up vote 9 down vote accepted

The following document prints correctly the nested footnote, with commas in the proper places:

\documentclass{article}
\usepackage[multiple]{footmisc}
\begin{document}
This text has multiple sequential footnotes, with
commas at the proper places\footnote{Here is a footnote}%
\footnote{Here is another footnote.\footnotemark{}}%
\footnotetext{This is the nested footnote.}%
\footnote{Here is the third (non-nested) footnote.}.
\end{document}

Here is the result:

enter image description here

I can understand your desire of automatically include multiple nested footnotes, but the "solution" you adopted doesn't seem to be very useful (it produces an error on first compilation, for example). Multiple nested footnotes are shown here

This text has multiple sequential footnotes, with
commas at the proper places\footnote{Here is a footnote}%
\footnote{Here is another footnote.\footnotemark{} with another\footnotemark{}}%
\addtocounter{footnote}{-1}\footnotetext{This is the first nested footnote.}%
\addtocounter{footnote}{1}\footnotetext{This is the second nested footnote.}%
\footnote{Here is the third (non-nested) footnote.}.

You can probably work from here to get a working solution.

share|improve this answer
    
Your proposal is very helpful. Can it be made more general? Supposing I had 5 nested footnotes, I would need to call \addtocounter{footnote}{-5} and then \addtocounter{footnote}{1} at each footnotetext command. If I added another footnotemark, then I would have to readjust the counters manually. One benefit of the solution originally proposed by @Werner is that it took care of footnote counting automatically and permitted use of \ref with \footnotemark because \stepcounter was replaced with \refstepcounter. Is there a solution that achieves these along with comma delimiting? –  user001 Dec 28 '11 at 11:35

I recently answered another question and somehow got carried away... anyway, there now is a new package, fnpct, which (by accident, really) offers a solution. Or rather two solutions.

  1. the \innernote command
  2. the \multfootnote command

The following code shows three working examples and one with a maybe unexpected output:

\documentclass{article}
% the option turns the punctuation switching and kerning adjustments off:
\usepackage[dont-mess-around]{fnpct}
\usepackage[colorlinks]{hyperref}
\begin{document}

% \innernote works well as long as you don't need to nest another level deeper
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
\footnote{Here is another footnote\innernote{This is the nested footnote}.}%
\footnote{Here is the third (non-nested) footnote.}.%

% The consecutive placing works well as long as one uses the package option
% `punct-after' (or the option `dont'mess-around' which calls the former
% implicitly) but fails otherwise:
\newpage
\setfnpct{punct-after=false}
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
\footnote{Here is another footnote\innernote{This is the nested footnote}.}%
\footnote{Here is the third (non-nested) footnote.}.%

% if it is a single inner footnote then \multfootnote works, too:
% place \footnotemark and use the * argument (= \footnotetext) inside
% \multfootnote. In this case the package option doesn't disturb anything.
\newpage
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\multfootnote{Here is a footnote;Here
is another footnote\footnotemark.;*This is the nested footnote.;Here is the third
(non-nested) footnote.}.%

% the combination of both methods is probably best:
\newpage
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\multfootnote{Here is a footnote;Here
is another footnote\innernote{This is the nested footnote}.;Here is the third
(non-nested) footnote.}.%

% so we can see that `hyperref' cooperates well:
\newpage\null

\end{document}

The fourth example looks like this:

enter image description here enter image description here

share|improve this answer

Below your question at http://tex.stackexchange.com/a/38652/10127 there is a comment:

Another possible solution can be found at tex.stackexchange.com/a/38898/6865 (including support for hyperref). – Stephen Dec 20 at 18:55

which is easy to miss. Applied to this case it means:

\documentclass{article}

\usepackage[multiple]{footmisc}

\usepackage{tablefootnote}[2011/11/26]% v1.0e

\makeatletter
\newcommand{\spewnotes}{%
\tfn@tablefootnoteprintout%
\global\let\tfn@tablefootnoteprintout\relax%
\gdef\tfn@fnt{0}%
}
\makeatother

%\usepackage{hyperref}

\begin{document}
This text has multiple sequential footnotes, with
commas at the proper places\footnote{Here is a footnote}%
\footnote{Here is another footnote.\tablefootnote{This is the first nested footnote.}%
with another\tablefootnote{This is the second nested footnote.}}\spewnotes{}%
\footnote{Here is the third (non-nested) footnote.}.

\newpage

The second page is needed when testing the hyperlinks.

\end{document}

Caveat!

  • The solution of egreg will not produce the right hyperlinks! (But tablefootnote will do this.)
  • When using the hyperref package, neither egreg's solution nor my one will produce commas between footnotes, not even between those created by

    \footnote{Here is a footnote}\footnote{Here is another footnote.}
    

You could call this a bug in either the footmisc or the hyperref package. Thus either hyperref (and \textsuperscript{,\,} between the footnote(mark)s or automatical commas.

About \spewnotes: The tablefootnote package is used for footnotes in tables, which are not possible except using \footnotemark in the table and \footnotetext{...} after the table. The \tablefootnote-command places the mark in the table, remembers the content of the footnote, and at the end of the table the footnote-text is placed. AND those \addtocounter{footnote}{+/- something} as well as \addtocounter{Hfootnote}{+/- something} for the hyperlinks are done automatically (& some additionally necessary code). You do not have a table here, but the same \footnotemark/\footnotetext issue, therefore \tablefootnote{...} can be used. But because it is not used in a table, there is no end of that table, and therefore the footnotes remembered by the tablefootnote-package are never issued. (Well, at the next table, but that is not what you want.) Therefore \spewnotes "spews" those footnotes manually: \tfn@tablefootnoteprintout prints the footnote, \global\let\tfn@tablefootnoteprintout\relax clears the memory of the tablefootnote package (i.e. \tfn@tablefootnoteprintout), otherwise the footnotes would be repeated the next time \spewnotes or a table is used, and \gdef\tfn@fnt{0} sets the footnote (fnt) "flag" of the tablefootnote package to zero, i.e. there are no unprocessed table footnotes. Documented tablefootnote source code can be found at ctan.org/tex-archive/macros/latex/contrib/tablefootnote.

share|improve this answer
    
Thanks Stephen. So, the solution you have posted will enable compatibility with hyperref, but not with footnote comma separation? It sounds as though these two features are mutually exclusive and I will have to choose whichever is more important to me. Could you briefly explain how your spewnotes function works? Thanks. –  user001 Dec 28 '11 at 22:14
1  
When used without hyperref, the commas are set correct with both solutions. With hyperref, the commas are not set in any of the two solutions. The hyperlinks are correct in the "tablefootnote/spewnotes" solution only. Just added an explanation of \spewnotes to the answer. –  Stephen Dec 29 '11 at 18:16
    
Great, thanks so much Stephen. I really appreciate it! –  user001 Dec 29 '11 at 18:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.