5

When an entry in my bibliography includes the crossref field, I would like it to print that information as if it were a regular citation in the text, provided the cross-referenced entry is included in the bibliography. Otherwise, it should print the inherited information as it does by default.

I've tried to cobble something together - just for the @incollection entry type for now - based on answers to similar questions (referenced in annotations in the code below).

First, based on Denis's schematic answer I tried this:

\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}

This does not, unfortunately, get me the full label for the cross-referenced entry: I just get the year in parentheses rather than the author-year label, and I've also managed to temporarily lose the page range etc.:

only dates

Based on Paul Stanley's answer addressing a similar question for alpha-style labels (rather than author-year), I also tried this:

\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}

Almost certainly I'm not meant to be using the citation macros here. In any case, I get the correct author-year label for one entry but neither author nor year for the other:

non-labelled entry

How should I be thinking about this? I'm interested in solving the problem, but I'm at least as interested in getting some clue how to think about this kind of problem.

It is still surprising to me that a standard feature of BibTeX is not straightforwardly supported in some way by Biblatex, but I guess this feature somehow got overlooked in the planning process!

  • BTW: One of my new pet peeves is people using citestyle=authoryear-comp, bibstyle=authoryear when style=authoryear-comp would do the exact same thing. The citestyle/bibstyle allows for a finer control of the exact output, but especially when the two keys are far apart in the options list, things become unclear and sometimes outright confusing. – moewe Sep 13 '15 at 5:31
  • Your first try fails meanly because of \printfield{editor+others}. – moewe Sep 13 '15 at 6:09
  • Related (but for citations) biblatex : avoid redundant information. – moewe Sep 13 '15 at 14:16
5

Those short "in" references are "hard" to implement because they often require a major overhaul of the entire driver. As such a solution will require lots of lines of code, many of them copied directly from standard.bbx with just a few additions. There are actually some custom styles that implement something similar, biblatex-chicago and biblatex-philosophy. These styles have already written their own versions of the drivers, so it was only a bit extra work to add the needed macros.

We can make use of \entrydata like your second example, which would have worked were it not for using the style authoryear-comp (it works fine with authoryear), where textcite has to do some complicated stuff.

So we define a simpler cite-bibmacro (based on 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}}
}

and use that

\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}}

in an \entrydata wrapper, inside the curly braces all fields will be filled with the information of the parent entry. Which is crucial if you were to apply an author-title style, there the title of the @incollection will not coincide with that of the @collection. It can also help deal with some weird corner cases in other styles.

MWE

\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}

The approach taken in biblatex-chicago is to define a special citation macro called \bibxrefcite and then just cite the crossref'd item as in \bibxrefcite{\thefield{crossref}}, special care has to be taken here to make sure no cite tracker features interfere with the output (we don't want an "ibid." here, or a page backref to this "citation"). So using standard \cite is a bad idea, a custom command such as \bibcrefcite is a good solution.

biblatex-philsophy uses a very similar approach.

Our cite macro approach could look like

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

Where simplecite is defined as above

With driver

\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}}

MWE

\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}

Both examples above give The relevant references read: Anvil, A. N. and Lily Pond, eds. (1987). Known Beings. Mountain View: Sheds & Sons.\ Ard, Liz (1987). “Befriending Reptiles”. In: Anvil and Pond 1987.\Keyes, Don (1987). “Asses I’ve Known”. In: Anvil and Pond 1987.\Other, A. N. (1989). “Flamingos of the Arctic”. In: Less Known Beings. Ed. by Bourne Ville and Rown Tree. Mountain Pass: Sheds & Sons, pp. 3–4.


Just to show what is possible using the power of biblatex we can also condition showing of information that could pertain to the child or parent (a DOI or URL, say) depending on where they belong

Again we have

\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}}
}

But now we also have extra eprint and addendum info

\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}}}

collected into one handy macro

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

In the driver

\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}}

This setup can in our MWE distinguish between an inherited DOI and a "eigen"-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}

The "Keyes" entry inherits the DOI from "Anvil & Pond", but it is not displayed to avoid redundancies, the distinct DOI of "Ard" is correctly reported. enter image description here

  • Thanks! This is superb. I can see, if you like, why it is 'hard' looking at the code. I just wonder why it wasn't considered when designing Biblatex but perhaps it was just an oversight. Is there any reason that I can't have the chapter-page stuff in the simplecite macro, as I did in crossref:label in my second example? I see you've got it only for the full entry but I think that's why your output loses the page range (and would presumably lose a chapter number). If that's not a good idea, is there a better way of including that information? – cfr Sep 13 '15 at 12:56
  • @cfr You can have that as well, the same goes for the pageref macro. But you have to add it outside the scope of \entrydata{\thefield{crossref}} in the first solution and outside the \citecrossref in the second solution because it should use the information of the main entry again and not the crossref'd-parent. If you want I can see if I can include the needed code. – moewe Sep 13 '15 at 13:01
  • OK. If you can do it without much trouble, that'd be great. If not, I am happy to have a go and tell you when I get stuck! – cfr Sep 13 '15 at 13:04
  • @cfr Done! I haven't updated the image yet, but the required code has been changed. Depending on whether doi+eprint+url and addendum+pubstate normally belong to the @collection or the @incollection, you might want to move them as well. (I would have to have a look at the inheriting rules to see if that makes sense. One could also do some elaborate checking to make sure there is no doubling there (if the DOI coincides with the parent DOI, drop it, if not print it), maybe if I have time I will investigate that direction.) – moewe Sep 13 '15 at 13:18
  • @cfr To show how awesome biblatex is I have added some code to deal with inherited DOIs. If the child DOI is different, it is printed; if it coincides with the parental DOI it is suppressed, to avoid redundant information. – moewe Sep 13 '15 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.