18.04.2018 by Felix Höffken

Statute in markup language

Why we write our statute in markdown

Incorporating a cooperative means a lot of paper work. Currently we are creating the statute. The ZdK is a lot of help providing a model statute as PDF and doc.

Since working with office software is a lot more difficult for me than working with markup languages I decided to base the statute on the Statute of the CCC Mannheim written in LaTeX.

I presumed it would be no problem to take latex and produce an odt document, which is still often needed because most offices work with Microsoft Word or other office solutions. But sadly I could not find a workable solution.

During my search I stumbled upon Pandoc . Pandoc is a document converter and supports a lot of formats - amongst others LaTeX. Sadly we used a lot of LaTeX libraries that were not supported - for example to prepend "§" to the paragraphs. Since I didn’t want to replace all the libraries I decided to start over with markdown. Markdown has the advantage that I know it a lot better as I use it for github or hugo on a regular basis.

Using pandoc I transformed the LaTeX document with pandoc -f latex -t markdown -o satzung.md satzung.tex to markdown. -t markdown defines the output format, -f latex defines the input format and -o satzung.md defines the name of the newly created file. Afterwards I adjusted some content with some vim and regex magic.

Browsing the Pandoc Manual I encountered --reference-doc=FILE, which allows to define a reference file from which the styles will be copied to the new file. markdown-resume by sdsawtelle served me as an example.

After generating the statute with the pandoc standard styles I had to adjust the styles in Libre Office. I really wanted to omit this step, but it was necessary - for example to prepend "§" and change some list styles.

Afterwards I shortened the document as much as possible and saved it to styles/style.odt.

Now it was possible to create the nice looking odt document with pandoc -f markdown --reference-doc=styles/style.odt -o Satzung.odt Satzung.md.

For creating PDF and docx I decided to rely on Libre Office.
Creating a second reference doc for docx lead to a different style than in the odt document. Using Libre Office I get a consistent result as the docx and the pdf look (almost) like the odt.

These commands are now in a Makefile - so a simple make is sufficient to create (or update) the statute as odt, docx and pdf.

As soon our statue is legally valid you will find the statute and the pandoc setup published on github and linked here.

Edit 06.10.2018: The statute is now online on github .