A man with brains and a shovel

A blog about goals and obstacles, motivation and procrastination, life's random events and getting things done.

Writing Letters in LaTeX

Sometimes I simply love doing stuff the nerdy way and waste more time really digging into stuff.

Today I had to write a letter because I want to end my cable subscription. No online form or e-mail can do that. They make you jump through hoops and mail them a good old fashioned letter.

Opening my LibreOffice, I notice that I don't have a proper template or example letter on this computer. I could just start with a blank page or one of their ugly templates, or I could take the nerdy route.

Nothing has a higher procrastination value than TeX, the typesetting system created by none other than Donald Knuth himself. I prefer LaTeX to be more precise.

TeX is free as in freedom, but you don't just download a TeX program, no you install a TeX-distribution because there is an ecosystem of packages for everything. I use MacTeX on my Apple MacBook Air.

The markup is arguably ugly and it has an extreme learning curve, but I love the warm fuzzy feeling you get when something compiles.

I could have written a latex-letter that can be reused next time, but I wanted more, so I created a templace called personalletter.lco.tex.


\setkomavar{fromname}{John Doe}
\setkomavar{frombank}{Bank Details go here}


A LaTeX letter with the filename myletter.tex could look like this:



  \begin{letter}{Address of Recepient goes here}

    \setkomavar{subject}{Example letter}

    \opening{Dear Sir Or Madam!}

    This is my example letter!

    \closing{Best regards}



And when I call

$ pdflatex myletter

I get a beautiful pdf letter that would have been so much easier in LibreOffice or any other WYSIWYG editor. But who wants to fiddle with all those formatting options when you can write some nerdy instructions?

This plaintext version of my letter and the template can now be committed into my personal git repository and I can track changes easily. Isn't that something?

I know - now I'm wasting even more time blogging about it.