tags:

views:

8187

answers:

5

By default (using th plain style) BibTeX orders citations alphabetically. How do I order the citations by order of appearance in the document?

A: 

The best I came up with is using the usrt style, which seems to be a tweaked plain style. i.e.


\bibliographystyle{unsrt}
\bibliography{bibliography}

However what if my style is not the default?

Brendan
If you're using a custom BibTeX style, can you edit it to remove the SORT command?
ChrisN
+3  A: 

You answered your own question---unsrt is to be used when you want references to ne listed in the order of appeareance.

But you might also want to have a look at natbib, an extremely flexible citation package. I can not imagine living without it.

lindelof
natbib only affects the typesetting of the \cite commands in the document itself. Having said that, it is distributed with unsrtnat.bst to achieve the effect sought by the original poster. (I'd recommend biblatex these days over natbib, unless absolute stability is most important.)
Will Robertson
+8  A: 

There are three good answers to this question.

  • Use the unsrt bibliography style, if you're happy with its formatting otherwise
  • Use the makebst (link) tool to design your own bibliography style

And my personal recommendation:

  • Use the biblatex package (link). It's not yet included in TeX Live or MiKTeX, but I've been using it for, oh, a year or two, and it's highly useable even before its official v1.0 release. It's the most complete and flexible bibliography tool in the LaTeX world.

Using biblatex, you'd write something like

\documentclass[12pt]{article}
\usepackage[sorting=none]{biblatex}
\bibliography{journals,phd-references} % Where journals.bib and phd-references.bib are BibTeX databases
\begin{document}
\cite{robertson2007}
\cite{earnshaw1842}
\printbibliography
\end{document}
  • To install, copy the contents of the biblatex package to the folders specified in the README and update the hash tables on teTeX or fpTeX by running texhash as root and on MikTeX by running initexmf -u.
Will Robertson
One apparent advantage of the biblatex package that caused me to accept this answer is that it allows editing up reference styles using TeX macros rather than weird BibTeX voodoo. Other packages may be better for a quicker/more reliable solution.
Brendan
A: 

with unsrt the problem is the format. use \bibliographystyle{ieeetr} to get refences in order of citation in document.

+1  A: 

Change

\bibliographystyle{plain}

to

\bibliographystyle{ieeetr}

Then rebuild it a few times to replace the .aux and .bbl files that were made when you used the plain style.

If you use MiKTeX you shouldn't need to download anything extra.

John1923