將 biblatex 參考書目連結到引文而不列印反向引用

將 biblatex 參考書目連結到引文而不列印反向引用

在我的 biblatex 參考書目中,我的參考文獻旁邊有類似 [1] 的數字。當我單擊引文 [1] 時,它會連結到參考書目 [1](感謝 hyperref 套件)。有沒有辦法在相反的方向建立這樣的連結?那麼從參考書目中,我很快就能看到引用的參考文獻在哪裡?這個解決方案幾乎是我想要的,但它要求列印引文頁碼,而我不想要這樣。我意識到如果我多次引用參考文獻就沒有意義,但對我來說很少出現這種情況。

答案1

以下解決方案不使用backref,而是基於 的連結verbose-inote

我們在每次引用處設定一個連結錨點,並將參考書目中的標籤連結回第一個錨點(我們可以安全地以供以後使用)。

這要求每個條目的第一次引用發生在 之前\printbibliography

微量元素

\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}

在此輸入影像描述

相關內容