An integrated book and website

Posted on .#markdown#latex#python

This post is part of a series:Making an integrated book/website about music coding using MkDocs, LaTeX, and Python

Over the past year, I wrote and compiled - literally hundreds of times - a textbook on making music with SuperCollider. The book, “Komposition og lydproduktion med SuperCollider”, was published in June, 2025, under the CC BY-SA 4.0 license.

Excerpt of the cover page for 'Komposition og lydproduktion med SuperCollider' by Anders Eskildsen
Excerpt of the cover page for 'Komposition og lydproduktion med SuperCollider' by Anders Eskildsen

In this series of blog posts I’ll explain how I set up a system that produces a nicely typeset PDF version of the book integrated with a full web version with audio examples. What makes this setup unique is the close integration between the PDF and web versions. Readers can jump directly from a code example in the PDF to the corresponding audio example on the website, where they can listen to it and explore it interactively.

The abbreviated origin story

I taught composition with SuperCollider at Aalborg University for the better part of a decade. Much of the book’s content came from lecture notes I had written and shared with students over the years. A few years ago, I collected these notes, converted them to markdown, and put them on a website using mkdocs.

Using the site as reference material in classes, it became clear to me that the site’s introductions to composition and audio synthesis techniques filled a gap in the Danish-language literature on computer music. With the included cheat sheets and exercises in SuperCollider, the site was a useful resource for my students.

Then, in the summer of 2024, I was introduced to AAU OPEN, an Open Access publication platform for the faculty of Aalborg University. I had been thinking of turning the website into a textbook, and AAU OPEN was the right place to finally make this happen.

If the website worked well, why turn it into a combined book/website?

While I would not recommend this developer-oriented workflow for everyone, there are compelling reasons for this decision:

Advantages for the reader

Advantages for the writer

The technical challenge: Combining markdown and LaTeX

The book’s sections exist as a set of markdown files, accompanied by image and audio files, which mkdocs uses to generate the web version as a static site. While there are ways of converting markdown documents to PDF directly, I chose to use LaTeX as an intermediary format. LaTeX is widely used in academia, and when set up with care, it can produce beautifully typeset publications without the hassle of WYSIWIG editors. However, maintaining both LaTeX and markdown versions of the source files seemed inefficient. Unless…

What if we could automate the conversion from markdown to LaTeX, and from there to a PDF file? Markdown’s syntactical categories are relatively simple and should, at least in theory, have corresponding structures in LaTeX. So I set out to build a system that would produce a nicely typeset and fully functional PDF using LaTeX, from the same sources that mkdocs uses to produce the website. This approach is similar to Continuous Integration, allowing the web and PDF versions to remain synchronized and up-to-date.

In the next part of this series, I’ll go over how I automated the conversion of markdown to LaTeX with a Python library called md2tex.

This post is part of a series: Making an integrated book/website about music coding using MkDocs, LaTeX, and Python

  1. Part 1: An integrated book and website (this post)
  2. Part 2: Converting markdown to LaTeX with md2tex
  3. Part 3: Making a pygments lexer to syntax highlight SuperCollider code
  4. Part 4: New MkDocs plugins for embedding and visualizing audio