Recent Posts

  • Producing stand-alone figures with TikZ in LaTeX

    With TikZ (the abbreviation for This is not a drawing program in German) you can produce beautiful figures for your papers (look here for some examples). One problem that often arises is that having the TikZ-code in your LaTeX file is not very efficient when working on the figure: You don’t want to regenerate your paper every time you change something in your figure. Another problem arises when your TikZ code is very long. LaTeX might complain and will not generate the figure.

    The easiest way to circumvent these problems is by using a stand-alone file that generates a pdf-file … Read the rest “Producing stand-alone figures with TikZ in LaTeX”

  • Automatic line breaks in LaTeX tables

    Tables with lots of text in LaTeX often lead to tables that do not fit on a page. This post shows how to produce tables with automatic line breaks. Here is a simple example of a badly formatted table:

    The tabularx package has the possibility to break lines automatically by using the column specifier X:

    Read the rest “Automatic line breaks in LaTeX tables”

  • DRY: Some useful macros in Gams

    DRY stands for “Don’t repeat yourself” and is one of the main principles of efficient programming. In Gams, I use some checks over and over again. Instead of rewriting the code or searching for a file with the existing code and copying it, I use macros in Gams. Macros aren’t difficult to write. You can find more on them here in the documentation.

    Here is a simple example from the Gams documentation defining and using a macro that calculates the reciprocal of a number:

    Read the rest “DRY: Some useful macros in Gams”

  • Checking Mappings in GAMS

    In my previous post, I showed an easy way to aggregate a matrix using mappings in GAMS. If you use a small mapping, you probably won’t make any errors, but if the sets in the mappings have many elements, the chance of an error rises. For example, you forget to map one of the elements on either side, or you map one element twice.

    Tom Rutherford wrote a nice piece of code to check your mappings. This code raises an error as soon as you make one of the mistakes mentioned above.

    Let us first set up a simple … Read the rest “Checking Mappings in GAMS”

  • New: Possibility to subscribe to this blog

    If you can’t do without my blog posts and don’t want to check if there are any new posts, you can subscribe to this blog. Just scroll down in the widget bar on the right side until you find the following:

    Add your email address and wait for the confirmation email.


Name *

Email *