2

I am trying to use code provided here to format references to newspaper articles, in a larger project aiming to follow MHRA style. The code makes use of a new entrysubtype 'newspaper', based on article. I need a colon before page ranges for articles, but a comma and p./pp. if it's from a newspaper or other source e.g. a chapter in an edited volume. How can I do that? Currently, the code below produces a colon for regular articles and newspapers. I have a feeling that it could be achieved by modifying the \renewcommand*{\bibpagespunct} section, but I can't seem to manage it.

\documentclass[british]{article}
\usepackage{babel}
\usepackage[backend=biber,
            style=authoryear,
            sortcites=true,
            sorting=ynt,
            mergedate=basic,
            dateabbrev=false
            ]{biblatex}
\DeclareFieldFormat[article,periodical]{pages}{#1}
\renewcommand*{\bibpagespunct}{%
  \ifboolexpr{test {\ifentrytype{article}} or test {\ifentrytype{periodical}}}
    {\addcolon\space}
    {\addcomma\space}}
\DeclareDelimFormat[bib]{nameyeardelim}{\addperiod\space}
\DeclareDelimFormat[bib]{nametitledelim}{\addperiod\space}
\renewcommand*{\intitlepunct}{\addspace}
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand*{\subtitlepunct}{\addcolon\space}
% for newspapers
\DeclareFieldFormat{chapter}{\ifnumerals{#1}{\bibstring{chapter}~}{}#1}
 \renewbibmacro*{journal+issuetitle}{%
   \usebibmacro{journal}%
   \setunit*{\addcomma\addspace}%
   \iffieldundef{series}
     {}
     {\newunit
      \printfield{series}%
      \setunit{\addspace}}%
   \usebibmacro{volume+number+eid}%
   \iffieldequalstr{entrysubtype}{newspaper}
     {\setunit{\addcomma\space}%
      \usebibmacro{newspaper:issue+date}}
     {\setunit{\addspace}%
      \usebibmacro{issue+date}%
      \setunit{\addcolon\space}%
      \usebibmacro{issue}}%
   \newunit}

\newbibmacro*{newspaper:issue+date}{%
  \printtext{%
    \iffieldundef{day}{}{%
      \mkdatezeros{\thefield{day}}%
      \iffieldundef{month}{}{\nobreakspace}}%
    \iffieldundef{month}
      {}
      {\mkbibmonth{\thefield{month}}}}}

\renewbibmacro*{note+pages}{%
  \printfield{note}%
  \newunit
  \iffieldequalstr{entrysubtype}{newspaper}
    {\printfield{chapter}}{}%
  \setunit{\bibpagespunct}%
  \printfield{pages}%
  \newunit}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{frie2002,
  author  = {Jonathan Friedland},
  title   = {Across the Divide},
  journal = {Guardian}, 
  pages   = {10-11},
  date    = {2002-01-15},
  chapter = {section G2}, 
  entrysubtype = {newspaper},
}
@Article{grad2001,
  author =   {Hugh Grady},
  title =    {Falstaff: Subjectivity between the Carnival and the Aesthetic},
  journal =      {MLR},
  year =     {2001},
  volume =   {96},
  number =   {3},
  pages =    {609-623},
}
@InCollection{herm2006,
  author =   {Rachel Hermetet},
  title =    {\emph{The Criterion} et les litt\'{e}ratures
                  europ\'{e}ennes, 1922--1935},
  booktitle =    {Revues modernistes anglo-am\'ericaines: lieux
                  d'\'{e}changes, lieux d'exil},
  publisher =    {Ent'revues},
  year =     2006,
  editor =   {Beno\^{i}t Tadi\'{e}},
  pages =    {189-200},
  address =      {Paris},
}
\end{filecontents}
\addbibresource{\jobname.bib} 

\begin{document}
\nocite{*}
\printbibliography
\end{document}

This is the current output. enter image description here

1 Answer 1

1

We can use \iffieldequalstr{entrysubtype}{newspaper} to test for newspaper subtypes.

\DeclareFieldFormat[article,periodical]{pages}{%
  \iffieldequalstr{entrysubtype}{newspaper}
    {\mkpageprefix[bookpagination]{#1}}
    {#1}}

\renewcommand*{\bibpagespunct}{%
  \ifboolexpr{(test {\ifentrytype{article}} or test {\ifentrytype{periodical}})
              and not test {\iffieldequalstr{entrysubtype}{newspaper}}}
    {\addcolon\space}
    {\addcomma\space}}

Starting with biblatex 3.5 you will want to use \mkdayzeros/\mkmonthzeros/\mkyearzeros instead of \mkdatezeros, so newspaper:issue+date should be

\newbibmacro*{newspaper:issue+date}{%
  \printtext{%
    \iffieldundef{day}{}{%
      \mkdayzeros{\thefield{day}}%
      \iffieldundef{month}{}{\nobreakspace}}%
    \iffieldundef{month}
      {}
      {\mkbibmonth{\thefield{month}}}}}
1
  • Brilliant: thanks. At least I was on the right track, though not very far along it... Thanks for the biblatex tip. Sep 13, 2016 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .