In my biblatex bibliography, I have numbers like [1] next to my references. When I click on the citation [1], it links to the bibliography [1] (thanks to the hyperref package). Is there a way to have such a link in the opposite direction? So from the bibliography, I can quickly see where a reference was cited? This solution is almost what I want, but it requires that the citation page numbers be printed, and I don't want that. I realize this wouldn't make sense if I cite a reference more than once, but that's rarely the case for me.
1 Answer
The following solution does not use backref
, but is based on the linking of verbose-inote
.
We set a link anchor at every citation and link the label in the bibliography back to the first anchor (which we safe for later use).
This requires that the first citation of each entry happens before \printbibliography
.
MWE
\documentclass{article}
\usepackage[backref=false]{biblatex}
\usepackage[colorlinks=false]{hyperref}
\makeatletter
\DeclareFieldFormat{bibhypertarget}{%
\bibhypertarget{\thefield{entrykey}:\the\value{instcount}}{#1}}
\renewbibmacro*{cite}{%
\printtext[bibhyperref]{%
\printtext[bibhypertarget]{%
\printfield{labelprefix}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}}%
\usebibmacro{cite:save}}
\newbibmacro*{cite:save}{%
\ifcsundef{cbx@\thefield{entrykey}}
{\csxdef{cbx@\thefield{entrykey}}{\the\value{instcount}}}
{}}
\newbibmacro{cbx:linktofirstcite}[1]{%
\ifcsdef{cbx@\thefield{entrykey}}
{\bibhyperlink
{\thefield{entrykey}:\csuse{cbx@\thefield{entrykey}}}
{#1}}
{#1}}
\DeclareFieldFormat{labelnumberwidth}{%
\usebibmacro{cbx:linktofirstcite}{\mkbibbrackets{#1}}}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{knuth:ct}
Some text \autocite{geer,worman}.
\clearpage
Some more text \autocite{cicero}.
\printbibliography
\end{document}