Graphics, Figures & TablesHow to make the bibliography in order

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sannemadsen
Posts: 2
Joined: Tue Dec 02, 2014 3:56 pm

How to make the bibliography in order

Post by sannemadsen »

Hello! I Am having a problem. I am using writelatex to make a report in. But when I cite a reference, it is not showing the proper number. I have around 20 references, and I want the first in my .bib file to be number 1, such that if I \cite{refnumber1} it will show [1] in the preview. The problem now is that it is showing [15] for the one that is the first in the .bib file. I have tried to remove each reference from the .bib file, and put them in one by one in the order I am refering to in my report. But it still doesn't work. Does anyone know how to solve this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

How to make the bibliography in order

Post by Johannes_B »

Hi and welcome,

i think your bibliography is sorted on the order of appearance in your document, not the bib.

You can change that, but you have to tell us yor basic setting, best in form of a minimal working example so we can test solutions.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
sannemadsen
Posts: 2
Joined: Tue Dec 02, 2014 3:56 pm

How to make the bibliography in order

Post by sannemadsen »

I have looked through the link you sent me, but I am not completely sure how to send such a package. I can give you the informations though. These are the commands I use for the main document.

Code: Select all

\documentclass[a4paper,oneside]{article}
\usepackage[margin=75pt]{geometry}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{lastpage}%in footer: \thepage\ of \pageref{LastPage} 
\usepackage{graphicx}
\usepackage[none]{hyphenat}%hyphenation is not allowed
\usepackage[hyphens]{url} %url force linebreak
\usepackage{titlesec}%fancy sections mm.
\usepackage[utf8]{inputenc}% 8-bit bytes to represent alphabet
\usepackage{float}%floating figures and tables
\usepackage{pbox}%adjusts its width to enclosed text
\usepackage{longtable}%allows tables to continue to the next page
\usepackage{capt-of}%putting a caption to something that's not a float
\usepackage[parfill]{parskip}%best place for pageskip and minimum space at the end of the last line of a paragraph.
\usepackage{array}%extends the options for column formats
\pagestyle{fancy}
\fancyhf{}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
\graphicspath{ {./images/} }
\begin{document}
\sffamily

(whole document)

\bibliographystyle{plain}
\bibliography{bibliography.bib}
Remember that this is in writelatex. I don't know if there is something special about it. And my .bib file is just references, I don't have any of the "start bibliography" or any other commands in that file. It just starts and ends like this:

Code: Select all

@article{Chandra20121462,
  title={something},
  author={Al Seadi, Teodorita},
  year={2008}
}

@book{al2008biogas,
  title={Biogas handbook},
  author={Al Seadi, Teodorita},
  year={2008}
}
And in my document, when I write "I like flowers, just like the president \cite{Chandra20121462} and his wife \cite{al2008biogas}" it turns out:
"I like flowers, just like the president [2] and his wife [1]". And when I have more than 2, it is completely random which number it gives.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: How to make the bibliography in order

Post by Johannes_B »

You can have your bibliography sorted by appearance or by author. But bibtex will always do some sort of sorting, i fear.

You can however make a dummy document, cite in the order you want the itemz to appear in the document and input the generated bbl-file in your main document. In this main document, you have to remove all things connected to the bibliography.

If you have few citations, you can do this by hand, if you have many a short script could be helpful.


May i ask, why want to have a specific order?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply