仅引用同上引用的第一作者

仅引用同上引用的第一作者

authoryear-icomp当使用BibLaTeX,我想仅引用多作者著作中的第一作者,即使这并不独特,当引用是重复的(例如 ibidem)时。我的理由是,ibidem 无论如何都可以唯一地标识参考文献。

我还没有找到办法,但考虑到 BibLaTeX 令人难以置信的灵活性,我怀疑这是可能的(我最近开始使用它,到目前为止很喜欢它)。 有可能实现上述目标吗?

考虑以下 MWE:

\documentclass{article}

\usepackage{filecontents}

\usepackage{csquotes}
\usepackage[%
    backend = biber,
    style = authoryear-icomp,
    giveninits = true,
    ibidpage = true,
    maxbibnames = 99,
    maxcitenames = 2,
    uniquename = init,
    useprefix = true
  ]{biblatex}
% always have first name, last name in bibliography
\DeclareNameAlias{sortname}{given-family}
\addbibresource{references.bib}

\begin{filecontents}{references.bib}
  @misc{keyA,
    title = {Title A},
    author = {First, Author and Second, Author and Third, Author},
    year = 2019,
  }

  @misc{keyB,
    title = {Title B},
    author = {First, Author and Fourth, Author and Fifth, Author},
    year = 2019,
  }
\end{filecontents}


\begin{document}

  We first note that~\textcite{keyA} and~\textcite{keyB} did a lot of work.
  The latter wrote \enquote{important stuff}, so we quote~\textcite{keyB} again.

  \printbibliography

\end{document}

渲染结果如下:

上述 LaTeX 源代码的 PDF 输出截图

而不是渲染第一、第四等(同上)对于最后一个引用,我希望它能够呈现First 等人(同上)。然后读者只需找到前面的引用,就能唯一地识别正确的参考文献。使用 BibLaTeX 可以做到这一点吗?在此先感谢任何指点和帮助。

答案1

它不是特别漂亮,但是是可能的。

我们可以通过替换来获得所需的效果

\printnames{labelname}

textcitebibmacro 中

\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
  {\printnames[][1-1]{labelname}}
  {\printnames{labelname}}%

由于textciteauthoryear-icomp很长,结果可能看起来有点令人生畏。

不幸的是,像我最初希望的那样,简单地maxnames在引用中注入一个不同的值是不够的,因为值可以被后端计算的-值覆盖(对于选项),这发生在很晚的阶段,因此标准钩子没有提供干扰的方法。\AtEveryCitekeymaxnameuniquelistmaxnameunqiuelist

\documentclass{article}

\usepackage{filecontents}

\usepackage{csquotes}
\usepackage[%
    backend = biber,
    style = authoryear-icomp,
    giveninits = true,
    ibidpage = true,
    maxbibnames = 99,
    maxcitenames = 2,
    uniquename = init,
    useprefix = true
  ]{biblatex}

\DeclareNameAlias{sortname}{given-family}

\makeatletter
\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\iffieldundef{shorthand}
       {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                    \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
          {\setunit{\addcomma}%
           \usebibmacro{cite:extradate}}
          {\setunit{\compcitedelim}%
           \usebibmacro{cite:labeldate+extradate}%
           \savefield{labelyear}{\cbx@lastyear}}}
       {\setunit{\compcitedelim}%
        \usebibmacro{cite:shorthand}%
        \global\undef\cbx@lastyear}}
    {\ifnameundef{labelname}
       {\iffieldundef{shorthand}
          {\usebibmacro{cite:label}%
           \setunit{%
             \global\booltrue{cbx:parens}%
             \printdelim{nonameyeardelim}\bibopenparen}%
           \ifnumequal{\value{citecount}}{1}
             {\usebibmacro{prenote}}
             {}%
           \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
             {\usebibmacro{cite:ibid}}
             {\usebibmacro{cite:labeldate+extradate}}}
          {\usebibmacro{cite:shorthand}}}
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\printnames[][1-1]{labelname}}
          {\printnames{labelname}}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \printdelim{nameyeardelim}\bibopenparen}%
        \ifnumequal{\value{citecount}}{1}
          {\usebibmacro{prenote}}
          {}%
        \iffieldundef{shorthand}
          {\iffieldundef{labelyear}
             {\usebibmacro{cite:label}}
             {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
                {\usebibmacro{cite:ibid}}
                {\usebibmacro{cite:labeldate+extradate}}}%
           \savefield{labelyear}{\cbx@lastyear}}
          {\usebibmacro{cite:shorthand}%
           \global\undef\cbx@lastyear}}%
     \stepcounter{textcitecount}%
     \savefield{namehash}{\cbx@lasthash}}%
  \setunit{%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}%
    \textcitedelim}}
\makeatother


\begin{filecontents}{\jobname.bib}
@misc{keyA,
  title  = {Title A},
  author = {First, Author and Second, Author and Third, Author},
  year   = 2019,
}
@misc{keyB,
  title  = {Title B},
  author = {First, Author and Fourth, Author and Fifth, Author},
  year   = 2019,
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
  We first note that~\textcite{keyA} and~\textcite{keyB} did a lot of work.
  The latter wrote \enquote{important stuff}, so we quote~\textcite{keyB} again.

  \printbibliography
\end{document}

我们首先注意到 First, Second, et al. (2019) 和 First, Fourth, et al. (2019) 做了很多工作。后者写了“重要的东西”,所以我们再次引用 First et al. (同上)。


如果你不喜欢长时间的重新定义,你当然可以使用xpatch来修补宏

\usepackage{xpatch}
\xpatchbibmacro{textcite}
  {\printnames{labelname}}
  {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
     {\printnames[][1-1]{labelname}}
     {\printnames{labelname}}}
  {}{}

修补与重新定义的优缺点在以下网址讨论:Biblatex 的 bibmacros、参考书目驱动程序、格式 - 修补或重新定义?

相关内容