Bibliography management with natbib
In this section we will cover another common way to manage your bibliography.
Introduction and Basic Usage
In this section we will go through how to make a bibliorgraphy using natbib.
-
We will need to create a .bib file to store our bibliorgraphy source. We will use the file mentioned in Bibliorgraphy Management, section Customization.
-
With the file set up, we can write this into out .tex file to create and example for natbib.
-
Once you've finished this, your output should be:
CODE
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%Includes "References" in the table of contents
\usepackage[nottoc]{tocbibind}
%Import the natbib package and sets a bibliography style
\usepackage[square,numbers]{natbib}
\bibliographystyle{abbrvnat}
%Title and author
\title{Bibliography management:
\texttt{natbib} package}
\author{Overleaf}
\date { }
\begin{document}
\maketitle
\tableofcontents
\section{First Section}
Let's cite! Einstein's journal paper
\citet{PhysRev.47.777}\\
Let's cite more journal paper from Einstein \cite{einstein}\\
Let's cite from my 2 most favorite book: Freakonomics \cite{fine2009economics} and Superforcasting \cite{tetlock2016superforecasting}\\
Some few more citation to make to table more interesting:\\
Deep Learning \cite{lecun2015deep}\\
Introduction to Algorithm
\cite{manber1989introduction}\\
\medskip
%Imports the bibliography file "PhysRev.47.777e.bib" \bibliography{PhysRev.47.777.bib}
\end{document}
-
A few thing that is different from Biblatex:
-
The options square and numbers in
\usepackage[square,numbers]{natbib}
enable squared brackets and numeric citations respectively. - The styles abbrvnat is used here. The styling of biblatex and abbrvnat differs from each other extensively.
-
The command
\citet
is used to extensively cite the source's author right on to the document.
-
The options square and numbers in
Natbib citation style
Natbib allows user to cite in several different style. For quick command that can help you choose what to cite, you can try these:
-
Textual citation
\citet{}
-
Parenthetical citation
\citep{}
-
Textual citation with every author's name printed
\citet*{}
-
Parenthetical citation with every author's name printed
\citep*{}
-
Prints only the name of the authors
\citeauthor{}
-
Prints only the year of the publication
\citeyear{}
We can also set citation style with our own preference choice. In this piece of code below, we added
\setcitestyle{authoryear,open={((},close={))}}
to modify the citation style, and this is the result:
CODE
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%Includes "References" in the table of contents
\usepackage[nottoc]{tocbibind}
%Import the natbib package and sets a bibliography style
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={((},close={))}}
%Title and author
\title{Bibliography management:
\texttt{natbib} package}
\author{Overleaf}
\date { }
\begin{document}
\maketitle
\tableofcontents
\section{First Section}
Let's cite! Einstein's journal paper
\citet{PhysRev.47.777}\\
Let's cite more journal paper from Einstein \cite{einstein}\\
Let's cite from my 2 most favorite book: Freakonomics \cite{fine2009economics} and Superforcasting \cite{tetlock2016superforecasting}\\
Some few more citation to make to table more interesting:\\
Deep Learning \cite{lecun2015deep}\\
Introduction to Algorithm
\cite{manber1989introduction}\\
\medskip
%Imports the bibliography file "PhysRev.47.777e.bib"
\bibliography{PhysRev.47.777.bib}
\end{document}
The command
\setcitestyle{authoryear,open={((},close={))}}
uses authoryear citation mode, with open and close parenthesis specify. Below is the list of possible parameter you can use for this command:- Citation mode: authoryear, numbers or super.
- Brackets: round or square. You can manually set any other opening and closing characters with open={char} and close={char}.
- Citation separator: semicolon, comma.
- Separator between author and year: aysep{char}.
- Separator between years with common author: <code>yysep={char}.
- Text before post-note: notesep={text}.