For example, I want to make footnotes both at Sentence 1 and Sentence 2 (which are on the same page) to the same footnote. Wikipedia's "References" have this effect.
Cross-Referencing – Reference Different Places to the Same Footnote
cross-referencingfootnotes
Related Solutions
There are a number of TeX.SE posts on Joseph's citation style. One of them asks about limiting the \ifciteseen
to the current page. The accepted solution takes an excessive number of LaTeX runs to compile and doesn't sort footnotes.
The new citation command \sfcite
defined in the document below addresses these limitations. It also correctly handles labelnumber
prefixes and shorthands.
\documentclass{article}
\usepackage[style=numeric-comp,sorting=none,citetracker,pagetracker=page]{biblatex}
\usepackage[colorlinks]{hyperref}
\makeatletter
% user-level citation command
\DeclareCiteCommand{\sfcite}[\cbx@superscript]
{\usebibmacro{cite:init}%
\let\multicitedelim\supercitedelim
\iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}%
\iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:super:foot}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}}
% save instcount, save key and last inline instcount if seen first on page
\newbibmacro*{cite:super:foot}{%
\xdef\cbx@key{\thefield{entrykey}}%
\ifsamepage{\value{instcount}}{\csuse{cbx@instcount@\cbx@key}}{}{%
\listxadd{\cbx@savelist}{\cbx@key}%
\ifnumequal{\value{cbx@tempcntd}}{0}{%
\defcounter{cbx@tempcntc}{\value{instcount}}%
\loop\ifnum\value{cbx@tempcntc}>0
\ifsamepage{\value{instcount}}{\value{cbx@tempcntc}}
{\ifcsundef{blx@fnpage@\number\numexpr\value{cbx@tempcntc}}
{\setcounter{cbx@tempcntd}{\value{cbx@tempcntc}}}{}%
\stepcounter{cbx@tempcntc}}
{\setcounter{cbx@tempcntc}{0}}%
\repeat}{}}%
\csnumgdef{cbx@instcount@\cbx@key}{\value{instcount}}}
\let\cbx@savelist\@empty
\newcounter{cbx@tempcntc}
\newcounter{cbx@tempcntd}
\setcounter{cbx@tempcntd}{0}
\newrobustcmd*{\cbx@superscript}[1]{%
\global\toggletrue{cbx@sfcite}
\mkbibsuperscript{#1}%
\cbx@footnote%
\global\togglefalse{cbx@sfcite}}
\newtoggle{cbx@sfcite}
\AtEveryCitekey{%
\ifciteseen{}{\csnumgdef{cbx@instcount@\thefield{entrykey}}{-1}}%
\iftoggle{cbx@sfcite}{}{\cbx@footnote}}
\AtEveryBibitem{\cbx@footnote}
\AtEveryLositem{\cbx@footnote}
% defer citation footnotes to last inline reference instance on page
\newrobustcmd*{\cbx@footnote}{%
\ifboolexpr{ not test {\ifdefempty{\cbx@savelist}}
and test {\ifnumequal{\value{instcount}}{\value{cbx@tempcntd}}} }
{\cbx@sortlist@init%
\let\do\cbx@do
\dolistloop{\cbx@sortlist}%
\global\let\cbx@savelist\@empty
\setcounter{cbx@tempcntd}{0}}{}}
% print footnotes in 'sorting' order
\def\cbx@do#1{%
\ifinlist{#1}{\cbx@savelist}
{\begingroup
\blx@resetdata
\blx@getrefcontext{#1}%
\blx@getdata@cite{#1}%
\blx@setoptions@type\abx@field@entrytype
\blx@setoptions@entry
\blx@execute
\blx@beglang
\iffieldundef{shorthand}
{\gdef\@thefnmark{\printfield{labelprefix}\printfield{labelnumber}}}
{\gdef\@thefnmark{\printfield{shorthand}}}%
\gappto\@thefnmark{\blx@initunit}%
\ifhyperref
{\H@@footnotetext{\blx@driver\abx@field@entrytype}}
{\@footnotetext{\blx@driver\abx@field@entrytype}}%
\blx@endlang
\endgroup}
{}}
% access internal list of sorted entry keys
\def\cbx@sortlist@init{%
\global\letcs{\cbx@sortlist}
{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}}
\let\cbx@sortlist\@empty
\makeatother
\addbibresource{biblatex-examples.bib}
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\begin{document}
\null\vfill\noindent
New citation.\sfcite{companion}
New and recurrent citations.\sfcite{kant:ku,companion}
Vanilla footnote with citation.\footnote{Following \textcite{companion}...}
\clearpage
\null\vfill\noindent
New citation.\sfcite{ctan}
Recurrent citations from previous and current pages.\sfcite{companion,ctan}
\clearpage
\printbibliography
\end{document}
Here are the citations from the first page:
And the second:
Printing of citation footnotes is deferred to the last inline citation, list of shorthands entry or bibliography item on the current page. This might pose a limitation if the document also contains regular footnotes, but can likely be resolved by using a package like manyfoot
.
I've found a solution which relies on the usage of \phantomsection
.
Here's a minimal working example of such solution:
\documentclass[%
reprint,
nofootinbib,
amsmath,amssymb,
aps,
]{revtex4-2}
\usepackage{hyperref} % Add hypertext capabilities
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
\begin{document}
\title{Title}
% footnote(s) to article title
\homepage[Website:\phantomsection\label{lb:homepage} ]{https://example.org}
\author{Author}
\date{\today}
\maketitle
sample text
\clearpage
sample text2 and reference: Footnote \ref{lb:homepage} on \autopageref{lb:homepage}
\end{document}
This solution was provided by the user Ijon Tichy over at Latex.org - link to forum thread.
Best Answer
You could do this (tested in
article
andamsart
):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. Placingin the preamble will allow us to mend the above example allowing any numbering of the footnotes.
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 packagecleveref
as in this answer seems to be the perfect fit.