3

I want to display an hyperlinked author-year citation with the super option in the natbib package like this:

\citet : Lancaster et al. (1999) (19)
\citep : (Lancaster et al., 1999) (19)

With \usepackage[round,super]{natbib}, only citation number (here for example :(19)) is hyperlinked. I want to display an hyperlink on both author-year and number whether I use textual (\citet) or parenthesized (\citep) citation.

Here's an MWE:

enter image description here

\documentclass[12pt,a4paper,english,french]{article} %% use 'article' so that output fits on one page
\usepackage{filecontents}
\begin{filecontents}{Bibliob.bib}
@article{Lancaster99,
   title={A new approach to {MSEs} Management},
   author={Lancaster, James R. and Drauster, Mikael F. and Logan, Richard},
   journal={Journal of International Research on Management},
   volume={74},
   number={2},
   pages={132-157},
   year={1999},
   publisher={JSTOR}
}
\end{filecontents}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage[round,super]{natbib}
\usepackage[colorlinks=true, linkcolor=blue, citecolor=blue]{hyperref}

\begin{document}
Textual citation:~\citep{Lancaster99}

Parenthesized citation:~\citet{Lancaster99}

\bibliographystyle{plainnat}
\bibliography{Biblio}  
\end{document} 

Is that possible to get the display I want ?

3

The solution comes in two parts. First, in order to make the name and year information part of the hyperlink, we add the code provided by @Audrey in her answer to the posting How to hyperlink name part in \citet using natbib numerical and hyperref. Second, we define two new macros, called (not very creatively, I'm afraid) \mycitet and \mycitep, which mimic the behavior of \citet and \citep in the authoryear citation style, but with the addition of the superscripted entry number.

enter image description here

\documentclass[12pt,a4paper,english,french]{article} %% use 'article' so that output fits on one page
\usepackage{filecontents}
\begin{filecontents}{Bibliob.bib}
@article{Lancaster99,
   title={A new approach to {MSEs} Management},
   author={Lancaster, James R. and Drauster, Mikael F. and Logan, Richard},
   journal={Journal of International Research on Management},
   volume={74},
   number={2},
   pages={132-157},
   year={1999},
   publisher={JSTOR}
}
\end{filecontents}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage[round,super]{natbib}

%% The following lines are straight from https://tex.stackexchange.com/a/76075/5001
\usepackage{etoolbox}
\makeatletter
\patchcmd{\NAT@test}{\else \NAT@nm}{\else \NAT@hyper@{\NAT@nm}}{}{}
\makeatother

\usepackage[colorlinks=true, citecolor=blue]{hyperref}

%% Provide custom macros to mimic the look created by \citet and \citep
\newcommand{\mycitet}[1]{\citeauthor{#1} (\citeyear{#1}) \citep{#1}}
\newcommand{\mycitep}[1]{(\citeauthor{#1}, \citeyear{#1}) \citep{#1}}

\begin{document}
\mycitet{Lancaster99}

\mycitep{Lancaster99}

\bibliographystyle{plainnat}
\bibliography{Biblio}  
\end{document} 
| improve this answer | |
  • @ Mico: I want to display also an hyperlinked year part. This is the difference between my question and the solution provided by @Audrey. Whether I use \citet or \citep I want both author-year and superscripted numbers to be hyperlinked. Thanks! – Houssem Sep 7 '14 at 19:48
  • @Houssem - Thanks for providing this clarification. I'll provide a modified answer. – Mico Sep 7 '14 at 19:56
  • 1
    Your solution works perfectly! This is exactly what I wanted:-) – Houssem Sep 7 '14 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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