5

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.

1 Answer 1

4
+50

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

6
  • Thanks for the solution using ctan.org/pkg/footnotehyper. I couldn't found this package. You increased the margins (\usepackage[margin=4cm]{geometry}), therfore I reduced \lipsum[1-3] to \lipsum[1-2] in your answer, because I want to show an example where the footnotes would actually fit on the same page as the table. Jul 14, 2018 at 6:49
  • No problem. I tried only to make changes to your MWE to make it easier to compare the code and the result - e.g. the larger margins so that the result after cropping appears larger, and the red hyperlink boxes to red text because the boxes did not print from pdf -> png. Jul 16, 2018 at 23:43
  • @stefan-pinnow You rejected my edit, but now it does not fullfill my request any more (I said without any warning!!), that was the only aim of this bounty to remove warnings. Jul 17, 2018 at 14:57
  • 1
    @JoKalliauer, I just added some edits to satisfy the bounty: there should be no compile errors now. Jul 17, 2018 at 15:11
  • It's weird that in my overleaf, it only has some numbers in the figure's caption, but no corresponding footnote text at the end of the page. I copied the exact same code from you. Could you help me figure it out? thank you
    – Jing
    Oct 7, 2021 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .