# How can I use natbib and make my reference list resemble apalike?

My question is related to here and here, but I could not yet find a satisfying answer. I will use the same example from this post.

I like the apalike reference style but I have trouble with breaking long references in the text. With the suggested natbib package and using citep, I get the references to break all right. However, I do not like the bibliography when using natbib, because (1) the reference key is not displayed, (2) first names are spelled out and (3) URLs are displayed.

With the following bibtex file

@Article{citeme1,
author =       {Longlastname, Longfirstname and Helloworld E. Xample },
title =        {A Title},
journal =      {A journal},
year =         {2009}
}
@Article{citeme2,
author =       {Hofstadter, L. and Cooper, S.},
title =        {Experiences with a roommate that has Asperger syndrome},
journal =      {The Big Bang Journal},
year =         {2010},
url = {http://u.rl},
}
@Article{citeme3,
author =       {Cooper, Sheldon and Koothrappali, Rajesh and Wolowitz, Howard},
title =        {Another example},
journal =      {Another journal},
year =         2010
}

I get the following reference list when using apalike (of course, in my document, the references are not broken nicely):

This would be exactly what I want. However, of course the references in my text are not broken appropriately.

When using natbib and the expression in the preamble suggested here:

\documentclass[a5paper]{article}
\usepackage[square]{natbib}

\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

\begin{document}
This is a paragraph with normal line breaking and hyphenation, isn't it?
Yes! It is.

This is paragraph that does not break well when citing \citep{citeme1},
or even \citep{citeme1, citeme2, citeme3}.
\bibliographystyle{plainnat}
\bibliography{f}
\end{document}

then I get the following reference list:

in which the first and third reference has full names and the second doesn't (because the full names are not in the bibtex entry). Also, the second reference still has the URL.

My question is: How can I use natbib for nice line breaking in the references in the text and get a reference list that resembles the apalike reference list (with keys, letters for first names and no URLs)?

• You might like to try biblatex and its APA implementation biblatex-apa. – moewe Jan 6 '14 at 18:42
• Thank you, biblatex-apa looks like a nice package, but I have not yet managed to install it on my ubuntu machine. I now found a workaround by using \bibliographystyle{abbrvnat} to get all names abbreviated and to parse out the url fields in my bibtex file. – user1981275 Jan 7 '14 at 18:25
• Well, unfortunately ubuntu ships out quite old LaTeX distributions, so you might be better off without biblatex. – moewe Jan 8 '14 at 7:49
• For Ubuntu, updating tex is easy: Uninstall the ubuntu package and use install-tl-ubuntu. Then, one can follow the instructions given at tex.stackexchange.com/a/55459/9075 to update the tex live distribution. – koppor Jan 25 '17 at 7:20
• @user1981275 Does biblatex-apa work with ubuntu (three years lateer ^^)? Does the package solved your problem? If yes maybe you could write an answer... – Bobyandbob Nov 24 '17 at 22:37