1

I am writing my thesis in LaTex but I have some problems with the bibliography. As always, I use the unsrt bibliography style to get the citations in order of appearance. However, this time it doesn't work so as a first citation I have the number 2 instead of the number 1.

That's the code I use:

\bibliographystyle{unsrt}
\bibliography{bibliography}

The bibliography is in a .bib file. I also would like to add all the references I do not cite explicitly in the text. So I usually add \nocite command. It works but in the text I get [?] instead of citations.

This usually works in the past articles I wrote, I don't know why now it doesn't. Do you have any suggestions?

(I am using Overleaf)

Thanks!

  • 1
    You presumably have an error in code you have not shown. You need to show something if you want anyone to say what is wrong with it. – David Carlisle Aug 14 at 8:39
  • 2
    usual reason for getting unexpected order is that you have a citation in a caption and so the first appearing citation is in the list of figures – David Carlisle Aug 14 at 8:41
  • Ah yes that's why! I completely forgot about the list of figures. It makes sense now. Thanks! – Chiara Aug 14 at 9:03
  • I suppose that it has to be taken like this, isn't it? – Chiara Aug 14 at 9:04
  • 2
    you can use \caption[shorter caption with no cite]{long caption with cite} so there is no cite in the list of figures – David Carlisle Aug 14 at 9:08
1

Tell natbib you want things numbered and sorted in the package options using \usepackage[sort,numbers]{natbib}, then tell it that's also how you want the references to be formatted \bibliographystyle{unsrtnat} (ending in nat "suitable" for natbib). Then to toggle on/off the references use \nocite{*} and you will get something that looks like:

\documentclass{article}
\usepackage[sort,numbers]{natbib}
\bibliographystyle{unsrtnat}

\begin{document}
\citet{alice} said something to \citet{bob}.
\nocite{*} % Toggle for unused references. 
\bibliography{references}
\end{document}

gives

enter image description here

where for the references.bib we have:

@misc{alice,
    title = {Something},
    year = {2020},
    author = {Alice}
}

@misc{bob,
    title = {Something else},
    year = {2020},
    author = {Bob}
}

@misc{charles,
    title = {Something completely different},
    year = {2020},
    author = {Charles}
}
| improve this answer | |

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.