Tuesday, July 5, 2016

Using Mendeley to create citations using LaTeX and BibTeX

Using Mendeley to create citations using LaTeX and BibTeX

source: https://blog.mendeley.com/2011/10/25/howto-use-mendeley-to-create-citations-using-latex-and-bibtex/

Multiplatform, free, and powerful. I could be using these terms to describe Mendeley Desktop, but what I’m going to write in this blog post is about something else, something called LaTeX and BibTeX. For those of you that are unfamiliar with LaTeX, it’s:
a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation.

And now let me introduce you to BibTeX too:
a tool and a file format which are used to describe and process lists of references, mostly in conjunction with LaTeX documents.
Ok, so we’re now acquainted with LaTeX and BibTeX. Let’s see how we can use these tools along with Mendeley Desktop to get you citing and writing your manuscript.

BibTeX preferences

Go to Mendeley Desktop preferences, select the BibTeX tab. Once there, tick the box labeled “Enable BibTeX syncing” and select one of the options you prefer. I chose the middle one, “Create one BibTeX file per collection”. This generates one .bib file for each folder you create in Mendeley Desktop.
BibTeX Preferences in Mendeley Desktop (Mac shown)

Autogenerate .bib file(s)

The next step is to create a folder where you will store all the articles or references pertaining to your manuscript. This will generate a .bib folder as per your settings in the preference menu.
Mendeley Desktop screenshot with Bioinformatics folder selected
Any articles or references added to a given folder are automatically synchronized and changes reflected in the .bib file with the same name as the folders you created. In my example, I have a folder I labeled “Bioinformatics”, therefore Mendeley Desktop automatically generates a Bioinformatics.bib file with all the document details for the references within that folder.
Automatically generated BibTeX file for the Bioinformatics folder

Citing in LaTeX

Here’s where the cool (and the only complicated) part is: writing your article using LaTeX syntax. There are great resources online to learn LaTeX, such as this one. However, what I really wanted to show you is how to add citations using LaTeX and your automatically generated BibTeX file (.bib).
In the following image, you can see an example LaTeX file (.tex) where I’ve added some dummy text, and in the middle you will see two citations from my .bib file.
LaTeX (.tex) file with citations added in dummy text

Generate your PDF

These citations are all I need so that LaTeX can generate a formatted PDF document with the appropriate citations and the corresponding reference list at the end of the document. Take a look at what the final product looks like below.
Generated example PDF article using LaTeX and BibTeX with Mendeley Desktop
As a finishing note, I’d just like to mention that I’m quite a novice with LaTeX. This seems like a fantastically useful tool so far and I’m looking forward to improving my LaTeX writing and formatting skills. The Mendeley developers are always looking to improve these features, so we’d like to read about your experience and suggestions for improvements.