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 2.2

(or How to fool LyX into using BibLaTeX)

What is biblatex?

BibLaTeX is a completely new 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 2.2

(Here's the guide to using Biblatex with older versions of LyX)

Due to completely different interface and overall complexity, LyX doesn't provide native support for BibLaTeX yet. However, it is possible to use it with some effort, as described here. 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 and biber:

  1. Make sure you have biber package installed.
  2. To change 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 citation style will be governed by the biblatex style option, and should be set to Default (numerical) here unless the natbib compatibility mode is used, as described below.
    The default bibliography processor can also be changed globally in Tools→Preferences→Output→LaTeX.
  3. In the document preamble (Document→Settings→LaTeX Preamble), load biblatex manually:
    \usepackage[style=authoryear,backend=biber]{biblatex}
    One other fancy style is style=philosophy-modern. A regular numeric style is invoked by style=numeric, but can also be style=phys for example. Please refer to the biblatex documentation and biblatex examples for further options.
    To have dates and urldates formatted according to ISO8601 (used basically everywhere except in North America), append ,urldate=iso8601,date=iso8601 to the biblatex options in the above line.
  4. Load your bibliography database in the preamble (Document→Settings→LaTeX Preamble):
    \addbibresource{name_of_your_bib_file.bib}
    \addbibresource[label=my_label]{subfolder/name_of_your_other_bib_file.bib}
    • Note that the bib file must be located either in your texmf tree (do not forget to run texhash in the terminal to tell LaTeX where to find the new file), or in the current document's directory to which the variable BIBINPUTS will be set by LyX (as of v2.2.0).
  5. In the document, insert the BibTeX inset (Insert→List/TOC→BibTeX Bibliography...) in a LyX note or comment, such that LyX finds the citations, but no \bibliography command is output to LaTeX. It does not matter which style you chose here, so you can stick to plain. However, in order to use the citation dialog, you'll have to choose the correct databases (i.e. those you loaded above in item (4)). This step gives you the possibility of inserting citations from the standard LyX citation dialog.
  6. In the document, enter \printbibliography in ERT (TeX code inset, Ctrl+L) at the point where you want the bibliography to occur.

Note on the natbib compatibility mode: The natbib=true option in the call of biblatex loads its natbib compatibility module. The module defines aliases for the citation commands provided by the natbib package. This includes aliases for the core citation commands \citet and \citep as well as the variants \citealt and \citealp.

\usepackage[style=authoryear,natbib=true,backend=biber]{biblatex}

These citation commands (or styles) can be invoked from the drop-down menu in Insert→Citation... if the Citation Style is set to natbib in Document→Settings→Bibliography. LyX, however, has to be tricked into not exporting the actual call to the natbib package by 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.

Note on using bibtex (or bibtex8) instead of biber: BibLaTeX originally used bibtex for pre-processing but now biber is its preferred pre-processor. If you want to use biblatex with classic bibtex or 8bit-character-aware bibtex8 nonetheless, you must pass the option backend=bibtex or backend=bibtex8 to the \usepackage[...]{biblatex} command (see above).

Then go to Document→Settings→Bibliography and change the Processor to bibtex or bibtex8 with options --wolfgang --csfile latin9.csf or something similar. 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 need to be adapted to your bib file encoding. The default bibliography processor can also be changed globally in Tools→Preferences→Output→LaTeX.

Note on XeTeX and polyglossia: If you use XeTeX with the polyglossia language package, you will need to manually load the polyglossia package in the preamble just before the above call to biblatex, and set the default language, as follows:

\usepackage{polyglossia}
\setdefaultlanguage{english}

Further reading

Bibliography Biblatex

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2016-09-22 09:59 CEST