Document Classes ⇒ Natbib numerical mode problem
Natbib numerical mode problem
I'm using WinEdit and JabRef to write my thesis. Wanting to cite documents in Author,Year style.
Has been working fine but then *something* has changed and all my in-text citations have switched into numerical.
Reading the natbib documentation I discovered that if natbib can't produce an author,year citation it will switch to numerical mode. So I vetted all my citations and discovered some of them did not have a year or an author so I fixed those. Unfortunately this did not fix my problem.
Nothing obvious shows up in the log. No errors come up if I run bibtex from the command line.
The "references.bib" file is in the same directory as the main tex document. Relevant parts of the main document:
\usepackage[authoryear]{natbib}
\usepackage{graphicx,enumerate}
\bibliographystyle{apalike}
\bibliography{references}
Changing the bibliographystyle to say, plainnat, changes the in-text citations into square parentheses but doesn't change them back to author,date.
Any ideas would be greatly appreciated.
Thanks,
Mark.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Natbib numerical mode problem
Your problem typically occurs when the bibliography style file you use is not compatible with natbib.markcs wrote:Changing the bibliographystyle to say, plainnat, changes the in-text citations into square parentheses but doesn't change them back to author,date.
When you changed your bibliogrpahy style to plainnat, were you sure to re-run bibtex after running latex once?
Can we have a look at a snippet out of your BBL file? In particular, what do the \bibitem lines look like? The optional argument is what stores what natbib uses to generate the in-text citations. IIRC, the format is something like...
Code: Select all
\bibitem[Short text form(year)Long text form]{bibkey}
You're using the apacite bibliography style. Have you tried using the apacite package instead of natbib? Their documentation comments on apacite's compatibility with natbib (near the bottom of the doc, on page 39): Finally, if worse comes to worst, try generating your own natbib-compatible bibliography style using makebst. Execute:
Code: Select all
latex makebst
Re: Natbib numerical mode problem
I am pretty sure you are correct because I found in an aux file this line "\bibstyle{pub-unsrt}".
I'm using a custom-defined document class created by someone since left in my research centre. Part of it creates a list of the author's publications which appears in the introductory section of the thesis. If I comment out the command (macro?) in the main document which creates the list of publications the in-text citations in the rest of the document go back to the correct author,date format that I want.
I think the document class is using pub-unsrt as a style but I can't figure how to change it.
In any case, I'm just going to manually write out the publications list at the beginning of the thesis and not use the pre-defined macro for doing so.
Its not a great solution but it works and hopefully if someone comes across a similar problem in the future they can investigate style files.
Thanks,
Mark.
Natbib numerical mode problem
Can you find pub-unsrt.bst somewhere on your system? If so, you might be able to generate your own (using latex makebst as discussed above) that matches and is compatible with natbib.markcs wrote:I am pretty sure you are correct because I found in an aux file this line "\bibstyle{pub-unsrt}".
I had a similar problem with my thesis. I ended up doing the same thing you did. To generate the properly formatted entries, I copied the lines out of the BBL file that natbib/bibtex formatted for me. I recommend that you do the same.markcs wrote:I'm using a custom-defined document class created by someone since left in my research centre. Part of it creates a list of the author's publications which appears in the introductory section of the thesis. If I comment out the command (macro?) in the main document which creates the list of publications the in-text citations in the rest of the document go back to the correct author,date format that I want.
Other options include using biblatex instead of natbib.
The biblatex package allows you to run "queries" on your bibliography database and dump the results to different parts of your document. It's not quite perfect yet, but it's ... close?