[Tex/LaTex] Multiple Footnotes in the same caption/figure/table/equation with hyperref

captionsequationsfloatsfootnotespdftex

Multiple Footnotes in the same caption/figure/table/equation and using hyperref

This question is very similar on Multiple Footnotes in the same caption/figure/table/equation and using hyperref
Since I want to award a bounty I specify the problem here more clearly with an example which needs to be fixed to get the bounty, without any error and without any warnings.

% !TeX TS-program = pdflatex
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
% !BIB TS-program = bibtex
%LaTeX=>PDF
\documentclass[a4paper]{report}
\usepackage{lipsum}  %enables \lipsum
\renewcommand{\baselinestretch}{1.24}
\usepackage[english]{babel} %enables \lipsum
\usepackage{pdflscape}     % enables \begin{landscape}...\end{landscape}
\usepackage{tablefootnote}
\usepackage{hyperref}      % enables \href{}{} and \url
\begin{document}

%Problem A1: Multiple footnotes in figurecaption
    \begin{figure}[htb]
        \caption[123]{A\footnote{\label{first}some footnote}B\tablefootnote{4}
            X\footnotemark{} Y\footnotemark{} Z\footnotemark{}}
    \end{figure}
    \addtocounter{footnote}{-3} %3=n
    \stepcounter{footnote}\footnotetext{a}
    \stepcounter{footnote}\footnotetext{b}
    \stepcounter{footnote}\footnotetext{c}

%Problem A2: Multiple footnotes in tablecaption
 \begin{table}[htb]
    \caption[123]{A\footnote{\label{table}some footnote}B\tablefootnote{4}
        X\footnotemark{} Y\footnotemark{} Z\footnotemark{}}
    \begin{tabular}{p{\hsize}}
        some table
    \end{tabular}
 \end{table}
 \addtocounter{footnote}{-3} %3=n
 \stepcounter{footnote}\footnotetext{a}
 \stepcounter{footnote}\footnotetext{b}
 \stepcounter{footnote}\footnotetext{c}

%Problem A3: Multiple footnotes in euqation
 \begin{eqnarray}
  A
  &\stackrel{\footnotemark}{=}&
  B\cr
  &\stackrel{\footnotemark}{=}&
  C
 \end{eqnarray}

%Problem B: (not working Workaround for A2): multiple footnotes in a table, with workaround tablefoote creates footnote on different page
 \begin{landscape}
     %some previous pages with landscape
     \clearpage
     \begin{table}[htb]

        \begin{tabular}{p{\hsize}}
            \lipsum[1-3]\footnote{test0}\tablefootnote{test1}\footnote{test2}
        \end{tabular}

     \end{table}\clearpage
     %further pages with landscape
 \end{landscape}

\end{document}

Problem A1,A2,A3 are the same Problem with hyperrefencing footnotes once for figure, once table and once for equation. Problem B might be suggested as a Workaround with tablefootnote ( table: footnote appears on previous page ), but it shows an example where the tablefootnote does not work.

I get two different warnings:

pdfTeX warning (ext4): destination with the same identifier (name{Hfootnote. }) has been already used, duplicate ignored

and

pdfTeX warning (dest): name{Hfootnote. } has been referenced but does not exist, replaced by a fixed one

result

Following requirements, for been awarded with a bounty (also I'm interested in other solutions)

  • Since it should work on a different computer, changing the binary of LaTeX is not allowed.
  • It should to be compiled with pdflatex.
  • It has to use hyperref, and the footnotemarks should link to the
    footnotetext.

Best Answer

Problem A: Solved

This combination of packages:

works well for me (MWE below). It seems to allow any number of footnotes within figures, tables, and equations, without having to manually update the footnote counter.

Problem B: not solved

The only caveat: Problem B is not solved -- footnotetext may still appear on a different page than footnotemark. However, this is a well-known but surprisingly unsolved problem. IMHO it is not worth fixing since it occurs so infrequently, and I'm sure the reader will be able to figure it out ;)

Problem C: Referencing footnotes in equations.

As shown below, you cannot reference footnotes defined within equations, since the \label links to the equation, not the footnote.

It seems strange to me to have footnotes within equations, and some people would agree, so I might reconsider if this is absolutely necessary.

MWE

Code

% !TeX TS-program = pdflatex
% !TeX encoding = UTF-8
% !TeX spellcheck = en_US
% !BIB TS-program = bibtex
%LaTeX=>PDF

\documentclass[12pt]{report}

% solution-related packages
\usepackage{hyperref,tablefootnote,footnotehyper}
\hypersetup{colorlinks}

% formatting stuff
\renewcommand{\baselinestretch}{1.24}
\usepackage{amsmath,booktabs,mwe,pdflscape}
\usepackage[margin=3cm]{geometry}
\setlength{\belowcaptionskip}{\abovecaptionskip}

\begin{document}

Reference the labeled footnote in the figure: \ref{fig-note};

\dots and in the table: \ref{tab-note};

\dots but not in the equation: \ref{eqn-note}.

% Problem A1: solved using tablefootnote -> tablefootnote
%             while this is a figure, it still seems to work
  \begin{figure}[htb]
    \centering
    \includegraphics[width=0.3\textwidth]{example-image}
    \caption[123]{Figure caption with notes:
      A\tablefootnote{\label{fig-note}figure note labeled}
      X\tablefootnote{figure note a}
      Y\tablefootnote{figure note b}}
  \end{figure}

% Problem A2: solved using tablefootnote -> tablefootnote
  \begin{table}[htb]
    \centering
    \caption[123]{Table caption with notes:
      A\tablefootnote{\label{tab-note}table note labeled}
      X\tablefootnote{table note a}
      Y\tablefootnote{table note b}}
     \begin{tabular}{cccccc}\toprule
       A & B & C & D & E & E \\\midrule
       1 & 1 & 2 & 3 & 5 & 8 \\\bottomrule
     \end{tabular}
  \end{table}

% Problem A3: solved using footnotehyper -> savenotes
  \begin{savenotes}
  \begin{align}
    A &\stackrel{\footnote{\label{eqn-note}equation note labeled}}{=} B\\
      &\stackrel{\footnote{equation note a}}{=} C\\
      &\stackrel{\footnote{equation note b}}{=} D
  \end{align}
  \end{savenotes}

% Problem B: someone write a damned package for this already
%            we can usually avoid this problem unless
%            the footnotes are right near the page-break like this
\begin{landscape}
  \clearpage
  \begin{table}[htb]
    \begin{tabular}{p{0.95\hsize}}
      \lipsum[1-3]
      \tablefootnote{test 1}
      \tablefootnote{test 2}
      \tablefootnote{test 3}
    \end{tabular}
  \end{table}
  \clearpage
\end{landscape}

\end{document}

Result

enter image description here