2

I need to include a footnote in an equation, and as it turns out I need to reference both the equation and the footnote so I want to \label them.

Here is what I am tryng to do:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \begin{equation}
        \label{eq:sum}
        1+1=2\footnote{\label{fn:hello}Hello.}
    \end{equation}
\end{document}

And here is the result:

./test.tex:6: Package amsmath Error: Multiple \label's: label 'eq:sum' will be lost.

Any workaround?

2
  • 2
    slightly off-topic ... if the equation contains superscripts, the superscripted footnote marker could be a source of confusion for the reader. Jun 26, 2018 at 14:31
  • @barbarabeeton, I didn't include it in my example to keep it minimal, but what I really do is 1+1=2 \quad.\footnote{...}
    – scozy
    Jun 26, 2018 at 19:55

1 Answer 1

5

A workaround is to split the \footnote in \footnotemark and \footnotetext:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
    \label{eq:sum}
    1+1=2\footnotemark
\end{equation}
\footnotetext{\label{fn:hello}Hello.}% <-- This % is important :)
See equation~\eqref{eq:sum} and footnote~\ref{fn:hello}.
\end{document}

another is to copy the definition of \label to another location beforehand and use the new name in the equation:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\let\LTXlabel\label
\begin{equation}
    \label{eq:sum}
    1+1=2\footnote{\LTXlabel{fn:hello}Hello.}
\end{equation}
See equation~\eqref{eq:sum} and footnote~\ref{fn:hello}.
\end{document}

amsmath.sty redefines the \label macro in display math mode to be:

\def\label@in@display{%
    \ifx\df@label\@empty\else
        \@amsmath@err{Multiple \string\label's:
            label '\df@label' will be lost}\@eha
    \fi
    \gdef\df@label
}

this is to ensure that there will be only as much labels as there are equations (for aligned equations, for example).

But this does not take into account that, for example, footnotes may use labels, which is still a valid, and will produce the correct output. This is why one needs to either externalize the usage of \label (as in the first workaround) or use the real \label (second workaround).

2
  • The first approach seems to insert a space before the first character of the line following the equation.
    – twofeet
    Jan 10, 2021 at 18:43
  • 1
    @twofeet That's because who wrote the answer didn't check the output properly ;-) (it was missing a % at the end of the line) Jan 11, 2021 at 23:09

You must log in to answer this question.

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