![參考文獻部分中 & 前面的逗號](https://rvso.com/image/286374/%E5%8F%83%E8%80%83%E6%96%87%E7%8D%BB%E9%83%A8%E5%88%86%E4%B8%AD%20%26%20%E5%89%8D%E9%9D%A2%E7%9A%84%E9%80%97%E8%99%9F.png)
我正在處理有關 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)。 ....
對於兩位以上的作者,文本引用中的 & in 前面也必須有一個逗號。
在尋找解決方案時,我嘗試使用以下方法修復它
\renewcommand*{\finalnamedelim}{%
\finalandcomma
\addspace
\bibstring{and}%
\space
}
或者
\renewcommand\finalandcomma{\addcomma}
但不幸的是,這些解決方案在我的情況下都不起作用...
幫助或任何建議將不勝感激。
最美好的祝愿,費迪南德
答案1
由於某種原因在鉤子中biblatex-apa
重新定義。\finalnamedelim
\AtBeginBibliography
因此,我們必須執行相同的操作來覆蓋該設定;另外,我們重新定義了\finalandcomma
in the \AtBeginDocument
hook
\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}}%
{}{}%