3

I have created a BibTeX file ref1.bib and calling the same in my LaTeX file.

However references are not printed in the order of citation. They are printed randomly. Please suggest correction to print references in correct order.

My code is as follows:

\documentclass[12pt,a4paper,twosided]{report}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{ragged2e}
\usepackage{txfonts, helvet} %other fonts pxfonts, fourier, lomdern%
\usepackage{graphicx}
\graphicspath{{F:/Figures/}}
\usepackage[a4paper, left=1in, right=1in, top=1in, bottom=1in]{geometry}
\usepackage[onehalfspacing]{setspace} 
\usepackage{natbib} %for bibliography
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\usepackage{multicol}%for multicolumn documents
\usepackage{multirow,rotating}
\usepackage{titlesec}
\titleformat{\chapter}
{\centering\normalfont\LARGE\bfseries}{\thechapter.}{1em}{}
\setcounter{secnumdepth}{2} %numbering of subsection upto 4th level
%body of the document
\begin{document}

\pagenumbering{gobble}
\input{titlepage_progress_report1_jan2018}
\clearpage
\pagenumbering{roman}
\tableofcontents
\listoftables
\listoffigures
\clearpage
\pagenumbering{arabic}
\chapter{Introduction}
 \paragraph{} With the rapid development of multiple types of sensors in various fields, abundent data has become available for research. Same is true with imaging sensors used in the field of remote sensing. Thus, there is a need to gather information from various images and combine it into a single one so that additional information can be extracted out of it. Image fusion deals with same. Formally,  Image fusion is the combination of two or more different images to form a new image by using a certain algorithm \cite{klein1993sensor,pohl1998review}.  Information from different images is combined so that image becomes more meaningful and suitable for visual perception and computer processing. 
Images obtained from different sensors certainly carry different information and if this information is combined, it is more informative than image obtained from single source. Image fusion is an optimal way of representing information  from different images into a single one and this fused information can be used for planning and decision making. \subparagraph{} Various satellites observing earth, are capturing data in different parts of the electromagnetic spectrum and hence different remotely sensed data products like  multispectral (MS), panchromatic(PAN), hyperspectral (HS) and synthetic aperture radar (SAR) imagery are available. These data products convey different information about earth area under observation. Information from these data products is useful for different applications like forecasting crop yield , mapping of forest cover, weather prediction, watershed development, monitoring urban sprawl mapping of various cities and disaster management etc. \cite{flusser2007image,ghassemian2016review,pandit2015image}. 

    \chapter{Literature Survey}

    \chapter{Speckle Reduction in SAR Imagery}
    \chapter{Conclusion}
    \bibliographystyle{plain} 
    \bibliography{ref1}
\end{document}
  • 1
    Try \bibliographystyle{unsrt} instead of \bibliographystyle{plain}. – Mensch Jan 2 '18 at 6:28
  • Thanks a lot for your immediate reply. But it doesn't work. – sckulkarni Jan 2 '18 at 6:54
  • Please explain what you mean by "it doesn't work". In particular, did you perform a full recompile cycle -- LaTeX, BibTeX, and LaTeX twice more -- after changing the argument of \bibliographystyle? – Mico Jan 2 '18 at 6:55
  • they will not be printed randomly, they will either be in alphabetic order, or order of citation, but as you have not provided a test file or said what result you got, it is hard to help – David Carlisle Jan 2 '18 at 9:02
2

Because you gave no bib file it is hard to test your code.

I have created a minimalized code based on your code with an sample bib file like this:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}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",
    keywords =     "physics",
}

@book{dirac,
    title={The Principles of Quantum Mechanics},
    author={Paul Adrien Maurice Dirac},
    isbn={9780198520115},
    series={International series of monographs on physics},
    year={1981},
    publisher={Clarendon Press},
    keywords = {physics},
}
\end{filecontents*}


\documentclass[12pt,a4paper,twosided]{article} % report <===============

