4

I am using natbib package in my project, which has \documentclass{report}, and I am using apalike style for my bibliography. I am currently using v2.overleaf to write my document. Everything was working so far, but now when I add any more references in my document's .bib file, the citations in my document change from author, date (I mostly used \citep(something), they change to numbers. It looks like there is a limit on the number of references.

I cannot seem to find what the problem is, but here is some info:

  • I have used 48 references so far, and adding the 49th lead to this problem (I have no idea if this is related or not)

  • my .bib file now has 541 lines.

I wonder if anyone has faced this problem before.

I appreciate any help guys :)

\documentclass[letterpaper,12pt]{report}
\usepackage[round]{natbib}

\begin{document}
some text here \citep{citation48}
some other text \citep{citation49} 
\bibliographystyle{apalike}
{\footnotesize
\bibliography{library.bib}}
\end{document}

Before enter image description here

After enter image description here

7
  • 1
    Adding references to the .bib file shouldn't affect your document at all unless you also cite them in the document. So when you cite the 49th reference, what does the output look like? Can you edit your question to include a minimal compilable document (beginning with \documentclass{...} and ending with \end{document} that shows exactly how you are generating the bibliography? (No other packages should be needed in the example other than natbib).
    – Alan Munn
    Commented Jun 25, 2018 at 3:43
  • 1
    Welcome, please don't feel offense, but i guess you will get a quicker solution to your problem by getting in touch with the Overleaf help team. I guess you won't be able to make us reproduce your local problem.
    – Johannes_B
    Commented Jun 25, 2018 at 4:44
  • This is a very weird problem, the more so because the apalike bibliography style is only set up to generate authoryear-style citation call-outs. If you're getting numeric-style citation call-outs all of a sudden, something very odd must have happened. Without access to your code, it's unfortunately not possible to offer a definitive diagnosis. Real quick: did you check (a) that there's no additional \bibliographystyle instruction lurking around somewhere and (b) that the natbib package isn't all of a sudden being loaded with the option numbers?
    – Mico
    Commented Jun 25, 2018 at 7:05
  • Thank you guys for the comments, I tried to follow your instructions and add some codes and screenshots. I will get in touch with overleaf to ask them, no offense taken :) there is no additional \bibliographystyle, and I do not touch natbib. the only thing I change is cite another (any) citation and boom, apalike changes to numbers!
    – peykaf
    Commented Jun 26, 2018 at 15:03
  • 1
    The natbib documentation also says The natbib package will automatically switch to numerical mode if any one of the \bibitem entries fails to conform to the possible author–year formats. There is no way to override this, since such an entry would cause trouble in the author–year mode. So perhaps a mal-formed entry is the problem.
    – Alan Munn
    Commented Jun 26, 2018 at 16:16

1 Answer 1

5

The natbib documentation states:

The natbib package will automatically switch to numerical mode if any one of the \bibitem entries fails to conform to the possible author–year formats. There is no way to override this, since such an entry would cause trouble in the author–year mode.

It does this only after generating an error:

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

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

Unfortunately, online LaTeX systems like ShareLaTeX and Overleaf do everything they can to produce some output and try to push through errors wherever they can. This problem is compounded by the fact that there is no simple way to view the error log without downloading it (last time I checked). For example, if you have the following .bib file entry, namely an item with an author but no year, and you push through the error, the bibliography will be generated using the numeric system. From your comment it seems that something of this sort is what happened.

@misc{Foo2018,
    Author = {Foo},
    Howpublished = {Unpublished manuscript},
    Title = {A title}}
3
  • That was exactly the case! I really appreciate your assistance Alan.
    – peykaf
    Commented Jun 27, 2018 at 19:40
  • I'm having the same issue, but can't find the problematic entry. How can I know exactly which entries are generating the problem?
    – MrT77
    Commented Feb 4, 2023 at 10:45
  • @MrT77 When you run bibtex on the document you should see a warning in the .blg file that tells you which items are missing years.
    – Alan Munn
    Commented Feb 4, 2023 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .