# biblatex-apa and hyperref: right parenthesis not part of link for \textcite

I use biblatex-apa citation style. I also use hyperref with colour links, rather than ugly coloured boxes. When I use \textcite the author name and year are both part of the link, but the right parenthesis is not. Like this: Jones (2000). Is there a way to fix this? I want either both or neither parenthesis linked...

One way round this is to use citestyle=authoryear as an option. This means that only the year is linked, so it's not a perfect solution. Is there a better way to solve this problem?

-
I've uploaded version 2.3 to CTAN which should fix this. – PLK Nov 4 '10 at 21:10
@PLK I have had a ridiculous week. I'll check this out this weekend. All maintainers of CTAN packages should know about this site... – Seamus Nov 5 '10 at 0:32

Greetings, I'm the author of biblatex-apa. I know what the problem is with this and I should have a fix and new release of biblatex-apa tomorrow on CTAN.

-
I suspect this has to be the 'correct' answer :-) – Joseph Wright Nov 1 '10 at 19:55
At least, I pointed Seamus to the "correct" answer. ;-) – lockstep Nov 1 '10 at 20:07
Well, it is now solved but is this the right behaviour of two in-text citings of one author? “The following description is mainly based on OECD (1997b), (2005) …” It was “OECD (1997b, 2005)” before the update with above-mentioned bugfix. – josefec Nov 6 '10 at 8:29
According to Wikipedia (goo.gl/PvdLK), the behaviour before bugfix is right. – josefec Nov 6 '10 at 8:38

A minimal example would have been appreciated. ;-) (I'm working with the standard biblatex styles and didn't know about biblatex-apa's \DeclareLanguageMapping.)

I regard the following solution as rather "hackish" because a) I don't know the functioning of this particular \textcite command b) other commands besides \textcite might be in need of change as well c) the additional \printtext[bibhyperref] wrappers seem to point at the right entry in the bibliography, but that was only luck on my part. In the long run, you should send a feature request to Philip Kime, the author of biblatex-apa.

\documentclass{article}

\usepackage[american]{babel}
\usepackage[style=apa]{biblatex}
\usepackage{csquotes}
\DeclareLanguageMapping{american}{american-apa}

\DeclareCiteCommand{\textcite}
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{textcite}}}%
{}
{\iffieldundef{postnote}
{\ifbool{cbx:parens}
%        {\bibrightparen}% DELETED
{\printtext[bibhyperref]{\bibrightparen}}% NEW
{}}
%     {\ifbool{cbx:parens}% DELETED (FOR POSTNOTE)
{\printtext[bibhyperref]{\ifbool{cbx:parens}% NEW (FOR POSTNOTE)
{\postnotedelim}
%      \printfield{postnote}\bibrightparen}}% DELETED (FOR POSTNOTE)
\printfield{postnote}\bibrightparen}}}% NEW (FOR POSTNOTE)

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{a01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}

@misc{b02,
author = {Buthor, B.},
year = {2002},
title = {Bravo},
}
\end{filecontents}

\bibliography{\jobname}

\begin{document}

Some Text \textcite{a01}. Some more text \textcite[A postnote]{b02}.

\printbibliography

\end{document}

-
Sorry about that. I got caught out by the \DeclareLanguageMapping thing too, should have thought to mention it... – Seamus Nov 1 '10 at 15:41