sam@samhartburn.co.uk

Using LaTeX Leadsheets for MathsJamJam

MathsJamJam is an event that takes place at the annual MathsJam gathering, where we sing songs that have had their lyrics rewritten to be about maths. This year I used the LaTeX package Leadsheets to compile the songbooks. I’ve documented how it works here – mainly so that I can remember how to do it, but also in case it’s of interest to anybody else.

First, a disclaimer: I’m not a LaTeX expert, and not a Leadsheets expert. I just figure things out as I go along, so it’s quite likely that there are better ways to do this than the method I used.

The Leadsheets package handles the typesetting of chords with lyrics, and has a couple of big benefits compared to using standard word processing software:

  • you can specify exactly where in the lyrics each chord should go and it will automatically be set above that location – no messing around with tabs and spaces to get your chords in the right places
  • it has capo and transpose functions, so I could use the same set of files to automatically generate chord books for instruments that use a capo, and for those that don’t.

You can download the Leadsheets package and documentation here. The package was already included in my LaTeX installation.

I chose to have each song in a file of its own, which can be compiled individually, and to have a parent file for the song book, which uses all the individual song files to compile a book with or without chords.

You can download all the tex files from GitHub, here.

The template file

The template file includes templates that are used to define how song titles are displayed. There are different versions for compiling with and without a capo, and for compiling individual files and song books.

Individual song files

The header for each individual song file imports the leadsheets package and the templates file.

\documentclass{leadsheet}
\usepackage{leadsheets}
\input{LeadsheetsTemplates.tex}

Before the main document begins, the following code sets up the Leadsheets options. Any options set here will only be used when compiling the song as an individual file; they are overridden by the parent settings when the songbook is compiled. Most of these settings define details of how different aspects of the song are displayed. The two that are likely to be changed are:

  • title-template – set to mathsjamjam_individual or mathsjamjamcapo_individual. The only difference between the two is that mathsjamjamcapo_individual includes a subheading showing which fret to put the capo on.
  • transpose-capo – set this to false to show the chords as written or true to transpose the chords for the chosen capo fret.
\setleadsheets{
  title-template = mathsjamjam_individual,
  after-song = \newpage,
  chords/sharp = \sharp ,
  chords/flat = \flat,
  chords/format = \bfseries,
  align-chords = {l},
  verse/name=Verse,
  verse/named=true,
  verse/numbered=false,
  verse/after-label=:,
  remember-chords=true,
  print-chords=true,
  capo-nr-format = arabic,
  transpose-capo=false,
  chorus/format = 
}

The first line within the body of the document sets the song properties. This is where you define the title, key, capo fret, etc. that are used when the file is compiled.

  • title – the name of the song
  • key – the key of the song; this needs to be set for the capo transposition to work
  • capo – which fret the capo should be placed on; this should be omitted (not set to 0) if no capo setting is needed
  • lyrics – for MathsJamJam purposes, this will be the person who has rewritten the lyrics
  • subtitle – for MathsJamJam purposes, this should be the title of the original song plus any extra notes; it will appear in a subheading, appended to ‘To the tune of…’
\begin{song}{title=To Make a Real Good Proof, key=Bb, capo=1, lyrics=Sam Hartburn, subtitle=To Make You Feel My Love by Bob Dylan (as sung by Adele)}

Leadsheets uses a number of categories (verse, chorus, etc.) to define the lyrics. These are important because the chords from the first instance of each category can be remembered in later instances. To specify a chord, use the notation ^{X} at the point in the lyrics where the chord change occurs, replacing X with the desired chord. The chord will be set above the letter that follows it. Use a capital letter for the chord name, b for flat, # for sharp. You can add suffixes such as 7 or sus2; these will be set as a superscript to the chord.

\begin{verse}
^{Bb} When your theory's falling ^{F/A}on its face \
^{Ab} And you can't tie up that ^{Eb}one last case \
^{Ebm}Just remember there's no ^{Bb}need to race \
^{C7} To make a ^{Eb/F}real good ^{Bb}proof \
\end{verse}

In subsequent instances of the same category, you only need to specify where the chord change occurs. The chord names will be remembered from the first instance.

\begin{verse}
^{} When you check it over and the ^{}doubts appear \\
^{} And there is no-one there to ^{}calm your fears \\
^{} You might think you need a ^{}million years \\
^{} To make a ^{}real good ^{}proof \\
\end{verse}

A slight problem with this approach occurs for songs where the chords are varied slightly for some verses or choruses. You can use other environments such as bridge, outro, etc. to define these.

The songbook file

As with the individual song files, the songbook file sets up the leadsheets options. These options override the settings in the individual songs. The settings that are likely to be changed are:

  • title-template – set to mathsjamjam_book or mathsjamjamcapo_book. The only difference between the two is that mathsjamjamcapo_book includes a subheading showing which fret to put the capo on. The book templates number each song, and define the headings in such a way that they can be used to generate a table of contents.
  • transpose-capo – set this to false to show the chords as written or true to transpose the chords for any song that has a capo setting specified.
  • print-chords – set this to true to include the chords or false to print lyrics with no chords.
  • transpose – this is currently commented out, but in theory can transpose all chords up or down by a specified number of semitones; there is a problem with this setting which I’ll mention later.
\setleadsheets{
  title-template = mathsjamjam_book,
  after-song = \newpage,
  chords/sharp = \sharp ,
  chords/flat = \flat,
  chords/format = \bfseries,
  align-chords = {l},
  verse/name=Verse,
  verse/named=true,
  verse/after-label=:,
  remember-chords=true,
  print-chords=true,
  capo-nr-format = arabic,
  transpose-capo=true,
  bar-shortcuts = false
  %transpose=0
}

After some code to display a title page and contents, all the songbook file does is import each of the individual song files.

\includeleadsheet{ToMakeARealGoodProof.tex}

Transposing for instruments in other keys

In theory, the transpose option in setleadsheets can be used to transpose the entire song book up or down for instruments in other keys. However, in practice I found that if a capo is specified for a particular song, leadsheets transposes from the capo chords, not from the chords as written. This means that each song with a capo specified is transposed by a different amount.

To get round this, I flagged which songs have capo settings and commented out the capo setting before compiling the transposed song book. This manual step is not ideal!

Other niggles

There are a few other things that aren’t ideal.

  • Although the ‘remember-chords’ feature is useful, it’s a bit annoying to have to specify a different category for a verse with a couple of different chords to the first verse.
  • I couldn’t be bothered to work out how to use different fonts in LaTeX, so just stuck to the default, which isn’t particularly pretty.
  • For instrumental parts I used the _{} notation to specify the chords, which sets them on the main text line instead of above it. However, chords specified using this notation are printed even when ‘print-chords’ is set to false, so these chords appeared in the lyrics-only songbook.

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Hello! I’m Sam Hartburn, a freelance maths author, editor and animator. I also dabble in music and write mathematical songs. Get in touch by emailing sam@samhartburn.co.uk or using any of the social media buttons above.

#DigitalGeometrySketchbook 3D geometry animations constructions Geogebra GeogebraArt geometry MathArt mathober mathober2023 MathsArt OpenSCAD parametric parametric curves poetry polygons polyhedra ruler and compass Rupert polyhedra Sunday Animations