[Tex/LaTex] How does BibTeX sort references

bibtexsorting

How does LaTeX sort references as it is causing the first reference I have used to be numbered as [2] in the document rather than [1]. See below:

Technology has been introduced in various ways within healthcare applications to support the delivery of reminders [2]. One of the most prevalent approaches to date for the delivery of reminders has been through the use of mobile phones, especially within the domain of provision of support for persons with dementia [1, 3].

Ref [2] in this paragraph is the first reference in my .bib file, how can I get it to be shown as [1]?

\documentclass[a4paper,12pt]{article}
\begin{document}

Technology has been introduced in various ways within healthcare applications to support the delivery of reminders \cite{GatorTechSmartHouse}. One of the most prevalent appraches to date for the delivery of reminders has been through the use of mobile phones, especially within the domain of provision support for persons with dementia \cite{NextGenerationOfMobileMedicationManagementSolutions, VideoRemindersAsCognitiveProstheticsForPeopleWithDementia}.

\bibliographystyle{plain}
\bibliography{ref}
\end{document}

.bib file

@article{
GatorTechSmartHouse,
    Author = {S. Helal, W. Mann, H. El-Zabadani, J.King, Y. Kaddoura, E. Jansen},
    Title = {The {G}ator {T}ech {S}mart {H}ouse: a programmable pervasive space},
    Journal = {Computer},
    Volume = {38, No. 3},
    Pages = {50-60},
    Year = {2001}
}

@article{
NextGenerationOfMobileMedicationManagementSolutions,
    Author = {C.D. Nugent, D. Finlay, R. Davis, M. Mulvenna, J. Wallace, C. Paggetti, E. Tamburini, N. Black},
    Title = {The next generation of mobile medication management solutions},
    Journal = {International {J}ournal of {E}lectronic {H}ealthcare},
    Volume = {3, No. 1},
    Pages = {7-31},
    Year = {2007}
}

@article{
VideoRemindersAsCognitiveProstheticsForPeopleWithDementia,
    Author = {S. O'Neill, S. Manson, G. Parente, M.P. Donnelly, C.D. Nugent, S. McClean, B. Scotney, D. Craig},
    Title = {Video reminders as cognitive prosthetics for people with dementia},
    Journal = {Ageing {I}nternational},
    Volume = {36, No. 2},
    Pages = {267-282},
    Year = {2011}
}

Best Answer

If you need the bibliography sorted in order of appearance, use

\bibliographystyle{unsrt}

because the plain bib style sorts alphabetically by author.


As an aside: your bib entries are wrong. Authors should be separated by and rather than commas:

@article{
GatorTechSmartHouse,
    Author = {S. Helal and W. Mann and H. El-Zabadani and J. King and Y. Kaddoura and E. Jansen},
    Title = {The {Gator} {Tech} {Smart} {House}: a programmable pervasive space},
    Journal = {Computer},
    Volume = {38, No. 3},
    Pages = {50-60},
    Year = {2001}
}

Watch out for missing spaces between name (initials) and surname.

Also it's better to write {Tech} for keeping the uppercase, so kerning between T and e can be applied (which isn't if the input is {T}ech).

Related Question