Biblatex,APA 样式,超链接 \parencite 在第二次引用时未显示作者

Biblatex,APA 样式,超链接 \parencite 在第二次引用时未显示作者

我的代码有问题。我希望第二个代码\parencite也包含作者姓名。

导致\DeclareCiteCommand第一次引用后作者姓名消失

\documentclass{article}

\begin{filecontents}{\jobname.bib}
    @misc{A01,
        author = {Sutherland and Varnam},
        year = {2001},
        title = {Title},
    }
\end{filecontents}

\usepackage[style=apa,backend=biber]{biblatex}

\addbibresource{\jobname.bib}

\DeclareCiteCommand{\parencite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
    \printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\usepackage{hyperref}

\begin{document}

    First cite \parencite{A01}.

    Second cite \parencite{A01}.

    \printbibliography

\end{document} 

答案1

biblatex-apa定义\parencite与示例中的重新定义略有不同。该定义适用于某些标准样式,但不适用于更复杂的样式,如authoryear-icompapa

因为apa你需要

\documentclass{article}

\usepackage[style=apa,backend=biber]{biblatex}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\DeclareFieldFormat{bibhyperrefnonest}{%
  \DeclareFieldFormat{bibhyperref}{##1}%
  \bibhyperref{#1}}

\DeclareCiteCommand{\parencite}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperrefnonest]{\usebibmacro{cite}}}
  {}
  {\usebibmacro{postnote}%
   \usebibmacro{cite:post}}

\DeclareCiteCommand{\textcite}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperrefnonest]{\usebibmacro{textcite}}}
  {}
  {\usebibmacro{textcite:postnote}%
   \usebibmacro{cite:post}}


\begin{document}
  First cite \parencite{sigfridsson}.

  Second cite \parencite{sigfridsson}.

\citereset

  First cite \textcite{sigfridsson}.

  Second cite \textcite{sigfridsson}.

  \printbibliography
\end{document}

MWE 显示带有链接和相同文本的引文“Sigfridsson & Ryde, 1998”

编辑:还添加了 的重新定义\textcite。请注意, 中的括号\textcite可能未按预期链接。修复这个问题会复杂得多。

答案2

不确定是否仍然需要,但我尝试了以下内容,它似乎也包含右括号:

\DeclareCiteCommand{\textcite}
{\usebibmacro{cite:init}%
    \usebibmacro{prenote}}
{\usebibmacro{citeindex}%
    \printtext[bibhyperref]{\usebibmacro{textcite}}}
{}
{\printtext[bibhyperref]{\usebibmacro{textcite:postnote}}%
    \usebibmacro{cite:post}}

希望它能有所帮助,并且对于没有发布 MWE 表示歉意。

相关内容