2

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,
    address = {Cambridge},
    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.

enter image description here

  • 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
  • 1
    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
2

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,
  address = {Cambridge, England},
  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}%
     \setunit*{\addcomma\space}}%
}{}{}
\pagestyle{empty}
\begin{document}
\cite{Stone1976}
\printbibliography
\end{document}

enter image description here

  • 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
1

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).

(can't comment, so I had to post this as new answer)

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.