23 September, 2014

Modern indentation for old LaTeX document classes

In my last papers I always manually removed the indentation of the first paragraph of each section. This indentation style is considered more modern and more aesthetic, compared to just indenting every paragraph independently of its placement in the document.

Many LaTeX book/article/conference templates, esp. those from the last century ;-), still use old-school indentation. And since I am finally starting to put my PhD thesis work into a real thesis document I was looking for a way to automate the cumbersome manual work I had done previously.

Here is my current solution (based on this TeX answer):


This work nicely for the AMS book template. If you use LyX, as I do, then just add this to your LaTeX preamble in the document settings.

17 September, 2014

Pushing uncompressed and gzip-compressed files into awk

I was just wondering how to best handle compressed and uncompressed files together in my CSV-processing bash/awk scripts. Here is a very simple solution:

#!/usr/bin/env bash


  case $file in
    *.gz) gzip -dc $file;;
    *)    cat      $file;;

kat $file | awk '{/* do something */}'

I would say this is really lean code. Even if bash has its restrictions and I despised it in the past, I
have come to love it over the past years.
PS: I know there are more sophisticated tools, such as `file` and `zcat`. However, they are not available in the default GitBash on Windows, which I am still using at work for many tasks.