> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/in-depth-articles/13-getting-started-with-biblatex.md).

# Getting started with BibLaTeX

**Author: Josh Cassidy (July 2013)**

For years LaTeX users have been using BibTeX along with multiple additional packages such as `natbib` to write bibliographies. However, now there's a new option, BibLaTeX. It's designed to give you many more options to easily configure your bibliographies/citations. Conveniently, existing `.bib` files are unlikely to need much altering to work with BibLaTeX. In addition to the 300+ pages of [BibLaTeX documentation](http://mirror.ox.ac.uk/sites/ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf), CTAN also has a useful [BibLaTeX “cheat sheet”](http://tug.ctan.org/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf). To complement those resources, here is a video tutorial followed by some notes/examples to help you get started.

{% embed url="<https://www.youtube.com/embed/nH9If8c5VCs>" %}

### Basic commands and styles

Firstly the commands you use in the tex file to add a bibliography into the document are quite different. In the preamble you need to use the following code:

```latex
\usepackage{biblatex}
\addbibresource{}
```

The first command just loads up the `biblatex` package. The second is used to specify which bib files you want to use. You simply enter the file name in the curly brackets including the `.bib` extension. Then in the body of the document instead of using a `\bibliography` command to construct the bibliography, you use the `\printbibliography` command. When using BibTeX you specify the bibliography style by using the `\bibliographystyle` command. In `biblatex` we no longer use this command, instead we specify style options by passing more arguments into the `\usepackage` command. To do this we enter `style=` followed by a style name into square brackets immediately before the curly brackets. For example:

```latex
\usepackage[style=numeric]{biblatex}
```

Alternatively if you want to declare one style for the citations and a different style for the bibliography, you use the words `citestyle` and `bibstyle`. Here's an example:

```latex
\usepackage[citestyle=alphabetic,bibstyle=authortitle]{biblatex}
```

Before moving on I will quickly show you what some of these styles look like for both the citations and the actual bibliography entry. However, you can [refer to the documentation](http://mirror.ox.ac.uk/sites/ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf) for a full list of styles.

* The `numeric` style: ![BiBLaTeXnumeric.png](/files/Qct0jhcDB1BBWBEkmkzK)- The `alphabetic` style: ![BiBLaTeXalphabetic.png](/files/C6gKgGxp28pMYFetcoll)- The `reading` style: ![BiBLaTeXreading.png](/files/im9vscMJTEaFQfglAzY8)- The `authoryear` style: ![BiBLaTeXauthoryear.png](/files/2jgCRidqhvXqs0KfrOdp)

Another argument you can give the `\usepackage` command is the sorting option. For example:

```latex
\usepackage[style=authoryear,sorting=ynt]{biblatex}
```

This would use the author-year style and then sort the bibliography entries by year, name, title. Here's a list of some of the different sorting options available:

* `nty`—sorts entries by name, title, year;
* `nyt`—sorts entries by name, year, title;
* `nyvt`—sorts entries by name, year, volume, title;
* `anyt`—sorts entries by alphabetic label, name, year, title;
* `anyvt`—sorts entries by alphabetic label, name, year, volume, title;
* `ynt`—sorts entries by year, name, title;
* `ydnt`—sorts entries by year (descending order), name, title;
* `none`—no sorting. Entries appear in the order they appear in the text.

If you don't specify an order the default is `nty`.

### Citation Commands

The citation commands have also been overhauled in `biblatex`. These more intelligent commands give you the option of adding a `prenote` and `postnote` in as arguments:

* a `prenote` is a word or phrase like 'see' that is inserted at the start of the citation;
* a `postnote` is text you want inserted at the end of the citation.

To add these notes in you uses two sets of square brackets in the citation command. Here's an example:

```latex
\cite[see][page 12]{latexcompanion}
```

In this example we've already loaded the `alphabetic` style and `latexcompanion` is just the citation key. This is what the citation would look like in the text:

![BiBLaTeXprepost.png](/files/PSFhG9HheGSYnSGi4Jbf)

If you only open one set of square brackets it will assume the contents of the brackets is a `postnote`, so if you only want a `prenote` make sure you still open the second set of square brackets and then just leave it empty.

There are also a number of different citation commands available for you to use. Here are some of the standard ones:

* `\cite`—the most basic one. Prints without any brackets except when using the `alphabetic` or `numeric` style when it uses square brackets;
* `\parencite`—prints citations in parentheses except when using the `alphabetic` or `numeric` style when it uses square brackets;
* `\footcite`—puts the citation in a footnote.

### Subdividing Bibliographies

One of the nice things about `biblatex` is that you can subdivide bibliographies according to source type. Here's an example of subdividing by source type:

```latex
\printbibheading
\printbibliography[type=book,heading=subbibliography,title={Book Sources}]
\printbibliography[nottype=book,heading=subbibliography,title={Other Sources}]
```

In this example we are subdividing the bibliography into two sections, one for sources that are books and one for sources that aren't. Here's an example output:

![BiBLaTeXtypes.png](/files/6LSyZu4nN3CNPzNIb4sE)

Another way you can subdivide bibliographies is using a keyword filter. To do this you need to add a `keywords` field into the entries in your `.bib` file. For example:

```latex
@article{key,
	keywords = {keywordA,keywordB,keywordC}
```

Here's an example of how you'd then subdivide by keyword:

```latex
\printbibheading
\printbibliography[keyword=major,heading=subbibliography,title={Major Sources}]
\printbibliography[keyword=minor,heading=subbibliography,title={Minor Sources}]
```

And the corresponding output:

![BiBLaTeXmajor.png](/files/No6sSe9x5UX6yzvpXtju)

It looks like one day soon BibTeX will be nothing but a piece of LaTeX history! I hope this has been helpful in getting you started with `biblatex`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/in-depth-articles/13-getting-started-with-biblatex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
