[Tex/LaTex] comma in citation before “and”

biblatex

I am trying to follow the MHRA author-date guidelines set out here. I
am building off this draft code. On p. 79 of the
style guide a citation with three authors has a comma after the second
author and before "and". (There is no comma before "and" if there are two authors.) How can I get that effect? The code below,
which is what I have so far towards an MHRA style, handles various aspects of the style as well as generating this output:
enter image description here

\documentclass[british]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{doyl1975,
  author    = {A.I. Doyle and Elizabeth Rainey and Dudley Butler Wilson},
  title     = {Manuscript to Print: Tradition and Innovation in the {R}enaissance {B}ook},
  date      = {1975},
  publisher = {University of Durham},
  location  = {Durham},
  series    = {Library Guides: Special Series},
  number    = {1},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\newrobustcmd{\mkbibangle}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  <#1>%
  \endgroup}

\renewcommand*{\RNfont}{\textsc}

\DeclareDelimFormat[bib]{nameyeardelim}{\addperiod\space}
\DeclareDelimFormat[bib]{nametitledelim}{\addperiod\space}
\renewcommand*{\intitlepunct}{\addspace}
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand*{\subtitlepunct}{\addcolon\space}

\DeclareFieldFormat{number}{\RN{#1}}
\DeclareFieldFormat[article,periodical]{pages}{#1}
\renewcommand*{\bibpagespunct}{%
  \ifboolexpr{test {\ifentrytype{article}} or test {\ifentrytype{periodical}}}
    {\addcolon\space}
    {\addcomma\space}}

\renewbibmacro*{finentry}{} % GW added; no dot at end of reference

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{\thefield{datelabelsource}year}
    {}
    {\iffieldsequal{year}{\thefield{datelabelsource}year}
       {\printdateextralabel}%
       {\printfield{labelyear}%
        \printfield{extrayear}}}}

\DeclareFieldFormat{url}{\mkbibangle{\url{#1}}}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
\DeclareFieldFormat{doi}{\mkbibangle{\url{http://dx.doi.org/#1}}}

\renewbibmacro*{in:}{%
  \ifentrytype{article}
    {}
    {\printtext{\bibstring{in}\intitlepunct}}}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}}%
  \newunit
  \usebibmacro{volume+number+eid}%
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

\renewbibmacro*{series+number}{%
  \printfield{series}%
  \setunit{\addcomma\space}%
  \printfield{number}%
  \newunit}

\renewbibmacro*{publisher+location+date}{%
  \setunit{\addspace}%
  \printtext[parens]{%
    \printlist{location}%
    \iflistundef{publisher}
      {\setunit*{\addcomma\space}}
      {\setunit*{\addcolon\space}}%
    \printlist{publisher}%
    \setunit*{\addcomma\space}%
    \usebibmacro{date}}%
    \newunit}

\renewbibmacro*{doi+eprint+url}{%
  \setunit{\addspace}%
  \iftoggle{bbx:doi}
    {\printfield{doi}}
    {}%
  \setunit{\addspace}%
  \iftoggle{bbx:eprint}
    {\usebibmacro{eprint}}
    {}%
  \setunit{\addspace}%
  \iftoggle{bbx:url}
    {\usebibmacro{url+urldate}}
    {}}

\DeclareBibliographyDriver{thesis}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \printfield{note}%
  \setunit{\addspace}\newblock
  \printtext[parens]{%
    \printfield{pubstate}%
    \global\clearfield{pubstate}%
    \setunit*{\addspace}%
    \printfield{type}%
    \newunit
    \usebibmacro{institution+location+date}}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit
  \printfield{pagetotal}%
  \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}}

% GW: appearance of "editor(s)"; altered from authoryear.bbx
\renewbibmacro*{editor}{%
  \usebibmacro{bbx:editor}{editorstrg}}
\renewbibmacro*{editor+others}{%
  \usebibmacro{bbx:editor}{editor+othersstrg}}
\newbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\printnames{editor}%
        \setunit{\addspace}
        \usebibmacro{bbx:savehash}}%
     \printtext{\usebibmacro{#1}}
     \clearname{editor}%
     \setunit{\adddot\addspace}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\addspace}}%
  \usebibmacro{date+extrayear}}

% GW: appearance of "author(s)"; altered from authoryear.bbx
\renewbibmacro*{author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\usebibmacro{bbx:savehash}%
        \printnames{author}%
        \iffieldundef{authortype}
          {\setunit{\printdelim{nameyeardelim}}}
          {\setunit{\addcomma\space}}}%
     \iffieldundef{authortype}
       {}
       {\usebibmacro{authorstrg}%
        \setunit{\printdelim{nameyeardelim}}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extrayear}}

% GW: get \fullcite as lastname-firstname
\DeclareCiteCommand{\fullcite}
  {\usebibmacro{prenote}}
  {\usedriver
     {}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

% GW: create \fullcitebib command
\DeclareCiteCommand{\fullcitebib}
  {\usebibmacro{prenote}}
  {\usedriver
     {}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

% GW: create \nptextcite (no parentheses) command
\DeclareCiteCommand{\nptextcite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}



% GW: change some strings
\DefineBibliographyStrings{english}{%
  % "and others" instead of "et al"
  andothers        = {and others},
  % no dot in "eds"
  editors          = {eds},
  % "edn" instead of "ed", with no dot after 
  edition          = {edn},
}

% GW: brackets around "editor"
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}

% GW: comma between authors'/editors' names in references 
\AtBeginBibliography{% 
\renewcommand{\finalnamedelim}{% 
  \finalandcomma%
  \addcomma%
  \space%
  \bibstring{and}%
  \space%
  \newunit}%
}

% GW: compress page ranges
\DeclareFieldFormat{pages}%
    {\mkcomprange[{\mkpageprefix[bookpagination]}]{#1}}
\setcounter{mincompwidth}{10}

% GW: colon in citations instead of p/pp
\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\begin{document}

\begin{quote}
  This is described as `a comic-strip style of depiction which was
  common in medieval book-illustration' \parencite[27]{doyl1975}.
\end{quote}

\printbibliography

\end{document}

Best Answer

Remove your code about

\AtBeginBibliography{% 
\renewcommand{\finalnamedelim}{% 
  \finalandcomma%
  \addcomma%
  \space%
  \bibstring{and}%
  \space%
  \newunit}%
}

and add

\DefineBibliographyExtras{british}{\def\finalandcomma{\addcomma}}

By default the British language settings do not enable the Oxford comma, but with the line above you can get it back.

To get the "Oxford comma" even if you have only two names in the bibliography, add

\DeclareDelimFormat[bib]{finalnamedelim}{\finalandcomma\addspace\bibstring{and}\space}

edit: This question was edited with a more elegant solution for newer versions of biblatex. If the solution here does not work for you, you may want to consider an update of TeX system. The old version can be found in the edit history.

Related Question