在我的参考文献中,我希望我的日期写成“日月年”。我按照此处的最佳答案实现了这一点使用 biblatex 格式化日期“日月年”。但是,当我尝试使用带有 style=apa 的 MWE 时,我在 \printbibliography 命令中收到错误“未定义的控制序列。\end”。
\documentclass{article}
\usepackage[australian,american]{babel}
\usepackage[style=apa, backend=biber, dateabbrev=false]{biblatex}
\begin{filecontents}{references.bib}
@book{Book,
title = {This is a Title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
date = 2005,
month = feb,
day = 14,
}
\end{filecontents}
\addbibresource{references.bib}
\begin{document}
\today
Citing \cite{Book}.
\begin{otherlanguage}{australian}
\printbibliography
\end{otherlanguage}
\end{document}
答案1
你的序言中的以下重新定义应该足够了
\DefineBibliographyExtras{american}{%
\protected\def\mkbibdateapalongmdy#1#2#3{%
\iffieldundef{#3}
{}
{\mkbibordinal{\thefield{#3}}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}}
但由于当前版本在文件中biblatex-apa
使用了\DefineBibliographyExtras
而不是 ,因此不太适用。此错误\DeclareBibliographyExtras
.lbx
已经在 github 存储库中解决,但它尚未进入 CTAN。
作为临时解决方法,我建议您创建一个名为的新文件american-bpb.lbx
并填充
\ProvidesFile{american-bpb.lbx}[2015/10/10\space v6.7\space APA biblatex localisation - modified]
\InheritBibliographyExtras{american-apa}
\DeclareBibliographyStrings{inherit = {american-apa}}
\DefineBibliographyExtras{american}{%
\protected\def\mkbibdateapalongmdy#1#2#3{%
\iffieldundef{#3}
{}
{\mkbibordinal{\thefield{#3}}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}}
\endinput
在您的文档中使用\DeclareLanguageMapping{american}{american-bpb}
(而不是通常需要的\DeclareLanguageMapping{american}{american-apa}
)
在 MWE 中我们创建了american-bpb.lbx
viafilecontents
\documentclass{article}
\usepackage{filecontents}
\usepackage[american]{babel}
\begin{filecontents}{american-bpb.lbx}
\ProvidesFile{american-bpb.lbx}[2015/10/10\space v6.7\space APA biblatex localisation - modified]
\InheritBibliographyExtras{american-apa}
\DeclareBibliographyStrings{inherit = {american-apa}}
\DefineBibliographyExtras{american}{%
\protected\def\mkbibdateapalongmdy#1#2#3{%
\iffieldundef{#3}
{}
{\mkbibordinal{\thefield{#3}}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}}
\endinput
\end{filecontents}
\usepackage[style=apa, backend=biber, dateabbrev=false]{biblatex}
\DeclareLanguageMapping{american}{american-bpb}
\begin{filecontents}{\jobname.bib}
@online{online,
title = {Something on the Internet},
author = {Anne Uthor},
date = {2015-04-08},
url = {http://www.example.com},
urldate = {2015-08-04},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}