Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When used in concert with the hyperref package, biblatex automatically creates hyperrefs for citations but not if they are inserted using \citeyear or \citeyearpar.
Is it possible to add a hyperref to year only citations?

\documentclass{article}

\usepackage[backend=biber,natbib=true, style=authoryear-comp]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{ref1,
  author = {Doe, John D.},
  title = {Hyperrefs to citations},
  journaltitle = {Links Everywhere},
  volume = {1},
  date = {2000},
  pages = {1--2},
}

\end{filecontents}

\addbibresource{\jobname.bib}

\usepackage{hyperref}

\begin{document}

citet -- \citet{ref1}

citeyear -- \citeyear{ref1}

citeyearpar -- \citeyearpar{ref1}

\printbibliography

\end{document}

enter image description here

share|improve this question

1 Answer

up vote 2 down vote accepted

One has to redefine the citation commands instructing to use hyperlink, namely:

\DeclareCiteCommand{\citeyear}
    {}
    {\bibhyperref{\printdate}}
    {, }
    {}

\DeclareCiteCommand{\citeyearpar}
    {}
    {\mkbibparens{\bibhyperref{\printdate}}}
    {, }
    {}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.