Can someone help me to make this?
Different numbers for the same footnote
cross-referencingfootnotes
Related Solutions
You could do this (tested in article
and amsart
):
Text with first footnote\footnote{\label{note1}This is the labeled footnote}
and more text with a second footnote\footnote{here}.
In this new paragraph we have a reference to the first
footnote\footnotemark[\ref{note1}].
The result will be
Edit: Further testing reveals, that the above solution fails when footnotes are numbered with anything other regular numbers. This is due to the fact, that the argument to \footnotemark
is the value of a counter. Placing
\makeatletter
\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
\makeatother
in the preamble will allow us to mend the above example allowing any numbering of the footnotes.
Text with first footnote\footnote{\label{note1}This is the labeled footnote}
and more text with a second footnote\footnote{here}.
In this a paragraph we have a reference to the first footnote\footnoteref{note1}.
Edit 2: This will cause a problem when using hyperref
where the link created by the \footnoteref
macro points to the previous footnote and not to the referenced footnote. Using the package cleveref
as in this answer seems to be the perfect fit.
To get the footnote number as superscript use \textsuperscript{\ref{<label>}}
. The link box provided by hyperref
is not easy to tweak with, but in Adjust box around hyperref footnote links there is a solution to make all boxes fit the number tightly.
Resulting in:
MWE
\documentclass[11pt, a4paper, oneside]{article}
\usepackage{hyperref}
%% Code from https://tex.stackexchange.com/a/45656/81905
\usepackage{ltxcmds}
\makeatletter
\renewcommand{\footnote}[2][\empty]{%
\nolinebreak%
\addtocounter{footnote}{+1}%
\xdef\sfootnote@number{\arabic{footnote}}%
\ltx@ifpackageloaded{hyperref}{% hyperref loaded
\ifHy@hyperfootnotes% option hyperfootnotes=true
\addtocounter{Hfootnote}{+1}%
% Code from the hyperref package
\global\let\Hy@saved@currentHref\@currentHref%
\hyper@makecurrent{Hfootnote}%
\global\let\Hy@footnote@currentHref\@currentHref%
\global\let\@currentHref\Hy@saved@currentHref%
% End of code form the hyperref package
\fi%
}{% hyperref not loaded, nothing to be done here
}%
\xdef\sfootnote@opt{#1}% contains the optional argument
\xdef\sfootnote@arabic{\arabic{footnote}}% is the Arabic footnotenumber
\edef\sfootnote@formated{\thefootnote}% could also be * or dagger
\ifx\sfootnote@opt\empty% i.e. no optional argument used
\footnotetext{\label{fnr:\sfootnote@arabic}#2}%
\else%
\ltx@ifpackageloaded{hyperref}{% hyperref loaded
\footnotetext[#1]{\phantomsection\label{fnr:\sfootnote@arabic}#2}%
}{% hyperref not loaded
\footnotetext[#1]{\label{fnr:\sfootnote@arabic}#2}%
}%
\fi%
\ltx@ifpackageloaded{hyperref}{% hyperref package loaded
\ifHy@hyperfootnotes% option hyperfootnotes=true
\hbox {\@textsuperscript {\normalfont \ref{fnr:\sfootnote@arabic}}}%
\else% option hyperfootnotes=false
\hbox {\@textsuperscript {\normalfont \ref*{fnr:\sfootnote@arabic}}}%
\fi%
}{% hyperref package not loaded
\hbox {\@textsuperscript {\normalfont \ref{fnr:\sfootnote@arabic}}}%
}%
}
\makeatother
%% End of code
\begin{document}
\noindent Textoç~\footnote{TextFootnote\label{ftn:X}} \\
TextB~\textsuperscript{\ref{ftn:X}}
\end{document}
Best Answer
Update 2022/05/29
The package and its documentation is basically finished and shall be published by 2022/05/31. Apart from the approach below, the final package also adopted a more convenient syntax proposed by @antshar. The commands are separated into two groups:
For examples you may refer to the documentation.
Update 2022/05/26:
I've converted this into a new package
multifootnote
(combined with my answer in this related question). The commands stated in the answer below have been renamed to\multifootnotemark
(or still\footnotenumber
) and\multifootnotetext
(or simply\multifootnote
).When the documentation is finished, it shall be uploaded to CTAN. This is expected to be finished before June.
Here is an automatic version. I defined two new commands:
\footnotenumber
and\footnotemultiple
.\footnotenumber
takes one optional argument, namely the label.\footnotemultiple
works similar as\footnote
, with the optional argument here as a list of labels you wish to refer to.Below is a complete example (if you prefer to have no hyperlink on the numbers in the footnote, simply replace
\ref
with\ref*
).Old answer
You can use
\footnotemark
to produce the number, and\footnotetext
to produce the text (\footnote
is just the combination of them). To get the1,2,3
, I locally redefined\thefootnote
.By the way, this TeX FAQ page might be helpful to you: Footnotes whose texts are identical.