Emacs and Gams (and R and LaTeX and …)

GAMS users probably spend most of their time editing their models. Just before project deadlines they may sit more than 8 hours a day in front of their computer hacking through their code. The choice of a good editor can therefore be crucial. After years of trying different editors I finally stuck (xxx) with the open-source editor Emacs.
For those of you who want to stop reading because they heard about the disadvantages of Emacs (“It has a steep learning curve”, “It is more a program for hackers” or “You have to learn all kind of key bindings by heart”), I can only say, that most of the disadvantages of Emacs are true. But: using Emacs in combination with Gams-Mode (an extension of Emacs developed by Shiro Takeda) can make your programming life so much easier and you will increase your efficiency so much, that reading on might save you hours of editing time.
For those of you who need more reasons for switching to Emacs, here are some of the advantages (in upcoming posts I will talk about all of these advantages in more detail):
  1. The editing facilities of the GAMS IDE are nothing compared to Emacs.
  2. The Gams Mode in Emacs is heaven on earth for doing Gams coding
  3. If you write your reports with LaTeX Emacs is probably one of the best editors around .
  4. For those of you who work with R (statistics) or Stata: Emacs Speaks Statistics (ESS) lets you do your statistics from within Emacs.
  5. If you write your statistics reports with LaTeX, you can use Sweave allowing you to embed your R-Code in your LaTeX document and let Emacs generate reports while running your analysis, generating graphs and tables for your report at the same time.
  6. Emacs has many extensions for working with other programming languages (Python, Perl, PHP, etc.).
  7. Emacs allows you to integrate your versioning system. I use Subversion and can from within Emacs use all commands like commit, update, etc.
  8. Making quick notes is easy in Emacs: you can generate a note and Emacs adds automatically a hyperlink to the file you are working on. This is a great feature if you want to keep working on the main issues in your model, but don’t want to forget to do some minor tasks. Instead of writing those tasks on a peace of paper of making it a task in Outlook, you can keep on working in Emacs and the next day it is easy to jump back to the place where the task refers to.
  9. Emacs runs on Windows, Linux and Mac.
For me the most important reason was the possibility to use one and only one editor for completely different tasks (R, Gams, LaTex, Note taking, Pytyhon and PHP). Instead of having to learn several different editors like WinEdt, the editor of GAMS IDE, Tinn-R, Beans, OneNote, I now have one editor.
 
 
 
 
 
 
 

5 thoughts on “Emacs and Gams (and R and LaTeX and …)

  1. Hi Mano
    Take a look at the gams mailing list. There are some questions about plotting using Gams (search for gnuplot or use the gdx viewer to plot data).
    Cheers
    Renger

  2. I am a new user of GAMS on Linux and I am wondering what to use to make graphs of GAMS simulations. Can somebody help me out? What is the best way to do graphs with GAMS in general (also under Windows)?

  3. Hi Mihaly
    I try to use spaces instead of tabs (so if I send my files to somebody else or use another editor) the tables are aligned. Usually I write the table using the tabulator and then I use the Emacs-command untabify

  4. Nice post. I’m also a fan of emacs and gams mode. I started using it when I had to work with gams on a linux machine and I’ve been stick to it ever since. There’s only one really annoying thing in emacs. It renders the tables in a very ugly way.

    So if you work on a gams file that was created with a different editor then it’s very likely that the header won’t match the columns and the numbers in the columns won’t be one under the other. Rendering is similarly bad in the listing files.

    I guess it’s something related to how emacs handles tabs and white spaces. Do you have similar experience?

Comments are closed.