26

There is a question about nested footnotes with commas, which has some answers. Nested footnotes can be properly numbered, and they can be properly hyperlinked. Remaining problem: Hyperlinked footnotes are not separated by commas, although the footmisc package with option multiple is used. Minimal not-working example:

\documentclass{article}
\usepackage[multiple]{footmisc}
\usepackage{hyperref}
\begin{document}
Text\footnote{Here is a footnote.}\footnote{Here is another footnote.}.
\end{document}

While \textsuperscript{,\,} between the footnote(mark)s would be possible, I am looking for some automatic solution. (The better, if it would also work for nested footnotes.)

2
  • Section 2 of the footmisc manual states very clearly that footmisc is incompatible with hyperrefs hyperfootnotes option.
    – lockstep
    Jan 4 '12 at 20:37
  • 2
    @lockstep: Yes, thus: How to solve this?
    – Stephen
    Jan 4 '12 at 20:45
38

I see that I come some months to late but I want to present my approach to maybe solve the problem or at least to provide a workaround. The problem at my side is, the approach is so simple so that I can't imagine that there is no other people who had the same idea before. So my question is: Where is the catch in this approach?

To explain the code: I redefine the footnote-command and have a look to the following command using \futurelet. If the next command is also a footnote-command a , is included. What do you think about it?

\documentclass{article}
\usepackage{hyperref}

\let\oldFootnote\footnote
\newcommand\nextToken\relax

\renewcommand\footnote[1]{%
    \oldFootnote{#1}\futurelet\nextToken\isFootnote}

\newcommand\isFootnote{%
    \ifx\footnote\nextToken\textsuperscript{,}\fi}

\textheight=3cm
\begin{document}

Text\footnote{First footnote}\footnote{Second footnote}\footnote{Third footnote} Text\footnote{Fourth footnote} Text

\end{document} 

And this is the output of the given example: multiple footnotes

2
  • 1
    The \ifx\footnote\nextToken could use a \else\ifx\footnotemark\nextToken\textsuperscript{,}\fi% (and \footnoetmark would be needed to be redefined similar to the redefinition of \footnote), but otherwise your solution indeed seems to be the obvious one. (Optional argument for footnotes would be needed, too.) Hyperref could do something like "if package footmisc has been loaded with option multiple, then redefine footnote as done by Holle". +1 for this!
    – Stephen
    Oct 5 '12 at 17:13
  • This is also a Steven but from the future. ;) There apparently were some fixes in the meantime and the behavior now is better. If one loads footmisc before hyperref the MWE and my own use case work fine. However, when you load them the other way around there is a benign(?) warning LaTeX Warning: Command \@footnotemark has changed. If you additionally use a footnote in a minipage you would get another warning however: Package hyperref Warning: Ignoring empty anchor on input line…. Not sure if it's actually a problem but it was not reported yet and kept me looking for a while.
    – stefanct
    Feb 19 '20 at 1:36
12

As @lockstep notes in the comments section above, the incompatibility between the footmisc and hyperref packages -- which somehow ends up suppressing the automatic insertion of a raised comma between consecutive footnote marks -- is sadly a fairly well-known phenomenon.

As a workaround, you could set up a macro named, say, \fnsep (short for "footnote mark separator") in the preamble:

\newcommand\fnsep{\textsuperscript{,}}

and then insert this little macro every time you have two consecutive footnotes -- which doesn't happen very often, right? -- as in

Text.\footnote{Here is a footnote.}\fnsep\footnote{Here is another footnote.}
10
  • 1
    To quote the OP: "I am looking for some automatic solution." ;-)
    – lockstep
    Jan 4 '12 at 22:32
  • @lockstep: Yeah, an automatic solution seems rather elusive, doesn't it? :-( If a halfway decent automatic solution were known, either the hyperref or the footmisc package would have incorporated it by now and hence the question wouldn't have to be asked in the first place, right?
    – Mico
    Jan 4 '12 at 23:00
  • 1
    Don't be so pessimistic. It's like saying "If there were any easy-to-fix bugs in colortbl, they would have been fixed by now." tex.stackexchange.com/questions/39976/…
    – lockstep
    Jan 4 '12 at 23:08
  • 2
    @lockstep & Mico: Here at tex.SE some astonishing solutions have been presented, thus I was just so bold as to ask whether there is some solution to the problem. In the footmisc manual is not written "It's not possible" but "Further work on the interaction between the two packages [footmisc & hyperref] is proposed, but not yet scheduled.", which sounds like it could be possible with enough time and knowledge of TeX. Maybe one needs just the right idea, and maybe somebody already had some solution but never published it? Thus I thought: better ask, as the worst case would be no answer.
    – Stephen
    Jan 5 '12 at 18:27
  • 1
    After six month, there are now two (!) solutions. To quote my comment: "Here at tex.SE some astonishing solutions have been presented". I know it was the right place to ask! Now that there are real solutions, I did accept one of those instead of your answer. Sorry! But I gave a +1 for it.
    – Stephen
    Oct 5 '12 at 17:17
10

Another possibility: the fnpct package handles multiple footnotes and supports hyperref correctly. However, since the main purpose of the package is a different one you might want to use its option dont-mess-around.

\documentclass{article}
\usepackage{fnpct}
 % uncomment if don't want the kerning and punctuation switching:
% \setfnpct{dont-mess-around}
\usepackage[colorlinks]{hyperref}
\begin{document}

Text\footnote{First footnote}\footnote{Second footnote}\footnote{Third footnote}
Text\footnote{Fourth footnote} Text

\newpage\null%so we see that the hyperlinks are correct
\end{document}

enter image description here

4
  • Hey, that also works with a \footnotemark after a \footnote - but not with two consecutive \footnotemarks. +1 nevertheless!
    – Stephen
    Oct 5 '12 at 17:23
  • 5
    I like a package having an option like dont-mess-around.
    – Dohn Joe
    May 12 '15 at 12:31
  • 2
    @DohnJoe Me too :)
    – cgnieder
    May 12 '15 at 13:08
  • For \multfootnote automagic, and for package babel using French, see this comment
    – hdl
    Mar 4 '16 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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