[Tex/LaTex] List the citation key shown by \citep in the references.

bibliographieshyphenationnatbib

Some months ago, I asked a question regarding bibliography hyphenation issue here.
In a nutshell, when I was having problems with the hyphenation of the citation keys in the text, I included the natbib package and the problem was solved. However, the list of references at the end of the article does not show the key that appears in the text as before.

Here is an example:

With the following code:

\documentclass[12pt,a5paper]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[square]{natbib}

\title{Test}
\author{Tester}
\date{\today}

\begin{document}
\maketitle

asd asd Hello world \citep{SaCouto:2010:HemodynamicBirth},
\citep{SaCouto:2010:HemodynamicBirth},
\citep{SaCouto:2010:HemodynamicBirth}

\bibliographystyle{apalike}
\bibliography{fullbiblio}

\end{document}

I get:
with natbib


When commenting the natbib package, and changing \citep to \cite, I get:
without natbib


What I would like is:

  • Correct hyphenation (possible when including natbib)
  • That the references include the key that is shown in the text (possible when not including natbib). This key should be [Lastname, year].

So my question is, how can I achieve this?

Best Answer

Try adding this to your preample:

\makeatletter
\def\@lbibitem[#1]#2{%
\if\relax\@extra@b@citeb\relax\else
\@ifundefined{br@#2\@extra@b@citeb}{}{%
\@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}}\fi
\@ifundefined{b@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
\item[\hfil\hyper@natanchorstart{#2\@extra@b@citeb}\citep{#2}%
\hyper@natanchorend]%
\NAT@ifcmd#1(@)(@)\@nil{#2}}
\makeatother

Source: http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2008-07/msg00540.html

Related Question