Using bookmarks in Emacs

In two of the last posts I talked about moving around in Emacs using the buffer list. Another way of jumping quickly to a buffer is setting a bookmark. A bookmark can be set using C-x r m (for bookmark-set;  for me “m” stands for “make”, so I can remember the difference between the different bookmark commands). Emacs asks for a name and after Enter saves the bookmark.
Moving to a bookmark can be done using C-x r b and entering (the first letters of) the name of the bookmark and use Tab to complete the name.
With C-x r l you can produce a list of all bookmarks and edit your bookmarks (delete with d) or use the list for jumping to a specific file (with f or j).



Forget your mouse and use Launchy

You probably have noticed that I like to have all commands under my finger tips. I believe that using a mouse is more time-consuming. One of the programs I use often is Launchy (http://www.launchy.net/). launchy is a free cross-platform utility designed to help you forget about your start menu, the icons on your desktop, and even your file manager. Launchy indexes the programs in your start menu and can launch your documents, project files, folders, and bookmarks with just a few keystrokes. It hides in the background once started. If you hold the Alt-Key and hit the space key is a small window appears.  You can start typing the first characters of the program you want to start and Launchy will find the program. Hit “Enter” and the program starts. It is so much easier than using the mouse and go to the start-button or your desktop searching for your program.
In the next picture you see that I typed “exc” and Launchy suggests Excel (if you wait a little longer it will show a list with other possible programs or files starting with “exc”).

I think that when you start using it you never can do without it anymore.

Indenting with Gams-mode

The new version of Gams-mode has a nice feature that helps you in formatting your model.
You can automatically indent GAMS programs according to GAMS syntax.
 
M-C-\        =       Indent region.  Specify region and type M-C-\.
TAB          =       Indent the current line.
 
On the left you see the model before using the indent feature of Gams-mode. I selected the region and typed M-C-\ (`indent-region’).
You can see on the right side what happened. The set and parameter declarations are nicely formatted and the loop is clearly visible because all assignments in the loop are indented.
This example was taken from the file gams-sample.gms which resides in the gams-mode directory (and contains lots of useful tricks with Gams-mode).
 
 
 
Another nice feature is indenting a region (examples taken from the sample-text.gms file from Gams-mode.
Just mark the region you wan to indent and hit c-c c-y. Choose “t” if it is a table and “o” for other text.
Here an example (once again taken from the sample file):
 
or a table

Excel-Addin for converting Excel tables to LaTeX tables

Although I am not a great fan of the Microsoft software, I have to admit that Excel is great. Sending tables from Excel to Word is easy but I work in LaTeX and then it can be time consuming. Fortunately there is a nice add-in for Excel that allows you to copy your Excel table to LaTeX. It is called Excel2LaTeX and developed by Joachim Marder and Andrew Hawryluk and can be downloaded from http://www.ctan.org/tex-archive/support/excel2latex/. I tested it with Excel 2010 and it works fine.
 
When you download the file Excel2LaTeX.xla you can either open it when you need it or if you use it often save it in your Excel add-in directory.
Most of the text formatting, border lines  and even multi-column cells are retained.
Text formatting (bold, italic) is retained and multi-column cells are supported. The LaTeX code can be copied to the clipboard or saved as a LaTeX file, which then can be included in an existing LaTeX document using the \input command.
 
Here a small example: First the excel table:
 
 
and here the code generated by Excel2LaTeX
 
% Table generated by Excel2LaTeX from sheet ‘Estimation LES’
\begin{table}[htbp]
\centering
\caption{Add caption}
  \begin{tabular}{rrrrrrr}
  \addlinespace
  \toprule
  {\bf } & \multicolumn{ 6}{|c}{{\bf from the Estimation}} \\
  \midrule
  {\bf Good} & {\bf Alpha} & {\bf Constant} & {\bf Number of hh} & {\bf R-Adjusted} & {\bf s.e. Alpha} & {\bf s.e. Constant} \\
  agr   & 0.01  & 68.79 & 8262  & 0.29  & 0.00  & 3.75 \\
  fd    & 0.03  & 329.83 & 8262  & 0.20  & 0.00  & 16.15 \\
  mnf   & 0.14  & -365.17 & 8262  & 0.67  & 0.01  & 52.49 \\
  ppp   & 0.01  & -16.51 & 8262  & 0.32  & 0.00  & 8.54 \\
  ene   & 0.03  & -26.40 & 8262  & 0.46  & 0.00  & 24.08 \\
  crp   & 0.02  & -45.15 & 8262  & 0.72  & 0.00  & 6.41 \\
  nmm   & 0.00  & -4.34 & 8262  & 0.29  & 0.00  & 1.51 \\
  \bottomrule
  \end{tabular}
\label{tab:addlabel}
\end{table}


And here the table in LaTeX (don’t  forget to include the package booktabs).

Version 3.5 of Gams-mode released

There is a new version of Gams-mode for Emacs (Release 3.5). >When I install a new version on my Windows machine, I usually rename the old Gams-mode directory (on my computer this is ‘C:\Program Files\Emacs\site-lisp\gams’ in ‘C:\Program Files\Emacs\site-lisp\gamsOld’ and put the downloaded Gams-mode files in a directory with the original name (C:\Program Files\Emacs\site-lisp\gams). This way I can check if the new version runs without problems (all settings are preserved) and go back to the old version if there are any problems (just by renaming the directories again). The new version has a great feature for aligning blocks in Gams code.
Changes are:
  • new function gams-align-block' (C-cC-y). By this command, you can align table and other blocks in GAMS code. See Section "Align block" in gams-sample.gms for the details.
  • Changed default value of gams-statement-file’ from “~/.gams-statement” to “~/gams-statement.txt”.
  • Changed default value of `gams-template-file’ from “~/.gams-template” to “~/gams-template.txt”.
  • Minor changes to GAMS-TEMPLATE mode.

You can download it from Gams mode.
 

Using Org-Mode for Project Management

In one of my last blogs I talked about using Org-Mode and Remember-Mode to organize your projects. Here is an example of one of my org-files for my PhD-project (I am working on transport models). The first line tags everything that is in this file with ‘PhD’. This is helpful if you want to search for all your entries in your org-files with a certain task. As you can see there are headings at the first level (blue). I usually have headings like ‘Tasks’, ‘Journal’, ‘Calls’, ‘Ideas’. I am working on a transport model and have my to do’s filed under the heading ‘Tasks.’ As you can see there are several main tasks at the second level. Not every task is shown. I just opened the tasks under ‘Model’. You can also see how many subtasks there are and how many I completed (not many yet…). The first subtask is completed (‘Done’). I also wrote a small comment when I completed the task and, just for showing what is possible, clocked the time I worked on this subtasks. After completing a task I decide what task will be next. In this case it is the task ‘Import data from transport calibration’. This is a task with a link to the place in the model file I was when I wrote this task. This is exactly where I want to start working on this task. I just click the link and Emacs opens the file.
‘The next heading is my research journal. Here I make small notes on what I did, so I keep track of my progress. There is another heading with ideas, calls and overall tasks.  I also have a heading ‘Later’ with things I want to do later, but don’t want them in my actual task list.
I use remember-mode to write down my tasks, calls, journal entries and ideas (see the blog on that topic). Those items are saved to a file called refile.org. At the end of the day I take a look at this file and move the items with C-x C-w to the files where they belong. This can be done quite fast, because Emacs completes the name of the org-file and the heading you choose. For example when I want to move a task to my pdh-org file, I put the cursor on this task in my refile.org, start typing ‘ph’ and Emacs completes it to ‘phd.org/’, then I type ‘t’ and Emacs completes it with ‘Tasks’.
You can send also many items at once. Once they are in the proper file you can rearrange them easily.