链接到不可见参考书目的超链接(hyperref)

链接到不可见参考书目的超链接(hyperref)

我目前有一个相当特殊的参考文献设置,其中有三个不相交的参考书目(其中两个可见)。简而言之,我的问题是:

我如何使\cite超链接指向最后的参考书目?


如果有相关性,以下是我的设置详细信息:

  • 第一个可见的参考书目仅引用某一位作者的文献。

    • 所有书籍参考文献都有一个前缀字母。
    • 其余参考文献均无前缀。其参考编号与其他作者的文献一致。
  • 第二个可见的参考书目列出了所有文章(没有书籍),包括一些文中未引用的文章。

下面是一个关于其实现方式的MWEB:

\documentclass{article}

\usepackage[backend=biber, style=ieee, sorting=nyt, defernumbers=true]{biblatex}
\usepackage{hyperref}

\addbibresource{\jobname.bib}

\begin{filecontents}{\jobname.bib}
    @book{turingBook2001,
        author = {Turing, Alan},
        year = {2001},
        title = {Title},
        keywords = {b},
    }
    @book{turingBook1999,
        author = {Turing, Alan},
        year = {1999},
        title = {Title},
        keywords = {b},
    }
    @article{turingArticle1970,
        author = {Turing, Alan},
        year = {1970},
        title = {Title},
        keywords = {a},
    }
    @article{turingArticle1950,
        author = {Turing, Alan},
        year = {1950},
        title = {Title},
        keywords = {a},
    }
    @article{hamiltonArticle1969,
        author = {Hamilton, Margaret},
        year = {1969},
        title = {Title},
    }
\end{filecontents}



\begin{document}

This work talks about: \cite{turingBook2001}, \cite{turingBook1999}, \cite{turingArticle1970}, \cite{hamiltonArticle1969}.

% Will not be cited:
\nocite{turingArticle1950}

\section{Publications by Alan Turing}

\defbibnote{book}{Book Chapters}
\defbibnote{article}{Articles}

% Invisible Bibliography, so that article publication reference numbers are alphabetically sorted
\newsavebox\mytempbib
\savebox\mytempbib{\parbox{\textwidth}{\printbibliography[notkeyword=b]}}


\begingroup
\let\clearpage\relax  % No new page after each of those bibliographies.

\begin{refcontext}[labelprefix=B]
\printbibliography[heading=none,prenote=book,keyword=b] 
\end{refcontext}
\begin{refcontext}
\printbibliography[heading=none,prenote=article,keyword=a] 
\end{refcontext}


\section{All Articles}
\printbibliography[heading=none,notkeyword=b]
\endgroup

\end{document}

可以看出,\cite{turingBook2001}\cite{turingBook1999}链接到第一个可见的书目,这是想要的行为。另一方面,\cite{turingArticle1970}\cite{hamiltonArticle1969}链接到不可见的书目。

我如何获得\cite{turingArticle1970}\cite{hamiltonArticle1969}链接到最新的参考书目?

答案1

默认情况下,链接biblatex会转到出现某项的第一个参考书目。使用以下技巧,您可以选择性地禁用某些参考书目列表的链接,方法是使设置锚点的命令不执行任何操作。请注意,效果应保持局部(示例中的情况如此,但在其他设置中\begingroup...\endgroup可能需要显式设置)。

\documentclass{article}
\usepackage[backend=biber, style=ieee, sorting=nyt, defernumbers=true]{biblatex}
\usepackage{hyperref}

\makeatletter
\newcommand*{\disablelink}{\let\blx@anchor\relax}
\makeatother

\begin{filecontents}{\jobname.bib}
@book{turingBook2001,
  author   = {Turing, Alan},
  year     = {2001},
  title    = {Title},
  keywords = {b},
}
@book{turingBook1999,
  author   = {Turing, Alan},
  year     = {1999},
  title    = {Title},
  keywords = {b},
}
@article{turingArticle1970,
  author   = {Turing, Alan},
  year     = {1970},
  title    = {Title},
  keywords = {a},
}
@article{turingArticle1950,
  author   = {Turing, Alan},
  year     = {1950},
  title    = {Title},
  keywords = {a},
}
@article{hamiltonArticle1969,
  author = {Hamilton, Margaret},
  year   = {1969},
  title  = {Title},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

This work talks about \cite{turingBook2001,turingBook1999,turingArticle1970,
  hamiltonArticle1969}.

% Will not be cited:
\nocite{turingArticle1950}

\section{Publications by Alan Turing}

\defbibnote{book}{Book Chapters}
\defbibnote{article}{Articles}

% Invisible Bibliography, so that article publication reference numbers are alphabetically sorted
\newsavebox\mytempbib
\savebox\mytempbib{\parbox{\textwidth}{\disablelink\printbibliography[notkeyword=b]}}


\begingroup
\let\clearpage\relax  % No new page after each of those bibliographies.

\begin{refcontext}[labelprefix=B]
\printbibliography[heading=none,prenote=book,keyword=b,resetnumbers] 
\end{refcontext}
\begin{refcontext}
\disablelink
\printbibliography[heading=none,prenote=article,keyword=a] 
\end{refcontext}


\section{All Articles}
\printbibliography[heading=none,notkeyword=b]
\endgroup

\end{document}

事实证明,图片中看不到链接目标。因此,此输出截图毫无意义。

相关内容