# Labeling a Footnotemark

Is there a way to label a \footnotemark instance (without redefining the \footnotemark macro)? Labeling the \footnotemark has no effect (it labels whatever environment the command is invoked from) and labeling its corresponding \footnotetext is not guaranteed to produce the correct number (it merely returns the current value of the default footnote counter). See below:

    \documentclass{article}
\begin{document}
This text is footnoted\footnotemark\label{fnm:1} \footnotemark\label{fnm:2}
\footnotetext{Footnote 1'\label{fnt:1}.}%
\footnotetext{Footnote 2'\label{fnt:2}.}%

The numbers of the labels: %
\{\ref{fnm:1}, \ref{fnt:1}, \ref{fnm:2},  \ref{fnt:2}\}

The sequence should read: \{1, 1, 2, 2\}
\end{document}


Output:

Labeling a \footnote is trivial as one can simply call the \label command from within the footnote environment. However, LaTeX does not appear to support labeling of a \footnotemark. Please advise if there is an efficient solution to label a \footnotemark. Thank you.

-
Could you explain a little more what you're trying to do? Do you expect the label of the footnotemark to point to the footnotemark itself, or to the footnote? And should the hyperref link take you to the footnote, or to the footnotemark? Why do you want to use \footnotemark and \footnotetext instead of \footnote{Footnote 1\label{fn:1}}? –  Jake Dec 20 '11 at 3:08
Hi @Jake: I merely want to store the value of the footnote counter at the point in time when the \footnotemark is placed. This way, I can place a series of footnotemarks, label each one with a number that corresponds to the footnote counter (e.g., \arabic{footnote}), and then subsequently print the corresponding \footnotetext with the appropriate number by referencing (\ref) the corresponding \footnotemark. The reason I wish to avoid the strategy you mentioned is that I intend to use footnotes within footnotes and the only way I know to achieve this is to place footnotemarks. Thanks. –  user001 Dec 20 '11 at 3:18

\footnotemark executes \stepcounter{footnote} by default, which does not allow proper referencing. If you want to label a footnote, you need to use \refstepcounter{footnote}. As such, you would need to patch \footnotemark or do other trickery in order to obtain the correct result. \footnotetext on the other hand, has no counter associated with it and therefore cannot be referenced in the same way.

\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
% Patch \footnotemark to provide a label that can be referenced.
\patchcmd{\footnotemark}{\stepcounter{footnote}}{\refstepcounter{footnote}}{}{}
\begin{document}
This text is footnoted\footnotemark\label{fnm:1} \footnotemark\label{fnm:2}
\footnotetext{Footnote 1'\label{fnt:1}.}%
\footnotetext{Footnote 2'\label{fnt:2}.}%

The numbers of the labels: %
\{\ref{fnm:1}, \ref{fnt:1}, \ref{fnm:2},  \ref{fnt:2}\}

The sequence should read: \{1, 1, 2, 2\}
\end{document}


In order to adequately reference a \footnotetext with the same marker as some \footnotemark, you need to be able to pass an expandable reference of that marker to the specific \footnotetext's optional argument. This is the technique that causes hyperref incompatibility in Nested footnotes.

-
Thank you @Werner. The patch you describe permits labeling of footnotemarks. As you have stated, if I subsequently attempt \footnotetext[\ref{fnm:1}]{...}, it appropriately numbers the footnotetext if and only if the hyperref package is omitted. You mention that this is due to the need to pass an expandable reference (perhaps hyperref chooses to act on the \footnotetext only if variable expansion is used?). I suppose there is no way "pre-expand" the reference and thereby pass in a literal? I notice there are no problems if a literal is passed. –  user001 Dec 20 '11 at 3:43