Go to page:

Search:   Help



LyX documentation


Shared groups



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

How to use biblatex with LyX (or How to fool biblatex and LyX in order to let them cooperate)

What is biblatex?

Biblatex follows a completely new approach to bibliography management as it reimplements almost everything on the LaTeX side. It originally used bibtex for preprocessing but now biber is the preferred preprocessor for biblatex. Please refer to this page for more information.

Using BibLaTeX with LyX

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 to process the data, because the capacities of traditional bibtex are too limited for biblatex. The best choice is definitely biber, a bibliography processor written in Perl and specifically designed for biblatex as a bibtex replacement. Biber has no resource limits, it can deal with unicode and many other encodings, and provides extra hooks that allow biblatex to perform some complex tasks. Even though biblatex still can be used with bibtex8 and even traditional bibtex, some complex things only work with biber. Check which backend works for you by compiling these two simple examples. Then continue reading to find out how it was all made to work:

  1. Make sure you have biber and/or bibtex8 package installed.
  2. To change from bibtex to biber, go to Document→Settings→Bibliography and change the Processor field from default or bibtex to biber (you can also input biber options here, if you need them). 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:
    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.
  4. Load your bibliography database in the preamble (Document→Settings→LaTeX Preamble):
    • Note that the bib file must either be located in your texmf tree (do not forget to run texhash in the terminal to tell LaTeX where to find the new file unless you put it in your personal directory), or you must enter the absolute path in the command above:
    Linux: \addbibresource{/home/myname/documents/dissertation/Dissertation.bib}
    Mac: \addbibresource{/Users/me/Documents/bibdesk/Dissertation.bib}
    Windows: \addbibresource{C:/Documents and Settings/My Name/Documents/Dissertation/Dissertation.bib}
    The latter can be automated, making the document portable, for .bib files in the (sub)folder of the main document folder by the following set of commands in the document preamble:
    \ifcsname input@path\endcsname 
      \edef\@basepath{\expandafter\@firstofone\input@path} %remove curly braces
      \def\rm@quotes#1"#2"#3\@nul{\ifx\relax#2\relax #1\else #2\fi} %
      \edef\@basepath{\expandafter\rm@quotes\@basepath""\@nul} %remove quotes
    LyX, namely, defines the \input@path macro as the path to the document directory. The format is either {/home/user/directory//} or {"/home/user/di rect ory/"/}. The first line is here only to assure that even after exporting to LaTeX and compiling from the command line, the \input@path macro is still properly defined (LyX adds this macro only when compiling in the temp directory).
    \addbibresource can then be redefined to include the path to the bibliography files
    and followed by (a number of)
    to load the bibliography databases.
  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.

  1. In the document, enter \printbibliography in ERT (TeX mode) 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.


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:


Otherwise, you'll get LaTeX errors of the following kind:

! Undefined control sequence.
<argument> blx@lng@\bbl@main@language

Known problems

  • If biber doesn't work or stops working suddenly (with or without an error being reported) resulting in the failure of citations and / or bibliography, you may get it going (again) by following the instructions from this stackexchange entry or this blog post.
    In short, you need to delete an invalid temporary cache folder which irritates biber. You can find out the par cache by checking either by issuing biber --cache in a terminal window or by inspecting Document→LaTeX Log→BibTeX (watch out for an error message looking like this: data source /some/path/par-<some number>/cache-<some number>/[...]/recode_data.xml not found; the folder to delete is the one starting with cache-).

Further information

Bibliography Biblatex

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2015-09-09 14:04 CEST