参考文献部分中的 & 前面有逗号

参考文献部分中的 & 前面有逗号

我正在处理有关以 APA 风格引用和引用来源的问题。

这是我的示例代码:

  \documentclass[a4paper, 
   12pt, 
   bibtotoc, 
   liststotoc, 
   pointlessnumbers 
     ]{scrartcl} 
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{textcomp}           
\usepackage[american,ngerman]{babel} 

\usepackage[babel=true]{csquotes} 
\usepackage[style=apa,backend=biber, doi=false, url=false]{biblatex}   
\DeclareLanguageMapping{ngerman}{ngerman-apa} 
\DefineBibliographyStrings{ngerman}{andothers={et\ \addabbrvspace al\adddot}} 
\renewcommand\finalandcomma{\addcomma} 

\usepackage{filecontents} 
\begin{filecontents}{literatur.bib} 
@article{DroitVolet2007, 
 author = {Droit-Volet, S. and Meck, W. H.}, 
 year = {2007}, 
 title = {{H}ow emotions colour our perception of time}, 
 pages = {504--513}, 
 volume = {11}, 
 number = {12}, 
 issn = {13646613}, 
 journal = {Trends in Cognitive Sciences}, 
 doi = {10.1016/j.tics.2007.09.008  Titel anhand dieser DOI in Citavi-Projekt übernehmen 

} 
@article{Gibbon1984,
 author = {Gibbon, J. and Church, R. M. and Meck, W. H.},
 year = {1984},
 title = {{S}calar timing in memory},
 pages = {52--77},
 volume = {423},
 issn = {0077-8923},
 journal = {Annals of the New York Academy of Sciences}
}
    } 
    \end{filecontents} 
    \bibliography{literatur} 
    \begin{document} 

   There is no comma in this citation \parencite{DroitVolet2007}, but the comma is missing in the references. 
For more than two authors there has to be a comma in front of & \parencite{Gibbon1984}.



    \printbibliography 
    \end{document} 

当只有两位作者时,Latex 在参考文献部分的 & 前面漏了一个逗号。对于两位作者,文内引用完全没问题,但参考文献中的条目应如下所示:Droit-Volet, S., & Meck, WH (2007)。...

对于两位以上的作者,在正文引用中 & 前面也必须有一个逗号。

在寻找解决方案时,我尝试使用以下方法修复它

\renewcommand*{\finalnamedelim}{%
  \finalandcomma
  \addspace
  \bibstring{and}%
  \space
}

或者

\renewcommand\finalandcomma{\addcomma} 

但不幸的是,这两种解决方案对我来说都不起作用......

如果您能提供任何帮助或建议我们将不胜感激。

祝一切顺利,费迪南德

答案1

由于某种原因,在钩子中biblatex-apa重新定义。\finalnamedelim\AtBeginBibliography

因此,我们必须执行相同的操作来覆盖设置;此外,我们\finalandcomma\AtBeginDocument钩子中重新定义

\AtBeginDocument{\renewcommand\finalandcomma{\addcomma}}
\AtBeginBibliography{%
  \renewcommand*{\finalnamedelim}{%
    \ifthenelse{\value{listcount}>\maxprtauth}
      {}
      {\finalandcomma\addspace\&\space}}}

这总是会打印\finalandcomma(通常只有在有两个以上的作者时才会打印)。

平均能量损失

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[american,ngerman]{babel}
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage[style=apa,backend=biber, doi=false, url=false]{biblatex}
\DeclareLanguageMapping{ngerman}{ngerman-apa}
\DefineBibliographyStrings{ngerman}{andothers={et\addabbrvspace al\adddot}}

\AtBeginDocument{\renewcommand\finalandcomma{\addcomma}}
\AtBeginBibliography{%
  \renewcommand*{\finalnamedelim}{%
    \ifthenelse{\value{listcount}>\maxprtauth}
      {}
      {\finalandcomma\addspace\&\space}}}

\addbibresource{biblatex-examples.bib}
\begin{document}
  There is no comma in this citation \parencite{baez/article}, but the comma is missing in the reference.

  \printbibliography
\end{document}

在此处输入图片描述

答案2

抑制\renewcommand{\finalandcomma}{\addcomma}(在 apa 样式中,\finalendcomma 打印一个 & 符号,而您想保留它)。在序言中将其替换为以下内容:

\usepackage{xpatch} 
\xpatchnameformat{apaauthor}{%
{\ifmorenames{\andothersdelim\bibstring{andothers}}{}}{}}%
{%
{\ifmorenames{\andothersdelim\bibstring{andothers}}{}}{\addcomma\space}}%
{}{}%

在此处输入图片描述

相关内容