A sane beamer directory structure

I had to give many talks, both to internal and external audiences. As you could imagine, I use LaTeX and Beamer to compile my slides. But until now, I had no good approach how to organize them. This lead to a chaos of copy-pasted Makefiles, assets such as images and TikZ sources, TeX preludes etc. Everything was scattered around several Git repositories, some talks have their own repositories, some were collected in a single one. That was quite a mess, to be honest.

So, I sat down and thought how to lay out things. Eventually, I set up one repository for all Beamer sources which are simply structured in a year/title hierarchy. I set up one repository for all assets and one repository for my BibTeX databases. At the moment I don’t have a good reason to split them that way other than that it doesn’t feel “semantically” right. To avoid repeating myself in the prelude, I pulled out the most common settings – including packages, fonts, colors, environments and commands – into its own top-level beamercommon.sty.

Each talk subdirectory as its own Makefile that consists of one of:

include ../../common.mk
include ../../common.pandoc.mk

The first Makefile is based on rubber and simply tries to compile all .tex files found in the current directory. The second Makefile uses Pandoc and a slightly modified template to build Beamer slides from Markdown input:

SRC=$(wildcard *.md)
PDF=$(subst .md,.pdf,$(SRC))
THEME_OPTIONS="english, titlepage0"
OPTS=-t beamer --latex-engine=xelatex --template=$(TEMPLATE) \
	 --variable theme=KIT \
	 --variable sansfont="Source Sans Pro" \
	 --variable monofont="Inconsolata" \
	 --variable fontsize=18pt \
	 --variable graphicspath=../../common/images/ \
	 --variable themeoptions=$(THEME_OPTIONS) \

.PHONY: clean

all: $(PDF)

%.pdf: %.md $(TEMPLATE)
	@pandoc $(OPTS) -o $@ $<

	@rm -f $(PDF)

In the talk-specific Makefile, I can then simply add or override the $(OPTS) variable to customize the outcome.

There was one thing, I wasn’t sure about: keeping the common and BibTeX repos outside, inside as a submodule or inside as a subtree. I decided for the submodule approach, although I know, it could hurt me in the long run. In any case, this is what the final, version-controlled directory structure looks like: