自定义参考书目的超链接发送至文档顶部

自定义参考书目的超链接发送至文档顶部

我使用它来在我的文档中创建参考文献的自定义显示:

\DeclareCiteCommand{\citehyperref}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
    \ifhyperref
    {\hyperlink{\thefield{entrykey}}{\usebibmacro{title}\printtext[parens]{\printfield{year}}}}
    {\usebibmacro{title}\printtext[parens]{\printfield{year}}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\DeclareFieldFormat[article,book,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{\printnames{author}\addcolon\space\textit{#1}\isdot}

我想要:一个带有“姓氏,名字:标题(日期)”的超链接。唯一的问题是,超链接指向文档顶部,而不是文档末尾参考书目中的相应参考资料。

我该如何解决这个问题?提前致谢。

编辑:

.tex 文件:

\documentclass[twoside,openright,12pt]{report}
\usepackage[a4paper,left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}

% BIBLIOGRAPHY
%\usepackage{natbib} % première bibliographie
\usepackage{csquotes}

\usepackage[style=authoryear-icomp,autolang=hyphen]{biblatex}
\addbibresource{essai.bib}

\DeclareCiteCommand{\citehyperref}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
    \ifhyperref
    {\hyperlink{\thefield{entrykey}}{\usebibmacro{title}\printtext[parens]{\printfield{year}}}}
    {\usebibmacro{title}\printtext[parens]{\printfield{year}}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\DeclareFieldFormat[article,book,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{\printnames{author}\addcolon\space\textit{#1}\isdot}

\usepackage{setspace}
\usepackage[french]{babel}
\usepackage[pdftex]{graphicx}
\usepackage{float}
\usepackage{epigraph}


\begin{document}

This is a citation

\citehyperref{MY_REF}


\newpage
\newpage
\newpage

\addcontentsline{toc}{chapter}{Bibliographie}
\chaptermark{Bibliographie}
\printbibheading
\printbibliography
\end{document}

这是我的.bib 文件:

@book{MY_REF,
    title = {TITLE},
    isbn = {2-7578-2258-6},
    pagetotal = {312},
    publisher = {Points documents},
    author = {XXX, YYY},
    urldate = {2023-03-11},
    date = {2011-04-21},
}

答案1

biblatex 提供\bibhyperref处理链接的功能。如果不使用 hyperref,它也能工作:

\documentclass{report}
\usepackage{lmodern}
\usepackage[T1]{fontenc}


\usepackage{csquotes}

\usepackage[style=authoryear-icomp,autolang=hyphen]{biblatex}
\addbibresource{test.bib}

\DeclareCiteCommand{\citehyperref}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
  \bibhyperref{\usebibmacro{title}\printtext[parens]{\printfield{year}}}}    
{\multicitedelim}
{\usebibmacro{postnote}}

\DeclareFieldFormat[article,book,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{\printnames{author}\addcolon\space\textit{#1}\isdot}
\usepackage{hyperref}


\begin{document}

This is a citation

\citehyperref{shepard_absolument_2011}

\newpage
\printbibliography[heading=bibintoc]
\end{document}

相关内容