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 songtexte.com):
See also: Original Source by Clemens Niederberger
Note: The copyright belongs to the blog author and the blog. For the license, please see the linked original source blog.
Leave a Reply
You must be logged in to post a comment.