2

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?

  • 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 – yo' 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
6

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

Note that the two packages hardly work together, you have to choose.

  • 1
    Please edit your answer to state explicitly that, when switching to the natbib citation management package and the plainnat bibliography style, it's also necessary to (a) no longer load the citepackage and (b) remove the \bibliographystyle{plain} directive? The reason I ask is that there's a new "answer", which claims there's some ambiguity in your answer with regard to coexistence of the cite and natbib packages. (It would have been better if the new "answer" had been posted as a comment under your answer, but I guess the user doesn't have sufficient rep yet to leave comments.) – Mico Dec 7 '16 at 6:46
0

In case you use {cite} package, it is better to remove {natbib} and vice versa. There is no compatibility between the two packages.

  • The accepted answer seems to suggest that it's possible to use them together. – Null Dec 7 '16 at 4:04
  • @Null - Where in the text of the accepted answer do you find this claim? – Mico Dec 7 '16 at 6:41
  • @Null I don't know where in "switch to natbib" you read "add natbib" or "keep cite" :-) Anyway, I clarified the answer. – yo' Dec 7 '16 at 14:15

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.