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.

I am trying to use the natbib style in order to cite references by author and year.

Using the tex and bib example here I am able to create a pdf file using the cite package.

mydocuments.tex

\documentclass[11pt]{article}

\usepackage{cite}

\author{John Doe} \title{Sample Document}

\begin{document} \maketitle

\section{Introduction}

According to the handbook of van Leunen \cite{vanleunen}, this paragraph---and certainly this section---should be longer than one sentence.

\bibliographystyle{plain}   % (uses file "plain.bst")

\bibliography{myrefs}       % expects file "myrefs.bib"
\end{document}

myrefs.bib

@book{vanleunen,    title = "A Handbook for Scholars",

   author = "Mary-Claire van Leunen",

   publisher = "Knopf",

   year = "1979"   

}

When I switch to the natbib package (and the bibliography style plainnat), I get the error.

Package natbib Error: Bibliography not compatible with author-year citations.

mydocuments.tex

\documentclass[11pt]{article}

\usepackage{natbib}

\bibliographystyle{plainnat}

\begin{document} \maketitle

\section{Introduction}

According to the handbook of van Leunen \cite{vanleunen}, this paragraph---and certainly this section---should be longer than one sentence.

\bibliographystyle{plain}   % (uses file "plain.bst")

\bibliography{myrefs}       % expects file "myrefs.bib"
\end{document}

What is wrong with the bib file in the example, and how do I format it for natbib please?

share|improve this question
2  
i think we need more than you've given us; a minimal example of the failure would help; this should be a complete, compilable document (so you need to provide a micro-.bib-file as well, introduced by a filecontents environment). (afaict, from what you say, it should be working...) –  wasteofspace Jan 31 '13 at 19:29
    
The example is in the web page that I have linked to. The files are literary there, all that needs to be done is copy and paste the contents. Other than that, I am honestly at loss on what you're asking. –  4th guy Jan 31 '13 at 19:35
    
Welcome to TeX.SE. More details on what we mean by Minimal Example can be found here: meta.tex.stackexchange.com/q/228 –  tohecz Jan 31 '13 at 19:36
    
It sounds like you LaTeX'ed (and BibTeX'ed) your document first with a different bibliography style (and the cite citation management package) and, more recently, have switched to natbib and plainnat. If that's the case, you may want to delete all "auxilliary" files and then rerun LaTeX, BibTeX, and LaTeX twice more. –  Mico Jan 31 '13 at 20:20
    
Thanks Mico, yours is a more complete answer :) Do you mind reposting it as an answer so that I can mark it as correct? –  4th guy Jan 31 '13 at 20:29
show 1 more comment

1 Answer

up vote 3 down vote accepted

When you switch to natbib, it is necessary to delete .aux and .bbl files since they contain the non-natbib information and the package complains about it.

share|improve this answer
add comment

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.