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}
Best Answer
You need to let BibTeX perform the organization (and sorting, if needed) of your bibliography. If you enter the
\bibitem
s manually, there's no way it will be sorted/arranged according to your style (unsrt
). So, follow the sequence:.bib
file using the appropriate BibTeX entry format.filename.tex
once (in order to obtain a correct/current.aux
).bibtex filename
(in order to obtain a correct/current.bbl
).filename.tex
again (in order to include the correct/current.bbl
).Here's an example with the
.bib
embedded in the.tex
usingfilecontents
:Note how there was no specification of formatting for the journal or number in the
.bib
- all of that was done by BibTeX.