Mendeley and Latex / Bibtex

1 Introduction

Mendeley is a really good literature management tool. Especially, if you are writing magazin articles or research papers in frequent manner. Beside the web portal, it also provides deskop, smartphone and tablet clients and allows for collaboration with you co-authers.

However, the integration with latex, respectively bibtex is still very young and you need to tweek some stuff or use workarounds for a really smooth integration. The key for this smooth integration is the bibtext backend biber. It allows for pre-processing the bib-file entries before they are processed by latex.

2 Biber Setup

TexnicCenter Biber Configuration

TexnicCenter Biber Configuration

First you should install biber in your local latex installation. I use Miktex installed to C:\Program Files (x86)\MiKTeX 2.9. If not already installed, download biber from http://biblatex-biber.sourceforge.net/ and place the biber.exe in C:\Program Files (x86)\MiKTeX 2.9\miktex\bin.
Furthermore, I use TexnicCenter for writing Latex. There you can copy the default output profile “LaTeX -> PDF” and rename it to “LaTeX -> PDF (Biber)”. Set the “path” to BibTeX to point to your biber.exe file.
Next, you should configure biber as biblatex backend in your main LaTeX file. Your usepackage definition for biblatex must look similar to

\usepackage[citestyle=numeric,style=numeric,backend=biber]{biblatex}

Finally, you can choose to either use a biber.conf file for your biber configurations, or include your configuration directly in your LaTeX document. I personally prefer the external configuration file to not mess-up the content of my document and because normally I have further biber configurations as well.

3 Filter Fields

Mendeley does not provide a configuration/mapping which of an entry’s fields to export and what target Bibtex fields to export to. It always exports the same standard fields into an bib file. While some of these fields are not needed and sometimes contain error prone characters (e.g. ‘{‘ or ‘}’), others must be stored into fields with different names to be processed by Bibtex in the intended manner.

To handle this issue, you can use biber to prepare the bib file entries for further processing by latex / bibtex. This configuration can be done either in the separate biber.conf file or directly in your LaTeX document. It is important to place the biber.conf file beside your main tex file to be sure it is found by the biber tooling.

3.1 External biber.conf File

If not yet done, create a file named biber.conf in the main directory of your project. If you want to filter your personal notes written to mendeley entries and the references’ abstracts from the bib entries, you must filter the fields named “annote” and “abstract”. Note: The field names are mendeley specific in the bib file. In your Latex bbl file, you might see a \field{annotation}. This is the final result from bibtext processing. While the biber processing is performed in advance, you must use the field names of the original bib file.

So to filter annote and abstract fields, you should place the following XML configurations in the biber.conf file:

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <sourcemap>
    <maps datatype="bibtex" map_overwrite="1">
      <map>
        <map_step map_field_set="annote" map_null="1"/>
        <map_step map_field_set="abstract" map_null="1"/>
      </map>
    </maps>
  </sourcemap>
</config>

Due to biber’s configuration lookup strategy, it automatically processes the biber.conf file’s content, if it is placed beside the latex main file.
Note: Biber supports different locations and scopes to place your configuration in. Please refer to the Biber documentation find out more about the other possibilities.

3.2 In-Document Configuration

If you do not want to have an extra file in your project, you can configure the biber mapping with latex commands right in your latex document.

Placing the following commands below your bibliography reference (and before the document ist started), this will have the same effect as the external XML configuration shown above:

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
    \map{
      \step[fieldset=annote, null]
      \step[fieldset=abstract, null]
    }
  }
}

4 URL vs. Howpublished Fields

Depending on the bibliography style required, the style supports the “url” field, the “howpublished” field, or both. Typically, you use your mendeley entries for different types of publications with different bibliography styles. One option would be to always maintain the “Medium” and the “URL” fields in parallel, because “Medium” is exported into “howpublished”. Depending on the particular style of the publication, you could use a field filter as described above to keep the required one only. However, this redundancy is quite unsatisfying in terms of effort and error-proneness.
A better solution is to maintain only one field (url might be the more obvious and activated by default in mendeley), and configure a biber mapping depending on what you need.

The following mapping configuration is able to map the “url” field into the “howpublished” if this is not filled already.

<map map_overwrite="0">
  <map_step map_field_source="url"/>
  <map_step map_field_set="howpublished" map_origfieldval="1"/>
</map>

You should place it inside the

<maps ...>...</maps>

tags.

4.1 References

Further information can be found at: