Bibliography in LaTex

What Is Bibliography?

A Bibliography, sometimes also known as a citation page, provides the information about the reference used to create a paper. At the end of the paper, these reference lists are generally written in alphabetical order. LaTex comes very handily in writing well-structured bibliography.

Generating Bibliography

To generate bibliography in LaTex, we use environment thebibliography and for the various entries we use command \bibitem{}.

\documentclass{article}
\begin{document}    
\begin{thebibliography}{9}
\bibitem{}Sharma H., Dominic P., and Christine H. L., Stabilization of Methanol-Bases Suspensions, \emph{J. K. Ceram. Soc.}, 89, (2005) 450-485.
\bibitem{}Sharma H., Dominic P., and Christine H. L., Stabilization of Methanol-Bases Suspensions, \emph{J. K. Ceram. Soc.}, 89, (2005) 450-485.
\end{thebibliography}
\end{document}

Output:

Bibliography in LaTex

It is mandatory to pass an argument along with command \begin{thebiblio.graphy}; otherwise, the above code will never compile. This argument tells the width of the widest label used in the bibliography. Instead of numbers, we can also use long- name in the argument. The numbering of entries is done automatically in a bibliography.

A key can also be passed along with \bibitem{} command to identify an entry. This key can be used with \cite{} command to give reference to the particular entry mentioned in the bibliography. Additional information such as chapter number, section number can also be used with \cite{} command, however, it is not mandatory. The following code explains the same.

\documentclass{article}
\begin{document}            
We are learning about how to cite some publications in documents used in the bibliography. \\ Methanol is used in chemical industry \cite[Chapter 5]{shachris05} for various purposes.\\ Momentum generated when a stone reaches at the top while following a parabolic path \cite[Sec 3.9, 3.10 Chapter 9]{morjen99}.  
 \begin{thebibliography}{9}
\bibitem{shachris05} Sharma H., Dominic P., and Christine H. L., Stabilization of Methanol-Bases Suspensions, \emph{J. K. Ceram. Soc.}, 89, (2005) 450-485.
\bibitem{morjen99} K. P. Morris and Jennifer L., 1999. \emph{  Concepts of Coordinate Geometry }-TURBoat, 11(1):32-37.  
\end{thebibliography}
\end{document}

Output:

Bibliography in LaTex

In the highlighted portion of the output, observe numbers 1 and 2. Where does that come from? The key shachris05 is for the first entry, and morjen99 is for the second entry. These entry numbers generate 1 and 2 in the output. We can also use multiple keys in the \cite{} command. If we use any key in \cite{} command that is not present in the bibliography will produce a question mark (?) in the output. Remove any of the keys that are present in the bibliography and observe the outcome.

Note 1: A key can never contain a comma (,). A key can be any combination of digits, letters, and punctuation characters. A maximum of 256 characters is allowed in a key.

Note 2: It is advisable to use a combination of the author’s name and year in the formation of a key, i.e., morjen99 (authors name – K. P. Morris and Jennifer L.   Year – 1999).

Note 3: The compilation of the above code is done in two stages. At the first stage, marking of citation or bibcite is done. In the second stage, \cite{} command is replaced by numeric values or codes, etc.

Customizing A Bibliography

A renowned package, bibletex, is used to customize a bibliography with very little effort. Its interface is quite flexible for various styles of a bibliography. Check the following code.

\documentclass{article} 
\usepackage[utf8]{inputenc} 
\usepackage{biblatex}  
 \addbibresource{example.bib}   
\title{Customizing Bibliography: \texttt{biblatex} package}  
 \author{Nikhil Kumar}   
\date{October 10, 2020}  
 \begin{document}    
\maketitle   
 \tableofcontents    
\section{First section}
Using \texttt{biblatex}, dpending on citation type, one can render bibliography divided into different sections. Let us do some cite! The Newton's book \cite{dirac}, The Albert Einstein's journal paper \cite{einstein}, both are physics related items.
Next, \textit{The \LaTeX\ Tutorial} book \cite{latexcompanion}, the website by Donald Knuth\cite{knuthwebsite}, \textit{The Archive Tex Comprehensive Network} (ATCN) \cite{atcn} are \LaTeX\ are quite related; however, the others items by Donald Knuth's \cite{knuth-fa,knuth-acp} are based on programming.
\printbibliography[heading=bibintoc, title={Complete bibliography}]    
%Displays the whole bibliography with the title "Complete bibliography"                  
\clearpage                                                                                                                                      
%Filtering bibliography
\printbibliography[heading=subbibintoc, type=article, title={Related with Articles}]
\printbibliography[type=book, title={Related with Books}]
\printbibliography[keyword={Science}, title={Related with Physics}]
\printbibliography[keyword={latex},title={Related with \LaTeX }]
\end{document}

The output will come on three pages. Snapshots of the output are mentioned below.

On the first page:

Bibliography in LaTex

On the second page:

Bibliography in LaTex

On the third page.

Bibliography in LaTex

For using the package biblatex, we use \usepackage{biblatex}.

To include a file example.bib\addbibresource{example.bib} is used. This file contains all the details of the bibliography. Its content is mentioned below.

@article{einstein,
 author = "A. Einstein",  
title = "{Zru Elektrodynamiks bewgters K{\"o}rpre}. ({German})   
[{On} the dynamics of  different bodies in motion]",   
journal = "Annaln der Physiks", 
volume = "32",               
number = "07",   
pages = "890--920",      
year = "1906",    
DOI = "http://dex.doii.edu/10.1020/nadp.19053221040",      
keywords = "Science"                                                                                                                                }
@book{dirac,      
title = {The Fundamentals of Quantum Mechanics},  
author = {Paul Maurice Adrien Dirac},    
isbn = {9708198521015},  
series = {An unique series of various monographs on science},    
year = {1980},     
publisher = {British Press},   
keywords = {Science}    
 }   
@book{latexcompanion,  
 author    = "Michel John and Franky Mittelball and Samarin Adams ",  
title     = "The \LaTeX\ Companion",   
year      = "1994", 
publisher = "Weiley Publication", 
address   = "U.S., Orleans", 
keywords  = "latex"     }
@online{knuthwebsite,   
author = "D. E. Knuth",  
title = "Knuth: Typesetting and Computers",   
url  = "http://www-cse-faculty.mit.edu/~unfo/abcdef.html", 
addendum = "(visited: 01.09.2017)", 
keywords = "knuth,latex"   
}
@inbook{knuth-fa,     
author = "D. E. Knuth",   
title = "Fundamenta Of Various Algorithms",    
publisher = "Weiley Publication",   
year = "1991",   
chapter = "2.3",      
keywords  = "programming,knuth"    
}
@book{knuth-acp,  
author = "D. E. Knuth",      
publisher = "Weiley Publication",   
title = "The Concept of Computer Programming",    
series = "Six volumes",    
  year = "1969",   
note = "Eight volumes are planned",    
  keywords  = "programming,knuth"                                                                                                            }
@article{atcn,       
author  = "G. D. Shepherd",    
title   = "The {A}rchive {T}ex {C}omprehensive {N}etwork ({ATCN})",  
year    = "1993",   
journal = "TUGBoat",    
volume  = "14",   
 number  = "3",         
pages   = "342--351",   
 keywords  = "latex"  
  }

@book{…..} gives information about the book. knuth-acp is the label used in the cite command to identify the reference. author = "D. E. Knuth" is the key-value pair where the key is author and value is D. E. Knuth. Keywords are used to categorize the entries.

\tableofcontents is used to create a table of contents.

\printbibliography[heading=bibintoc, title={Complete bibliography}]

It displays the entire bibliography beneath the title “Complete bibliography”. heading=bibintoc is responsible for the display of the Complete bibliography in the table of contents.

In the second case, heading=subbibintoc provides second-level entry and displays the title “Related with Articles”.

  \printbibliography[heading=subbibintoc, type=article, title={Related with Articles}]

This line of code does filter based on type “article” and puts the title “Related with Articles”

\printbibliography[keyword={latex},title={Related with \LaTeX }]

The above line is responsible for displaying entries whose keyword contains the word “latex”. This section will be beneath the tile “Related with \LaTex”.

\clearpage is used to push the content to the new page. Observe the output, the second page contains only one entry. Because of the page break, other contents shift to the next page. Remove this command and observe the changes in output yourselves.

Note: We need to create two files, one for the code and one for the bibliographic contents (example.bib). This can be easily done on the online editor provided by overleaf.com.