跳到内容

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, CTAN also has a useful BibLaTeX “cheat sheet”. To complement those resources, here is a video tutorial followed by some notes/examples to help you get started.

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:

\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:

\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:

\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 for a full list of styles.

  • The numeric style:
  • BiBLaTeXnumeric.png
  • The alphabetic style:
  • BiBLaTeXalphabetic.png
  • The reading style:
  • BiBLaTeXreading.png
  • The authoryear style:
  • BiBLaTeXauthoryear.png

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

\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:

\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

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:

\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

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:

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

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

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

And the corresponding output:

BiBLaTeXmajor.png

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.

Overleaf guides

LaTeX Basics

Mathematics

Figures and tables

References and Citations

Languages

Document structure

Formatting

Fonts

Presentations

Commands

Field specific

Class files

Advanced TeX/LaTeX