I've been able to answer my own question using various hacks I found on tex.sx. As @PLK pointed out, there appears to be a compatibility issue with polyglossia and Biblatex, but among all the styles I tried this issue is only visible with the APA style. So I am using authoryear-comp instead that suits the requirements I stated. This might be useful for anyone wanting a simple, apalike style, particularly when using Mendeley.
- Citations: cite: year in parentheses or citep: Author-Year separated by coma) ->
\let\citealp\cite
\let\cite\textcite
- If using hyperlink, creating link for the full citation and not just the year. -> Answer from @Audrey, see MWE below.
Use of et al. when more than 2 authors. -> maxcitenames=2
Bibliography: Only initials for first/middle name. -> giveninits=true, uniquename=init
Last name, First name -> \DeclareNameAlias{sortname}{family-given}
- Never use et al. ->
maxbibnames=99
- Only show year, even when month is specified ->
\AtEveryBibitem{%
\clearfield{month}{}% \clearlist{language}{}% }
(also omits the language field)
- Never show URL (retrieved from...) ->
url=false, doi=false, isbn=false, eprint=false
- Issue in parentheses, next to volume -> see MWE below.
There are also some other tweaks in the MWE below, such as using "cited" instead of "cit." for backrefs, removing "in:" for articles, increasing vertical space for bib items.
\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{%
colorlinks=true,
citecolor=blue}
\usepackage{polyglossia}
\setmainlanguage[variant=british]{english}
\usepackage{csquotes}
\PassOptionsToPackage{
natbib=true,
style=authoryear-comp,
hyperref=true,
backend=biber,
maxbibnames=99,
giveninits=true,
uniquename=init,
maxcitenames=2,
parentracker=true,
url=false,
doi=false,
isbn=false,
eprint=false,
backref=true,
} {biblatex}
\usepackage{biblatex}
\DeclareNameAlias{sortname}{family-given}
% remove "in:" from articles. Thanks to Herbert.
\renewbibmacro{in:}{%
\ifentrytype{article}{}{%
\printtext{\bibstring{in}\intitlepunct}}}
% mit "month" and "language" from Bibliography
\AtEveryBibitem{%
\clearfield{month}{}%
\clearlist{language}{}%
}
% some natbib backwards compatibility
\let\citealp\cite
\let\cite\textcite
% increase vertical space between bibliography items.
\setlength\bibitemsep{0.5ex}
\setlength\bibnamesep{1.2ex}
% Comma before and after journal volume. Thanks to lockstep.
\renewbibmacro*{volume+number+eid}{%
\setunit*{\addcomma\space}% NEW
\printfield{volume}%
\printfield{number}%
\printfield{eid}}
\DeclareFieldFormat[article]{number}{(#1)}% number of a journal
% Citation Hyperlinks (not just years), thanks to Audrey.
\makeatletter
\renewbibmacro*{cite}{% Based on cite bib macro from authoryear-comp.cbx
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\printtext[bibhyperref]{% Include labelname in hyperlink
\DeclareFieldAlias{bibhyperref}{default}% Prevent nested hyperlinks
\usebibmacro{cite:label}%
\setunit{\addspace}%
\usebibmacro{cite:labelyear+extrayear}}%
\usebibmacro{cite:reinit}}
{\iffieldequals{namehash}{\cbx@lasthash}
{\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
\(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
{\setunit{\addcomma}%
\usebibmacro{cite:extrayear}}
{\setunit{\compcitedelim}%
\usebibmacro{cite:labelyear+extrayear}%
\savefield{labelyear}{\cbx@lastyear}}}
{\printtext[bibhyperref]{% Include labelname in hyperlink
\DeclareFieldAlias{bibhyperref}{default}% Prevent nested hyperlinks
\printnames{labelname}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:labelyear+extrayear}}%
\savefield{namehash}{\cbx@lasthash}%
\savefield{labelyear}{\cbx@lastyear}}}}
{\usebibmacro{cite:shorthand}%
\usebibmacro{cite:reinit}}%
\setunit{\multicitedelim}}
\renewbibmacro*{textcite}{% Based on textcite bib macro from authoryear-comp.cbx
\iffieldequals{namehash}{\cbx@lasthash}
{\iffieldundef{shorthand}
{\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
\(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
{\setunit{\addcomma}%
\usebibmacro{cite:extrayear}}
{\setunit{\compcitedelim}%
\usebibmacro{cite:labelyear+extrayear}%
\savefield{labelyear}{\cbx@lastyear}}}
{\setunit{\compcitedelim}%
\usebibmacro{cite:shorthand}%
\global\undef\cbx@lastyear}}
{\ifnameundef{labelname}
{\printtext[bibhyperref]{% Include labelname in hyperlink
\DeclareFieldAlias{bibhyperref}{default}% Prevent nested hyperlinks
\iffieldundef{shorthand}
{\usebibmacro{cite:label}%
\setunit{%
\global\booltrue{cbx:parens}%
\addspace\bibopenparen}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{cite:labelyear+extrayear}}
{\usebibmacro{cite:shorthand}}%
\ifthenelse{\iffieldundef{postnote}\AND
\(\value{multicitetotal}=0\AND\value{citetotal}=1\)}
{\bibcloseparen% Include closing parenthesis in hyperlink
\global\boolfalse{cbx:parens}}
{}}}
{\printtext[bibhyperref]{% Include labelname in hyperlink
\DeclareFieldAlias{bibhyperref}{default}% Prevent nested hyperlinks
\printnames{labelname}%
\setunit{%
\global\booltrue{cbx:parens}%
\addspace\bibopenparen}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\iffieldundef{shorthand}
{\iffieldundef{labelyear}
{\usebibmacro{cite:label}}
{\usebibmacro{cite:labelyear+extrayear}}%
\savefield{labelyear}{\cbx@lastyear}}
{\usebibmacro{cite:shorthand}%
\global\undef\cbx@lastyear}%
\ifthenelse{\iffieldundef{postnote}\AND
\(\value{multicitetotal}=0\AND\value{citetotal}=1\)}
{\bibcloseparen% Include closing parenthesis in hyperlink
\global\boolfalse{cbx:parens}}
{}}%
\savefield{namehash}{\cbx@lasthash}}}%
\setunit{%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\multicitedelim}}
\makeatother
% Backrefs "cited" instead of "cit"
\DefineBibliographyStrings{english}{%
backrefpage={cited on p\adddot},
backrefpages={cited on pp\adddot}
}
\addbibresource{bib.bib}
\begin{document}
Finally, as written by \cite{Attanasio2010}, my Bibliography is cool \citep{Galindo2002}. Furthermore (see, for example, \citealp{Attanasio2010}) there are some cool tweaks.
\printbibliography
\end{document}
Since we need to modify the citation commands, the solution depends on the style quite a lot and biblatex-apa
's cite macros differ from the standard ones in authortitle
quite a bit, this is why your attempt didn't work.
It is probably easiest to modify the cite
macro directly here (one could change cite:plabelyear+extrayear
but that could interfere with other commands)
\makeatletter
\renewbibmacro*{cite}{%
\iffieldequals{namehash}{\cbx@lasthash}
% Multiple cites in one command
{\setunit{\compcitedelim}%
\usebibmacro{cite:plabelyear+extrayear}}%
% Single cite
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
% No author/editor
{\usebibmacro{cite:noname}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}
% Normal cite
{\ifnameundef{shortauthor}
{\printnames[labelname][-\value{listtotal}]{labelname}}%
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}}%
\setunit{\addcomma\space}%<-- this is new
\printfield[citeurl]{url}%<--- and so is this
\setunit{\multicitedelim}}
\makeatother
is a copy of the definition from apa.cbx
with two lines added in towards the end.
MWE
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[babel]{csquotes}
\usepackage[style=apa,backend=biber]{biblatex}
\DeclareLanguageMapping{italian}{italian-apa}
%\renewbibmacro*{cite:title}{%
%\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}
%\iffieldundef{url}{}{\nametitledelim\printfield{url}}}}
\makeatletter
\renewbibmacro*{cite}{%
\iffieldequals{namehash}{\cbx@lasthash}
% Multiple cites in one command
{\setunit{\compcitedelim}%
\usebibmacro{cite:plabelyear+extrayear}}%
% Single cite
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
% No author/editor
{\usebibmacro{cite:noname}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}
% Normal cite
{\ifnameundef{shortauthor}
{\printnames[labelname][-\value{listtotal}]{labelname}}%
{\cbx@apa@ifnamesaved
{\printnames{shortauthor}}
{\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}%
\setunit{\nameyeardelim}%
\usebibmacro{cite:plabelyear+extrayear}%
\savefield{namehash}{\cbx@lasthash}}}%
\setunit{\addcomma\space}%<-- this is new
\printfield[citeurl]{url}%<--- and so is this
\setunit{\multicitedelim}}
\makeatother
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{cit1,
title = {Title},
url = {http://www.website.com},
titleaddon = {Example},
urldate = {2013-04-10},
date = {2004}
}
@report{cit2,
author = {BBBAuthor, Name},
title = {Title Title Title},
url = {http://www.example.com},
titleaddon = {Website Name},
urldate = {2013-04-10},
date = {2004}
}
@book{cit3,
location = {Location},
title = {Title Title},
langid = {english},
publisher = {Publisher},
author = {Author, Name},
date = {2001}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
Bla bla\footcite[]{cit1}.
Bla\footcite[]{cit2}
BLA BLA\footcite[]{cit1}
Blaaa blaa bla\footcite[]{cit3}.
\printbibliography[heading=bibintoc,nottype=online,title={Bibliography}]
\printbibliography[title={Online},type=online,heading=subbibliography]
\end{document}
Best Answer
http://texnik.dante.de/misc/
there is a mla-goodURL, which knows the field "urldate", which should be printed if not empty.
Herbert