Biblatex: no comma between title and year with citation that has no author

I've researched this problem, but am not coming up with the right solution. I have a online resource with no author, so with APA style, biblatex produces: ("Title of article" 2009} with no comma. But the style requires a comma in between the title and the year. I think I need something along the lines of:

\AtBeginBibliography{%
\renewcommand*{\nonameyeardelim}{\addcomma\space}}


But it is not working.

Here is a minimal example:

\documentclass[man,]{apa6}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=apa,natbib=true]{biblatex}
\usepackage{float}
\usepackage{graphicx}
\addbibresource{example.bib}
\DeclareLanguageMapping{american}{american-apa}
%\AtBeginDocument{\renewcommand\nonameyeardelim}{\addcomma\space}
%\AtBeginDocument{\renewcommand*{\nonameyeardelim}{\addcomma\space}}
\AtBeginBibliography{%
\renewcommand*{\nonameyeardelim}{\addcomma\space}}

\title{Title}
\shorttitle{Short Title}

\author{Tom  }
\affiliation{University of Ignorance}

\date{May 28, 2017}

\abstract{This paper is meant to illustrate a problem I have with Latex
}
\keywords{ignorance}

\begin{document}
\maketitle
\section{Introduction}
I want to cite this \citep{vicodin}.

\printbibliography[heading=bibnumbered]

\end{document}


The minimal bib file (example.bib) would be this:

@Online{vicodin,
title = {Life Without Vicodin?},
year  = {2009},
date  = {2009-07-02},
url   = {http://nymag.com/news/intelligencer/topic/57770/},
}


Note: when I reproduce the error in the minimal example above, I notice that the reference occurs correctly in the reference listing at the end, but it still has no comma in the inline citation.

1 Answer

If you wanted the comma for everything,

\renewcommand*{\nonameyeardelim}{\addcomma\space}


would be enough. You don't need the \AtBeginBibliography hook.

But you don't actually need that here, the citation macros of biblatex-apa use \nameyeardelim, which is set to \addcomma\space in apa.cbx.

Your problem here is different, though.

You are not seeing the comma because of US punctuation and the question mark that ends the title.

With american (American English) biblatex uses \uspunctuation, this involves moving punctuation inside quotation marks. So you have

"Carefree," in general, means "free from care or anxiety."

and not (British style/'logical' punctuation)

"Carefree", in general, means "free from care or anxiety".

This is also what happens here. The comma is moved inside the quotation mark. Instead of (British)

"Life Without Vicodin?", 2009

you would have (American)

*"Life Without Vicodin?," 2009

but that double punctuation is not acceptable and the quotation mark wins (it is more important), so you get you would have

"Life Without Vicodin?" 2009

Try dropping the question mark in the title and check the output.

If you don't want US punctuation, issue

\DefineBibliographyExtras{american}{\stdpunctuation}

• Thank you @moewe. \DefineBibliographyExtras{american}{\stdpunctuation} did the trick. I really appreciate your help. When looking on this type of thing earlier, your name came up often. Thanks for your generosity in helping others. – T. Frei May 28 '17 at 22:51
• @T.Frei Keep in mind that \stdpunctuation switches citations and bibliography to British/logical punctuation, i.e. you will get the punctuation outside the quotation marks. I'm not sure what the APA exactly prescribe, but they want American punctuation (blog.apastyle.org/apastyle/2011/08/…). So your document will not be APA compliant if you go for \stdpunctuation. – moewe May 29 '17 at 6:45
• @T.Frei Glad my answer helped you. You might want to consider up-voting and accepting it to show that it solved your problem. – moewe May 29 '17 at 6:45