LaTeX: How to add bibliography and references?

There are two ways to add bibliography (references) to your document. One is for small document with few bibliography items using thebibliography environment. The other is for large documents where there are many bibliography items using packages like biblatex.

1) BIBLIOGRAPHY ON SMALL DOCUMENTS

If you have few bibliography items, which is a general case for small few pages documents, then you can use thebibliography environment to create bibliography on your document. \bibitem command is used to add bibliography items. \cite command is used to cite the bibliography item in the document chapter or section.

Below is an example of creating bibliography using “thebibliography” environment. The number “10” at the beginning of “thebibliography” indicates the number of bibliography entries that can be added in the document.


\documentclass{article}

\begin{document}

\section{Introduction}
Leslie Lamport is the initial developer of the document preparation system \LaTeX \cite{lamport94}. 

% Multiple citation example
%\cite{citation01,citation02,citation03} 

\begin{thebibliography}{10}

\bibitem{lamport94}
  Leslie Lamport,
  \textit{\LaTeX: a document preparation system},
  Addison Wesley, Massachusetts, 
  2nd edition,
  1994.

\end{thebibliography}

\end{document}

Bibliography will have the title as “References” if the document class is “article” and it will have title “Bibliography” if the document class is “book” or “report”.

Below is the pdf file generated after you compile the above LaTeX source:

2) BIBLIOGRAPHY ON LARGE DOCUMENTS

For large documents like large report or book, you need to specify .bib file. Bibliographic references are kept in this file. \cite command is used to cite the bibliography items in the document.

Here is an example of the BibTeX database stored in .bib file. Let us name the file as references.bib.


@article{Herlocker:2004,
 author = {Herlocker, Jonathan L. and Konstan, Joseph A. and Terveen, Loren G. and Riedl, John T.},
 title = {Evaluating Collaborative Filtering Recommender Systems},
 journal = {ACM Trans. Inf. Syst.},
 issue_date = {January 2004},
 volume = {22},
 number = {1},
 month = jan,
 year = {2004},
 issn = {1046-8188},
 pages = {5--53},
 numpages = {49},
 url = {http://doi.acm.org/10.1145/963770.963772},
 doi = {10.1145/963770.963772},
 acmid = {963772},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Collaborative filtering, evaluation, metrics, recommender systems},
}

@inproceedings{HuLiu:2004,
 author = {Hu, Minqing and Liu, Bing},
 title = {Mining and Summarizing Customer Reviews},
 booktitle = {Proceedings of the Tenth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining},
 series = {KDD '04},
 year = {2004},
 isbn = {1-58113-888-1},
 location = {Seattle, WA, USA},
 pages = {168--177},
 numpages = {10},
 url = {http://doi.acm.org/10.1145/1014052.1014073},
 doi = {10.1145/1014052.1014073},
 acmid = {1014073},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {reviews, sentiment classification, summarization, text mining},
}

@online{opinion:lexicon,
    author        = {Minqing Hu and Bing Liu},
    title         = {A list of positive and negative opinion words or sentiment words for English},
    year          = {2004},
    urldate       = {2015-01-04},
    url           = {http://www.cs.uic.edu/~liub/FBS/opinion-lexicon-English.rar}
}

I have used biblatex package which uses bibtex to generate bibliographies. However, now biblatex uses biber as the default backend instead of bibtex.

If you have not installed biber, you need to install it first. Here is the command to install biber on Ubuntu:


sudo apt-get install biber

Here is the sample LaTeX document that uses references.bib as the bibliography database. In the document chapter, citation is done using \cite command. Package defination and bibliographic resource file is defined in the preamble of the document. \printbibliography command is used to print the bibliography at our desired position.


\documentclass{report}

\usepackage[english]{babel}
\usepackage{biblatex}
\addbibresource{references.bib}

\begin{document}

\chapter{Introduction}

Testing \cite{HuLiu:2004}. 
New citation \cite{Herlocker:2004}.
Another citation \cite{opinion:lexicon}. 

\printbibliography

\end{document}

Suppose that the tex file is named as myfile.tex. To compile the tex and bib file, you need to run the following commands:


pdflatex myfile
biber myfile
pdflatex myfile

Now, myfile.pdf is generated with the bibliography items.

Below is the pdf file generated after you compile the above LaTeX source:

If you are using document class as ‘report’ or ‘book’ then the title will be “Bibliography” and if you are using document class as ‘article’ then the bibliography title will be “References“.

More detail on Bibliography Management