Hi I am using the natbib
compatibility mode under biblatex
:
\usepackage[style=authoryear-comp, sorting=nyt, natbib,
uniquename=false, maxbibnames=99, dashed=false]{biblatex}
I frequently use the citation format of author (year), that is \citet
.
First, I wanted to have link for all parts of the citation — author and year (default is just year). So I followed the solution here: hyperlink name with biblatex authoryear
\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\cite}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{citeyear}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\parencite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\parencite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{citeyear}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\footcite}[\mkbibfootnote]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\textcite}
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{textcite}}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\multicitedelim}
{\usebibmacro{textcite:postnote}}
Then, I wanted to change color of the links to be blue, so I changed the setting in hyperset:
\usepackage[hyperfootnotes=true,bookmarksopen]{hyperref}
\hypersetup{
pdffitwindow=false,
pdfstartview={XYZ null null 1.00},
pdfnewwindow=true,
colorlinks=true, % false: boxed links; true: colored links
linkcolor=darkblue, % Color of internal links
citecolor=darkblue, % Color of links to bibliography
urlcolor=darkblue} % Color of external links
However, once I call \citet
, say XX(2000), the color for XX(2000 is in darkblue but the color for ) is in black.
Is there anyway to fix the color of ( to be black?
Best Answer
Full linking is hard for
biblatex
. So there is a good reason why only the year is linked by default. Have a look at https://tex.stackexchange.com/a/27615/35864 for a full-link solution that colours both parentheses for\textcite
.Alternatively, I could offer you this answer I once gave at golatex.de: https://golatex.de/biblatex-textcite-link-fehler-bei-einem-autor-t20366.html (at least I think it was me ...)
Here is a solution that never links (colours) the brackets. For
\cite
/\parencite
we can use Audrey's approach from hyperlink name with biblatex authoryear (biblatex 1.4b). But for\textcite
only want to additionally link the name, so we patch thetextcite
bibmacro withxpatch
to link the labelname.