# Can't get Natbib package to work

I'm trying to create a bibliography. I'd like it so that I can write with the Harvard style:

"..bla bla bla bla bla (Bloggs, 2012). Bla bla bla..."

in the main body of the text, with something like this:

"Bloggs, J., The Journal of Stuff, 2012."

as the actual bibliography. I'd like to have the list of 'references' (i.e. of which the above line is one) in alphabetical order. I'd also prefer (but at this stage of frustration, willing to go without) that the "(Bloggs, 2012)" would take the reader to the bibitem when it is clicked on with the cursor.

Any help would be greatly appreciated! I'm in a real hole at the moment; I've read the (natbib) documentation and various wikis but to no avail.

Addendum (moved from the comment section): Here's an MWE --

\documentclass[11pt]{article}
\usepackage[authoryear]{natbib}
\begin{document}
\section{First Section}
\noindent Something is true (Bloggs, 2012)\citep{bloggs:2012}.
\bibliographystyle{plain}
\begin{thebibliography}{99}
\bibitem{bloggs:2012} Bloggs, J., The Journal of Stuff, 2012
\end{thebibliography}
\end{document}


The problem is that the hyperlink is in a box (numbered as "1") but I actually want the "(Bloggs, 2012)" to be the hyperlink. At the moment, it's kind of double.

-
Welcome to TeX.SE! It would be helfpul if you provided a bit more information about your setup. For instance, which bibliography style file do you use: plain, plainnat, etc? –  Mico Jul 5 '12 at 18:13

I take it that by "Harvard style" you mean a generic author-year citation style. The harvard package was among the first to implement such a style for LaTeX users, but there are quite a few other packages as well by now that provide author-year citation possibilities.

To instruct the natbib citation management package to use an author-year rather than a numeric citation style, it's best to load the package with the authoryear option:

\usepackage[authoryear]{natbib}


Assuming you have an entry in your bib file with a key of "bloggs:2012" that is authored by "Jane Bloggs", you could issue the command

\citep{bloggs:2012}


to generate a "parenthetical" citation reference of (Bloggs, 2012). To get a "textual" citation, viz., Bloggs (2012), using the same entry, you'd type

\citet{bloggs:2012}


The precise manner in which the bibliographic entries will be typeset in the References section depends critially on the bibliography style file you use. You may want to start with plain.bst or plainnat.bst and see if this meets your needs. I.e., issue a command such as

\bibliographystyle{plainnat}


Finally, to have LaTeX make each citation into a hyperlink to the corresponding item in the bibliography, you need to load the hyperref package, preferably with the options colorlinks=true and citecolor=<MyColorOfChoice>.

Addendum, prompted by the OP's provision of an MWE. Alright, I understand now that you aren't using BibTeX for now to construct the bibliography but, instead, are building the bibliography "by hand" by assembling a bunch of \bibitem entries.

There are two issues with your MWE. First, if you're going to do the \bibitems by hand, the \bibitem in question must look like this:

\bibitem[(Bloggs, 2012)]{bloggs:2012} Bloggs, J., The Journal of Stuff, 2012.


Without the material in brackets (in "parenthetical" citation mode for this example), LaTeX is going to insert its own default, i.e., numeric-style label when it encounters a citation of this bibitem.

Second, don't type

Something is true (Bloggs, 2012)\citep{bloggs:2012}


in the text. Rather, type something like

Something is true \cite{bloggs:2012}


and let LaTeX provide the citation text -- (Bloggs, 2012 in this case -- and make the citation text into a hypertarget.

-
A-ha! Thank you so much Mico! I have included a minimum working example: \documentclass[11pt]{article} \usepackage[authoryear]{natbib} \usepackage[colorlinks=true]{hyperref} \begin{document} \section{First Section} \noindent Something is true (Bloggs, 2012)\citep{bloggs:2012}. \bibliographystyle{plain} \begin{thebibliography}{99} \bibitem{bloggs:2012} Bloggs, J., The Journal of Stuff, 2012 \end{thebibliography} \end{document} The problem is that the hyperlink is in a box (numbered as "1") but I actually want the "(Bloggs, 2012)" to be the hyperlink. At the moment, it's kind of double. –  user16307 Jul 5 '12 at 18:43
@user16307: I've moved your bulk of your comment, including the MWE, into the main part of your original question, as it'll be more easily seen by readers there. I've provided an update to my answer in response to your additional material; see above. Basically, you need to provide a bit more information in the \bibitem piece, and you can simplify the citation command itself. –  Mico Jul 5 '12 at 19:03
Excellent advice! :) –  user16307 Jul 5 '12 at 19:26
@user16307 -- glad you find my comments helpful. If you don't mind doing so, please feel free to up-vote and/or to accept my answer. :-) –  Mico Jul 5 '12 at 19:31
unfortunately, my 'reputation' is <15 at the moment (since I've just joined today) so when I click on the "this answer is useful" fountain-pen, it denies the vote :( Is there another way to vote to 'thumbs-up' the comments? P.s. it did let me click on "accept this answer" :D –  user16307 Jul 5 '12 at 19:40