# [texhax] Ordering references in bibtex by appearance order

Steve Schwartz s.j.schwartz at qmul.ac.uk
Mon Oct 18 17:35:33 CEST 2004

Bryan,

Look at the chapterbib package which does what you want. Basically, you
need to put each of your chapters in a separate file and \include (NOT
\input) them into the whole. Each chapter has its own \bibliography
command

THEN you run bibtex on the INDIVIDUAL CHAPTERS (each of which will have
its own .aux file because that's the way \include works), NOT on the
master .tex file.

If this clashes with your other packages you can easily do it yourself
by following the above procedure and then  \input'ting the resulting
.bbl files in their respective chapters.

So you have a master document with:

\documentclass{book}
% \usepackage{chapterbib}  % if you want; may be a good idea
\begin{document}
\include{ch_intro}
\include{ch_results}
\include{ch_conclusion}
\end{document}

and a file ch_intro.tex which has within it

[blah][blah]
\bibliographystle{unsrt}   % or whatever
\input{ch_intro.bbl}

or better instead of the last line:

\IfFileExists{ch_intro.bbl}{\input{ch_intro.bbl}}{\typeout{ch_intro.bbl

This way gives lots of complaints about multiply defined references
it gets the job done.

So you do:

latex master.tex
bibtex ch_intro
bibtex ch_results
bibtex ch_conclusion
latex master.tex
latex master.tex

There are sectionbib options to many bibliography packages (e.g. natbib
and chapterbib) which ensure that the bibliography is treated as a
section in your chapter, and not a new chapter.

Sorry this is a bit on the long side in the way of answer. The short
version is: try the chapterbib package first.

Steve

On Mon, 2004-10-18 at 14:37, Bryan W. Lepore wrote:
> On Mon, 18 Oct 2004, Robin Fairbairns wrote:
> > > How can i order my bibliographic references (i'm using bibtex) by their
> > > [...]
>
> what should i look for in order to get a bibliography at the end of every
> chapter (containing the refs for only that chapter)?  i THINK the default
> is at the end of the document.
>
> i tried putting \begin{thebibliography} at the end of each chapter, but it
> contains the entire bibliography.
>
> -bryan
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
--
+-----------------------------------------------------------------+
| Steve Schwartz               S.J.Schwartz at qmul.ac.uk            |
| Astronomy Unit                                                  |
| Queen Mary, Univ. of London  Tel: +44 (0)20 7882 5449           |
| Mile End Road                Fax: +44 (0)20 8983 3522           |
| London E1 4NS, UK            URL: www.space-plasma.qmul.ac.uk/  |
+-----------------------------------------------------------------+