Tag Archives: LaTeX

Hints and tips on LaTeX

Unofficial ERC Starting Grant LaTeX template

erc2013-B1After I mentioned that I used LaTeX for an ERC Starting Grant application in a previous blog post, I have gotten several questions from people about what type of LaTeX template I used. Unfortunately, the ERC does not provide any LaTeX template, only templates for MS Word and OpenOffice. My scientific workflow is so dependent on LaTeX/BibTeX that I decided to recreate a LaTeX document setup that resembled the MS Word template. The end result is not identical to the MS Word output, but it is pretty close. The most important is that I did not get any complaints from the ERC about the looks of the document (and I made it to the final Brussel interviews last year, though not getting funded, unfortunately).

Sharing is fun, so if anyone wants to save a little bit of time, here you can get a stripped-down version of my LaTeX file:

Please be aware that this template is absolutely unofficial. Also, the ERC tends to change the template a little from year to year, so you should always check with the latest MS Word template. Good luck with the application writing!

LaTeX fonts in OSX

When creating figures for papers written in LaTeX, I have found it aesthetically unpleasing to have different fonts in the figures than in the text. Most figures I create in either OmniGraffle or Matlab, and here I have relied on regular OSX fonts.

Fortunately, I have discovered that it is possible to use LaTeX fonts in OSX. Apparently, this is now included as a feature in the latest version(s) of the MacTeX distribution (?), but I also discovered that it is possible to just download the fonts (as OTF files) and install them directly:

  1. Download the latest Computer Modern (Latex) Unicode fonts, the ones with *otf.tar.xz extension, from sourceforge

  2. Uncompress the archive

  3. Open the OSX application “Font Book”

  4. Drag all the OTF files onto the Font Book

The end result is that the fonts show up in all OSX applications. All the font names start with CMU, so it is easy to find them when opening the font dialogue in your application.

Cmu Font Book

Compact bibliography list in LaTeX

I have already written about how to compact lists earlier today. Now is the time to compact the bibliography… This is how the regular bibliography in LaTeX looks like:

First I found a suggestion to use the setspace function, but it turns out that it is much easier to just use the bibsep option to natbib. Just add the following to the preamble:

\usepackage{natbib}
\setlength{\bibsep}{0.0pt}

and you will get something like this:

Compact lists in LaTeX

I have for a long time been struggling with making lists more compact in LaTeX. While the standard lists often look good, as seen in the example below, there are times when space limits, etc. makes it necessary to save some space.

Screen Shot 2011 11 02 at 10 32 02

Up until now I have been using things like the rather ugly \vspace{-7pt} command to remove space between list items. Now I finally decided to figure out a better solution. While there are many different package to help with this, it seems like the enumitem package is the newest and most comprehensive solution for making compact lists.

It is possible to change the settings of individual lists, but it may be easier to change the settings globally. Then you need to add this to your preamble:

\usepackage{enumitem}
\setitemize{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt}

And you can then use the regular itemize function in LaTeX. The above example will then look like this:

Screen Shot 2011 11 02 at 10 32 13

This way you can remove the space between each item, between the list and the surrounding paragraphs, and the indention of the list items.

Using MultiMarkDown

I tend to move between different computers/devices and OSes all the time, and have started to become very tired of storing text data in different formats that are either not compatible or tend to mess up the formatting between different applications (e.g. RTF files).

To avoid this I am now testing to write all my text-based documents (notes, memos, letters, etc.) using MultiMarkDown. This is a so-called Lightweight markup language, similar to e.g. Textile. The reason I chose MultiMarkDown is mainly because I liked the syntax over that of Textile, and that MultiMarkDown seems more alive than its predecessor MarkDown.

The nice thing about using MultiMarkDown is that I can use any text editor on any OS (OSX, iOS, Android, Windows, Linux) to edit the files. The syntax is super simple, barely more than I would use if I wrote plain text files. And, most importantly, there are some nice facilities to help convert MultiMarkDown files to HTML, LaTeX or ODT.

Here are some of the things I have used to get started:

  • The nice installer for OSX
  • bundle for TextMate
  • The full manual (I probably didn’t need to read that, but it was good to see that there is more to this than I might need…)
  • There is also a trick to make TextMate show a live preview of the file (by using the HTML preview window).
  • And I also found a nice quicklook plugin that will show the formatted document when looking at text files with multimarkdown in OSX.

We’ll see how it goes, but I already feel life is easier when passing files back and forth to e.g. PlainText on my iPad.