Take the 2-minute tour ×
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

2 Answers 2

up vote 4 down vote accepted

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

\DeclareCiteCommand{\citeyear}
    {}
    {\bibhyperref{\printdate}}
    {\multicitedelim}
    {}

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

Another alternative is to use the \cite* command which is provided by all by all author-year and author-title styles. See the manual, section 3.7.2 "Style-specific Commands".

share|improve this answer
    
Welcome to TeX.SX! –  moewe Mar 31 at 9:28
1  
Be aware though that \cite* is a "style-specific" command and as such only available in authoryear and authortitle; it also changes its behaviour depending on the style used. That is with authoryear it prints the year while with authortitle it prints the title. –  moewe Mar 31 at 9:30
    
Yes. My feeling is that the \citeyear behaviour is intentional in biblatex, thus my hint about \cite*. In a numeric citation style you want the [1]; in authortitle you want the title, along with the year. Only in authoryear does the link actually belong with the year, hence the \cite* command. –  Jan-Åke Larsson Mar 31 at 14:00

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.