Sublime, LaTeX and Mendeley - From idea to document, easy

Written on

Do you want to write essays or research papers with less hassle? I’ll describe my system and, hopefully, it will improve your document writing times, or you will reinforce your belief in your better pipeline!

tl;dr version: Sublime Text 3 + LaTeXing + Mendeley = really nice and pleasant writing experience.

tl;still read version:

Sublime Text is a great editor for any sort of text-related work, be it LaTeX, JavaScript, Python or, to a lesser degree, the likes of C++ and C#. It is extremely fast, comes with a plethora of addons and the UI is clean and extremely useful. While you can use it for free, it will bug you to buy it every so often. Completely free alternatives include Atom, notepad++ and Code.

LaTeXing is an addon for Sublime Text that adds a lot of support for LaTeX. It is also free to use, but bugs you with “please buy me” until you do so. The alternative that I am less familiar with is LaTeXTools.

Mendeley is a tool for managing your references. It has an extensive paper and book library to find references from, but has no issues with adding custom entries. You can also give it .pdfs and it will try its best to find the relevant information from it (such as author, journal, title, date, etc). It has a desktop client, but also a web-based interface and mobile apps.

How to set up this pipeline:

  • Get Sublime Text (3 preferably).

  • Get Package Control for Sublime Text - installation. This is not critical, but simplifies a lot of addon-related goodiness for Sublime.

  • Use the magic keyboard shortcut (Ctrl - Shift - P) and type in “Package”, then select “Package Control: Install Package”.

  • From the new menu, type “LaTeXing” and press enter. This will install the addon.

  • Do you have a LaTeX compiler thingy installed? No? Install TeXLive (this does take quite a while). Feel free to uncheck the option to install TeXworks, you already have Sublime!

  • So far, all good. You should now be able to write .tex files and compile them in Sublime with Ctrl - B. They will open using your default PDF viewer.

  • Another optional step: install SumatraPDF. It is a lightweight PDF viewer with inverse search support. What is inverse search? You can double click on an element in the PDF and it will send you to the appropriate line of code in the .tex file. And you can select something in the .tex file, and use Ctrl - Shift - P (Remember? Magic keyboard shortcut) and Jump to PDF to send you to the appropriate part of the PDF file.

  • To enable inverse search in SumatraPDF, open a PDF you just created in LaTeX with SumatraPDF, go to Menu (Sandwich button in top left) -> Settings -> Options and put this in the “Set inverse search command-line” field: “C:\Program Files\Sublime Text 3\sublime_text.exe” “%f:%l” . Of course, replace the path with your appropriate path. If the field doesn’t show up, you probably haven’t opened a LaTeX compiled PDF yet. It doesn’t show up unless it thinks you’ll need it (weird, I know).

  • Install Mendeley.

  • In Mendeley, go to Tools -> Options -> BibTeX and check Enable BibTeX syncing. Choose how you want your .bib file to be saved (I recommend one file for the whole library, but your needs might be different) and where you want it stored. I have it stored in the root folder of all my document folders.

  • When writing your LaTeX code, make sure you reference this new .bib file, accounting for its relative position in the file system. If you have the .bib file in “Documents”, and your .tex file is in “Documents/AwesomePapers/GreatResearch”, you will need to point your bibliography to “../../library”.

  • Give Sublime a few seconds to recognize the new .bib file and then try this: type \cite{. Woah. Things to cite show up. You can filter the list to find what you’re looking for. No more need to go back and forth between screens / files to see what the reference is called or what the paper was titled or how to spell someone’s name.

  • You can also use the magic shortcut (Ctrl - Shift - P) and type “Snippet” in. You will have a choice of many bits of code to auto-fill where your cursor is, such as tables, enumerations, figures, etc. That is one of many of Sublime’s awesome features.

Have fun writing things!