8

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}

1 Answers1

12

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.

moewe
  • 175,683
  • 3
    For the opposite problem see Multiple authors in (classicthesis) Bibliography: removing comma before “and”. american and english have the Oxford comma enabled by default, british not. – moewe Aug 02 '16 at 09:50
  • Removing my \AtBeginBibliography code takes away the comma after the first of two authors in the references, which I need to have. How can I get that comma back? I need there to be no comma after the first of two authors in a citation. With both the \AtBeginBibliography code and the \finalandcomma code, my \fullcite command doesn't generate the same thing as the references (no comma after the first of two authors in the \fullcite command). If I redefine \finalnamedelim for the whole document, then I get a comma after the first of two authors in the citation. – Gareth Walker Aug 03 '16 at 10:16
  • 1
    @GarethWalker Add the additional code posted. (BTW: Why do you have both \fullcite and \fullcitebib, don't they do the same thing with your code above?) – moewe Aug 03 '16 at 12:29
  • Great - that did it. I just put the same code for \fullcite and \fullcitebib for now, to remind me they need attending to and to allow me to compile (if incorrectly) documents I have already written using biblatex-apa which uses both of those commands. – Gareth Walker Aug 03 '16 at 12:44
  • I need both the oxford comma and to replace "and" with "&". Using the second command is a no-go (only apply comma if 3 or more), but the first one doesn't do anything if I've done anything with finalnameddelim. – TakingItCasual Jun 16 '20 at 12:53
  • @TakingItCasual I suggest you ask a new question about that. Issues like this depend both on the style you use and the document language (as selected - or not - with babel or pilyglossia). – moewe Jun 16 '20 at 14:16