• Home   /
• Archive by category "1"

## Bibliography

A typical scientific document contains a number of references, and this leads to the problem of organizing and presentation of the references in the document. The problem can be subdivided into several parts: store of the reference information, later retrieval of this information while preparing the document, and presentation (formatting) of the reference information in the document and in the bibliography according to a particular format.

A widely-used approach to deal with references in LaTeX documents is to employ BibTeX reference management software. In BibTeX reference information is stored in format-independent plain text file(s) (usually with .bib extension), which can be modified with almost any text editor. Such a text file contains BibTeX entries, and each entry, formed by several text lines, has

• unique ID or key, needed to identify and refer to the particular entry, for instance Author2001;
• entry type, which can be article, book, thesis, etc.;
• entry fields (such as year, publisher, journal, etc.), corresponding to the particular type.

Here is an example of the article type entry from the .bib file I used while typesetting thesis:

@article{Khirevich2010,author= {Khirevich, S. and Daneyko, A. and H\"{o}ltzel, A. and Seidel-Morgenstern, A. and Tallarek, U.},doi= {10.1016/j.chroma.2010.05.019},journal= {Journal of Chromatography A},shortjournal= {J. Chromatogr. A},pages= {4713--4722},title= {Statistical analysis of packed beds, the origin of short-range disorder, and its impact on eddy dispersion},volume= {1217},year= {2010}}

The command \bibliography{reference_list} placed before \begin{document} is used to specify a plain text input file (reference_list.bib here) containing information on references.

References can be "cited" during editing the LaTeX document using, for example, \cite{key} command, and later at the document compilation step LaTeX input files must be processed with LaTeX and BibTeX.

The most popular approaches to indicate a reference appearing in the text can be classified as "numeric" and "author–year". The former uses sequential number of a reference in the document

while "author–year" is based on the extended reference information and may appear like this:

Each indication has particular advantages and drawbacks. For example, numeric is more compact (i.e., require less space in a text line), and a group of references can be "compressed" into a range in the case they have sequential numbering (i.e., [1,2,3,5] will be shown as [1–3,5]). On the other hand, author–year indication shows more information on the cited document (typically, first one or two author names, and a year of a publication), but requires more space compared to the numeric one. The space consumed by reference may become important if your document has high density of references (and you care about in-line space "wasted" by references :).

and each number has associated script-sized text at the bottom of the page (where the reference appeared) containing extended information on the cited reference:

## Biblatex

To create citations in my thesis, I employed the biblatex package, which is one of the most notable packages I have used with LaTeX. The package provides a highly customizable interface for the creation and edit of the presentation of bibliographic data in the document. Compared to the plain BibTeX, biblatex enables relatively easy customization of the appearance of bibliographic data. Below I provide customizations I used to modify the default biblatex output. The detailed description of the biblatex commands is available in the package documentation.

The two basic commands to enable biblatex and output citation list are

\usepackage{biblatex}% place in the document preamble\printbibliography% place in the document body where list of citations has to appear

While preparing the thesis I activated biblatex with the following optionscompiling the document using biblatex with the options
below will need and
files (see next
sections, "Biblatex customization" and "Footnote
citation"):

\usepackage[hyperref=true, url=false, isbn=false, backref=true, style=custom-numeric-comp, citereset=chapter, maxcitenames=3, maxbibnames=100, block=none]{biblatex}

Option hyperref=true was specified to transform various citation elements (like citation number, page number where citation appears, hyperlink to the web page where cited document can be found, etc.) into clickable hyperlinks. This option requires hyperref package (see also notes on hyperref).

With options url=false,isbn=false I disabled printing the URLs and ISBNs in the bibliography.

### Back references

Option backref=true enables generation of the back references to the citation, which are usually number(s) of the page where citation appears:

% backref=true
% backref=false

The back reference text preceding the page number ("see p.") can be modified using the following command:

\DefineBibliographyStrings{english}{%backrefpage= {see p.}, % for single page numberbackrefpages= {see pp.}% for multiple page numbers}

Just a note on the back references. When you are reading a .pdf document, encounter a reference, and click on it, .pdf viewer will change view to the record of this reference in the bibliography. Now, if you want to return to the main text and continue reading, you may find it difficult to do using back reference when the reference was cited on several pages (back reference will contain several page numbers and you have to bear in mind the original page number you came to the bibliography), and a good solution here is to use "Alt + ←" instead of the back reference itself. On the other hand, back references are useful to indicate how often and where a particular reference was cited in the document.

### Citation style

Option style=custom-numeric-comp determines the citation style. As seen from its name, the chosen citation style uses numbers (numeric) to indicate citations in text, and consequent numbers are compressed (comp) into a range: [1,2,3,5] is printed as [1–3,5]. Above it was mentioned that I used footnote version of the standard biblatexnumeric-comp style — as a result, each citation has i) its number typeset as superscript, and ii) short and extended reference information located at the bottom of the page ("footnote text") and in the bibliography, respectively:

Option citereset=chapter defines biblatex behavior for the reference footnote text in a typical situation when a citation appears several times in the document: footnote text for the particular citation is printed only once per document chapter (citereset=chapter), where chapter is defined according to the LaTeX sectioning commands. In my thesis a typical chapter includes about 20 pages, and I assumed citereset=chapter to be quite acceptable. However, one of my colleagues was confused by such a rule for printing the footnote text (i.e., he did not get the logic behind the rule until I have explained it). I was thinking about resetting footnote text as "once-per-page" (not "once-per-chapter") but decided to avoid this due to high density of the references in my thesis. If you are interested in such a behavior some useful information can be found here.

### Amount of displayed author names

Options maxcitenames=3 and maxbibnames=100 limit amount of authors of the cited document to be printed in the document body and in the bibliography, respectively. If the number of authors exceeds maxcite(bib)names, the author list is truncated according to biblatex settings, and usually printed as "Author1 et al." In my case I have very short authors lists in the footnote text (document body) to reduce space occupied by footnote citations,

and virtually all authors are displayed in the bibliography:

I note that I have prepared my thesis with biblatex v. 0.9a (19.03.2010), while this on-line document was prepared and tested on biblatex v. 1.6 (29.07.2011). Options maxcitenames and maxbibnames were not available in v. 0.9a, and the described biblatex behavior (with maxcitenames=3 and maxbibnames=100) was obtained using maxnames=3 while loading the biblatex package, and maxnames=100 while printing the bibliography, i.e.

\usepackage[..., maxnames=3]{biblatex}% in the document preamble\printbibliography[..., maxnames=100]% in the document body

The next section continues the discussion of the biblatex customization.

If you likeI hope you came to the bottom of this
page not just by fast scrolling the information presented on this web site, and would like to support development of this project you may consider buying me a coffee.

Learn how to create a bibliography using modern biblatex and biber - A short tutorial.

This will only be a short overview of the main and most often used features of biblatex and biber to create a bibliography. More detailed information can be found in the package documentation.

### The database

Creating a bibliography using biblatex and biber means storing all of your available bibliographic information in a simple text-based database. The name should be as unique as possible, for example . This is helpful when transferring files with your advisor, students or colleagues. biber is used to deal with the database.

A sample database file could look like this:

@article{wombat2016, author = {Walther Wombat and Klaus Koala}, title = {The true meaning of 42}, journal = {Journal of modern skepticism}, date = {2016}, keywords = {trusted}, } @book{lion2010, author = {Laura Lion and Gabrielle Giraffe and Carl Capybara}, title = {The dangers of asking the wrong question}, publisher = {publishing house}, date = {2010}, keywords = {trusted}, } @online{wikibook, title = {Generating Bibliographies with biblatex and biber}, organization = {Wikibooks}, date = {2016}, urldate = {2016-03-07}, url = {https://en.wikibooks.org/wiki/LaTeX/Generating_Bibliographies_with_biblatex_and_biber}, keywords = {untrusted}, }

Every entry in the database starts with an -sign followed by the entry type. More types are available, the package documentation lists all of them. The bibliographic information for each entry are stored in a pair of braces, beginning with a unique keyword for that entry (bibkey). Least complicated way of presenting the data is every field type in a new line, the content in curly braces, followed by a comma. The order in which you give the information is not important.

Please have a close look at the authors, every individual author is separated by the keyword . All dates are written in YYYY-MM-DD, or just the year if the other information is not available. The file which should have been installed with the package contains some sample entries.

### Setting up biber

Biber is the name of the helper program that sorts the entries and provides all the relevant information to package biblatex. If you are not comfortable using the command line (aka the terminal), you should set up your editor to call biber for you. Setting up my editor to use biber shows how to do it for the different editors.

### A simple example

 \documentclass{article}\usepackage[backend=biber]{biblatex}\addbibresource{lauraPhd2016.bib}\begin{document} I doubt that there is any useful information here~\cite{wikibook}. All we know is limited, apart from knowing the answer we all know. Or do we? Wombat and Koala have discovered some interesting things~\cite{wombat2016}. Some people are too nosy. What can happen to them is described by Laura Lion~\cite[9]{lion2010}. \printbibliography\end{document}

Now how does it actually work? Package biblatex is loaded with the option followed by adding your database file to the list of bibliographic files using . Please note that the file extension is mandatory and that this is happening in the preamble of the document.

Within the document you can cite one of your database entries using . Your database can contain hundreds of entries, but only cited references will occur in the final list. You can use to add uncited entries to the list. If you want to add all entries from the database use .

Finally, the list of your references is printed with .

Running LaTeX (no matter if , etc.) on the main document will result in the following output.

LaTeX Warning: Citation 'wikibook' on page 1 undefined on input line 5. LaTeX Warning: Citation 'wombat2016' on page 1 undefined on input line 7. LaTeX Warning: Citation 'lion2010' on page 1 undefined on input line 9. LaTeX Warning: Empty bibliography on input line 11. [1{/usr/local/texlive/2017/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./lauraPhd2016Main.aux) LaTeX Warning: There were undefined references. Package biblatex Warning: Please (re)run Biber on the file: (biblatex) lauraPhd2016Main (biblatex) and rerun LaTeX afterwards.

We get several warnings about undefined references, no bibliography and instead of proper citations, we see just the cite key in bold.

In order to really get a bibliography and the citations, and not just the infamous warning, you have to run biber after latex to extract the relevant data from the database. After setting up biber as described in Setting up my editor to use biber you should be able to do it by pressing one button while working on your document. To incorporate the bibliography information into your document, LaTeX then has to process the data biber has generated before. To sum it up, if you have a file you (or your editor) will have to do:

• latex lauraPhdd2016Main
• biber lauraPhdd2016Main
• latex lauraPhdd2016Main

Everytime your database is updated, remember to process the database by calling biber.

The full result can be seen in the picture below. Please note that package biblatex adds some small little details. Can you see things that are printed but have not been defined?

## Reference Styles

Different reference styles are in use within the different disciplines of science. Very broadly speaking, you can divide into a numerical referencing sytem (Vancouver) or an author date referencing system (Harvard).

Package biblatex[1] provides different citation commands that generate different output (in-text citation, footnotes and more). A few examples are given below, the package documentation contains and explains the use of the whole set.

### Numerical Referencing

Numerical referencing is the default style. Numbers within brackets are used in text and in the bibliography. Using makes it easy to change the style into footnotes. gives a bibliography that is sorted chronologically, i.e. the numbers increase to the end of the document.

 \documentclass{article}\usepackage[backend=biber,style=numeric,autocite=plain,sorting=none]{biblatex}\addbibresource{lauraPhd2016.bib}\begin{document} I doubt that there is any useful information here.~\cite{wikibook} All we know is limited, apart from knowing the answer we all know. Or do we? \citeauthor{wombat2016} have discovered some interesting things.~\autocite[compare][80]{wombat2016} What can happen to nosy people is described by \textcite[9]{lion2010}. \printbibliography\end{document}

Using gives a diffferent output. Can you spot all the differences?

### Author Date Referencing

If you want an author-date referencing style, you can use when loading biblatex. The option with the option puts parenthesis around the cite genererated with (which is similar to using . In some cases, may come in handy when the citation is the subject and part of the sentence flow.

 \documentclass{article}\usepackage[backend=biber,style=authoryear,autocite=inline]{biblatex}\addbibresource{lauraPhd2016.bib}\begin{document} I doubt that there is any useful information here~\cite{wikibook}. All we know is limited, apart from knowing the answer we all know. Or do we?~\cite{wombat2016} Some people are too nosy. What can happen to them is described by Laura Lion~\autocite[9]{lion2010}. Some people are too nosy. What can happen to them is described by \textcite[9]{lion2010}. \printbibliography\end{document}

### APA Citing

The American Psychological Association (APA) defines a very strict author year style. You can access it using and additionally defining the language mapping.

Compare the output with the normal author year style. How many changes can you spot?

## Separate Bibliographies by Entry Type

Suppose you want to have a separate bibliography for all the online resources you are citing. No problem using the optional argument of . You can also change the title (and other stuff).

## Splitting into different topics

You can split your bibliography into different topics, in trusted and untrusted sources, or in primary and secondary sources. The way to tell biblatex what is what, is by adding a tag to the entries of the database.

@book{lion2010, author = {Laura Lion and Gabrielle Giraffe and Carl Capybara}, title = {The dangers of asking the wrong question}, publisher = {publishing house}, date = {2010}, keywords = {trusted}, }

Note, that the entryfield in the dataase is called (plural) because you can have more than one keyword (separated by commas). When calling the command, you have to use the singular. biblatex has a powerful system of filtering data, more can be found in the manual.

## Bibliographies per Section or Chapter

Some people have the need for a reference list at the end of each chapter or section. This can be done using .