biblatex 改变 urldate 的格式

biblatex 改变 urldate 的格式

如何在“urldate”中在日期后添加逗号:访问时间:2016 年 12 月 8 日

我认出了,它帮助我前进,但没有解决我的问题。

\thefield{urlday}\iscomma \addspace不起作用也不起作用\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}

尼杰姆根据 AMA,它是“numeric-icomp”的衍生词。

我已经创建了文件/tex/latex/biblatex/biblatex.cfg/tex/latex/biblatex/bbx/myStile.bbx/tex/latex/biblatex/bbx/myStile.cbx带有虚拟文本:\ProvidesFile{biblatex.cfg} \endinput bzw\ProvidesFile{myStyle.bbx} \RequireBibliographyStyle{nejm} \endinput\ProvidesFile{myStile.cbx} \RequireBibliographyStyle{nejm} \endinput、并运行了'texhash TEXMFHOME',但我不知道要将什么放入*.cfg或中*.bbx

我使用 TeX Live 2015.20160320-1 并在 Xubuntu 1604 上使用 XeLaTeX 进行编译

答案1

biblatex-nejm使用稍微不寻常的方式仅获取年份。尝试以下操作

\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}}}}%
}

并加载biblatex选项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}

给予

作者,M 和作者,N。标题。副标题。[摘要]。在:年度会议(2016 年)。11(补充 12)无分页。网址:http://nothing.org/of/interest/(2016 年 12 月 8 日访问)。

答案2

我抬头,现在可以正常工作:

\DeclareFieldFormat{urldate}{%
    (Accessed %
    \mkbibmonth{\thefield{urlmonth}}\addspace%
    \thefield{urlday}\addcomma \addspace     %  addcomma works !!!
    \thefield{urlyear}\isdot)}

相关内容