This functionality is provided by the cite package. By default it will also compress lists of citations so [1,2,3] becomes [1-3], however a document stating with
\documentclass{article}
\usepackage[nocompress]{cite}
\bibliographystyle{ieeetr}
will produce the effect you wish. Sorting can be turned off by using the [nosort]
option.
Incidentally, I notice that there are alternative bibliography styles for IEEE Transactions, called ieeetrans
which include a variant ieeetranS
that sorts citations by default. These styles seem to be newer. May be you should consider using those instead.
Using biblatex
is a very good idea but then you have to use a bib
file.
The advantage is double: biblatex
gives you a lot of parameters to define the layout of the bibliography and the bib
file can be used for more than one LaTeX document.
You gave no concret examples for your book so have a look to this MWE (package filecontents
is only used to include a example bib
file in the mwe code; please notice that I used biber
):
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Book{goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
@article{einstein,
author = {Albert Einstein},
title = {{Zur Elektrodynamik bewegter Körper}. ({German})
[{On} the electrodynamics of moving bodies]},
journal = {Annalen der Physik},
volume = {322},
number = {10},
pages = {891--921},
year = {1905},
DOI = {http://dx.doi.org/10.1002/andp.19053221004},
}
\end{filecontents*}
\documentclass{article}
\usepackage[utf8]{inputenc} % <========================================
\usepackage[T1]{fontenc} %
\usepackage[
backend=biber, % bibtex % bibtex or biber (prefered)
natbib=true,
style=numeric,
sorting=none % none, nty % no sorting or standard sorting
]{biblatex}
\addbibresource{\jobname.bib} % calls bib file to create the bibliography
\begin{document}
We first cite Albert Einstein~\cite{einstein}, second~\cite{adams} and
third the \LaTeX{} Companian~\cite{goossens}.
\printbibliography
\end{document}
With the option sorting=none
the resulting bibliography follows your cites as you can see here:
Now only with changing the biblatex
option sorting=nyt
the resulting bibliography is sorted by the author names.
See here:
The order of the bib entrys in the bib file do not change the results.
Just a remark: You saw the character ö
in my example bib file? That's the reason I used utf-8 encoding (line 35 of MWE). Then you should use biber
, which can handle utf8 encoding.
Best Answer
I suggest you load either the
cite
or thenatbib
citation management package (but not both...). If thecite
package is loaded, sorting of citation call-outs is enabled automatically unless thenosort
package option is set. With thenatbib
package, be sure to specify eithersort
orsort&compress
as one of the package options in order to get, you guessed it, sorting of the numeric-style citation call-outs.