# How to make @bookinbook use short title in bibliography with biblatex-chicago when there are multiple entries pointing to the same @book

Using biblatex-chicago, I would like @bookinbook to behave analogously to @incollection in using the shorttitle and just the editor's last name for the @book in crossref when there are multiple entries pointing to the same book.

# MWE:

\documentclass{article}

\usepackage[notes]{biblatex-chicago}

\begin{filecontents*}{\jobname.bib}
@book{kotter:schriften.jdam,
Author = {{John of Damascus}},
Date = {1969/2013},
Editor = {Kotter, Bonifaz},
Publisher = {de Gruyter},
Shorttitle = {Schriften},
Title = {Die Schriften des Johannes von Damaskos},
Volumes = {7}}

@bookinbook{jdam:expositio.fidei:kotter1973,
Crossref = {kotter:schriften.jdam},
Entrysubtype = {primary},
Title = {Expositio fidei},
Volume = {2},
Year = {1973}}

@bookinbook{jdam:instit.element:dialectica:kotter1969,
Crossref = {kotter:schriften.jdam},
Entrysubtype = {primary},
Title = {Institutio elementaris. Capita philosophica (Dialectica)},
Volume = {1},
Year = {1969}}
\end{filecontents*}

\begin{document}
\nocite{kotter:schriften.jdam,jdam:instit.element:dialectica:kotter1969,jdam:expositio.fidei:kotter1973}
\printbibliography
\end{document}


# Desired output:

John of Damascus. Die Schriften des Johannes von Damaskos. Edited by Bonifaz Kotter. 7 vols. Berlin: de Gruyter, 1969–2013.

——. Expositio fidei. In Kotter, Schriften, vol. 2. Berlin: de Gruyter, 1973.

——. Institutio elementaris. Capita philosophica (Dialectica). In Kotter, Schriften, vol. 1. Berlin: de Gruyter, 1969.

• There is an option called booklongxref which if set to false would result in "Expositio fidei. In Schriften, vol. 2." The output you want is much more tricky because biblatex would have to respond dynamically to the data in the parent entry. Mar 16 '19 at 16:03
• That's perfect! I'm happy with that output too. Thank you! Mar 16 '19 at 20:07

biblatex-chicago has an option called booklongxref that can help you shorten the bibliography entries here.

\documentclass{article}

\usepackage[notes,booklongxref=false]{biblatex-chicago}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{kotter:schriften.jdam,
Author = {{John of Damascus}},
Date = {1969/2013},
Editor = {Kotter, Bonifaz},
Publisher = {de Gruyter},
Shorttitle = {Schriften},
Title = {Die Schriften des Johannes von Damaskos},
Volumes = {7}}

@bookinbook{jdam:expositio.fidei:kotter1973,
Crossref = {kotter:schriften.jdam},
Entrysubtype = {primary},
Title = {Expositio fidei},
Volume = {2},
Year = {1973}}

@bookinbook{jdam:instit.element:dialectica:kotter1969,
Crossref = {kotter:schriften.jdam},
Entrysubtype = {primary},
Title = {Institutio elementaris. Capita philosophica (Dialectica)},
Volume = {1},
Year = {1969}}
\end{filecontents*}

\begin{document}
\nocite{kotter:schriften.jdam,jdam:instit.element:dialectica:kotter1969,jdam:expositio.fidei:kotter1973}
\printbibliography
\end{document}


The output is not exactly what you had in mind, but hopefully it is close enough.

It seems particularly challenging to me to get the short references in the @bookinbook entries to refer to the editor of the @book work, when the @book is primarily associated with its author.

The other things can be worked around with some saving and restoring of field values. Internally the short crossref is produced by a citation command. Additional information can be passed to that citation command by means of saving fields in macros and restoring the macros later.

\documentclass{article}

\usepackage[notes,booklongxref=false]{biblatex-chicago}

\usepackage{xpatch}
\xapptobibmacro{crossref:volume+postnote}{%
\newunit\newblock
\usebibmacro{saved:publ+loc+year}%
}{}{}

\makeatletter
\xapptobibmacro{xrefprenote}{%
\iflistundef{publisher}
{\undef\cbx@incollpublisher}
{\savelist{publisher}{\cbx@incollpublisher}}%
\iflistundef{location}
{\undef\cbx@incolllocation}
{\savelist{location}{\cbx@incolllocation}}%
\iffieldundef{year}
{\undef\cbx@incollyear}
{\savefield{year}{\cbx@incollyear}}%
\iffieldundef{endyear}
{\undef\cbx@incollendyear}
{\savefield{endyear}{\cbx@incollendyear}}%
}{}{}

\newbibmacro*{saved:publ+loc+year}{%
\ifboolexpr{
not test {\iflistequals{publisher}{\cbx@incollpublisher}}
or
not test {\iflistequals{location}{\cbx@incolllocation}}
or
not test {\iffieldequals{year}{\cbx@incollyear}}
or
not test {\iffieldequals{endyear}{\cbx@incollendyear}}
}
{\restorelist{publisher}{\cbx@incollpublisher}%
\restorelist{location}{\cbx@incolllocation}%
\restorefield{year}{\cbx@incollyear}%
\restorefield{endyear}{\cbx@incollendyear}%
\printlist{location}%
\iflistundef{publisher}%
\printlist{publisher}%
\usebibmacro{date}}
{}}%
\makeatother

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{kotter:schriften.jdam,
Author = {{John of Damascus}},
Date = {1969/2013},
Editor = {Kotter, Bonifaz},
Publisher = {de Gruyter},
Shorttitle = {Schriften},
Title = {Die Schriften des Johannes von Damaskos},
Volumes = {7}}

@bookinbook{jdam:expositio.fidei:kotter1973,
Crossref = {kotter:schriften.jdam},
Entrysubtype = {primary},
Title = {Expositio fidei},
Volume = {2},
pages = {2-200},
Year = {1973}}

@bookinbook{jdam:instit.element:dialectica:kotter1969,
Crossref = {kotter:schriften.jdam},
Entrysubtype = {primary},
Title = {Institutio elementaris. Capita philosophica (Dialectica)},
Volume = {1},
pages = {1-100},
Year = {1969}}
\end{filecontents*}

• @AlexRoberts If the editor is important it might make sense to carry it over, but have it mentioned after the shorttitle (as in the @book entry itself). Unfortunately, that would also be tricky to pull off here, especially seeing that you probably don't want the editor mentioned for all works, but only for a certain subclass of works where the editor has a more important role than usual. Mar 17 '19 at 15:24
• I just noticed that when the publisher is missing (or when combined with code that omits the publisher), the address and year are separated by a colon (Berlin: 1973) rather than a comma (Berlin, 1973). Mar 17 '19 at 15:24
• @AlexRoberts That was an embarrassing copy-and-paste error. I forgot to include one line (\iflistundef{publisher}%) from the original publ+loc+year macro. Thanks for spotting that. Should be fixed now. Mar 17 '19 at 15:28