# biblatex: edit apa style for online sources

I've a little question. For papers in university we're supposed to use the apa citation style, however one of our professors wants some slight changes to the apa style (he calls this style apa+), when it comes to online sources:

He requires the following style:

EUR-Lex. (2017). Democratic Deficit - EU-LEX. Retrieved from https://eur-lex.europa.eu/summary/glossary/democratic_deficit.html on 16 March 2018.

However when I use the default apa style it the citation looks like that:

EUR-Lex. (2017). Democratic Deficit - EU-LEX. Retrieved 16 March 2018, from https://eur-lex.europa.eu/summary/glossary/democratic_deficit.html

I somehow need to change the order and the prefixes of 'url' and 'urldate', but I've been looking through a lot of questions and articles but I couldn't find anything that worked for that specific case.

Here is my latex code:

\documentclass{scrartcl}
\usepackage[british]{babel}
\usepackage[style=apa, backend=biber, dateabbrev=false, urldate=long] {biblatex}
\usepackage{csquotes}

% used to remove the 'th' in the british date format
\DefineBibliographyExtras{british}{
% d-m-y format for long dates
\protected\def\mkbibdatelong#1#2#3{%
\iffieldundef{#3}
{}
{\stripzeros{\thefield{#3}}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}%
}

\bibliography{new.bib}

\begin{document}

ping.\parencite{EUR-LexDemocraticDeficitEULEXs.d.}

\printbibliography

\end{document}


And here the bib file:

@online{EUR-LexDemocraticDeficitEULEXs.d.,
title = {Democratic {{Deficit}} - {{EU}}-{{LEX}}},
url = {https://eur-lex.europa.eu/summary/glossary/democratic_deficit.html},
urldate = {2018-03-16},
year = {2017},
author = {{EUR-Lex}},
}


I would be extremely thankful for any ideas!

We 'just' need to redefine the bibmacro url+urldate a bit. Since the APA has some peculiar ideas about URLs, that macro is not that short already. Unfortunately, "APA+" does not really make it shorter or simpler. Then we need a bit of trickery to get the period back if the entry ends in a URL with urldate.

\documentclass{scrartcl}
\usepackage[british]{babel}
\usepackage[style=apa, backend=biber, dateabbrev=false, urldate=long] {biblatex}
\usepackage{csquotes}

\DefineBibliographyExtras{british}{%
\protected\def\mkbibdatelong#1#2#3{%
\iffieldundef{#3}
{}
{\stripzeros{\thefield{#3}}%
\iffieldundef{#2}{}{\nobreakspace}}%
\iffieldundef{#2}
{}
{\mkbibmonth{\thefield{#2}}%
\iffieldundef{#1}{}{\space}}%
\iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}}

\DefineBibliographyStrings{british}{urlseen = {on}}

\DeclareFieldFormat{urldate}{\bibstring{urlseen}~#1}
\renewbibmacro*{url+urldate}{%
\ifthenelse{$$\iffieldundef{url}\AND\iffieldundef{abstracturl}\AND\iffieldundef{abstractloc}$$\OR\NOT\iffieldundef{doi}}
{}
{\ifthenelse{\iffieldundef{abstracturl}\AND\iffieldundef{abstractloc}}
{}
\iffieldequalstr{entrysubtype}{{DVD}}
{\printtext{\bibstring{available}}}
{\printtext{\bibstring{retrieved}}}%
\printtext{\bibstring{from}}%
\printfield{urldescription}%
\printfield{url}%
\printfield{abstractloc}%
\printfield{abstracturl}%
\iffieldundef{urlyear}
{}
{\printtext{\printurldate}}}}

\usepackage{xpatch}
\xpatchbibdriver{online}
{\iffieldundef{url}{}{\renewcommand*{\finentrypunct}{\relax}}}
{\ifboolexpr{not test {\iffieldundef{url}} and test {\iffieldundef{urlyear}}}{\renewcommand*{\finentrypunct}{\relax}}{}}
{}{}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{EUR-LexDemocraticDeficitEULEXs.d.,
title = {Democratic {{Deficit}} - {{EU}}-{{LEX}}},
url = {https://eur-lex.europa.eu/summary/glossary/democratic_deficit.html},
urldate = {2018-03-16},
year = {2017},
author = {{EUR-Lex}},
}
\end{filecontents}


• I had tried to deal with this one, but couldn't sort out whatever was happening to the final punctuation. What's the deal with the frequent \renewcommand*{\finentrypunct}{\relax} to be found in biblatex-apa? What's their purpose? – gusbrs Apr 9 '18 at 15:34
• That's what I supposed initially, but then I saw a number of them, including after abstractloc (whatever that is). But looking closer after your comment everything I recognize seems to fit in your case (eprint, doi etc). Thanks! – gusbrs Apr 9 '18 at 16:01