如何使用 Biblatex/Biber 在参考书目中打印交叉引用条目的 \textcite{} 等效内容?

如何使用 Biblatex/Biber 在参考书目中打印交叉引用条目的 \textcite{} 等效内容?

当我的参考书目中的条目包含该crossref字段时,我希望它打印该信息,就像它是文本中的常规引用一样,前提是交叉引用的条目包含在参考书目中。否则,它应该像默认那样打印继承的信息。

我试图@incollection根据对类似问题的答案(在下面代码的注释中引用)拼凑一些东西 - 仅用于目前的条目类型。

首先,基于Denis 的示意图我尝试过这个:

\begin{filecontents}{\jobname.bib}
  @incollection{incoll1,
    crossref    =   {coll1},
    author      =   {Ard, Liz},
    title       =   {Befriending Reptiles},
    pages       =   {1--45}}
  @incollection{incoll2,
    crossref    =   {coll1},
    author      =   {Keyes, Don},
    title       =   {Asses I've Known},
    pages       =   {342--346}}
  @incollection{incoll3,
    crossref    =   {coll2},
    author      =   {Other, A. N.},
    title       =   {Flamingos of the Arctic},
    pages       =   {3--4}}
  @collection{coll1,
    editor      =   {Anvil, A. N. and Pond, Lily},
    title       =   {Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain View},
    year        =   1987}
  @collection{coll2,
    editor      =   {Ville, Bourne and Tree, Rown},
    title       =   {Less Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain Pass},
    year        =   1989}
\end{filecontents}
\documentclass{article}
\usepackage[citestyle=authoryear-comp,bibstyle=authoryear,mergedate=basic,isbn=false,url=false,eprint=false,dashed=true,doi=false,sortcites=true,backend=biber,mincrossrefs=2]{biblatex}
\bibliography{\jobname}
\DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at https://tex.stackexchange.com/a/118850/
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
    \ifentryinbib{\thefield{crossref}}%
    {\printfield{editor+others}%
      \addspace\mkbibparens{\usebibmacro{citeyear}}}%
    {\usebibmacro{maintitle+booktitle}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \printfield{edition}%
    \newunit
    \iffieldundef{maintitle}
      {\printfield{volume}%
      \printfield{part}}
      {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \usebibmacro{series+number}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
      {\printfield{isbn}}
      {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{addendum+pubstate}%
    \setunit{\bibpagerefpunct}\newblock
    \usebibmacro{pageref}}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}
\begin{document}
  \textcite{incoll1}
  \textcite{incoll2}
  \textcite{incoll3}
  \printbibliography
\end{document}

不幸的是,这并不能让我获得交叉引用条目的完整标签:我只得到了括号中的年份而不是作者年份标签,而且我还暂时丢失了页面范围等:

仅限日期

基于Paul Stanley 的回答解决 alpha 样式标签(而不是作者年份)的类似问题时,我也尝试过这个:

\begin{filecontents}{\jobname.bib}
  @incollection{incoll1,
    crossref    =   {coll1},
    author      =   {Ard, Liz},
    title       =   {Befriending Reptiles},
    pages       =   {1--45}}
  @incollection{incoll2,
    crossref    =   {coll1},
    author      =   {Keyes, Don},
    title       =   {Asses I've Known},
    pages       =   {342--346}}
  @incollection{incoll3,
    crossref    =   {coll2},
    author      =   {Other, A. N.},
    title       =   {Flamingos of the Arctic},
    pages       =   {3--4}}
  @collection{coll1,
    editor      =   {Anvil, A. N. and Pond, Lily},
    title       =   {Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain View},
    year        =   1987}
  @collection{coll2,
    editor      =   {Ville, Bourne and Tree, Rown},
    title       =   {Less Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain Pass},
    year        =   1989}
\end{filecontents}

\documentclass{article}
\usepackage[citestyle=authoryear-comp,bibstyle=authoryear,mergedate=basic,isbn=false,url=false,eprint=false,dashed=true,doi=false,sortcites=true,backend=biber,mincrossrefs=2]{biblatex}
\bibliography{\jobname}
\DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at https://tex.stackexchange.com/a/118850/
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
    \ifentryinbib{\thefield{crossref}}%
    {\usebibmacro{crossref:label}}%
    {\usebibmacro{crossref:collection}}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}
% modified from Paul Stanley's answer at https://tex.stackexchange.com/a/54844/39222
\newbibmacro{crossref:collection}{%
  \usebibmacro{maintitle+booktitle}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \printfield{edition}%
    \newunit
    \iffieldundef{maintitle}
      {\printfield{volume}%
      \printfield{part}}
      {}%
    \newunit
    \printfield{volumes}%
    \newunit\newblock
    \usebibmacro{series+number}%
    \newunit\newblock
    \printfield{note}%
    \newunit\newblock
    \usebibmacro{publisher+location+date}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
      {\printfield{isbn}}
      {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}}
\newbibmacro{crossref:label}{%
  \entrydata{\strfield{crossref}}
  {\boolfalse{cbx:parens}\usebibmacro{textcite}\ifbool{cbx:parens}{\bibcloseparen}{}}%
    \newunit\newblock
    \usebibmacro{chapter+pages}%
}
\begin{document}
  \textcite{incoll1}
  \textcite{incoll2}
  \textcite{incoll3}
  \printbibliography
\end{document}

几乎可以肯定,我并不想在这里使用引用宏。无论如何,我为一个条目获得了正确的作者年份标签,但为另一个条目获得了正确的作者年份标签:

未标记的条目

我应该如何思考这个问题?我对解决这个问题很感兴趣,但我至少对获得一些如何思考这类问题的线索也很感兴趣。

令我感到惊讶的是,BibTeX 的标准功能没有以某种方式直接得到 Biblatex 的支持,但我猜这个功能在规划过程中以某种方式被忽视了!

答案1

更新

biblatex-ext此功能在具有简单选项的样式中可用: citexref

\documentclass{article}
\usepackage[backend=biber,
  style=ext-authoryear-comp,
  citexref=true,
  mergedate=basic,
  mincrossrefs=2,
]{biblatex}
\usepackage{hyperref}

\begin{filecontents}{\jobname.bib}
@incollection{incoll1,
  crossref    =   {coll1},
  author      =   {Ard, Liz},
  title       =   {Befriending Reptiles},
  pages       =   {1--45},
  doi         =   {12345/6789/1},
}
@incollection{incoll2,
  crossref    =   {coll1},
  author      =   {Keyes, Don},
  title       =   {Asses I've Known},
  pages       =   {342--346},
}
@incollection{incoll3,
  crossref    =   {coll2},
  author      =   {Other, A. N.},
  title       =   {Flamingos of the Arctic},
  pages       =   {3--4},
}
@collection{coll1,
  editor      =   {Anvil, A. N. and Pond, Lily},
  title       =   {Known Beings},
  publisher   =   {Sheds \& Sons},
  address     =   {Mountain View},
  year        =   1987,
  doi         =   {12345/6789/main},
}
@collection{coll2,
  editor      =   {Ville, Bourne and Tree, Rown},
  title       =   {Less Known Beings},
  publisher   =   {Sheds \& Sons},
  address     =   {Mountain Pass},
  year        =   1989,
}
\end{filecontents}
\addbibresource{\jobname.bib}


\begin{document}
  \textcite{incoll1}
  \textcite{incoll2}
  \textcite{incoll3}
  \printbibliography
\end{document}

Keyes, Don (1987)。“我认识的蠢货”。收录于:Anvil and Pond 1987,第 342-346 页。

该功能的实现使用内部\cite...命令(如下面答案的第二部分所述)。


旧答案

这些简短的“in”引用很难实现,因为它们通常需要对整个驱动程序进行大修。因为这样的解决方案需要很多行代码,其中许多代码都是直接从中复制而来,standard.bbx只需添加一些内容即可。实际上有一些自定义样式可以实现类似的功能,biblatex-chicago并且biblatex-philosophy。这些样式已经编写了自己的驱动程序版本,因此添加所需的宏只是一点额外的工作。

我们可以利用\entrydata像你的第二个例子那样的,如果没有使用样式的话,它本来可以起作用authoryear-comp(它可以很好地与 一起使用authoryear),其中textcite必须做一些复杂的事情。

因此我们定义一个更简单的 cite-bibmacro (基于authoryear.cbxs cite

\newbibmacro*{simplecite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}}
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
     \usebibmacro{cite:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}
}

并使用它

\DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at http://tex.stackexchange.com/a/118850/
  \usebibmacro{bibindex}%
  [...]
  \usebibmacro{in:}%
  \ifentryinbib{\thefield{crossref}}%
    {\entrydata{\thefield{crossref}}{%
       \usebibmacro{simplecite}}
     \newunit\newblock
     \usebibmacro{chapter+pages}}%
    {[... code for full item here ...]}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\entrydata包装器中,大括号内的所有字段都将填充父条目的信息。如果您要应用作者标题样式,这一点至关重要title@incollection因为@collection。它还可以帮助处理其他样式中的一些奇怪的极端情况。

平均能量损失

\begin{filecontents}{\jobname.bib}
  @incollection{incoll1,
    crossref    =   {coll1},
    author      =   {Ard, Liz},
    title       =   {Befriending Reptiles},
    pages       =   {1--45}}
  @incollection{incoll2,
    crossref    =   {coll1},
    author      =   {Keyes, Don},
    title       =   {Asses I've Known},
    pages       =   {342--346}}
  @incollection{incoll3,
    crossref    =   {coll2},
    author      =   {Other, A. N.},
    title       =   {Flamingos of the Arctic},
    pages       =   {3--4}}
  @collection{coll1,
    editor      =   {Anvil, A. N. and Pond, Lily},
    title       =   {Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain View},
    year        =   1987}
  @collection{coll2,
    editor      =   {Ville, Bourne and Tree, Rown},
    title       =   {Less Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain Pass},
    year        =   1989}
\end{filecontents}
\documentclass{article}
\usepackage[style=authoryear-comp, mergedate=basic, isbn=false, url=false, eprint=false, dashed=true, doi=false, sortcites=true, backend=biber, mincrossrefs=2]{biblatex}
\usepackage{hyperref}
\bibliography{\jobname}

\newbibmacro*{simplecite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}}
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
     \usebibmacro{cite:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}
}

\DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at http://tex.stackexchange.com/a/118850/
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \ifentryinbib{\thefield{crossref}}%
    {\entrydata{\thefield{crossref}}{%
       \usebibmacro{simplecite}}
     \newunit\newblock
     \usebibmacro{chapter+pages}}%
    {\usebibmacro{maintitle+booktitle}%
     \newunit\newblock
     \usebibmacro{byeditor+others}%
     \newunit\newblock
     \printfield{edition}%
     \newunit
     \iffieldundef{maintitle}
       {\printfield{volume}%
       \printfield{part}}
       {}%
     \newunit
     \printfield{volumes}%
     \newunit\newblock
     \usebibmacro{series+number}%
     \newunit\newblock
     \printfield{note}%
     \newunit\newblock
     \usebibmacro{publisher+location+date}%
     \newunit\newblock
     \usebibmacro{chapter+pages}%
     \newunit\newblock
     \iftoggle{bbx:isbn}
       {\printfield{isbn}}
       {}%
     \newunit\newblock
     \usebibmacro{doi+eprint+url}%
     \newunit\newblock
     \usebibmacro{addendum+pubstate}}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\begin{document}
  \textcite{incoll1}
  \textcite{incoll2}
  \textcite{incoll3}
  \printbibliography
\end{document}

所采用的方法biblatex-chicago是定义一个名为 的特殊引用宏\bibxrefcite,然后仅引用 中crossref的项目,如\bibxrefcite{\thefield{crossref}},此处必须特别注意确保没有引用跟踪器功能干扰输出(我们不希望此处出现“ibid.”或页面反向引用此“引用”)。因此,使用标准\cite不是一个好主意,自定义命令(如 )\bibcrefcite是一个好的解决方案。

biblatex-philsophy采用非常相似的方法。

我们的引用宏观方法可能看起来像

\DeclareCiteCommand{\citecrossref}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}}
  {\usebibmacro{simplecite}}
  {}
  {}

