# 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

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
\begin{tabular}{rrrrrrr}
\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}
\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.