Hyperref 无法与 superfullcite 一起使用

Hyperref 无法与 superfullcite 一起使用

我希望论坛的其他地方还没有回答这个问题,我已经找了一段时间了,但没有找到任何东西……

问题是,我正在使用 superfullcite 命令对我的参考书目进行排序,效果很好。但是,当我使用 hyperref 包时,每个引用的超链接都坏了……

我在这里发布了一个 MWE...任何帮助都非常有用。谢谢!

\documentclass{article}
\usepackage[style=numeric-comp]{biblatex}
\bibliography{biblatex-examples}
\makeatletter

\ExecuteBibliographyOptions{citetracker,sorting=none}

\DeclareCiteCommand{\superfullcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{superfullcite}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newbibmacro*{superfullcite}{%
  \ifciteseen
    {}
    {\xappto\cbx@citehook{%
       \noexpand\footnotetext[\thefield{labelnumber}]{%
         \fullcite{\thefield{entrykey}}.}}}}

\newrobustcmd{\cbx@superscript}[1]{%
  \mkbibsuperscript{#1}%
  \cbx@citehook
  \global\let\cbx@citehook=\empty}
\let\cbx@citehook=\empty

\makeatother

\usepackage{hyperref,bookmark}
\begin{document}

Some filler text,\superfullcite{augustine} then some more
text.\superfullcite{companion} Perhaps some more text and the
same citation again.\superfullcite{companion} Yet another
one.\superfullcite{kastenholz} Now all
again.\superfullcite{augustine,companion,kastenholz}


\newpage

And now...\superfullcite{augustine}

\end{document}

答案1

您缺少链接的目的地。

\documentclass{article}
\usepackage[style=numeric-comp]{biblatex}
\bibliography{biblatex-examples}
\usepackage{l3pdf}
\ExplSyntaxOn
\pdf_uncompress:
\ExplSyntaxOff
\makeatletter

\ExecuteBibliographyOptions{citetracker,sorting=none}

\DeclareCiteCommand{\superfullcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{superfullcite}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\newrobustcmd\superfullcitedest[1]{%
  \raisebox{\baselineskip}[0pt][0pt]{\makebox[0pt][l]{%
         \hypertarget{cite.\the\c@refsection @#1}{}\hspace{-\parindent}}}}

\newbibmacro*{superfullcite}{%
  \ifciteseen
    {}
    {\xappto\cbx@citehook{%
       \noexpand\footnotetext[\thefield{labelnumber}]{%
         \superfullcitedest{\thefield{entrykey}}%
         \fullcite{\thefield{entrykey}}.}}}}

\newrobustcmd{\cbx@superscript}[1]{%
  \mkbibsuperscript{#1}%
  \cbx@citehook
  \global\let\cbx@citehook=\empty}
\let\cbx@citehook=\empty

\makeatother

\usepackage{hyperref,bookmark}
\begin{document}

Some filler text,\superfullcite{augustine} then some more
text.\superfullcite{companion} Perhaps some more text and the
same citation again.\superfullcite{companion} Yet another
one.\superfullcite{kastenholz} Now all
again.\superfullcite{augustine,companion,kastenholz}


\newpage

And now...\superfullcite{augustine}


\end{document}

答案2

通常,biblatex将引文链接到参考书目中的相应条目。在 MWE 中,您没有参考书目,因此biblatex不会创建任何链接。(您可以通过\printbibliography向 MWE 添加来查看通常的工作方式)。

作为 Ulrike 答案的替代,这里有一个解决方案,它使用biblatex命令来设置通常由全引文中的参考书目条目设置的锚点。

这种方法的主要思想是在执行书目驱动程序之前\fullcite复制一份。\blx@anchor

\documentclass{article}
\usepackage[style=numeric-comp]{biblatex}


\makeatletter
\ExecuteBibliographyOptions{citetracker,sorting=none}

\DeclareCiteCommand{\superfullcite}[\cbx@superscript]%
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{superfullcite}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}


\newbibmacro*{superfullcite}{%
  \ifciteseen
    {}
    {\xappto\cbx@citehook{%
       \noexpand\footnotetext[\thefield{labelnumber}]{%
         \superfullcite@fullcite{\thefield{entrykey}}.}}}}

\newrobustcmd{\cbx@superscript}[1]{%
  \mkbibsuperscript{#1}%
  \cbx@citehook
  \global\let\cbx@citehook=\empty}
\let\cbx@citehook=\empty

\DeclareCiteCommand{\superfullcite@fullcite}
  {\usebibmacro{prenote}}
  {\usedriver
     {\blx@anchor
      \DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
\makeatother



\usepackage{hyperref,bookmark}

\addbibresource{biblatex-examples.bib}
\begin{document}
Some filler text,\superfullcite{augustine} then some more
text.\superfullcite{companion} Perhaps some more text and the
same citation again.\superfullcite{companion} Yet another
one.\superfullcite{kastenholz} Now all
again.\superfullcite{augustine,companion,kastenholz}


\newpage

And now...\superfullcite{augustine}
\end{document}

相关内容