[Tex/LaTex] bibtex: Problem in Reference number Order

bibtexcitingnatbibsorting

I am having problem with my bibtex reference number. The number does not increase in order as you can see from the screenshot below. The index goes from 1 to 3, 4, 5, and back to 2.

enter image description here

Sorry in advance for the lengthy question, I have tried to trim it down. I have attached my simplified latex files below.

As you can see from the source files, there are two figures, removal of any of these figures would eliminate the problem (but I need these images).

if I comment out the "List of Figure" The problem will also disappear. Again, I still need this section. Please help me to figure out what has gone wrong.

The entire source file can be taken from https://www.dropbox.com/s/o6648xgozxnxxfs/BibtexProblem_Question.zip?n=50499474

 \documentclass[a4paper, 11pt, oneside]{Thesis}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
%\documentclass{book}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn

\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments
\usepackage{vector}  % Allows "\bvec{}" and "\buvec{}" for "blackboard" style 6
\usepackage{amssymb} 


\begin{document}

\lhead{\emph{List of Figures}}  % Set the left side page header to "List if Figures"
\listoffigures  % Write out the List of Figures

\mainmatter   % Begin normal, numeric (1,2,3...) page numbering
\pagestyle{fancy}  
%\input{Chapter1} % Introduction

This is the first \cite{Ackermann02}

\begin{figure}[h]
 \centering
 \includegraphics[width = 0.4\textwidth]{Figure1.jpg}
 \caption{Figure1 \cite{Ackermann02}. }
 \label{fig:Figure1}
\end{figure}

This is the second \cite{Esteban04, Remondino06, Nguyen12}.

Sixth is this \cite{Olsen09}. 

\begin{figure}[h]
 \centering
 \includegraphics[scale=1.0]{Figure2.eps}
     \hspace{ 5.5 mm}\caption{ (taken from \cite{Olsen09}). }
\label{fig:Figure2}
\end{figure}

\label{Bibliography}
\lhead{\emph{Bibliography}}  % Change the left side page header to "Bibliography"
\bibliographystyle{unsrtnat}  % Use the "unsrtnat" BibTeX style for formatting the Bibliography
\bibliography{Bibliography}  % The references (bibliography) information are stored in the file named "Bibliography.bib"

\end{document}  % The End

This latex file use an external thesis class,

