1

When I want to place a footnote above some operator I usually use something like this

\begin{equation}
2 + 2 \stackrel{\footnotemark}{=} 4
\end{equation}
\footnotetext{it's trivial.}

which works fine as long as I only use it once in the equation. If I try to use it twice, both of the footnotes get numbered with the bigger counter, like this:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
%
\begin{equation}
1 \stackrel{\footnotemark}{=} 1 \stackrel{\footnotemark}{=} 1
\end{equation}
\footnotetext{is equal to}
\footnotetext{is the same as}
%
\end{document}

enter image description here

In the accepted answer to Multiple footnotes in equations in stackrel/overset with hyperref, the workaround is using the stackon command from the stackengine package. However, this has some drawbacks:

1) the hyperref links don't work;

2) the following counter doesn't have the right number, as shown in this example:

\begin{equation}
1 \stackon[1pt]{=}{\Shortstack{\footnotemark[1]}} 1 \stackon[1pt]{=}{\Shortstack{\footnotemark[2]}} 1
\end{equation}
\footnotetext[1]{is equal to}
\footnotetext[2]{is the same as}
%
\footnote{a third footnote, with the wrong counter.}

3) the spaces before and after the equal sign are removed:

enter image description here

So my question is: is there a way to solve this problem while still using stackrel?

1 Answer 1

0

When in doubt, use saveboxes. I don't know why this works, but I suspect is has something to do with synchronizing the counters for \footnotemark and \footnotetext.

\documentclass{article}
\usepackage{hyperref}

\newsavebox{\footboxa}% reserve global box registers
\newsavebox{\footboxb}

\begin{document}
%
\sbox\footboxa{\footnotemark}\footnotetext{is equal to}%
\sbox\footboxb{\footnotemark}\footnotetext{is the same as}%
\begin{equation}
1 \stackrel{\usebox\footboxa}{=} 1 \stackrel{\usebox\footboxb}{=} 1
\end{equation}
%
\end{document}
3
  • This solves the problem, but I wouldn't mind a more "automatic" approach, since it requires me to add a new savebox everytime I need more boxes.
    – noibe
    Apr 29, 2019 at 11:30
  • I know, what I meant to say was: say you have an equation where you want to use three times this \stackrel... command, then you'd have to add another \newsavebox in your preamble, and so on...
    – noibe
    Apr 29, 2019 at 16:20
  • Also, you can't put \footnotetext inside a group (local only). You might look at tex.stackexchange.com/questions/185140/reusing-saveboxes/… Apr 29, 2019 at 16:23

You must log in to answer this question.

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