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 have a basic tex file and a bibliography which is exported from Mendeley

However, when I want to cite in the author-year style, I get the error:

Package natbib Error: Bibliography not compatible with author-year citations. (natbib) Press <return> to continue in numerical citation style.

Any clue what's wrong?

Minimum working example:

\documentclass[letterpaper, 10pt]{article}

\usepackage[authoryear]{natbib}
\usepackage{lipsum}

\begin{document}

\lipsum[1-4]
\nocite{*}

\bibliographystyle{apalike}
\bibliography{articles}

\end{document} 

A snippet of my .bib library:

@article{shortcode,
author = {Lastname, Firstname},
file = {:/path/to/file.pdf:pdf},
journal = {Journal name},
number = {xx},
pages = {x--xx},
title = {Title},
volume = {xx},
year = {xxxx}    
}
share|improve this question
    
I also get the error, but my PDF still gets rendered fine. All my library entries have a year and I deleted temporary files several times. So, I ignore it for now. I found out that this command always gets into the aux file: \providecommand\NAT@force@numbers{}\NAT@force@numbers –  OneWorld Aug 22 '12 at 10:15
add comment

8 Answers

up vote 23 down vote accepted

Another way this error can arise is if one of your BibTeX entries has no year.

share|improve this answer
    
That was indeed the case Josh. Tnx –  grrrbytes May 31 '12 at 8:03
add comment

When changing the bibliography style, sometimes natbib is upset because it can't interpret the data correctly.

In any case, after changing the argument to \bibliographystyle a run of LaTeX and one of BibTeX are necessary to get back in sync. Removing the .bbl and .aux files before those run is recommended, in order to avoid spurious error messages that might corrupt the .aux file currently being generated.

share|improve this answer
9  
A vote here to remove all the temporary files- it does not seem like just the bbl+aux was enough (though I was tearing my hair out so I may not have been of entirely sound mind). Anyway- temporary files- they'll get ya. –  Brandon Kuczenski Jun 2 '12 at 0:04
    
This fixed my problem! –  rhombidodecahedron Dec 8 '12 at 19:14
add comment

I had the same error trying to use spmpsci.bst in conjunction with natbib. While natbib's default citation style is author-year, spmpsci.bst is numeric, so this is a strange error to get. I eventually changed the following:

\usepackage[square,sort,comma]{natbib}

to

\usepackage[square,sort,comma,numbers]{natbib}

Problem went away.

share|improve this answer
1  
Terrific solution, thanks! –  Xi'an Apr 9 '13 at 11:43
1  
The spbasic.bst doesn't have this problem for me, but the spmpsci.bst does. But if I use the svjour3.cls document class, I can't use natbib as you suggest, because of a clash of options. Also, doesn't setting numbers mean that you're no-longer using author-date? –  naught101 Jun 11 '13 at 7:18
    
Thanks! \usepackage[square,sort,comma,numbers]{natbib} that helped for me. –  moe Nov 3 '13 at 9:28
add comment

remove below line in the preamble works for me %\bibpunct{(}{)}{;}{a}{,}{,}

share|improve this answer
2  
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. In particular, you would improve your answer, by providing a complete working document demonstrating what you mean. –  Andrew Swann Nov 8 '13 at 15:30
add comment

Follow these steps:

  1. Delete the .aux and the .bbl files
  2. Do your changes (in the \bibliographystyle or in any option of natbib)
  3. Run LaTeX
  4. Run BibTeX
share|improve this answer
add comment

This can also happen if one of the BibTeX entries is missing the label (shortcode).

One possible scenario is when the bibliography is exported from e.g. EndNote and the label for the entry has not been set in EndNote. (This happened to me.)

share|improve this answer
1  
If the entry in question doesn't have a label, how do you \cite it? –  Mico Dec 4 '13 at 19:47
    
With the label I thought I had set, but had actually forgot to set. –  matsr Dec 4 '13 at 20:08
add comment

I had the same problem and didn't have any BiBTeX entries without years. I was able to solve this error by changing two \cite commands to \citet or \citep.

share|improve this answer
    
Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with the site. I would like to ask you: Your solution looks a bit "strange". Could you please compose a small document -- minimal working example that would show under what conditions precisely your solution can be used? Without that, it looks more like a comment than an answer. –  tohecz May 30 '13 at 14:35
    
with the natbib package, replacing citet* with a simple cite solved the problem, which I have not been able to identify. –  PatrickT Mar 27 at 18:57
add comment

The error occurs because natbib cannot find year information in the .bbl file (or possibly, but less likely, it cannot find author information). You can open it up yourself to see why this is the case.

The simplest reason would be that you have a \bibitem with the year field missing. A trickier reason is that your bibliography style does not output year information in a way that is parsable by natbib. For example, I was using \bibliographystyle{abbrv}, which does not play nicely with natbib. I fixed the problem by using instead \bibliographystyle{authordate1}. Of course, delete all temporary files, especially .bbl and .aux files, after making this change.

A final workaround is to use \usepackage[numbers]{natbib} when including the package. This outputs numbered citations instead of (author, year) citations and does not need year information.

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.