Procrastinating writing my thesis, I seem to come up with all kinds on nonsense. This one, however, is actually important. It’s about the feeling I get when reading other people’s thesis. They all seem to have this deep, intellectual quotes at the start of every chapter.

Every time I see somebody citing Plato, I wonder, how the heck did that guy manage to write his thesis, while catching up with the philosophical body of literature, dating back before Christ.

I’m not that kind of guy, but I also didn’t want to miss the unique opportunity to impress people by showing how intellectual I am. So I decided for using good old fortune to insert something for me. Currently, my chapter headers look something like:

\chapter{Introduction}
\label{sec:introduction}
\immediate\write18{./quote.sh \the\value{chapter}}
\epigraph{\input{/tmp/fortune-\the\value{chapter}}}{--- \textup{\texttt{/usr/bin/fortune}}}

This runs quote.sh for every chapter and inserts the quotes from LaTex files that it generates. (Yes, you can run shell scripts from LaTeX (at least, if you enabled shell escape, which you probably have). This is exactly why it’s a bad idea to compile other peoples LaTeX files without checking the sources. If there would be something like rm -rf ~, then bye bye home directory.)

The qhote.sh script checks if there is already a fortune for that chapter. If there is none or if it’s older than an hour, it will create a new one.

#!/bin/bash

# new fortunes every hour
if [ ! -f /tmp/fortune-$1.tex ] || test "find /tmp/fortune-$1.tex -mmin +60"
then
fortune | sed -e 's/-- .*//g' | sed '/^\s*$/d' > /tmp/fortune-$1.tex
fi

With this I have awesome (albeit sometimes a bit demotivational) chapter quotes in my thesis :-)

Let’s see what the next hour brings.