[Tex/LaTex] biblatex change format of urldate

biblatexformatting

How to get a comma after the day in „urldate“: Accessed December 08, 2016

I recognized this, it helped me forward but did not solve my problem.

\thefield{urlday}\iscomma \addspace does not work
neither does \mkbibday{\thefield{urlday}\iscomma}\addspace

\documentclass[version=last,11pt,DIV=calc]{scrartcl}
\usepackage[english,main=ngerman]{babel}
\usepackage{url}
\usepackage{hyperref}

\usepackage{filecontents}

\usepackage[babel,english=british]{csquotes}
\usepackage{ragged2e}
\usepackage[backend=biber,babel=other,style=nejm,dateabbrev=false]{biblatex}
%\usepackage[backend=biber,babel=other,style=myStile,dateabbrev=false]{biblatex}

\DeclareFieldFormat{urldate}{%
    (Accessed%
    \mkbibmonth{\thefield{urlmonth}}\addspace%
    \thefield{urlday}\addspace%
    %\thefield{urlday}\iscomma \addspace% does not work
    %\mkbibday{\thefield{urlday}\iscomma}% does not work
    \thefield{urlyear}\isdot)}

\addbibresource{testBiblio.bib}

\begin{document}
    \selectlanguage{english}

    \begin{filecontents}{testBiblio.bib}
    @Conference{AuthorMAuthorN2016,
        author      = {Author, M and Author, N},
        title       = {{{T}he {T}itle}},
        subtitle    = {{{T}he {S}ubtitle}},
        titleaddon  = {[abstract]},
        number      = {no pagination},
        eventtitle  = {{A}nnual {C}onf},
        urldate     = {2016-12-08},
        url         = {http://nothing.org/of/interest/},
        series      = {11 (suppl 12)},
        eventdate   = {2016}
    }
    \end{filecontents}

    \section{foo}

    Part of a proceeding \cite{AuthorMAuthorN2016} \\

    \printbibliography[title={References}]
\end{document}

nejm is according to AMA, it is a derivative of „numeric-icomp“.

I already created the files /tex/latex/biblatex/biblatex.cfg, /tex/latex/biblatex/bbx/myStile.bbx and /tex/latex/biblatex/bbx/myStile.cbx with dummy-text: \ProvidesFile{biblatex.cfg} \endinput bzw. \ProvidesFile{myStyle.bbx} \RequireBibliographyStyle{nejm} \endinput and \ProvidesFile{myStile.cbx} \RequireBibliographyStyle{nejm} \endinput, an ran 'texhash TEXMFHOME' but I don‘t know what to put into *.cfg or *.bbx.

I use TeX Live 2015.20160320-1 and compile with XeLaTeX on Xubuntu 1604

Best Answer

biblatex-nejm uses a slightly unusual way of getting only the year. Try the following

\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#1}}

\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{\space}}
     {\nobreakspace}}%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}%
       \iffieldundef{#1}{}{,\space}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}}%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{/}}
         {/}}%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}%
       \iffieldundef{#1}{}{/}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}%
}

And load biblatex with the options alldates=year,urldate=long.

\documentclass[version=last,11pt,DIV=calc]{scrartcl}
\usepackage[main=english]{babel}

\usepackage{filecontents}

\usepackage[babel,english=british]{csquotes}
\usepackage[backend=biber,babel=other,style=nejm,dateabbrev=false,alldates=year,urldate=long]{biblatex}

\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#1}}

\begin{filecontents}{\jobname.bib}
@conference{AuthorMAuthorN2016,
  author      = {Author, M and Author, N},
  title       = {{{T}he {T}itle}},
  subtitle    = {{{T}he {S}ubtitle}},
  titleaddon  = {[abstract]},
  number      = {no pagination},
  eventtitle  = {{A}nnual {C}onf},
  urldate     = {2016-12-08},
  url         = {http://nothing.org/of/interest/},
  series      = {11 (suppl 12)},
  eventdate   = {2016}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{\space}}
     {\nobreakspace}}%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}%
       \iffieldundef{#1}{}{,\space}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}}%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#3}
         {\iffieldundef{#1}{}{/}}
         {/}}%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}%
       \iffieldundef{#1}{}{/}}%
     \iffieldbibstring{#1}
       {\bibstring{\thefield{#1}}}
       {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}%
}

\begin{document}
  Part of a proceeding \cite{AuthorMAuthorN2016}
  \printbibliography[title={References}]
\end{document}

Gives

Author, M and Author, N. The Title. The Subtitle. [abstract]. In: Annual Conf. (2016). 11 (suppl 12) no pagination. url: http://nothing.org/of/interest/ (visited on December 8, 2016).