其中simplecite定义如上

带司机

\DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at http://tex.stackexchange.com/a/118850/
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  [...]
  \usebibmacro{in:}%
  \ifentryinbib{\thefield{crossref}}%
    {\citecrossref{\thefield{crossref}}
     \newunit\newblock
     \usebibmacro{chapter+pages}}%
    {[... code for full item here ...]}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

平均能量损失

\begin{filecontents}{\jobname.bib}
  @incollection{incoll1,
    crossref    =   {coll1},
    author      =   {Ard, Liz},
    title       =   {Befriending Reptiles},
    pages       =   {1--45}}
  @incollection{incoll2,
    crossref    =   {coll1},
    author      =   {Keyes, Don},
    title       =   {Asses I've Known},
    pages       =   {342--346}}
  @incollection{incoll3,
    crossref    =   {coll2},
    author      =   {Other, A. N.},
    title       =   {Flamingos of the Arctic},
    pages       =   {3--4}}
  @collection{coll1,
    editor      =   {Anvil, A. N. and Pond, Lily},
    title       =   {Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain View},
    year        =   1987}
  @collection{coll2,
    editor      =   {Ville, Bourne and Tree, Rown},
    title       =   {Less Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain Pass},
    year        =   1989}
\end{filecontents}
\documentclass{article}
\usepackage[style=authoryear-comp, mergedate=basic, isbn=false, url=false, eprint=false, dashed=true, doi=false, sortcites=true, backend=biber, mincrossrefs=2]{biblatex}
\usepackage{hyperref}
\bibliography{\jobname}

\newbibmacro*{simplecite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}}
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
     \usebibmacro{cite:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}
}

\DeclareCiteCommand{\citecrossref}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}}
  {\usebibmacro{simplecite}}
  {}
  {}


\DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at http://tex.stackexchange.com/a/118850/
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \ifentryinbib{\thefield{crossref}}%
    {\citecrossref{\thefield{crossref}}
     \newunit\newblock
     \usebibmacro{chapter+pages}}%
    {\usebibmacro{maintitle+booktitle}%
     \newunit\newblock
     \usebibmacro{byeditor+others}%
     \newunit\newblock
     \printfield{edition}%
     \newunit
     \iffieldundef{maintitle}
       {\printfield{volume}%
       \printfield{part}}
       {}%
     \newunit
     \printfield{volumes}%
     \newunit\newblock
     \usebibmacro{series+number}%
     \newunit\newblock
     \printfield{note}%
     \newunit\newblock
     \usebibmacro{publisher+location+date}%
     \newunit\newblock
     \usebibmacro{chapter+pages}%
     \newunit\newblock
     \iftoggle{bbx:isbn}
       {\printfield{isbn}}
       {}%
     \newunit\newblock
     \usebibmacro{doi+eprint+url}%
     \newunit\newblock
     \usebibmacro{addendum+pubstate}}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\begin{document}
  \textcite{incoll1}
  \textcite{incoll2}
  \textcite{incoll3}
  \printbibliography
\end{document}

上述两个例子都给出了 相关参考文献如下:Anvil, AN 和 Lily Pond 编(1987 年)。《已知存在》。Mountain View:Sheds & Sons。\Ard, Liz(1987 年)。“与爬行动物为友”。收录于:Anvil and Pond 1987。\Keyes, Don(1987 年)。“我认识的驴子”。收录于:Anvil and Pond 1987。\Other, AN(1989 年)。“北极的火烈鸟”。收录于:《鲜为人知的存在》。Bourne Ville 和 Rown Tree 编。Mountain Pass:Sheds & Sons,第 3-4 页。


为了展示使用 的能力,biblatex我们还可以根据孩子或父母所属的位置,有条件地显示与他们有关的信息(例如 DOI 或 URL)

我们再次

\newbibmacro*{xref:simplecite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}}
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
     \usebibmacro{cite:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}
}

但现在我们还有额外的电子版和附录信息

\newbibmacro*{xref:doi+eprint+url}{%
  \ifboolexpr{togl {bbx:doi} and not test {\iffieldxref{doi}}}
    {\printfield{doi}}
    {}%
  \newunit\newblock
  \ifboolexpr{togl {bbx:eprint} and not test {\iffieldxref{eprint}}}
    {\usebibmacro{eprint}}
    {}%
  \newunit\newblock
  \ifboolexpr{togl {bbx:url} and not test {\iffieldxref{url}}}
    {\usebibmacro{url+urldate}}
    {}}

\newbibmacro*{xref:addendum+pubstate}{%
  \iffieldxref{addendum}
    {}
    {\printfield{addendum}}%
  \newunit\newblock
  \iffieldxref{addendum}
    {}
    {\printfield{pubstate}}}

收集到一个方便的宏中

\newbibmacro{xref:condinf}{%
  \usebibmacro{xref:doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{xref:addendum+pubstate}}

在驱动程序中

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  [...]
  \usebibmacro{in:}%
  \ifentryinbib{\thefield{crossref}}%
    {\entrydata{\thefield{crossref}}{%
       \usebibmacro{xref:simplecite}}
     \newunit\newblock
     \usebibmacro{chapter+pages}%
     \newunit\newblock
     \usebibmacro{xref:condinf}}%
    {[... code for full reference ...]}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

在我们的 MWE 中,此设置可以区分继承的 DOI 和“特征”DOI。

\begin{filecontents}{\jobname.bib}
  @incollection{incoll1,
    crossref    =   {coll1},
    author      =   {Ard, Liz},
    title       =   {Befriending Reptiles},
    pages       =   {1--45},
    doi         =   {12345/6789/1},
  }
  @incollection{incoll2,
    crossref    =   {coll1},
    author      =   {Keyes, Don},
    title       =   {Asses I've Known},
    pages       =   {342--346},
  }
  @incollection{incoll3,
    crossref    =   {coll2},
    author      =   {Other, A. N.},
    title       =   {Flamingos of the Arctic},
    pages       =   {3--4}}
  @collection{coll1,
    editor      =   {Anvil, A. N. and Pond, Lily},
    title       =   {Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain View},
    year        =   1987,
    doi         =   {12345/6789/main},
  }
  @collection{coll2,
    editor      =   {Ville, Bourne and Tree, Rown},
    title       =   {Less Known Beings},
    publisher   =   {Sheds \& Sons},
    address     =   {Mountain Pass},
    year        =   1989}
\end{filecontents}
\documentclass{article}
\usepackage[style=authoryear-comp, mergedate=basic, backend=biber, mincrossrefs=2]{biblatex}
\usepackage{hyperref}
\bibliography{\jobname}

\newbibmacro*{xref:simplecite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}}
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
     \usebibmacro{cite:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}
}

\newbibmacro*{xref:doi+eprint+url}{%
  \ifboolexpr{togl {bbx:doi} and not test {\iffieldxref{doi}}}
    {\printfield{doi}}
    {}%
  \newunit\newblock
  \ifboolexpr{togl {bbx:eprint} and not test {\iffieldxref{eprint}}}
    {\usebibmacro{eprint}}
    {}%
  \newunit\newblock
  \ifboolexpr{togl {bbx:url} and not test {\iffieldxref{url}}}
    {\usebibmacro{url+urldate}}
    {}}

\newbibmacro*{xref:addendum+pubstate}{%
  \iffieldxref{addendum}
    {}
    {\printfield{addendum}}%
  \newunit\newblock
  \iffieldxref{addendum}
    {}
    {\printfield{pubstate}}}

\newbibmacro{xref:condinf}{%
  \usebibmacro{xref:doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{xref:addendum+pubstate}}

\DeclareBibliographyDriver{incollection}{% adapted from standard.bbx based on answer by Denis at http://tex.stackexchange.com/a/118850/
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \ifentryinbib{\thefield{crossref}}%
    {\entrydata{\thefield{crossref}}{%
       \usebibmacro{xref:simplecite}}
     \newunit\newblock
     \usebibmacro{chapter+pages}%
     \newunit\newblock
     \usebibmacro{xref:condinf}}%
    {\usebibmacro{maintitle+booktitle}%
     \newunit\newblock
     \usebibmacro{byeditor+others}%
     \newunit\newblock
     \printfield{edition}%
     \newunit
     \iffieldundef{maintitle}
       {\printfield{volume}%
       \printfield{part}}
       {}%
     \newunit
     \printfield{volumes}%
     \newunit\newblock
     \usebibmacro{series+number}%
     \newunit\newblock
     \printfield{note}%
     \newunit\newblock
     \usebibmacro{publisher+location+date}%
     \newunit\newblock
     \usebibmacro{chapter+pages}%
     \newunit\newblock
     \iftoggle{bbx:isbn}
       {\printfield{isbn}}
       {}%
     \newunit\newblock
     \usebibmacro{doi+eprint+url}%
     \newunit\newblock
     \usebibmacro{addendum+pubstate}}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\begin{document}
  \textcite{incoll1}
  \textcite{incoll2}
  \textcite{incoll3}
  \printbibliography
\end{document}

“Keyes”条目继承了“Anvil & Pond”的 DOI,但为了避免冗余而未显示该条目,而“Ard”的不同 DOI 则被正确报告。 在此处输入图片描述

相关内容