My leadsheets package is one of my newer packages. It seems to already have some fans – I get the occasional email asking for support and on github it has at the moment of writing 7 people who watch it and 5 stars. I wrote the first time about it on my German blog (neverthless in English).

Personally I use it a lot for writing leadsheets for my band.

What I like quite a lot about leadsheets is the possibility of designing title templates for the song environment. This allows almost complete control about the layout. The next version (which will be on CTAN in a few days) also adds hooks to the song environment for even more control. In this post I like to show how this can be used to mimick the layout of the songs package.

\usepackage[table]{xcolor}
}

No real surprise here – some colors, some table support, mdframed for adding frames around contents, and needspace.

Next let’s define a horizontal rule:

\newlength\songrulewidth
\setlength\songrulewidth{1pt}
\newcommand*\songrule{\par\noindent\rule{\linewidth}{\songrulewidth}\par
}

Now the real fun starts: a new title template:

\newcounter{songs}
\definesongtitletemplate{songs}{
\ifsongmeasuring{}{\refstepcounter{songs}}
\vspace*{.5ex}
\noindent
\begin{tabularx}{\linewidth}{>{\columncolor{black!10}}p{1cm}>{\raggedright}X}
\sffamily\huge\strut\thesongs &
\sffamily\Large\itshape\songproperty{title}
\end{tabularx}
\vspace*{.5\baselineskip}
}

First we define a new counter so we can have numbered songs. We only step this counter when leadsheets is not in its measuring phase:

\ifsongmeasuring{}{\refstepcounter{songs}}

Then we put the song number in a table cell with a gray background and the title next to it:

\noindent
\begin{tabularx}{\linewidth}{>{\columncolor{black!10}}p{1cm}>{\raggedright}X}
\sffamily\huge\strut\thesongs &
\sffamily\Large\itshape\songproperty{title}
\end{tabularx
}

Some vertical space

\vspace*{.5\baselineskip}

and that’s it.

Next we define a new verse type template – this is where mdframed comes into play:

\mdfdefinestyle{songs}{
hidealllines = true ,
leftline = true ,
linewidth = \songrulewidth
}
\defineversetypetemplate{songs}
{ \mdframed[style=songs] }
{ \endmdframed
}

And last but not least the setup for using all the new stuff:

Now let’s see what this looks like in a twocolumn document (lyrics taken from songtexte.com):