# Incompatibility between footmisc-option multiple and hyperref

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.)

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

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:

-
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

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.}

-
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
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
@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
Thanks, @Stephen! The sentence you quote from the footmisc manual has been in there, AFAICT, more or less unchanged for quite a few years. Alas, to date nobody has risen to the challenge of providing a solution. –  Mico Jan 5 '12 at 18:33

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}

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