使用 Biblatex-chicago 的 DMY 日期和连续逗号

使用 Biblatex-chicago 的 DMY 日期和连续逗号

我对 LaTeX 还不太熟悉,但我一直在拼凑一些东西来开发一个具有我使用的风格的模板。具体来说,我需要使用美国地理学家协会年鉴 (AAG) 风格,这是一种经过修改的芝加哥风格。我几乎已经设法获得了引用所需的内容(这可不是一件小事);我目前可以生成以下内容:

我的书目风格的样本

但是,为了符合 AAG 样式,我需要将日期设置为 dd Mon. yyyy 格式。在四处搜索后,我发现了通过 babel 使用澳大利亚英语的建议,结果如下:

在此处输入图片描述

不幸的是,现在作者名单上的连续逗号已经删除了。

这是我的 TeX 的 MWE(带有澳大利亚):

\documentclass{article}

\usepackage[australian,american]{babel}

\usepackage[authordate-trad, backend=biber, dateabbrev=true, firstinits=true, maxcitenames=3, isbn=false, doi=false, eprint=false]{biblatex-chicago}

%Set custom strings for url and date labels (available at and last accessed)
\NewBibliographyString{available}
\NewBibliographyString{urlwhen}

\DefineBibliographyStrings{english}{%
  available = {Available at},
}

\DefineBibliographyStrings{english}{%
  urlwhen = {last accessed},
}

\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlwhen}\addcolon\space{#1}}}

% Set url + date appearance in bib (add doi here if needed)
\renewbibmacro*{bib+doi+url}{%
  \usebibmacro{url+urldate}
  }

%Remove Quotes around titles
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1\isdot}

\addbibresource[datatype=bibtex]{biblio.bib}
\begin{document}
\autocite{article}

\renewcommand*{\bibname}{References}
\begin{otherlanguage}{australian}
\printbibliography 
\end{otherlanguage}
\end{document}

这是 .bib:

@article{article,
 Author = {Brown, J. C. and Jepson, W. E. and Kastens, J. H. and Wardlow, B. D. and Lomas, J. M. and Price, K. P.},
 Number = {2},
 Pages = {117-148},
 Title = {Multitemporal, moderate-spatial-resolution remote sensing of modern agricultural production and land modification in the Brazilian Amazon},
 Url = {http://www.somehost.org/somefolder/somefile.pdf},
 Urldate = {2013-10-27},
 Volume = {44},
 Year = {2007}}

有人知道获得我需要的最佳方法吗?也就是说,如何才能获得日期格式而不丢失逗号?

谢谢!

答案1

还有 一种 无需 切换 语言 的 方法australian, 但 我 认为 , 如果 您 的 文件 实际上 是 如此 , 那 这 并不是 最好 的 主意american.

您只需将以下代码块放入序言中即可biblatex更改日期格式。american

您可以在 中找到定义australia.lbx,其他日期格式均继承自british.lbx。只需从那里复制相关定义即可(相关定义包括\mkbibdatelong\mkbibdateshort,如果也使用\mkbibordinal)。

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

如果你打算更频繁地使用这种日期格式,一个更biblatex简单的方法是创建一个新的本地化文件,american-dmy.lbx其内容如下

\ProvidesFile{american-dmy.lbx}[american localisation with dmydate format for long dates]

\InheritBibliographyExtras{american}
\DeclareBibliographyExtras{%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}%
       \iffieldundef{#2}{}{/}}%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#1}{}{/}}%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}%
}
\InheritBibliographyStrings{american}
\endinput

并通过加载此语言配置

\DeclareLanguageMapping{american}{american-dmy}

第二种解决方案的完全独立的 MWE(如果您在文档中使用它,您将拥有该.bib文件,并且american-dmy.lbxLaTeX 可以在某个地方找到它,当然可以省略filecontents

\documentclass{article}
\usepackage[american]{babel}
\usepackage[authordate-trad, backend=biber, dateabbrev=true, firstinits=true, maxcitenames=3, isbn=false, doi=false, eprint=false]{biblatex-chicago}
\DeclareLanguageMapping{american}{american-dmy}

\begin{filecontents}{american-dmy.lbx}
\ProvidesFile{american-dmy.lbx}[american localisation with dmydate format for long dates]

\InheritBibliographyExtras{american}
\DeclareBibliographyExtras{%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}%
       \iffieldundef{#2}{}{/}}%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#1}{}{/}}%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}%
}
\InheritBibliographyStrings{american}
\endinput
\end{filecontents}

\begin{filecontents}{\jobname.bib}
@article{article,
 Author = {Brown, J. C. and Jepson, W. E. and Kastens, J. H. and Wardlow, B. D. and Lomas, J. M. and Price, K. P.},
 Number = {2},
 Pages = {117-148},
 Title = {Multitemporal, moderate-spatial-resolution remote sensing of modern agricultural production and land modification in the Brazilian Amazon},
 Url = {http://www.somehost.org/somefolder/somefile.pdf},
 Urldate = {2013-10-27},
 Volume = {44},
 Year = {2007}}
\end{filecontents}

\DefineBibliographyStrings{american}{%
  url = {available at},
  urlseen = {last accessed},
}

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

% Set url + date appearance in bib (add doi here if needed)
\renewbibmacro*{bib+doi+url}{%
  \usebibmacro{url+urldate}%
}

%Remove Quotes around titles
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1\isdot}

\addbibresource{\jobname.bib}
\begin{document}
\autocite{article}

\renewcommand*{\bibname}{References}
\printbibliography 
\end{document}

产量

在此处输入图片描述


还要注意,最好使用大写,因为单词出现在句中而不是句首(“请注意,所有表达都应大写,因为它们通常在句中使用。当需要在句首使用时,软件包biblatex会自动将第一个单词大写。用于标题的表达方式应以适合标题的方式大写”biblatex文档 v. 2.8,§3.8“本地化命令”,第 90 页。我将其更改available = {Available at},available = {available at},。)还biblatex已为 URL(称为url)和urlseen访问 URL 的日期提供了本地化字符串,因此您可以使用这些字符串,而不必声明新的字符串。

答案2

在进一步研究文档并进行实验后,我设法找到了一种方法。将以下内容添加到文档中将添加连续逗号并保留澳大利亚日期格式:

\DefineBibliographyExtras{australian}{%
  \renewcommand*{\finalandcomma}{\addcomma\addspace}
}

结果是:

成功!正确的参考格式

相关内容