# [Tex/LaTex] how to use bibliographystyle unsrt

bibliographiesbibtexnumbering

I have posted a question regarding this matter in here. Some ppl suggest me to use unsrt for numeric case of citations since I'm using .bib. This works sometimes and sometimes switches to another mode that I don't want. To illustrate the problem, this is code my code

\documentclass{article}

\begin{document}

hshshhhs \cite{2}     \cite{1}  \cite{3}  \cite{4}

\bibliographystyle{unsrt}
\bibliography{references}{}

\end{document}


The references.bib is

@article{1,
author ={H. Durrant-Whyte, T. Bailey},
title = {Simultaneous localization and mapping: part I},
publisher = "Robotics Automation Magazine, IEEE",
year = {2006},
volume  = "13",
pages = {99-110}
}

@incollection{2,
year={1996},
isbn={978-1-4471-1257-0},
booktitle={Robotics Research},
editor={Giralt, Georges and Hirzinger, Gerhard},
doi={10.1007/978-1-4471-1021-7_69},
title={Localization of Autonomous Guided Vehicles},
url={http://dx.doi.org/10.1007/978-1-4471-1021-7_69},
publisher={Springer London},
author={Durrant-Whyte, Hugh and Rye, David and Nebot, Eduardo},
pages={613-625},
language={English}
}

@book{3,
author = "Mr. X",
title = {Mr. X Knows BibTeX},
publisher = "AWOL",
YEAR = 2005,
}

@misc{ 4,
author = "Nobody Jr",
title = "My Article",
year = "2006" }


The output is

Since I'm using \cite{2}, I'm expecting the output to be [2] but for somehow latex rearranges the references list to something I don't want. It is so confusing now. Any suggestions why this occurs.

https://tex.stackexchange.com/questions/228034/how-to-change-bibtex-orders-citations-from-alphabetically-to-numerically

unsrt numbers citations in the order they appear in the document. The 2 in the \cite{} command and in the .bib file is just the "key" that's used to refer to the entry; it has nothing to do with the numbering of the citations.

I don't see how it could simplify the citations: the whole point of BibTeX is to make it so you don't have to worry about any of this stuff (see my notes below).

You can use \nocite{<keys>} to force the order.

But first, in general, numerical keys are very confusing:

• Say you add a citation to the beginning of the document. Will you then go back through and re-name every single key and reference to it?
• When writing the document, most people say,

Oh, here I need to cite Duckington's first paper from 1998!

and write \cite{duckington98a} or whatever pattern they've chosen, not

Oh, now I'm on citation n, let me type \cite{n} and then go add an entry to my .bib file with exactly that number.

• Multiple cites: you'll have to constantly go back and remember what number belongs with what reference. If you use author names this is much easier to commit to memory.

Here's how you could do it if you really wanted to:

\begin{filecontents}{myrefs.bib}
@article{1,
author ={H. Durrant-Whyte, T. Bailey},
title = {Simultaneous localization and mapping: part I},
publisher = "Robotics Automation Magazine, IEEE",
year = {2006},
volume  = "13",
pages = {99-110}
}

@incollection{2,
year={1996},
isbn={978-1-4471-1257-0},
booktitle={Robotics Research},
editor={Giralt, Georges and Hirzinger, Gerhard},
doi={10.1007/978-1-4471-1021-7_69},
title={Localization of Autonomous Guided Vehicles},
url={http://dx.doi.org/10.1007/978-1-4471-1021-7_69},
publisher={Springer London},
author={Durrant-Whyte, Hugh and Rye, David and Nebot, Eduardo},
pages={613-625},
language={English}
}

@book{3,
author = "Mr. X",
title = {Mr. X Knows BibTeX},
publisher = "AWOL",
YEAR = 2005,
}

@misc{ 4,
author = "Nobody Jr",
title = "My Article",
year = "2006" }
\end{filecontents}

\documentclass{article}

\begin{document}
\nocite{1,2,3,4} % force the order here
hshshhhs \cite{2}     \cite{1}  \cite{3}  \cite{4}

\bibliographystyle{unsrt}
\bibliography{myrefs}
\end{document}