biblatex APA 格式修改的后续问题

biblatex APA 格式修改的后续问题

对于我的最终论文,我需要使用稍微修改过的 APA 格式。在详细介绍之前,我想向您展示一个 MWE:

\documentclass[12pt]{scrreprt} 
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage[ngerman]{babel}
\usepackage{csquotes} 
\usepackage[%
backend=biber,
style=authoryear-comp,
bibstyle=apa]{biblatex}   
\DeclareLanguageMapping{ngerman}{ngerman-apa}
\DefineBibliographyStrings{ngerman}{andothers={et\ \addabbrvspace al\adddot}}

\usepackage{filecontents} 
\begin{filecontents}{literatur.bib} 
@book{XYZ2010, 
 author = {Andrew Alphason and Bertram Betason and Christian Gammason}, 
 year = {2010}, 
 title = {{Ein Testbuch}},
 publisher = {Springer},
 address = {Stuttgart}
}
@book{XYZ2011,
 editor = {Andrew Alphason and Bertram Betason and Christian Gammason},
 year = {2011},
 title = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart},
}
@incollection{XYZ2012,
 title = {{Meine kleine Testdatei}},
 author = {Dirk Deltason},
 editor = {Andrew Alphason and Bertram Betason and Christian Gammason},
 year = {2012},
 booktitle = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart}, 
}
@incollection{XYZ2013,
 title = {{Meine kleine Testdatei}},
 author = {Dirk Deltason},
 editor = {Andrew Alphason and Bertram Betason},
 year = {2013},
 booktitle = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart}, 
}
@book{XYZ2014a, 
 author = {Phil Phison and Bertram Betason}, 
 year = {2014}, 
 title = {{Ein Testbuch}},
 publisher = {Springer},
 address = {Stuttgart},
} 
@book{XYZ2014b, 
 author = {{Fictional Institution}}, 
 year = {2014}, 
 title = {{Ein Testbuch}},
 publisher = {Springer},
 address = {Stuttgart},
}
@incollection{XYZ2014c,
 title = {{Meine kleine Testdatei}},
 author = {Dirk Deltason and Ezra Epsilonson},
 editor = {Andrew Alphason and Bertram Betason},
 year = {2014},
 booktitle = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart},
}
\end{filecontents} 
\bibliography{literatur} 

\begin{document} 
\parencite{XYZ2010,XYZ2011,XYZ2012,XYZ2013,XYZ2014a,XYZ2014b,XYZ2014c}
\printbibliography 
\end{document}

我需要改变的是:

  1. 当参考书目条目的起始位置有 2 个或 2 个以上的作者/编辑时,应该在“&”前加一个逗号。
  2. 如果编辑者出现在后面,如 MWE 中的条目 3 和 4,则在有超过 2 个编辑者的情况下,在“&”之前应该只有一个逗号。这里只有 2 个编辑者,所以没有逗号。不要问我为什么,我就是必须这样做!
  3. APA 通常会在作者/编辑/机构和年份之间打印一个句号(在括号中)。我不能在那里插入句号。我该如何删除它?在示例中,条目 2 中“(Hrsg.)”后面的句号是不允许的。

我插入了输出的图片。我用红色表示错误,用绿色表示正确。

参考书目

也可以看看biblatex APA 样式修改

答案1

我认为这段代码应该可以满足你的要求:

\documentclass[12pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[%
backend=biber,
style=authoryear-comp,
bibstyle=apa]{biblatex}
\DeclareLanguageMapping{ngerman}{ngerman-apa}
\DefineBibliographyStrings{ngerman}{andothers={et\ \addabbrvspace al\adddot}}

\usepackage{filecontents}
\begin{filecontents}{literatur.bib}
@book{XYZ2010,
 author = {Andrew Alphason and Bertram Betason and Christian Gammason},
 year = {2010},
 title = {{Ein Testbuch}},
 publisher = {Springer},
 address = {Stuttgart}
}
@book{XYZ2011,
 editor = {Andrew Alphason and Bertram Betason and Christian Gammason},
 year = {2011},
 title = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart},
}
@incollection{XYZ2012,
 title = {{Meine kleine Testdatei}},
 author = {Dirk Deltason},
 editor = {Andrew Alphason and Bertram Betason and Christian Gammason},
 year = {2012},
 booktitle = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart},
}
@incollection{XYZ2013,
 title = {{Meine kleine Testdatei}},
 author = {Dirk Deltason},
 editor = {Andrew Alphason and Bertram Betason},
 year = {2013},
 booktitle = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart},
}
@book{XYZ2014a,
 author = {Phil Phison and Bertram Betason},
 year = {2014},
 title = {{Ein Testbuch}},
 publisher = {Springer},
 address = {Stuttgart},
}
@book{XYZ2014b,
 author = {{Fictional Institution}},
 year = {2014},
 title = {{Ein Testbuch}},
 publisher = {Springer},
 address = {Stuttgart},
}
@incollection{XYZ2014c,
 title = {{Meine kleine Testdatei}},
 author = {Dirk Deltason and Ezra Epsilonson},
 editor = {Andrew Alphason and Bertram Betason},
 year = {2014},
 booktitle = {{Ein Sammelwerk}},
 publisher = {Springer},
 address = {Stuttgart},
}
\end{filecontents}
\bibliography{literatur}

    \usepackage{xpatch}

     \DefineBibliographyExtras{ngerman}{\def\finalandcomma{\addcomma}}

    \xpatchbibmacro{editorinauthpos}{%
           \clearname{editor}%
           \setunit{\adddot\addspace}%
    }{%
           \clearname{editor}%
           \setunit{\addspace}%
    }{}{}
\AtBeginBibliography{\renewcommand*{\finalnamedelim}{%
    \ifthenelse{\value{listcount}>\maxprtauth}
      {}
      {\finalandcomma\addspace\&\space}
         }}

\renewbibmacro*{author}{%
  \ifnameundef{author}
    {\usebibmacro{labeltitle}}
    {\printnames[apaauthor][-\value{listtotal}]{author}%
     \setunit*{\addspace}%
     \printfield{nameaddon}%
     \ifnameundef{with}
       {}
       {\setunit{}\addspace\mkbibparens{\printtext{\bibstring{with}\addspace}%
        \printnames[apaauthor][-\value{listtotal}]{with}}
        \setunit*{\addspace}}}%
  \setunit{\addspace}\newblock%
  \usebibmacro{labelyear+extrayear}}

\xpretobibmacro{editor+trans}{\renewcommand*{\finalnamedelim}{%
  \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
  \addspace\&\space}}


\begin{document}
\parencite{XYZ2010,XYZ2011,XYZ2012,XYZ2013,XYZ2014a,XYZ2014b,XYZ2014c}
\printbibliography
\end{document} 

在此处输入图片描述

相关内容