# Bookauthor field is not displayed in APA reference style

I want to cite a foreword of a book. So when I input the details as a @incollection entry, book authors didn't appear in the reference list. This works for authoryear reference style. But not for APA. Any help is greatly appreciated.

    \documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}

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

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@incollection{Author1976,
author = {Author, A},
booktitle = {Book title},
bookauthor = {Bookauthor, A and Bookauthor, B},
pages = {1--10},
publisher = {University Press},
title = {{Foreword title}},
year = {1976}
}
\end{filecontents}

\bibliography{\jobname.bib}

\begin{document}
\cite{Author1976}
\printbibliography

\end{document}


The output should looks like below.

• What should the output look like? I think you will have to patch the incollection (and inbook) driver to do this. Which can be done using the xpatch package and xpatchbibdriver – David Purton Nov 26 '16 at 11:06
• Actually, you might have to modify the maintitle+booktitle macro. This might be better I think. Again xpatch and \xpatchbibmacro could be used. I'll do an actual answer if you show me what the expected output is. – David Purton Nov 26 '16 at 11:12
• It won't really help with the problem at hand, but it could be that you actually have an @inbook(or even a @suppbook) entry instead of an @incollection. – moewe Nov 26 '16 at 11:39
• I tried both @inbook and \$suppbook. It didn't work with APA style. – shani Nov 26 '16 at 11:40
• Yes, that's why I said, it won't help with your specific problem, still conceptually one of the two is better suited. – moewe Nov 26 '16 at 11:44

Try this. (I've used @suppbook, since @moewe is right that this makes more sense—still works with @incollection though.

The name format for bookauthor is set using DeclareNameAlias{bookauthor}{apanames} and \xpatchbibmacro is used to insert the bookauthor after in in the maintitle+booktitle macro.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage[backend=biber,style=apa]{biblatex}
\DeclareLanguageMapping{english}{english-apa}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@suppbook{Stone1976,
author = {Stone, R},
booktitle = {Social Accounting for Development Planning with Special Reference to {Sri Lanka}},
bookauthor = {Pyatt, G and Roe, A},
pages = {xvi-xxxi},
publisher = {Cambridge University Press},
title = {Foreword},
subtitle = {The Development of Economic Data Systems},
year = {1976}
}
\end{filecontents}
\bibliography{\jobname.bib}
\DeclareNameAlias{bookauthor}{apanames}
\xpatchbibmacro{maintitle+booktitle}{%
\usebibmacro{in}%
}
{%
\usebibmacro{in}%
\ifnameundef{bookauthor}
{}
{\usebibmacro{bybookauthor}%
}{}{}
\pagestyle{empty}
\begin{document}
\cite{Stone1976}
\printbibliography
\end{document}


• Thanks. This worked. Could you please explain bit more about this macro editing. Because I haven't tried something before. – shani Nov 26 '16 at 11:50
• Sure! Have a look at apa.bbx and find the maintitle+booktitle macro. Notice that it inserts in then goes straight to maintitle and then booktitle. \xpatchbibmacro inserts the bookauthor after the in. (Actually, I've been a bit lazy... I think that this will generate problems, looking at things more closely). Probably bookauthor should be inserted before booktitle and it should be wrapped in an \ifnameundef{bookauthor}{}{} to ensure that punctuation isn't stuffed up. I had to modify the bookauthor macro also to print the names in the right format. I'll edit my answer. – David Purton Nov 26 '16 at 11:58
• Hmm. Actually I'm not so sure. It annoys me that biblatex doesn't have mainauthor and associated variant fields. I think I'll leave it after usebibmacro{in}. I'll change the name format in a more clever way though. Edit coming up. – David Purton Nov 26 '16 at 12:08

As you can see, the name order is wrong here. It is not

last name, [short] first name but

[short] first name, last name

To change this, replace \DeclareNameAlias{bookauthor}{apanames} with \DeclareNameAlias{bookauthor}{apaauthor}.

In the standard biblatex.def, the NameAlias of bookauthor and bybookauthor also refers to author respectively byauthor (that also refers to author) (which is default).