Managing papers with Org-Mode and Reftex

Writing papers means reading lots of papers, and I often lose track of all the papers I am reading: Where did I file a certain paper? Which paper did I start reading? Which paper might be interesting?

A reading list would be nice, but such a list should be easy to handle. I have all my papers catalogued in JabRef and use AucTex and RefTex for writing and Org-Mode for my tasks.The solution should therefore combine the strength of all three. I found a nice post on how to this ( and adopted it to my needs.

Here is how my solution looks like (for managing tasks with Org-Mode see one of my previous posts)


  1. For every paper I am writing I have an org-file with my tasks, reading list, notes, and calls.
  2. I have four lists for my reading:
    1. Actual reading
    2. Should read: papers I glanced through and that look promising
    3. Not yet read: lower priority papers to be read
    4. Already read
  3. I insert new papers by using C-c ) (as in LaTeX/AucTex/RefTex). More on that later. Automatically, a link to this paper and the title are inserted (I save all papers as pdf-file and named with the first author name and the year of publication. They are all saved in the same dropbox directory). With “C-c C-c” I can tag the entries for easy searching later on.
  4. If I want to work on my paper, I open the org-file and, if I want to read a paper, I just click on its link and start reading.
  5. If necessary I can make short notes directly under the link.

Org-Mode makes it possible to use RefTex. For this it is necessary to put the information on where the bib-file is (third line in the next figure)


The .emacs file has to be adjusted as follows:

Note: as I can make the reading to a TODO or a MIT (most important task), it will also show up in my daily agenda and I can also start reading from here by clicking on the link:


How to generate nice nomenclatures in LaTeX

If you have to write up your model results, often you have to write down the model documentation. My colleague at work pointed me to a great package in LaTeX that can make your life easier with respect to the nomenclature used. It allows you to produce a glossary with all your variables, parameters and acronyms without much extra work. The package is called “nomencl” and here is an example of a pdf generated with LaTeX:


As you can see, I have acronyms, parameters and variables as well as the reference to where they are used for the first time (if you only use variables and parameters you can even refer to the equation they are used for the first time).  

Using this package is quite easy:


to print the nomenclature.

Symbols can be added in the text like follows (after the equation they appear the first time):

\nomenclature{$vw$}{ Time cost multiple for walking time}

To generate the nomenclature you have to give a specific command. In Emacs you can add the following code to your .emacs-file

When you now hit C-c C-c you can choose the option “Nomenclature” and the necessary files are generated.

If you want to have the distinction between several groups, you just add the following code in your preamble and change the second part according your preferences:

To produce an entry for paramters, you just add [P] in front of the normal entry

One last remark: The entries might not be aligned properly. For this you can add in your preamble:

and choose the width accordingly. The nomenclature entries have rather much vertical space between them. This can be changed by adding one of the following lines to your preamble:

Switching between Emacs color themes

Emacs has lots of different color-themes. Depending on the light and my own mood, I would like to change between my two favorite themes, the “standard” light theme and a dark one.
This is the color-theme I use for my LaTeX files (“sitaramv-nt”):
But for my model files, I like the dark color-theme (“dark-laptop”), but sometimes the light one.
I searched the internet and found some code that allows me to switch easily between the themes using F11:

Integrating Emacs in your file explorer

Sometimes I have files that I want to open with Emacs, but I haven’t set the program to open to Emacs (for example, a log-file or .emacs). I found a nice hack for Windows machines in the internet (
Just create a file emacs.reg with the following text and adjust the path to your settings.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Open In Emacs\Command]
@=”\”C:\\bin\\Emacs-23.1\\bin\\emacsclientw.exe\” -a \”C:\\bin\\Emacs-23.1\\bin\\runemacs.exe\” \”%1\””
Before you double click on this file, save your registry (you never know…). After double clicking you will have a extra option in your right-click menu in your explorer, which starts Emacs, if Emacs is not running and start the client if it is already running.

Using more than one Dropbox folder using Dropboxifier

