2

I am using Mendeley as a citation manager and I have produced a .bib from my bibliography. I am using this as my \bibiography

\documentclass[a4paper,12pt]{report}

\usepackage{titlesec}
\usepackage[Conny]{fncychap} %lets me choose styles for the chapter section
\ChNameAsIs
\ChTitleAsIs
\ChTitleVar{\Huge} %size of letters

\usepackage{natbib}
\usepackage{apalike}
\bibliographystyle{apalike}

\begin{document}
\title{Proposal for PhD project}
\author{xxx}
\maketitle
\newpage

\pagenumbering{roman}
\tableofcontents
\newpage
\pagenumbering{arabic}

---document chapters and stuff

\bibliography{/Users/xxx/Documents/Latexdocs/Bibtex/library}

I get the error message

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

(natbib)                Press <return> to continue in numerical citation style.


See the natbib package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.8 ...mmand\NAT@force@numbers{}\NAT@force@numbers

when I cite, it comes in the standard number citation but I want to change it to author, year or only (year) when necessary.

I am trying with the natbib package and apalike style however, it doesn't work and keeps showing the numbers.

My guess is that the .bib is not consistent and this is causing an error for natbib.

Does anyone know how to use the Mendeley .bib for the document whilst still being able to change the citation from numbers to author and year?

(I am learning Latex thus the non-technical jargon)

  • In general apalike should be compatible with natbib's authoryear option. So things should work. If you load natbib and get numbers, then you (or a package or class you load) must load natbib with the option numbers or pass that option on to it. Make sure that you load natbib with the option authoryear. For that option to work properly, your entries must have an author and a year, if an entry is missing that information you may get an error. We can offer more specific help if you can show us an example of what you are doing so far (tex.meta.stackexchange.com/q/228). – moewe Feb 15 at 11:16
  • 1
    Apart from not loading the apalike package which shouldn't matter, that looks right. natbib assumes authoryear unless told otherwise. – Paul Stanley Feb 15 at 11:31
  • 1
    You might also try a very minimal file: \documentclass{article} \usepackage{natbib}\usepackage{apalike}\bibliographystyle{apalike} \begin{document} This is a citation for a book: \citep{book-full}. \bibliography{xampl} \end{document} – Paul Stanley Feb 15 at 11:32
  • 1
    Aha! Together with the code we have seen so far that error message suggests that there is indeed an issue with your .bib file. Can you try and narrow down which entry (or entries) might be responsible? Start from really small document like the one in Paul's comment above and add your citations one by one until you find the citation that throws the error. – moewe Feb 15 at 11:45
  • 1
    Woohoo it is fixed! so, I deleted the apalike package and left the code as: \usepackage[authoryear]{natbib} \bibliographystyle{apalike} Then i compiled latex then the bibliography and some warning came out directing me to the problem in the Mendeley library (so easy, it told me what was wrong) then i compiled twice more and it is done! Thank you sooo much! everyone helped me quite a lot – Ana Feb 15 at 13:34
1

Some comments and suggestions.

  • Mendeley is not a citation manager. Instead, it's an external program that assembles bib files, usually from various online sources. Mendeley doesn't do anything related to creating or managing citation call-outs in a LaTeX document.

  • It's not a good idea to load both the apalike and the natbib citation management packages. (Yes, these packages help you manage the creation of citation call-outs, and can thus be called citation manager packages.) Choose one or the other package, but not both.

    For what it's worth, I recommend employing the natbib package.

  • If you employ the natbib package as well as the apalike bibliography style, it's advisable -- though not strictly necessary -- to load the package with the option authoryear. This is especially true if you're switching from some other bibliography style to apalike.

Be sure to perform a full recompile cycle (LaTeX-BibTeX-LaTeX-LaTeX) whenever you load a new citation management package or a new bibliography style.

Here's the output of a simplified form of your example code.

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{library.bib}
@misc{aa:99,
   author  = "Anne Author",
   title   = "Thoughts",
   year    = 1999,
}
\end{filecontents}

\documentclass{article}
\usepackage[authoryear]{natbib}
\bibliographystyle{apalike}

\begin{document}
\cite{aa:99}
\bibliography{library}
\end{document}

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.