• Automatic operator formatting mode in Emacs

    Emacs has a nice new mode called electric-operator developed by David Spepherd. It helps when you write code by formatting all operators in a predefined way. For example, in R it adds spaces around the operator signs, when you write 1+1, this is automatically converted into 1 + 1.

    You can define your own way of formatting for other modes. For gams-mode you add the following to your .emacs file

    Read the rest “Automatic operator formatting mode in Emacs”

  • Using file templates in Emacs

    A good practice in modeling is to place information related to the project your are working on, the subject, the data and your personal information like E-mail address at the top of your file. In Emacs you can define skeleton functions that will prompt for the information and put it in the file. Below is an example for a file with as comment symbol “**: (the $Id: $ is for my version control system, that automatically will add the information on the last commit in this line).


    Below you see how to make a function using skeleton. As I don’t … Read the rest “Using file templates in Emacs”

  • Automating writing LaTeX papers even further

    In an earlier post I wrote on how to use R to produce all kind of figures and tables for a LaTeX paper. This time, I will show, how to automate this process even more.

    My work flow consists of a batch file, that runs my model, sends the results to R, produces my tables and figures and sends these to my paper: If I change my model, I just have to run this batch file, and the results in my paper are automatically adjusted. One smaller problem is that I often write in my text on a specific value … Read the rest “Automating writing LaTeX papers even further”

  • Using org-mode in outline-mode

    I have written about using org-mode in gams-mode in an earlier post. Gams-mode lets you structure your gams file using headings and subheadings. These headings can be (partially) collapsed. The structure of your file could look like this:


    You can now cycle through the structure using Shift-Tab. Tab opens a section:


    This is a great help in complex files.

    Gams-mode has another great outline feature for the listing file. Instead of putting a normal comment with a “*” in front, one writes a display statement that starts with a “@” (see the code above). We now see a nice heading … Read the rest “Using org-mode in outline-mode”

  • Migrating to R 3.0.0: TikzDevice and gdxrrw

    I am an avid user of R. Most of the time, I use R for preparing nice plots and tables for my LaTeX papers. For my plots, I use TikzDevice and for my tables I use xtable. Gams, my modeling software, developed a nice interface for using data from Gams in R and the other way around (see When I upgraded from R 2.15 to R 3.0, I had some problems on my windows 8 machine, especially with TikZDevice. I finally managed to get it installed. The necessary trick is described on “The Stata Things” (!!!, )
    Read the rest “Migrating to R 3.0.0: TikzDevice and gdxrrw”


Name *

Email *