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 [cci_latex]song[/cci_latex] 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 [cci_latex]song[/cci_latex] 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. Let’s start with the needed packages: [cce_latex]\usepackage[table]{xcolor} \usepackage{array,tabularx,leadsheets,mdframed,needspace}[/cce_latex] No real surprise here – some colors, some table support, mdframed for adding frames around contents, and needspace. Next let’s define a horizontal rule: [cce_latex]\newlength\songrulewidth \setlength\songrulewidth{1pt} \newcommand*\songrule{\par\noindent\rule{\linewidth}{\songrulewidth}\par}[/cce_latex] Now the real fun starts: a new title template: [cce_latex]\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} }[/cce_latex] 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: [cce_latex] \ifsongmeasuring{}{\refstepcounter{songs}}[/cce_latex] Then we put the song number in a table cell with a gray background and the title next to it: [cce_latex] \noindent \begin{tabularx}{\linewidth}{>{\columncolor{black!10}}p{1cm}>{\raggedright}X} \sffamily\huge\strut\thesongs & \sffamily\Large\itshape\songproperty{title} \end{tabularx}[/cce_latex] Some vertical space [cce_latex] \vspace*{.5\baselineskip}[/cce_latex] and that’s it. Next we define a new verse type template – this is where mdframed comes into play: [cce_latex]\mdfdefinestyle{songs}{ hidealllines = true , leftline = true , linewidth = \songrulewidth } \defineversetypetemplate{songs} { \mdframed[style=songs] } { \endmdframed }[/cce_latex] And last but not least the setup for using all the new stuff: [cce_latex]\setleadsheets{ before-song = \needspace{5\baselineskip}\songrule , after-song = \songrule , title-template = songs , chorus/template = songs , verse/numbered = false , verse/format = \itshape }[/cce_latex] Now let’s see what this looks like in a [cci_latex]twocolumn[/cci_latex] document (lyrics taken from aint-nobody

One thought on “Customizing leadsheets

  1. Thanks for this package, it’s exactly what I’ve been looking for! I was thinking that I would have to create my own mediocre package, but while reading up on xsim (I’m an extensive exsheets user; thanks for that also), I discovered leadsheets.

Leave a Reply

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