# Modification of biblatex APA style

For my final thesis I need to use a slightly modified version of the APA style. Before I go into more detail, I would like to show you a 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}

\usepackage{filecontents}
\begin{filecontents}{literatur.bib}
@book{XYZ2010,
author = {Andrew Alphason and Bertram Betason and Christian Gammason},
year = {2010},
title = {{Ein Testbuch}},
publisher = {Springer},
}
@book{XYZ2011,
editor = {Andrew Alphason and Bertram Betason and Christian Gammason},
year = {2011},
title = {{Ein Sammelwerk}},
publisher = {Springer},
}
@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},
}
@incollection{XYZ2013,
title = {{Meine kleine Testdatei}},
author = {Dirk Deltason},
editor = {Andrew Alphason and Bertram Betason},
year = {2013},
booktitle = {{Ein Sammelwerk}},
publisher = {Springer},
}
@book{XYZ2014a,
author = {Phil Phison and Bertram Betason},
year = {2014},
title = {{Ein Testbuch}},
publisher = {Springer},
}
@book{XYZ2014b,
author = {{Fictional Institution}},
year = {2014},
title = {{Ein Testbuch}},
publisher = {Springer},
}
@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},
}
\end{filecontents}
\bibliography{literatur}

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


What I need to change is:

1. There should be a comma before "&" in case of 2 AND more than 2 authors/editors in the initial position of the bibliography entry.
2. In case the editors appear afterwards like in entry No. 3 and 4 in the MWE there should be only a comma before "&" in case there are more than 2 editors. No comma for only 2 editors here. Don't ask me why, I just have to do it like that!
3. APA normally prints a period between the authors/editors/institution and the year (in brackets). I am not allowed to insert a period there. How can I remove it? In the example, the period in entry No. 2 after "(Hrsg.)" would not be allowed.

I've inserted an image of the output. I used red to indicate what's wrong and green to show what's correct.

Edit info: I added some more examples to demonstrate the issues I am talking about.

• Welcome to TeX.SX! Big thanks for adding an MWE from the start for your first question! – Paul Gessler Apr 29 '15 at 23:09
• @Seb as I said below: It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The StackExchange staff can merge them together for you. – Paul Gessler Apr 30 '15 at 1:57

Here you are;

\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}

\usepackage{filecontents}
\begin{filecontents}{literatur.bib}
@book{XYZ2010,
author = {Andrew Alphason and Bertram Betason and Christian Gammason},
year = {2010},
title = {{Ein Testbuch}},
publisher = {Springer},
}
@book{XYZ2011,
editor = {Andrew Alphason and Bertram Betason and Christian Gammason},
year = {2011},
title = {{Ein Sammelwerk}},
publisher = {Springer},
}
@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},
}
@incollection{XYZ2013,
title = {{Meine kleine Testdatei}},
author = {Dirk Deltason},
editor = {Andrew Alphason and Bertram Betason},
year = {2013},
booktitle = {{Ein Sammelwerk}},
publisher = {Springer},
}
\end{filecontents}

\usepackage{xpatch}

\xpatchbibmacro{editorinauthpos}{%
\clearname{editor}%