apa
我在 BibLaTeX 中使用样式时遇到了问题。
\documentclass[a4paper,14pt]{extarticle}
\usepackage{cmap}
\usepackage{mathtext}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{csquotes}
\usepackage[style=apa,backend=biber,sorting=nyt]{biblatex}
\addbibresource{bibl1.bib}
\begin{document}
Text, text...
\nocite{*}
\printbibliography
\end{document}
错误信息:
! Undefined control sequence.
<argument> \mkbibdateapalongextra
{year}{month}{day}\iffieldundef {endyear}{...
我找到了其他语言的解决方案,但 TeXstudio 无法识别\DeclareLanguageMapping
,而且我没有找到russian-apa.lbx
。
答案1
biblatex-apa
在文件中定义一些必要的宏.lbx
,因此对于文档中使用的每种语言,您都需要
\DeclareLanguageMapping{<lang>}{<lang>-apa}
从
biblatex
v3.8/biblatex-apa
v7.5 开始,不再需要手动\DeclareLanguageMapping
。biblatex-apa
现在使用 自动设置所有语言的映射。当然,这只有在文件存在\DeclareLanguageMappingSuffix{-apa}
时才有效。<lang>-apa.lbx
不幸的是,没有,russian-apa.lbx
所以这条线\DeclareLanguageMapping{russian}{russian-apa}
不会真正有帮助,我们只会收到一条rusian-apa.lbx
未找到的消息并且映射被忽略。
最好的解决方案是写russian-apa.lbx
。你可以将任意...-apa.lbx
s 作为起点并翻译该文件。请参阅配置 biblatex 以用于不受支持的语言的最合适方法是什么?。这里可能涉及复制english-apa.lbx
到russian-apa.lbx
、更改顶部的日期和 ID、翻译内容以及修改日期格式为俄语用法。
为了快速修复,您只需添加
\DefineBibliographyExtras{russian}{%
\protected\def\mkbibdateapalong#1#2#3{%
\iffieldundef{#1}%
{}%
{\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}%
\iffieldundef{#2}%
{}%
{\iffieldundef{#1}%
{}%
{\addcomma\addspace}%
\mkbibmonth{\thefield{#2}}}%
\iffieldundef{#3}%
{}%
{\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#1}}%
{}%
{\addspace}%
\stripzeros{\thefield{#3}}}}%
\protected\def\mkbibdateapalongextra#1#2#3{%
\iffieldundef{#1}%
{}%
{\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}\printfield{extrayear}}%
\iffieldundef{#2}%
{}%
{\iffieldundef{#1}%
{}%
{\addcomma\addspace}%
\mkbibmonth{\thefield{#2}}}%
\iffieldundef{#3}%
{}%
{\ifthenelse{\iffieldundef{#2}\OR\iffieldundef{#1}}%
{}%
{\addspace}%
\stripzeros{\thefield{#3}}}}%
\protected\def\mkbibdateapalongmdy#1#2#3{%
\iffieldundef{#2}%
{}%
{\mkbibmonth{\thefield{#2}}}%
\iffieldundef{#3}%
{}%
{\addspace}%
\stripzeros{\thefield{#3}}%
\iffieldundef{#1}%
{}%
{\ifthenelse{\iffieldundef{#3}}%
{\ifthenelse{\iffieldundef{#2}}%
{}%
{\addspace}}%
{\addcomma\addspace}%
\iffieldbibstring{#1}{\biblcstring{\thefield{#1}}}{\thefield{#1}}}}}
到你的序言。(如果需要,可以将其修改为俄罗斯习俗。)