Bibliography¶
See more on SE.
For bibliography management, whole toolchain is usually needed, including:
- a tool that generates the bibliography file (e.g. Zotero, Mendeley, ...)
- a latex package that cares about the citations style (e.g. biblatex, natbib, or default style)
- the real bibliography processer that generates and sorts the bibliography (e.g. bibtex, biber, ...)
However, not all combinations of theses tools are possible. For understanding the pipeline and the possible combinations, see the following figure:

When choosing what package to use in latex, we have to take care that we:
- have the bibliography file in the right format (
.bibfor all pipelines, but the content differs) - have the style in the right format (
.bstfor default or natbib,.bbxfor biblatex)
By default, we should use the Biblatex - Biber pipeline. However, there are some circumstances where we need to use bibtex, for example, if we need to use a style that is not available for biblatex (as there is no conversion tool). The styles available for biblatex are listed on CTAN.
Latex document configuration¶
Biblatex styling¶
official biblatex documentation
Basic setup:
\usepackage[style=numeric]{biblatex}
...
\addbibresource{bibliography.bib}
...
\printbibliography
The style parameter is optional. The styles available for biblatex are listed on CTAN.
The style can be further customized by:
- editing the processed bibliography data (
\DeclareSourcemapcommand) - editing the bibliography printing
- using
\AtEveryBibitemcommand to edit the bibliography item as a whole or content of specific fields - using
\DeclareFieldFormator\renewbibmacrocommand to edit the formatting of a bibliography field
- using
Customizing the bibliography printing¶
The bibliography printing can be customized:
- using the
\AtEveryBibitemcommand to edit the bibliography item as a whole or content of specific fields:latex \AtEveryBibitem{ \clearfield{urldate} % remove the url date }- Inside the
\AtEveryBibitemwe typically use the following macros:\clearfield{<field>}: remove the field from the bibliography item. Be aware that by doing this, we edit the model, i.e., the field cannot be used in subsequent commands.\togglefalse{bbx:<field>}: disable the printing of the field.
- Inside the
- using
\DeclareFieldFormator\renewbibmacrocommand to edit the formatting of a bibliography field:latex \DeclareFieldFormat{title}{\textbf{#1}} % make the title bold- the difference between
\DeclareFieldFormatand\renewbibmacrois that the former is used to declare format for a bibliography field, while the latter changes an existing macro that prints the field. It is not an easy task to determine which one is applicable in a given situation, as it depends on the field we want to format, but also on the applied bibliography style. - Inside the
\DeclareFieldFormatand\renewbibmacrowe typically use the following macros:\printfield{<field>}: print the field, styled according to the bibliography style.\thefield{<field>}: print the field value.
- the difference between
There are some biblatex macros that can help us to controll the flow inside our customization commands. These can be used inside \AtEveryBibitem, but also inside \DeclareFieldFormat and \renewbibmacro. Most useful are:
\iffieldundef{<field>}{<true>}{<false>}: if the field is undefined, execute the true branch, otherwise execute the false branch.\ifhyperref{<true>}{<false>}: if thehyperrefpackage is loaded, execute the true branch, otherwise execute the false branch. With this, we can compile without error even if thehyperrefpackage is not loaded.
Customizing the bibliography data¶
The bibliography data can be customized using the \DeclareSourcemap command. Example:
\DeclareSourcemap{
\maps{
\map{
\step[fieldset=urldate, null] % remove the url date
}
}
}
Inside the \map command, we can use conditional statements:
\pernottype{<type>}: execute the following steps only if the entry type is not<type>
In each step, we can use multiple conditions, e.g:
\DeclareSourcemap{
\maps{
\map{
\step[
fieldset=urldate, fieldvalue={2022-01-01}, null] % remove the url date if it is 2022-01-01
}
}
}
Handle overflowing URLs in bibliography¶
Sometimes, the links overflow the bibliography. To fix this, we can use the following commands:
\setcounter{biburllcpenalty}{100}
\setcounter{biburlucpenalty}{100}
\setcounter{biburlnumpenalty}{100}
\biburlnumskip=0mu plus 1mu\relax
\biburlucskip=0mu plus 1mu\relax
\biburllcskip=0mu plus 1mu\relax
Default and natbib styling¶
Basic setup:
\bibliographystyle{plain}
...
\bibliography{bibliography}
Note that we do not have to use any package to use basic cite commands. Also note, that the \bibliographystyle command is mandatory. Finally, we do not need to specify the extension of the bibliography file.
Natbib¶
The bibtex bibliography management system is quite old and does not support many features. To overcome this, we can use the natbib package:
\usepackage{natbib}
Commands for citing¶
There are multiple commands for citing, each resulting in a different output. The two most important variants are in-text citation and parenthetical citation:
- In-text citation: the citation is part of the text.
- IEEE: this was proven by Smith et al. [1]
- APA: this was proven by Smith et al., 2019
- Parenthetical citation: the citation is not part of the text.
- IEEE: this has been proven before [1]
- APA: this has been proven before (Smith et al., 2019)
Unfortunately, the commands for these two variants are not consistent across the bibliography packages. The following table summarizes the commands for the two variants:
| Package | In-text citation | Parenthetical citation | Full citation |
| --- | --- | --- | --- |
| Biblatex | \textcite{<key>} | \cite{<key>} (\parencite for APA) | \fullcite{<key>} |
| Natbib | \cite{<key>} | \citep{<key>} | \bibentry{<key>} (requires the bibentry package) |
There are more citation commands resulting in different styles for each bibliography styling package, and each of these packages can be also configurated for even more customized look. For more information, see the following links:
Adittional details for citation (page number, chapter, ... )¶
To add additional details to the citation, we can use the optional argument of the citation command:
\cite[page~123]{key}
Adding a reference to the bibliography without citing it¶
For this, we use the \nocite command. Example:
\nocite{key}
Bibliography entries¶
There are many types of bibliography entries, each of them with different fields. to make things even more complicated, these entries does not match the entry types in Zotero. To make it easier, many use-cases are covered in the table below:
| Use-case | Biblatex | Zotero |
|---|---|---|
| Book | @book |
Book |
| Book chapter | @incollection |
Book Section |
| Conference paper | @inproceedings |
Conference Paper |
| Journal article | @article |
Journal Article |
| Report | @report |
Report |
| Thesis | @thesis |
Thesis |
| Web page | @online |
Web Page |
| Legal document | @legal |
Unavailable. Use Report instead. |
Other sources: