Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

Biblatex

Categories: Bibliography, Biblatex
<< | Page list | >>

How to use Biblatex with LyX

(or How to fool LyX into using Biblatex)

What is Biblatex?

Biblatex is a specific approach to bibliography management. It avoids the crude language of BibTeX's bst files and controls the design of the bibliographies and citations by LaTeX macros. Biblatex introduces a new, LaTeX-based style file format or, more precisely, a system of task-differentiated style files: "biblatex bibliography styles" (bbx files) controlling the layout of the bibliography, "biblatex citation styles" (cbx file), controlling the layout of the citations, and "language definition files" (lbx files) controlling the localization. The biblatex package itself ships with a number of these files that cover the most common purposes. There are also user contributed additional biblatex styles for specific purposes or specific journals. Biblatex overcomes several limitations of BibTeX, and is much easier to use, for anyone familiar with LaTeX. Customizing a bibliography style can be as easy as adding a LaTeX line in your preamble. Furthermore, it is much more powerful than any other existing approach, providing things like citation filtering, sectioned bibliographies, chapter bibliographies, full cites, ibidem, gender differentiation, full localization, on the fly modification etc. Really, there's hardly a requirement Biblatex cannot fulfill. In terms of LaTeX bibliography management, it is a huge step forward.

Biblatex originally used bibtex for preprocessing but now biber, a bibliography processor written in Perl and specifically designed for Biblatex, is the preferred backend. Even though bibtex or bibtex8 can still be used, you'll need to use biber to get Biblatex running at full steam. Biber has no capacity limitations, it is fully unicode aware (but also supports many other encodings), it can modify bibliography data on the fly (thus allowing biblatex to perform many fancy tricks) and much more. Biber is closely tied to biblatex, which means that you can only use it with Biblatex (not with any of the other approaches), and you have to use specific versions of biber with specific versions of biblatex (a thing you usually do not need to care about, since both packages are included in and automatically updated by all modern LaTeX distributions).

Using Biblatex with LyX

LyX 2.3 (currently in development) will introduce native Biblatex support. As of that version, you can use Biblatex simply by selecting it, and the bibbliography and citation styles, in Document→Settings...→Bibliography. Until LyX 2.3 is released, you'll have to resort to some tricks to make Biblatex work with LyX. These are described below.

Using Biblatex with LyX 2.2 and earlier

Although LyX 2.2 doesn't provide native support for Biblatex yet, it is possible to use it with some effort. The Biblatex manual strongly advises to use biber or at least bibtex8 instead of the traditional bibtex as the backend for processing the data, because the capacities of traditional bibtex are too limited for biblatex. To check which backend works for you, try compiling these two simple examples. Then continue reading to find out how it was all made to work for LyX v2.2.0, or earlier, and biber:

Base settings

  1. Make sure you have biber installed.
  2. To switch from bibtex to biber, go to Document→Settings...→Bibliography and change the Processor field from Default to biber (you can also insert biber options here, if you need any).
    The default bibliography processor can also be changed globally in Tools→Preferences...→Output→LaTeX instead, if you mainly use Biblatex.
  3. The citation style in Document→Settings...→Bibliography should be set to Default (numerical) unless you want to use different citation styles from the citation dialog, as described below.
  4. In the document preamble (Document→Settings...→LaTeX Preamble), load biblatex manually, as follows:
    \usepackage[style=authoryear]{biblatex}
    The style option specifies the citation and bibliography style. Base styles include authoryear, as in Jones (2016), numeric, as in Jones [6], and alphabetic, as in [Jon16].
    Biblatex itself ships many more variants, and there is a huge range of additional styles available in other biblatex-xxx packages. Please refer to the biblatex documentation and biblatex examples for further information.
    You can also mix different citation and bibliography styles by using bibstyle=<style>,citestyle=<style> instead of style=<style>.
  5. Load your bibliography database in the preamble (Document→Settings...→LaTeX Preamble), after the \usepackage... line described above:
    \addbibresource{name_of_your_bib_file.bib}
    Note that you need to add subsequent \addbibresource commands for each bib file you want to use. In other words, each \addbibresource command refers to one single bib file only.
    Note further that if the bib file is not located either in your texmf tree (which is strongly advised) or in the current document's directory to which the variable BIBINPUTS will be set by LyX (as of v2.2.0), you must enter a full path to the bib file here:
    \addbibresource{/full/path/to/name_of_your_bib_file.bib}
  6. In the document, insert the BibTeX inset (Insert→List/TOC→BibTeX Bibliography...) in a LyX note or comment. This makes LyX finds the citations (and list them in the citation dialog), but no \bibliography command is output to LaTeX. It does not matter which style you select here, so you can stick to plain. However, in order to use the citation dialog, you'll have to select the correct databases (i.e. those you loaded via \addbibresource).
  7. In the document, enter \printbibliography in ERT (TeX code inset, Ctrl+L) at the point where you want the bibliography to occur.

Using different citation styles from the citation dialog

If you want to use different citation styles (such as "Name (Year)", "Name Year", "Year" in author year styles, or "Name [No.]", "[No.]", "Year" in numeric styles) from the citation dialog, you have to activate Biblatex's "natbib compatibility mode". This is done as follows:

  1. Add the option natbib=true to the biblatex call in the preamble (step (4) in the Base settings), e.g.:
    \usepackage[style=authoryear,natbib=true]{biblatex}
  2. Make LyX believe you use Natbib. This is done either by
    • installing the biblatex module and activating it in Document→Settings...→Modules, or
    • adding the following line in the document's local layout (Document→Settings...→Local Layout):
      Provides natbib 1
      Make sure you press the Validate button before applying the change.
The two variants basically do the same. Just select what fits you most.
  1. Select Natbib in Document→Settings...→Bibliography.
    It does not matter whether you select "Author-year" or "Numeric" here. This is determined by Biblatex's citation style.

Using bibtex or bibtex8 instead of biber

Biblatex originally used bibtex for processing, but now biber is its preferred processor. If you want to use Biblatex with classic bibtex or 8bit-character-aware bibtex8 nonetheless, you must

  1. pass the option backend=bibtex or backend=bibtex8 to the \usepackage[...]{biblatex} command (step (4) in the Base settings).
  2. go to Document→Settings→Bibliography and change the Processor to bibtex or bibtex8. Bibtex8 options such as --wolfgang --csfile latin9.csf can be added to the Options field.
    Please refer to the Biblatex manual, section 2.4.2 (BibTeX capacity issues) for further explanations on the --wolfgang switch, and to section 2.4.3 (BibTeX sorting and encoding issues) for explanations on the --csfile switch, which needs to be adapted to your bib file encoding.

Using Biblatex with polyglossia (XeTeX or LuaTeX with non-TeX fonts)

If you use the polyglossia language package, you will need to manually load the polyglossia package and set the default language manually in the preamble just before the \usepackage of biblatex, as follows:

\usepackage{polyglossia}
\setdefaultlanguage{english}

Substitute english with the main language of your document.

Further reading

Bibliography Biblatex

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2017-01-31 11:15 CET