%%
%% This is file `Thesis.cls', based on 'ECSthesis.cls', by Steve R. Gunn
%% generated with the docstrip utility.
%%
%% Created by Steve R. Gunn, modified by Sunil Patel: www.sunilpatel.co.uk

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2007/22/02 v1.0
   LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\usepackage{setspace}
\usepackage{vmargin}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[scriptsize]{subfigure}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{lstpatch}
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
   bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
   colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red},
   pdfstartview={FitV},unicode,breaklinks=true]{hyperref}
\pdfstringdefDisableCommands{
   \let\\\space
}
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{3}  
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\listoffigures{
\btypeout{List of Figures}
\addtotoc{List of Figures}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename
      \@mkboth{\MakeUppercase\listfigurename}
              {\MakeUppercase\listfigurename}}
    \@starttoc{lof}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}

and the bibtex file

@unpublished{Ackermann02,
        author = "Author One",
        title = "modelling",
        note = "Available at",
                year = 2000}

@book{Esteban04,
        author = "Author Two",
        title = "Title Two",
        publisher = "Publisher 2",
        address = "",
        year = "2000"
}           

@book{Nguyen12,
        author = "Author three",
        title = "Title Three",
        publisher = "Publisher 3",
        address = "",
        year = "2000"
}   

@article{Remondino06,   
    author = {Author Four},
    journal = {The Photogrammetric Record},   
    title = {Title four},
    volume = {20},
    year = {2000}
}   

@article{Olsen09,
     author = {Author Five},
     title = {Title Six},
     journal = {Computers and Graphics},         
     volume = {31},
     year = {2000},
     pages = {0--10}
} 

Best Answer

Since you put \listoffigures before your \cite commands, the first two cited references are the ones inside the \captions.

So they appear in the following order:

Ackermann02

Olsen09

Esteban04

Remondino06

Nguyen12

Moving \listoffigures at the end of the document solves the problem.

\documentclass[a4paper, 11pt, oneside]{Thesis}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
%\documentclass{book}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn

\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments
\usepackage{vector}  % Allows "\bvec{}" and "\buvec{}" for "blackboard" style 6
\usepackage{amssymb}


\begin{document}

\mainmatter   % Begin normal, numeric (1,2,3...) page numbering
\pagestyle{fancy}
%\input{Chapter1} % Introduction

This is the first \cite{Ackermann02}

\begin{figure}[h]
 \centering
 \includegraphics[width = 0.4\textwidth]{Figure1.jpg}
 \caption{Figure1 \cite{Ackermann02}. }
 \label{fig:Figure1}
\end{figure}

This is the second \cite{Esteban04, Remondino06, Nguyen12}.

Sixth is this \cite{Olsen09}.

\begin{figure}[h]
 \centering
 \includegraphics[scale=1.0]{Figure2.eps}
     \hspace{ 5.5 mm}\caption{ (taken from \cite{Olsen09}). }
\label{fig:Figure2}
\end{figure}

\label{Bibliography}
\lhead{\emph{Bibliography}}  % Change the left side page header to "Bibliography"
\bibliographystyle{unsrtnat}  % Use the "unsrtnat" BibTeX style for formatting the Bibliography
\bibliography{Bibliography}  % The references (bibliography) information are stored in the file named "Bibliography.bib"

\lhead{\emph{List of Figures}}  % Set the left side page header to "List if Figures"
\listoffigures  % Write out the List of Figures

\end{document}  % The End

If you can not move \listoffigures at the end of the document, you can \nocite the references in the right order just after \begin{document}:

 \documentclass[a4paper, 11pt, oneside]{Thesis}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn
%\documentclass{book}  % Use the "Thesis" style, based on the ECS Thesis style by Steve Gunn

\usepackage[square, numbers, comma, sort&compress]{natbib}  % Use the "Natbib" style for the references in the Bibliography
\usepackage{verbatim}  % Needed for the "comment" environment to make LaTeX comments
\usepackage{vector}  % Allows "\bvec{}" and "\buvec{}" for "blackboard" style 6
\usepackage{amssymb}


\begin{document}

\nocite{Ackermann02}
\nocite{Esteban04}
\nocite{Remondino06}
\nocite{Nguyen12}
\nocite{Olsen09}

\lhead{\emph{List of Figures}}  % Set the left side page header to "List if Figures"
\listoffigures  % Write out the List of Figures

\mainmatter   % Begin normal, numeric (1,2,3...) page numbering
\pagestyle{fancy}
%\input{Chapter1} % Introduction

This is the first \cite{Ackermann02}

\begin{figure}[h]
 \centering
 \includegraphics[width = 0.4\textwidth]{Figure1.jpg}
 \caption{Figure1 \cite{Ackermann02}. }
 \label{fig:Figure1}
\end{figure}

This is the second \cite{Esteban04, Remondino06, Nguyen12}.

Sixth is this \cite{Olsen09}.

\begin{figure}[h]
 \centering
 \includegraphics[scale=1.0]{Figure2.eps}
     \hspace{ 5.5 mm}\caption{ (taken from \cite{Olsen09}). }
\label{fig:Figure2}
\end{figure}

\label{Bibliography}
\lhead{\emph{Bibliography}}  % Change the left side page header to "Bibliography"
\bibliographystyle{unsrtnat}  % Use the "unsrtnat" BibTeX style for formatting the Bibliography
\bibliography{Bibliography}  % The references (bibliography) information are stored in the file named "Bibliography.bib"

\end{document}  % The End 

There are still two possibilities:

  1. If you don't need the link to the reference to be printed in the 'List of Figures' you can print the "short form" of the caption. For example substitute \caption{ (taken from \cite{Olsen09}). } with \caption[Fig. 2]{ (taken from \cite{Olsen09}). }. This way the corresponding \cite is not collected.
  2. In the .bib file, put the references in the exact order they have to appear in the 'Bibliography' and put \nocite{*} just after \begin{document}. Anyaway, note that in this case all the references included in the .bib file will be printed, even the ones you have not \cited...