Dropbox is a nice tool for synchronizing files over different computers. One problem is that you have to put your files in the Dropbox folder. I often make small changes to my settings in Emacs, so I used to have my home directory for Emacs in my Dropbox folder.
You can choose where to put your Dropbox folder on your machine, however, you can only have one Dropbox folder. What to do, if you want to synchronize your whole Emacs program directory (or any other directory you don’t want to move to your Dropbox folder)?
There is a nice open source utility called dropboxifier ( that allows you to put a symbolic link in your Dropbox folder. The folder remains in the original position but Dropbox treats it as if it is in the Dropbox folder. This utility can also be used for Skydrive or Google Drive.
Examples of my use of dropboxifier:
  • As you probably know, you can easily copy your Emacs directory to another computer. If the home directory on the other computer is properly set, you can start directly working with it. Using dropboxifier I nowadays sync the whole Emacs directory and don’t have to bother, when I update or add packages on one computer.  They are automatically installed on the other computer.
  • I have a directory called “Inbox”. I use if for all the files I download (and don’t want to put in a project or other directory) and for “scratch” files, small files I use for testing stuff (for example, if I answer a question in a mailing list, I, if necessary, usually test my answer with a small file). I use dropboxifier for this folder too (of course, I could have put the whole directory in my Dropbox folder, but than it is hidden deep down in my folder hierarchy). Note, that in the figure above, I still have to add the symbolic link on my other computer. I use my inbox folder also for all my downloads (you can change the download folder in your browser easily).
Note that I don’t use this for my project directories and files, because for this task I use my version control system.

Presentation, Article and Notes in one run using Beamer

Still using Powerpoint for your presentation? Consider using LaTeX with the Beamer package.
Tom Rutherford taught me how to build an efficient stream for a presentation or lecture:
  1. generate the presentation with beamer,
  2. generate the presentation as an article and
  3. clean up all the stuff
All this in one batch file. The presentation is projected on the big screen and the article is used for preparation and for notes, I use during my prepartation (I have a printout of the article next to my laptop during the presentation)
The batch (build.bat) file looks like this:
@echo off
pdflatex beamer
pdflatex beamer
pdflatex print
pdflatex print
del *.toc
del *.log
del *.out
del *.nav
del *.snm
del *.vrb
del *.synctex
del *.aux
cd auto
del *.*
rd auto /Q
and after finishing my slides, I just run it from my shell or my explorer.
The latex commands are run twice, so if there are citations, bibtex is run. I give a serie of lectures and for every lecture I have three files:
  1. lecture.tex:    all the slides to be presented
  2. beamer.tex:   the preamble for generating the lecture as beamer presentation
  3. print.tex:        the preamlbe for generating the lecture as article.
Beamer tex looks like this:
It gets the lecture.tex file as input and grabs the style.tex file for “styling” my presentation.
I added the following features.
Setting a directory for all my figures and for my style file:
I use import, so I can set a directory for all my figures (instead of having them in the same direcotry as my tex files). The directory is set in the lecture.tex file:

The style file resides in its own directory, so I do not have to replicate it and changes are easy done in just one file.
Comments not showing in my presentation, but in my article:
I use the package comment to add notes to my presentation. Beamer allows you to make notes, that will be shown as a parallel slide, so you can have your presentation projected and the other half on your notebook monitor (split screen). This seems to work fine on a Mac or under Linux, but is almost impossible on a Windows machine (there is ony very basis and not very satisfactorysolution called presenter-pdf). I just use the comment package that allows you to add notes that are printed in my article version of my presentation but do not show up in my beamer presentation. In beamer.tex I give the commend to not show the comments:
In print.tex I add the lines to include the comments:
A comment in the lecture.tex follows an \end{frame} command and could look like this:
In the article version, the comments are red and start with a bold “NOTES” above them, so I can concentrate on them, when I am presenting.
Size of graphics
I use the width option for included graphics, so figures also fit if the format of my paper in beamer (landscape) is changed to portrait (article). Example:  [width=0.8\textwidth].
Here you see the presentation:
And here the article format (in the right margin, you see the number of the lecture as well as the slide number).

Outlining in Gams-Mode: Org-Mode for Gams

The new version of Gams-mode has a new feature that I like very much. It allows you to use an outline-mode in your gams files. It is called org-mode, which is a major mode in Emacs.
You can outline your Gams file using sections, subsections, etc. You define sections using the following notation:
or for subsections
       *@@, *@@@, etc.
Let us have a look at the file org-minor-mode.gms. This file can be found in your gams-mode directory. This file contains all the help for gams-mode. All the help topics have a section title that starts with *@.
Here is an overview of the contents of this file:
This is great! Now, instead of scrolling or searching, you can just cycle through the different display possibilities using Shift-Tab (org-global-cycle), or if you want to see or hide the content of a certain section, hit Tab (org-cycle).
Here, I used Tab to show the subsections of the section “Process handling”
And if I hit Tab again on the first subsection, it shows the contents :

Todo's from Everywhere

I use Emacs for taking notes and project management using Remember-Mode and Org-Mode (see my blog entries Capturing and More. However, if I am working in Excel or reading a pdf , More and I want to make a note or I suddenly have a thought about a feature that I want to add to my model, I have to jump to Emacs,hit some keys, enter the note or the task and navigate back to the program I was working in.
Not much of a hassle, but inefficient as it really interrupts my work flow too much.
No problem, if you use some macro scripting tool (for example winautomation or autohotkey) it is rather easy.
Here is the macro in Winautomation:
In step 1 the macro saves the location of the active window (for example Excel). In the next step it jumps to Emacs, followed by sending the keys C-c r  which asks me for a template:
I then choose the template (for example t for ToDo) and enter the information. I quit with C-c C-c and my entry is saved. Then I hit Ctrl-g (which is the Emacs command for “break” and in this case does nothing and if I change my mind and don’t want to save the note or tasks it stops the remember mode). This keystroke combination is used as a trigger for the Winautomation macro to return to the macro. In the last step the focus jumps back to the program I was working with.
The macro is started when I hit the hokey “Ctrl-Shift+F11”, which I defined in Winautomation.
As I have the professional version of Winautomation, I can generate an executable and send it to you. Just mail me at renger(at)
The only thing you have to do, is add a keyboard trigger like Win+…
For this you can use free programs like winkey (on Win32)  or HotkeyBind (I did not test these programs).

Viewing all the objects in R in a buffer in Emacs

You also probably did not read the complete Emacs-Speaks-Statistics manual… ? By chance, I discovered a nice feature, called Rdired.
This command gives you a dired-buffer with all your objects. In this buffer you can view, edit and plot your R-objects. It is documented in chapter 12.9 of the manual.
Here is small example: In the buffer in the middle, you see the original code taken from the manual. I invoked ess-rdired and the lower buffer is shown. I then put the cursor on the line with the parameter s and hit “v”. This gave me the upper buffer with all the values. Then I hit the “p” and a nice plot is shown. With “d” you could delete the object.
You have to put the following lines in your .emacs file: