Search Account

# Mendeley at MIT: Mendeley with LaTeX and BibTeX

## Using Mendeley with LaTeX and BibTeX FAQ

### What is LaTeX?

LaTeX is a typesetting program that takes a plain text file with various commands in it and converts it to a formatted document based on the commands that it has been given. The source file for the document has a file extension of .tex. It is widely used at MIT for theses and other technical papers due to its prowess with mathematical and foreign characters. For more information on LaTeX, see LaTeX on Athena Basics, provided by the Athena On-Line Help system.

### What is BibTeX?

BibTeX is a bibliographic tool that is used with LaTeX to help organize the user's references and create a bibliography. A BibTeX user creates a bibliography file, wth a file extension of .bib, that is separate from the LaTeX source file. Each reference in the bibliography file is formatted with a certain structure and is given a "key" by which the author can refer to it in the source file. For more information on BibTeX, see MIT IS&T's page: How do I Create Bibliographies in LaTeX.

### How do I export from Mendeley to BibTeX?

Open Mendeley, and within "My Library" found on the left, select references that you would like to export to BibTeX. In the drop-down menu in the toolbar at the top of the screen, click "File –> Export" (or ctrl-E if you use keyboard shortcuts) and in the dropdown list of filetypes, chose "BibTeX (*.bib)" and save to the same location as the LaTeX file.

If you're working with Mendeley on a PC and your manuscript is on Athena, you'll need to save the BibTeX export to your hard drive and use FTP or another file transfer method to transfer the file to the correct directory in your Athena space.

\bibliographystyle{style} should go just inside your \begin{document} command. style.bst is the name of the style file dictating the format of your bibliography (see How do I change the format of the bibliography? below).

\bibliography{filename} should go wherever you want LaTeX to generate the bibliography. filename.bib is the name of the file that you just downloaded from Mendeley containing your exported references.

### How do I set up auto-syncing from Mendeley to BibTeX?

Mendeley has the built-in capability to auto sync a BibTeX file when changes have been made to your Mendeley library. That said, it can only auto sync your entire library (not a selected subset of references).

To set up the Mendeley auto sync, go to Mendeley Desktop preferences, select the BibTeX tab. Select the box labeled “Enable BibTeX syncing” and select the BiBTeX file option you prefer. Select the location where you want the generated .bib file(s) to be stored (this should be the same location as your LaTeX file(s)). These files will now automatically sync in this location as changes/additions are made in Mendeley.

For more detailed instructions on setting up your Mendeley export, see the Mendeley and BibTeX Quick Guide.

### How do I cite references in my document?

Insert the command \cite{citation_key}. To check that you have the correct citation key for a certain reference, you can look at the .bib file using a text editor.

### How can I correct errors I encounter when running BibTeX on my bibliography file?

BibTeX has a 5000 character limit for each field. Most fields will not surpass this limit, but for a reference where the "note" field contains a large amount of information such as the entire table of contents, this limit may be breached. When this problem occurs, you will see an error message saying "Sorry--you've exceeded BibTeX's buffer size 5000." When you encounter this problem, use a text editor to open your bibliography file and shorten the field that contains too many characters.

### How can I correct errors I encounter when running LaTeX on my document after compiling the bibliography file?

If the references in your bibliography file contain certain special characters which are used as part of the syntax of LaTeX, you could see a whole host of errors when you run LaTeX on your document after running BibTeX. For example, LaTeX will view any ampersand in a journal title as an alignment character, and you will see an error message saying "Misplaced alignment tab character &." Use a text editor to find the line that is causing the error (LaTeX should tell you as part of its error message) and replace the trouble-making character with the following commands:

 Character LaTeX Command # \# $\$ % \% & \& _ \_ { \{ } \} ~ \~{ } ^ \^{ } \ $\backslash$

If you receive a warning from LaTeX that references may have changed, simply run LaTeX again. In fact, the correct order for running LaTeX and BibTeX, where document is your document name, is:

latex document
bibtex document
latex document
latex document

This process should correctly create your bibliography and in-text citations for your document.

### How can I make an organization name display correctly?

BibTeX reads text in the author field as an author's name or names unless told otherwise. For example, say a reference exported from Mendeley contains the line:

author={Institute of Electrical Engineers},

BibTeX will read this field as a person's name, where the first name is "Institute" and the last name is "of Electrical Engineers," and would format accordingly. Use a text editor to add quotes around the field so that the line reads:

author="{Institute of Electrical Engineers}",

Now BibTeX will read this all as one piece rather than as a person's name and will format correctly.

### How can I override BibTeX capitalization conventions?

BibTeX attempts to correct the capitalization in the title field such that only the first letter of the first word is capitalized. While this is generally gramatically correct, it can cause problems if the title contains a proper name or an acronym, so that a line in the bibliography file that looks like this:

title={IEE Proceedings},

will appear in the bibliography as "Iee proceedings." Use a text editor to add quotes around the field so that the line reads:

title="{IEE Proceedings}",

The quotes will prevent BibTeX from applying its capitalization rules to the title of the document and thus will preserve the capitalization for proper nouns.

### How do I change the format of the bibliography?

The bibliography format is determined by the style file that you have entered in the \bibliographystyle{} command. Several default styles exist, and they are explained in the section of IST's LaTeX Answers page entitled How to make Bibliographies in LaTeX. Style files may also be edited to produce a required bibliography style.