% !TEX root = ../manual.tex
% !TEX program = xelatexmk
% !TEX spellcheck = en_GB

\section{Bibliography management}
When using \LaTeX\ for a large report or thesis it's often good to use \LaTeX\ for the bibliography as well. This works by using a bibliography database, a program to parse it, and a package to show your bibliography in your document.

\subsection{Bibliography database}
A bibliography is usually included as a |.bib| database. |.bib| files are plain-text, and quite simple to type yourself.

\begin{lstlisting}
@article{glashow,
  author       = {Glashow, Sheldon},
  title        = {Partial Symmetries of Weak Interactions},
  journaltitle = {Nucl.~Phys.},
  date         = 1961,
  volume       = 22,
  pages        = {579-588},
}
\end{lstlisting}

Most important is the \emph{key}, here |glashow|. This key is used to refer to an entry in your databse.


There is also a lot of software that can help in managing a bibliography, JabRef for example.
Some more software is listed in
\fnhref{http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management\#Helpful_tools}{the \LaTeX\ Wikibook}.

\subsection{Typesetting with a bibliography}
When using a bibliography, you also need to parse your bibliography database. This is done using a parser like |biber|. When you typeset your document, the workflow is now:

\begin{itemize}
	\item pdflatex
	\item biber
	\item pdflatex
\end{itemize}

This is not very convenient, but there are solutions that do this for you. More on this is explained in section~\ref{sec:latexmk}.

\subsection{Bibliography package}
To load the bibliography features, use the |biblatex| package.
\begin{lstlisting}
\usepackage[backend=biber,style=ieee]{biblatex}
% Load `biblatex-examples.bib`
\bibliography{biblatex-examples}
\end{lstlisting}
When loading |biblatex| you can select the bibliography parser (|bibtex|) and the citation style (IEEE). The citation style can be changed to whatever is required for your document. Some well known styles are ACS (as |chem-acs|), AIP (as |phys|), nature, science, ieee, Chicago (as |chicago-authordate|), mla and apa. 

Now you can use the citation commands |\textcite| and |\cite| to refer to publications in your database:

\begin{multicols}{2}
\begin{lstlisting}
As \textcite{glashow} noted.
We know that this works\cite{spiegelberg}.
But \textcite[p.~172]{aristotle:
rhetoric} noted this in untrue\cite[p.~12]{augustine}.
\end{lstlisting}
\columnbreak
As \textcite{glashow} noted.
We know that this works\cite{spiegelberg}.
But \textcite[p.~172]{aristotle:rhetoric} noted this in untrue\cite[p.~12]{augustine}.
\end{multicols}

What remains is printing the bibliography:

\begin{lstlisting}
\printbibliography
\end{lstlisting}
\printbibliography