\usepackage[T1]{fontenc}

\usepackage{natbib} %for bibliography <=================================


\begin{document}
algorithm \cite{einstein}. text \cite{dirac}. 

\bibliographystyle{unsrtnat} % plainnat unsrtnat abrvnat <==============
\bibliography{\jobname}
\end{document}

Because you are calling natbib you need to use bibliography style unsrtnat. I changed report to article to have citing and bibliography on one pae ...

That is the resulting pdf:

resulting pdf

Edit:

Without using natbib you need the following code for your wished result (see style unsrt which gives the bibliography in the order the citings are done):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}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",
    keywords =     "physics",
}

@book{dirac,
    title={The Principles of Quantum Mechanics},
    author={Paul Adrien Maurice Dirac},
    isbn={9780198520115},
    series={International series of monographs on physics},
    year={1981},
    publisher={Clarendon Press},
    keywords = {physics},
}
\end{filecontents*}


\documentclass[12pt,a4paper,twosided]{article} % report <===============

\usepackage[T1]{fontenc}


\begin{document}
algorithm \cite{einstein}. text \cite{dirac}. 

\bibliographystyle{unsrt} % plain unsrt abrv <==============
\bibliography{\jobname}
\end{document}

with the result:

resulting pdf

or with natbib you have to add option numbers to natbib and use style unsrtnat:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{einstein,
    author =       "Albert Einstein",
    title =        "{Zur Elektrodynamik bewegter K{\"o}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",
    keywords =     "physics",
}

@book{dirac,
    title={The Principles of Quantum Mechanics},
    author={Paul Adrien Maurice Dirac},
    isbn={9780198520115},
    series={International series of monographs on physics},
    year={1981},
    publisher={Clarendon Press},
    keywords = {physics},
}
\end{filecontents*}


\documentclass[12pt,a4paper,twosided]{article} % report <===============

\usepackage[T1]{fontenc}

\usepackage[numbers]{natbib} %for bibliography <=================================


\begin{document}
algorithm \cite{einstein}. text \cite{dirac}. 

\bibliographystyle{unsrtnat} % plainnat unsrtnat abrvnat <==============
\bibliography{\jobname}
\end{document}

with the result:

enter image description here

As you can see Einstein is cited first and also shown first in the bibliography ...

|improve this answer|||||
  • Since the OP was using the plain bibliography style up to now, he/she is probably interested in getting numeric-style citation call-outs. To maintain this citation style, it's necessary to load the natbib package with the option numbers. – Mico Jan 2 '18 at 7:00
  • 1
    @mico Fist I want to know if natbib is wanted or not. Then your remark should be the next step :-) Let's see the feedback of th OP ... – Mensch Jan 2 '18 at 7:07
  • I am a naive user of LaTeX. natbib may or may not be used. My simple requirement is document or paper which I am citing first, should appear first in my bibliography which is not taking place. – sckulkarni Jan 2 '18 at 7:23
  • yes.... I want numbers like [1] and so on. What is happening in my case is reference which i am citing first , is being printed as [2], in the compiled output. Thanks for your patient replies. – sckulkarni Jan 2 '18 at 7:34
1

You wrote,

However references are not printed in the order of citation. They are printed randomly.

Nothing done by LaTeX and BibTeX is random. To wit, the plain bibliography style is programmed to sort all bibliographic entries in alphabetical order by authors' surnames (and, in case of a tie, by publication year).

If you do not want the entries sorted alphabetically and, instead, by order of first citation, you need to change the bibliography style. I suggest you replace \bibliographystyle{plain} with \bibliographystyle{unsrt} and perform a full recompilation cycle: LaTeX, BibTeX, and LaTeX twice more.

The plain and unsrt bibliography styles are more than 30 years old by now and, as such, don't recognize fields such as url and doi. If you have a need for these fields, I suggest you load the natbib package and use either the plainnat or the unsrtnat bibliography style instead.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.