2

I want to call footnotes in (self-explanatory) equations, so I use \footnotemark and \footnotetext, but the footnote numbering is going wrong. Numbers skip from 1 to 3 (when I'd want a 2), and when I try to addtocounter footnote -1, it doesn't skip anymore, and doesn't increment at all.

Why is that so, and how to get consecutive numbers ?

MWE :

\documentclass[12pt]{report}
\usepackage{amsmath}
\begin{document}

$1^{st}$ footnote call\footnote{some footnote}.
\[a \xrightarrow{2^{nd}\footnotemark} a\]
\footnotetext{$\leftarrow$ this should be footnote 2}

\[a \xrightarrow{3^{rd}\footnotemark} a\]
\footnotetext{$\leftarrow$ this should be footnote 3}

\[a \xrightarrow{4^{th}\addtocounter{footnote}{-1}\footnotemark} a\]
\footnotetext{$\leftarrow$ following the pattern, I'd expect this to be 7 without fix, 6 once fixed. But 5??}
\end{document}

Picture of problem

2 Answers 2

2

Don't do it. Superscripts in math have mathematical meaning and you are confusing the reader with such footnote marks. See also https://tex.stackexchange.com/a/155481/2388.

Beside this: Quite a number of math expressions are processed more than once and so change counters. In your case the problem is the arrow, so you should reset the footnote counter before it.

\documentclass[12pt]{report}
\usepackage{amsmath}
\begin{document}

$1^{st}$ footnote call\footnote{some footnote}.
\[a \addtocounter{footnote}{-1}\xrightarrow{2^{nd}\footnotemark} \]
\footnotetext{$\leftarrow$ this should be footnote 2}

\end{document}
1
  • It's not really math-mode, it really is text over the arrow. I did read, and link to, the same answer as you mention. That works, and I maybe I'll look further into "processed several times", I understand that the counter update had been counted twice, that makes sense now ; many thanks ! Oct 26, 2016 at 17:34
0

Be kind to your readers and don't inflict them footnotes in math mode.

Just to show it's possible, here it is.

\documentclass[12pt]{report}
\usepackage{amsmath}

\makeatletter
\def\ext@arrow#1#2#3#4#5#6#7{%
  \mathrel{\mathop{%
    \let\mathfootnotemark\fake@footnotemark
    \setbox\z@\hbox{#5\displaystyle}%
    \setbox\tw@\vbox{\m@th
      \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
      \hbox{$\scriptstyle\mkern#3mu{#7}\mkern#4mu$}%
      \copy\z@
    }%
    \hbox to\wd\tw@{\unhbox\z@}}%
  \limits
    \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi
                       #7\if0#2\else\mkern#2mu\fi}}%
    \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi
                       #6\if0#2\else\mkern#2mu\fi}}}%
}
\newcommand{\mathfootnotemark}{%
  \ifmeasuring@
    \fake@footnotemark
  \else
    \footnotemark
  \fi
}
\newcommand{\fake@footnotemark}{%
  \textsuperscript{\the\numexpr\value{footnote}+1\relax}%
}
\makeatother

\begin{document}

$1^{st}$ footnote call\footnote{some footnote}.
\[a \xrightarrow{2^{nd}\mathfootnotemark} a\]
\footnotetext{$\leftarrow$ this should be footnote 2}%
text
\[a \xrightarrow{3^{rd}\mathfootnotemark} a\]
\footnotetext{$\leftarrow$ this should be footnote 3}%
text
\[a \xrightarrow{4^{th}\mathfootnotemark} a\]
\footnotetext{$\leftarrow$ this should be footnote 4}%
text
\begin{align}
a & \xrightarrow{5^{th}\mathfootnotemark} a \\
b & \xrightarrow{xxxx} b
\end{align}
\footnotetext{$\leftarrow$ this should be footnote 5}%
text
\end{document}

You must log in to answer this question.

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