| 1 |
% arara: pdflatex: { shell: on , interaction: nonstopmode } |
| 2 |
% arara: biber |
| 3 |
% arara: pdflatex: { interaction: nonstopmode } |
| 4 |
% arara: pdflatex: { interaction: nonstopmode } |
| 5 |
% -------------------------------------------------------------------------- |
| 6 |
% the LEADSHEETS package |
| 7 |
% |
| 8 |
% typesetting leadsheets and songbooks |
| 9 |
% |
| 10 |
% -------------------------------------------------------------------------- |
| 11 |
% Clemens Niederberger |
| 12 |
% E-Mail: [email protected] |
| 13 |
% -------------------------------------------------------------------------- |
| 14 |
% Copyright 2014--2022 Clemens Niederberger |
| 15 |
% |
| 16 |
% This work may be distributed and/or modified under the |
| 17 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 18 |
% of this license or (at your option) any later version. |
| 19 |
% The latest version of this license is in |
| 20 |
% http://www.latex-project.org/lppl.txt |
| 21 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 22 |
% version 2005/12/01 or later. |
| 23 |
% |
| 24 |
% This work has the LPPL maintenance status `maintained'. |
| 25 |
% |
| 26 |
% The Current Maintainer of this work is Clemens Niederberger. |
| 27 |
% -------------------------------------------------------------------------- |
| 28 |
\documentclass[load-preamble+]{cnltx-doc} |
| 29 |
\usepackage{leadsheets,bookmark,csquotes} |
| 30 |
\setcnltx{ |
| 31 |
package = leadsheets , |
| 32 |
info = Typesetting leadsheets and songbooks , |
| 33 |
authors = Clemens Niederberger , |
| 34 |
email = [email protected] , |
| 35 |
url = https://github.com/cgnieder/leadsheets/ , |
| 36 |
add-cmds = { |
| 37 |
choir , chord , chordname , |
| 38 |
definesongtitletemplate , |
| 39 |
defineversetypetemplate , |
| 40 |
expandcode , |
| 41 |
ifallsongproperties , |
| 42 |
ifanysongproperty , |
| 43 |
ifobeylines , |
| 44 |
ifsongmeasuring , |
| 45 |
ifsongpropertiesequal , |
| 46 |
ifsongproperty , |
| 47 |
ifversenamed , |
| 48 |
ifversenumbered , |
| 49 |
ifversestarred , |
| 50 |
includeleadsheet , |
| 51 |
instruction , |
| 52 |
leadsheetstranslate , |
| 53 |
lsenparen , |
| 54 |
mkchoir , |
| 55 |
mkinstruction , |
| 56 |
mklsenparen , |
| 57 |
mklsenparens , |
| 58 |
newversetype , |
| 59 |
printsongpropertylist , |
| 60 |
setchords , |
| 61 |
setleadsheets , |
| 62 |
songproperty , |
| 63 |
useleadsheetslibraries , |
| 64 |
useleadsheetslibrary , |
| 65 |
verseafterlabel , |
| 66 |
verselabel , |
| 67 |
verselabelformat , |
| 68 |
versename , |
| 69 |
versenumber , |
| 70 |
writechord |
| 71 |
} , |
| 72 |
add-silent-cmds = { |
| 73 |
@itemdepth , |
| 74 |
arraybackslash , |
| 75 |
endmdframed , |
| 76 |
mdframed , |
| 77 |
newfontfamily , |
| 78 |
newrobustcmd , |
| 79 |
musejazz |
| 80 |
} , |
| 81 |
add-envs = { |
| 82 |
bridge , |
| 83 |
chorus , chorus* , |
| 84 |
flushleft , |
| 85 |
flushright , |
| 86 |
info , |
| 87 |
interlude , |
| 88 |
intro , intro* , |
| 89 |
outro , outro * , |
| 90 |
prechorus , prechorus* , |
| 91 |
solo , solo* , |
| 92 |
song , |
| 93 |
verse |
| 94 |
} , |
| 95 |
index-setup = { othercode=\footnotesize, level=\section , noclearpage } , |
| 96 |
makeindex-setup = { columns=3, columnsep=1em } |
| 97 |
} |
| 98 |
|
| 99 |
\defbibheading{bibliography}{\section{References}} |
| 100 |
\addbibresource{\jobname.bib} |
| 101 |
|
| 102 |
\begin{filecontents}[overwrite]{\jobname.bib} |
| 103 |
@book{book:realbook, |
| 104 |
author = {Various} , |
| 105 |
title = {The Real Book} , |
| 106 |
volume = {I} , |
| 107 |
subtitle = {C Edition} , |
| 108 |
publisher = {Hal Leonard Publishing Corporation} , |
| 109 |
isbn = {978-0634060380} , |
| 110 |
date = {2000-01-01} , |
| 111 |
edition = {6th edition} |
| 112 |
} |
| 113 |
@book{book:newrealbook, |
| 114 |
author = {Various} , |
| 115 |
title = {The New Real Book} , |
| 116 |
volume = {I} , |
| 117 |
subtitle = {C Edition} , |
| 118 |
publisher = {Ama Verlag} , |
| 119 |
isbn = {978-0961470142} , |
| 120 |
date = {2009-02-12} , |
| 121 |
edition = {1st edition} |
| 122 |
} |
| 123 |
\end{filecontents} |
| 124 |
|
| 125 |
\usepackage{booktabs} |
| 126 |
|
| 127 |
\newidxcmd\library{\code{#1}}[ (library)] |
| 128 |
\AtEndPreamble{% |
| 129 |
\pdfstringdefDisableCommands{% |
| 130 |
\def\library*#1{``#1''}% |
| 131 |
}% |
| 132 |
} |
| 133 |
\newrobustcmd*\musicsymbols{\library{musicsymbols}} |
| 134 |
\newrobustcmd*\chords{\library{chords}} |
| 135 |
\newrobustcmd*\musejazz{\library{musejazz}} |
| 136 |
|
| 137 |
\setchords{format=\libertineLF} |
| 138 |
|
| 139 |
\makeatletter |
| 140 |
\colorlet{property}{cnltxgreen} |
| 141 |
\newenvironment{properties} |
| 142 |
{% |
| 143 |
\def\prop{\@cnltx@option@item\propval}% |
| 144 |
\cnltxlist |
| 145 |
} |
| 146 |
{\endcnltxlist} |
| 147 |
|
| 148 |
\newrobustcmd*\propval{\@ifstar{\cnltx@prop@star}{\cnltx@prop@nostar}} |
| 149 |
|
| 150 |
\newrobustcmd*\cnltx@prop@star{% |
| 151 |
\cnltx@ifdash |
| 152 |
{\cnltx@prop@aux*\meta} |
| 153 |
{\cnltx@prop@aux*\marg}% |
| 154 |
} |
| 155 |
\newrobustcmd*\cnltx@prop@nostar{% |
| 156 |
\cnltx@ifdash |
| 157 |
{\cnltx@prop@aux{}\meta} |
| 158 |
{\cnltx@prop@aux{}\marg}% |
| 159 |
} |
| 160 |
\newcommand*\cnltx@prop@aux[4]{% |
| 161 |
\code{\property#1{#3}\cnltx@isvalue#2{#4}}% |
| 162 |
} |
| 163 |
\makeatother |
| 164 |
|
| 165 |
\newidxcmd\property{\code{\textcolor{property}{#1}}} |
| 166 |
|
| 167 |
\newrobustcmd*\symarg[1]{\textcolor{argument}{\code{#1}}} |
| 168 |
|
| 169 |
\newidxcmd\titletemplate{\textit{\sffamily#1}}[\ (songtitle template)] |
| 170 |
\newidxcmd\versetemplate{\textit{\sffamily#1}}[\ (verse-type template)] |
| 171 |
\newidxcmd\shortcut{\code{#1}}[ (shortcut)] |
| 172 |
\newidxcmd\pkgopt{\code{#1}}[ (package option)] |
| 173 |
\newnote*\packageoption[1]{Package option: \pkgopt{#1}} |
| 174 |
|
| 175 |
\newrobustcmd*\barsymbol{|} |
| 176 |
|
| 177 |
\AfterPackage{hyperref}{% |
| 178 |
\pdfstringdefDisableCommands{% |
| 179 |
\def\property#1{#1}% |
| 180 |
}} |
| 181 |
|
| 182 |
\renewcommand*\dictumauthorformat[1]{#1} |
| 183 |
\renewcommand*\raggeddictumtext{} |
| 184 |
|
| 185 |
\begin{document} |
| 186 |
|
| 187 |
\part{About the Package} |
| 188 |
\dictum[Tom Waits]{% |
| 189 |
I like beautiful melodies telling me terrible things.% |
| 190 |
} |
| 191 |
|
| 192 |
\section{License and Requirements} |
| 193 |
|
| 194 |
\license |
| 195 |
|
| 196 |
\leadsheets{} requires the bundles \bnd{l3kernel}~\cite{bnd:l3kernel} and |
| 197 |
\bnd{l3packages}~\cite{bnd:l3packages} to be available. It also needs the |
| 198 |
package \pkg{translations}~\cite{pkg:translations}. |
| 199 |
|
| 200 |
\section{Background} |
| 201 |
|
| 202 |
Over the years I repeatedly wanted to typeset simple leadsheets of songs, \ie, |
| 203 |
song lyrics and the corresponding chords\footnote{I also have had the need (or |
| 204 |
let's say: wish) to typeset leadsheets in the style of the |
| 205 |
\citetitle{book:realbook} -- but this is a task where other software than |
| 206 |
\LaTeX{} usually is far easier.}. This is not too hard with standard |
| 207 |
\LaTeX{} commands and environments but it is not very convenient\ldots{} so |
| 208 |
looking for existing packages is the logical next step and I found two very |
| 209 |
promising packages: \pkg{songs}~\cite{pkg:songs} and |
| 210 |
\pkg{songbook}~\cite{pkg:songbook}. However, both were note \emph{quite} what |
| 211 |
I wanted. Just a bit too inflexible in the wrong places, needing tweaking |
| 212 |
here and there, and so on. On the other hand I had quite some code lying on |
| 213 |
my hard drive with various attempts of typesetting leadsheets. This package |
| 214 |
is now the attempt to have a clean, documented and customizable version of my |
| 215 |
code\footnote{Plus new things!}. |
| 216 |
|
| 217 |
\section{The Structure of the Package} |
| 218 |
\leadsheets{} is a modular package and consists of several |
| 219 |
libraries\footnote{This did seem like a good idea for maintenance when I first |
| 220 |
came up with it. Now I'm not so sure any more but I am way too lazy to |
| 221 |
change it back. So here we are\ldots}. If you just say |
| 222 |
\begin{sourcecode} |
| 223 |
\usepackage{leadsheets} |
| 224 |
\end{sourcecode} |
| 225 |
then the \library{songs} library is loaded\footnote{Which currently means that |
| 226 |
\emph{all} libraries are loaded as the \library{songs} library needs them.}. |
| 227 |
If you want to ensure that \emph{every} library is loaded\packageoption{full} |
| 228 |
so you don't have to think about it any more you can use |
| 229 |
\begin{sourcecode} |
| 230 |
\usepackage[full]{leadsheets} |
| 231 |
\end{sourcecode} |
| 232 |
This actually loads every library except the \library{musejazz} library. |
| 233 |
|
| 234 |
If you instead use\packageoption{minimal} |
| 235 |
\begin{sourcecode} |
| 236 |
\usepackage[minimal]{leadsheets} |
| 237 |
\end{sourcecode} |
| 238 |
then \emph{no} libraries are loaded. In this case you have to load the |
| 239 |
libraries yourself in order to use the package. |
| 240 |
\begin{commands} |
| 241 |
\command{useleadsheetslibraries}[\marg{comma list of libraries}] |
| 242 |
With this command one or several of \leadsheets' libraries can be loaded. |
| 243 |
\command{useleadsheetslibrary}[\marg{library}] |
| 244 |
With this command one of \leadsheets' libraries can be loaded. |
| 245 |
\end{commands} |
| 246 |
|
| 247 |
The libraries are divided into two parts: libraries to be loaded by users and |
| 248 |
auxiliary libraries loaded by other libraries but not to be loaded directly by |
| 249 |
users. |
| 250 |
|
| 251 |
The user-libraries are the following ones: |
| 252 |
\begin{description} |
| 253 |
\item[\library{musicsymbols}] \packageoption{musicsymbols}This library makes |
| 254 |
the music symbol font provided by MusiX\TeX{} available as text font. It |
| 255 |
is described in part~\ref{part:musicsymbols-library}. |
| 256 |
\item[\library{chords}] \packageoption{chords}This library defines a |
| 257 |
few macros for typesetting of chord symbols. It is described in |
| 258 |
part~\ref{part:chords-library}. It also loads the |
| 259 |
\library{musicsymbols}library. |
| 260 |
\item[\library{musejazz}] \packageoption{musejazz}extends the \chords\ |
| 261 |
library to use MuseScore's \enquote{MuseJazz Text} font, see |
| 262 |
section~\ref{sec:musejazz-libr}. It loads the \library{chords} |
| 263 |
library. |
| 264 |
\item[\library{songs}] \packageoption{songs}This is the \emph{main |
| 265 |
library}. It defines everything necessary for the typesetting of the |
| 266 |
leadsheets. It currently loads \emph{all other libraries}, \ie, user |
| 267 |
libraries \emph{and} internal libraries, except for the \library{musejazz} |
| 268 |
library. This library is described in part~\ref{part:leadsheets-songs-library}. |
| 269 |
\item[\library{external}] \packageoption{external}enables to include |
| 270 |
external leadsheet documents using the \cls{leadsheets} class into a main |
| 271 |
document, see part~\ref{part:external-leadsheet} for details. |
| 272 |
\end{description} |
| 273 |
Those libraries can also be loaded as a package option. If you say |
| 274 |
\begin{sourcecode} |
| 275 |
\usepackage[musicsymbols]{leadsheets} |
| 276 |
\end{sourcecode} |
| 277 |
then \emph{only} the \library{musicsymbols} library is loaded. Saying |
| 278 |
\begin{sourcecode} |
| 279 |
\usepackage[songs]{leadsheets} |
| 280 |
\end{sourcecode} |
| 281 |
is the same as using the package \emph{without} any options. ``Without any'' |
| 282 |
also means that neither \library{musicsymbols}, \library{chords} nor |
| 283 |
\library{songs} has been given as class option! |
| 284 |
|
| 285 |
There is also a number of auxiliary libraries which are all needed by |
| 286 |
the \library{songs} library. The libraries are usually not described in |
| 287 |
sections of their own but as part of the \library{songs} library. However, |
| 288 |
the following list gives hints to where some of the concepts are explained: |
| 289 |
\begin{description} |
| 290 |
\item[\library{properties}] This is an auxiliary library not meant to be |
| 291 |
loaded directly by users. It defines the necessary macros for song |
| 292 |
properties. See section~\ref{sec:song-properties} for more details on the |
| 293 |
concept. |
| 294 |
\item[\library{shorthands}] This is an auxiliary library not meant to be |
| 295 |
loaded directly by users. It provides means for defining shorthand |
| 296 |
characters. |
| 297 |
\item[\library{transposing}] This is an auxiliary library not meant to be |
| 298 |
loaded directly by users. It defines a transposing mechanism for chord |
| 299 |
symbols. See section~\ref{sec:transposing} for further details. |
| 300 |
\item[\library{chordnames}] This is an auxiliary library not meant to be |
| 301 |
loaded directly by users. It defines the necessary macros for printing |
| 302 |
chords. |
| 303 |
\item[\library{templates}] This is an auxiliary library not meant to be |
| 304 |
loaded directly by users. It defines the necessary macros for |
| 305 |
\leadsheets' template mechanism. See section~\ref{sec:templates} for |
| 306 |
details on the concept. |
| 307 |
\item[\library{translations}] This is an auxiliary library not meant to be |
| 308 |
loaded directly by users. It provides a few translations for a number of |
| 309 |
printed strings. See section~\ref{sec:internationalization} for more |
| 310 |
information. |
| 311 |
\end{description} |
| 312 |
|
| 313 |
\part{The \library*{musicsymbols} Library}\label{part:musicsymbols-library} |
| 314 |
\dictum[Victor Hugo]{% |
| 315 |
Music expresses that which cannot be said and on which it is impossible to |
| 316 |
be silent.% |
| 317 |
} |
| 318 |
\vspace*{\baselineskip}\csname @afterheading\endcsname |
| 319 |
|
| 320 |
The \musicsymbols{} library is a very small library that makes the music |
| 321 |
symbol font provided by MusiX\TeX{} available as text font and then uses it to |
| 322 |
define a number of symbols. This redefines the macros \cs{sharp}, \cs{flat} |
| 323 |
and \cs{natural}. All defined symbols are listed in |
| 324 |
table~\ref{tab:musicsymbols}. |
| 325 |
|
| 326 |
If you want to use the library standalone then you can say: |
| 327 |
\begin{sourcecode} |
| 328 |
\usepackage[minimal]{leadsheets} |
| 329 |
\useleadsheetslibraries{musicsymbols} |
| 330 |
\end{sourcecode} |
| 331 |
|
| 332 |
\musicsymbols{} defines three further commands, namely \cs{musix}, |
| 333 |
\cs{textmusix} -- a font switch and a text font command -- and |
| 334 |
\cs{musicsymbol}. Those commands are meant for internal use only which is why |
| 335 |
they're not explained here. |
| 336 |
|
| 337 |
\begin{table}[htbp] |
| 338 |
\centering |
| 339 |
\newcommand*\showsymbol[1]{\cs{#1}&\csuse{#1}} |
| 340 |
\caption{Symbols defined by \musicsymbols.} |
| 341 |
\begin{tabular}{llll} |
| 342 |
\toprule |
| 343 |
\bfseries Command & \bfseries Symbol & |
| 344 |
\bfseries Command & \bfseries Symbol \\ |
| 345 |
\midrule |
| 346 |
\showsymbol{sharp} & \showsymbol{flat} \\ |
| 347 |
\showsymbol{doublesharp} & \showsymbol{doubleflat} \\ |
| 348 |
\showsymbol{natural} \\ |
| 349 |
\midrule |
| 350 |
\showsymbol{trebleclef} & \showsymbol{bassclef} \\ |
| 351 |
\showsymbol{altoclef} \\ |
| 352 |
\midrule |
| 353 |
\showsymbol{allabreve} & \showsymbol{meterC} \\ |
| 354 |
\midrule |
| 355 |
\showsymbol{wholerest} & \showsymbol{halfrest} \\ |
| 356 |
\showsymbol{quarterrest} & \showsymbol{eighthrest} \\ |
| 357 |
\showsymbol{sixteenthrest} \\ |
| 358 |
\midrule |
| 359 |
\showsymbol{Break} \\ |
| 360 |
\bottomrule |
| 361 |
\end{tabular} |
| 362 |
\label{tab:musicsymbols} |
| 363 |
\end{table} |
| 364 |
|
| 365 |
\musicsymbols{} also defines a number of macros for denoting bars. Those |
| 366 |
macros are listed in table~\ref{tab:bar-symbols}. |
| 367 |
|
| 368 |
\begin{table}[htbp] |
| 369 |
\centering |
| 370 |
\newcommand*\showsymbol[1]{\cs{#1}&\csuse{#1}} |
| 371 |
\caption{Bar symbols.} |
| 372 |
\begin{tabular}{llll} |
| 373 |
\toprule |
| 374 |
\bfseries Macro & \bfseries Symbol & |
| 375 |
\bfseries Macro & \bfseries Symbol \\ |
| 376 |
\midrule |
| 377 |
\showsymbol{normalbar} & \showsymbol{leftrepeat} \\ |
| 378 |
\showsymbol{rightrepeat} & \showsymbol{leftrightrepeat} \\ |
| 379 |
\showsymbol{doublebar} & \showsymbol{stopbar} \\ |
| 380 |
\bottomrule |
| 381 |
\end{tabular} |
| 382 |
\label{tab:bar-symbols} |
| 383 |
\end{table} |
| 384 |
|
| 385 |
There are three macros that can be redefined to adjust the appearance of those |
| 386 |
bars: |
| 387 |
\begin{commands} |
| 388 |
\command{normalbarwidth}\Default{.02em} |
| 389 |
The thickness of a bar rule as used in \cs{normalbar}. |
| 390 |
\command{thickbarwidth}\Default{.15em} |
| 391 |
The thickness of the thick bar rules as used for example in |
| 392 |
\cs{leftrepeat} or \cs{stopbar}. |
| 393 |
\command{interbarwidth}\Default{.1em} |
| 394 |
The distance between two bar rules as in \cs{doublebar} or \cs{stopbar}. |
| 395 |
\end{commands} |
| 396 |
|
| 397 |
Finally \musicsymbols{} provides a macro for adding an arbitrary meter: |
| 398 |
\begin{commands} |
| 399 |
\command{meter}[\marg{numerator}\marg{denominator}] |
| 400 |
\sinceversion{0.5}For example \verbcode+\meter{6}{8}+: \meter{6}{8} |
| 401 |
\end{commands} |
| 402 |
|
| 403 |
\clearpage |
| 404 |
\part{The \library*{chords} Library (and the \library*{musejazz} |
| 405 |
Library)}\label{part:chords-library} |
| 406 |
\dictum[Wes Montgomery]{% |
| 407 |
I never practice my guitar -- from time to time I just open the case and |
| 408 |
throw in a piece of raw meat.% |
| 409 |
} |
| 410 |
|
| 411 |
\begin{figure} |
| 412 |
\centering |
| 413 |
\includegraphics[scale=.5,trim=0 22cm 10cm 2cm,clip]{ring-of-fire.pdf} |
| 414 |
\caption{One possible layout for \leadsheets{} mimicking the typewriter |
| 415 |
style.} |
| 416 |
\label{fig:leadsheet} |
| 417 |
\end{figure} |
| 418 |
|
| 419 |
\section{The \cs*{writechord} Command} |
| 420 |
|
| 421 |
\chords{} provides the command \cs{writechord}\marg{chord} for convenient |
| 422 |
typesetting of chords: |
| 423 |
|
| 424 |
\begin{example}[side-by-side] |
| 425 |
\writechord{Bb7(#9)} \writechord{Bbb6} |
| 426 |
\writechord{C#7(b9)} \writechord{C##13} |
| 427 |
\end{example} |
| 428 |
|
| 429 |
\begin{commands} |
| 430 |
\command{chordname}[\marg{chord}] |
| 431 |
Typesetting chords. Inside the argument every \code{\#} will be replaced |
| 432 |
by $\sharp$ and every \code{b} is replaced with $\flat$. Numerals and |
| 433 |
parentheses are typeset as superscripts. Everything between parentheses |
| 434 |
is always a superscript: \verbcode+\writechord{F#7(#11)}+ |
| 435 |
\writechord{F#7(#11)}. |
| 436 |
\command{writechord}[\marg{chord}] |
| 437 |
This command can and actually \emph{should} be used for placing chords |
| 438 |
inline. It transforms the chords according to the options knows the |
| 439 |
options \option{input-notation} and \option{output-notation}. This |
| 440 |
command also transforms the chord according to the options inside of the |
| 441 |
\env{song} environment \option{transpose} and \option{enharmonic} before |
| 442 |
printing it, see also page~\pageref{cs:writechord}. |
| 443 |
\end{commands} |
| 444 |
|
| 445 |
There are several token lists that are treated specially inside \cs{writechord}: |
| 446 |
\begin{labeling}[--]{xxxxx} |
| 447 |
\item[\code{\^{}}] This token is replaced by \cs*{textsuperscript}. |
| 448 |
\item[\code{ma}] The symbol for major chords. Per default this is |
| 449 |
empty. \verbcode+\writechord{Gma}+ \writechord{Gma}. |
| 450 |
\item[\code{mi}] The symbol for minor chords. Per default this is |
| 451 |
\code{m}. \verbcode+\writechord{Gmi}+ \writechord{Gmi}. |
| 452 |
\item[\code{o}] The symbol for diminished chords. Per default this is |
| 453 |
\code{\cs*{textsuperscript}\Marg{o}}. \verbcode+\writechord{Go}+ |
| 454 |
\writechord{Go}. |
| 455 |
\item[\code{+}] The symbol for augmented chords. Per default this is |
| 456 |
\code{\cs*{textsuperscript}\Marg{+}}. \verbcode!\writechord{G+}! |
| 457 |
\writechord{G+}. |
| 458 |
\item[\code{/o}] The symbol for half diminished chords. Per default |
| 459 |
this is \code{\cs*{textsuperscript}\Marg{\cs*{o}\Marg{}}}. |
| 460 |
\verbcode+\writechord{G/o}+ \writechord{G/o}. |
| 461 |
\item[\code{\#}] The \enquote{sharp} symbol. Per default this is |
| 462 |
\cs{sharp}. \verbcode+\writechord{F#}+ \writechord{F#}. |
| 463 |
\item[\code{\#\#}] The \enquote{double sharp} symbol. Per default this is |
| 464 |
\cs{doublesharp}. \verbcode+\writechord{F##}+ \writechord{F##}. |
| 465 |
\item[\code{b}] The \enquote{flat} symbol. Per default this is |
| 466 |
\cs{flat}. \verbcode+\writechord{Eb}+ \writechord{Eb}. |
| 467 |
\item[\code{bb}] The \enquote{double flat} symbol. Per default this is |
| 468 |
\cs{doubleflat}. \verbcode+\writechord{Ebb}+ \writechord{Ebb}. |
| 469 |
\item[\code{b\#}] Cancelling flat/sharp combination: this is removed. |
| 470 |
\item[\code{\#b}] Cancelling sharp/flat combination: this is removed. |
| 471 |
\item[\code{add}] This is superscripted: \verbcode+\writechord{Gadd9}+ |
| 472 |
\writechord{Gadd9}. |
| 473 |
\item[\code{sus}] This is superscripted: \verbcode+\writechord{Gsus4}+ |
| 474 |
\writechord{Gsus4}. |
| 475 |
\item[\code{dim}] This is superscripted: \verbcode+\writechord{Gdim5}+ |
| 476 |
\writechord{Gdim5}. |
| 477 |
\item[\code{maj7}] This is superscripted: \verbcode+\writechord{Gmaj7}+ |
| 478 |
\writechord{Gmaj7}. |
| 479 |
\item[\code{maj9}] This is superscripted: \verbcode+\writechord{Gmaj9}+ |
| 480 |
\writechord{Gmaj9}. |
| 481 |
\end{labeling} |
| 482 |
|
| 483 |
How these token lists are treated depends on optional settings: |
| 484 |
|
| 485 |
\begin{example} |
| 486 |
\setchords{ |
| 487 |
major-seven = $\Delta$ , |
| 488 |
major-nine = $\Delta$\textsuperscript{9} |
| 489 |
} |
| 490 |
\writechord{Gmaj7} \writechord{Gmaj9} |
| 491 |
\writechord{G^6} \writechord{G6} |
| 492 |
\writechord{G7^#5} |
| 493 |
\end{example} |
| 494 |
|
| 495 |
If you want to use the library standalone then you can say: |
| 496 |
\begin{sourcecode} |
| 497 |
\usepackage[minimal]{leadsheets} |
| 498 |
\useleadsheetslibraries{chords} |
| 499 |
\end{sourcecode} |
| 500 |
This also loads the \musicsymbols{} library. |
| 501 |
|
| 502 |
\section{Options} |
| 503 |
|
| 504 |
Options are set with the command |
| 505 |
\begin{commands} |
| 506 |
\command{setchords}[\marg{options}] |
| 507 |
where \meta{options} is a comma separated list of keyval options. |
| 508 |
\end{commands} |
| 509 |
Actually there's a second possibility: options can also be set with the |
| 510 |
command \cs{setleadsheets} (see section~\ref{sec:options}) if they're preceded |
| 511 |
by \code{chords/} (including the slash). |
| 512 |
|
| 513 |
The options allow detailed customization of how chords are printed. It |
| 514 |
doesn't change the input syntax. |
| 515 |
|
| 516 |
\begin{options} |
| 517 |
\keyval{format}{code}\Default |
| 518 |
Code inserted before a chord within the same group. Can be used for |
| 519 |
special formatting of the chords, with \cs*{sffamily}, say. |
| 520 |
\keyval{sharp}{code}\Default{\cs{sharp}} |
| 521 |
The sharp symbol. |
| 522 |
\keyval{flat}{code}\Default{\cs{flat}} |
| 523 |
The flat symbol. |
| 524 |
\keyval{double-sharp}{code}\Default{\cs{doublesharp}} |
| 525 |
The double sharp symbol. |
| 526 |
\keyval{double-flat}{code}\Default{\cs{doubleflat}} |
| 527 |
The double flat symbol. |
| 528 |
\keyval{aug}{code}\Default{+} |
| 529 |
The augmented symbol. |
| 530 |
\keyval{half-dim}{code}\Default{\cs*{o}\Marg{}} |
| 531 |
The half-diminished symbol. |
| 532 |
\keyval{full-dim}{code}\Default{o} |
| 533 |
The diminished symbol. |
| 534 |
\keyval{dim}{code}\Default{\cs*{textsuperscript}\Marg{dim}} |
| 535 |
The token list \code{dim}. |
| 536 |
\keyval{add}{code}\Default{\cs*{textsuperscript}\Marg{add}} |
| 537 |
The token list \code{add}. |
| 538 |
\keyval{sus}{code}\Default{\cs*{textsuperscript}\Marg{sus}} |
| 539 |
The token list \code{sus}. |
| 540 |
\keyval{major}{code}\Default |
| 541 |
The token list \code{ma}. |
| 542 |
\keyval{minor}{code}\Default{m} |
| 543 |
The token list \code{mi}. This option knows a special value. If you set |
| 544 |
\keyis{minor}{lowercase} then minor chords are converted to lowercase |
| 545 |
letters. This means an input \code{Dmi} becomes \code{d}. |
| 546 |
\keyval{major-seven}{code}\Default{\cs*{textsuperscript}\Marg{maj7}} |
| 547 |
The token list \code{maj7}. |
| 548 |
\keyval{major-nine}{code}\Default{\cs*{textsuperscript}\Marg{maj9}} |
| 549 |
The token list \code{maj9}. |
| 550 |
\end{options} |
| 551 |
|
| 552 |
There are further options which concern the different notations of the pitches |
| 553 |
\writechord{B} and \writechord{Bb} in German (and a few other European |
| 554 |
countries) and English. |
| 555 |
\begin{options} |
| 556 |
\keychoice{input-notation}{german,english}\Default{english} |
| 557 |
If\changedversion{0.2} set to \code{german} B should be input as \code{H} |
| 558 |
and B~flat as \code{B}. If set to \code{english} B should be input as |
| 559 |
\code{B} and B~flat as \code{Bb}. |
| 560 |
\keychoice{output-notation}{german,english}\Default{english} |
| 561 |
\setchords{output-notation=german}If\changedversion{0.2} set to |
| 562 |
\code{german} B is output as \writechord{B} and B-flat as \writechord{Bb}. |
| 563 |
\keyval{german-B}{code}\Default{B} |
| 564 |
Customize\sinceversion{0.2} the output of B~flat when |
| 565 |
\keyis{output-notation}{german}. |
| 566 |
\keyval{german-H}{code}\Default{H} |
| 567 |
Customize\sinceversion{0.2} the output of B when |
| 568 |
\keyis{output-notation}{german}. |
| 569 |
\end{options} |
| 570 |
|
| 571 |
Let's see a few examples for the \option{input-notation} and |
| 572 |
\option{output-notation} options. |
| 573 |
|
| 574 |
\begin{example} |
| 575 |
input and output English:\par |
| 576 |
\writechord{Bb} \writechord{B} \writechord{B#}\par |
| 577 |
\writechord{B} \writechord{H} \writechord{H#}\par |
| 578 |
\medskip |
| 579 |
|
| 580 |
\setchords{input-notation=german} |
| 581 |
input German and output English:\par |
| 582 |
\writechord{Bb} \writechord{B} \writechord{B#}\par |
| 583 |
\writechord{B} \writechord{H} \writechord{H#}\par |
| 584 |
\medskip |
| 585 |
|
| 586 |
\setchords{output-notation=german} |
| 587 |
input and output German:\par |
| 588 |
\writechord{Bb} \writechord{B} \writechord{B#}\par |
| 589 |
\writechord{B} \writechord{H} \writechord{H#}\par |
| 590 |
|
| 591 |
\medskip |
| 592 |
\setchords{input-notation=english} |
| 593 |
input English and output German:\par |
| 594 |
\writechord{Bb} \writechord{B} \writechord{B#}\par |
| 595 |
\writechord{B} \writechord{H} \writechord{H#} |
| 596 |
\end{example} |
| 597 |
|
| 598 |
\section{The \library*{musejazz} Library}\label{sec:musejazz-libr} |
| 599 |
|
| 600 |
The \musejazz\ library extends the \chords\ library to use |
| 601 |
MuseScore's\footnote{\url{http://musescore.com/}} font \enquote{MuseJazz Text} |
| 602 |
for the chord symbols. The library contains the two lines which explains why |
| 603 |
it requires \LuaLaTeX\ or \XeLaTeX. Well, and the font, obviously. |
| 604 |
|
| 605 |
\begin{sourcecode} |
| 606 |
\RequirePackage{fontspec} |
| 607 |
\newfontfamily\musejazz{MuseJazz Text} |
| 608 |
\end{sourcecode} |
| 609 |
|
| 610 |
Here is a small example of it's usage and the outcome: |
| 611 |
|
| 612 |
\begin{example}[compile,program=xelatex,max-pages=1,add-frame=false] |
| 613 |
% compile with LuaLaTeX or XeLaTeX |
| 614 |
\documentclass[margin=4mm]{standalone} |
| 615 |
\usepackage{leadsheets} |
| 616 |
\useleadsheetslibrary{musejazz} |
| 617 |
\begin{document} |
| 618 |
\Huge\writechord{Bb7(#9)}\space\writechord{F##9} |
| 619 |
\end{document} |
| 620 |
\end{example} |
| 621 |
|
| 622 |
\clearpage |
| 623 |
\part{The \library*{songs} Library}\label{part:leadsheets-songs-library} |
| 624 |
\dictum[Jeff Beck]{% |
| 625 |
I don't care about the rules. If I don't break the rules at least ten |
| 626 |
times every song then I'm not doing my job.% |
| 627 |
} |
| 628 |
|
| 629 |
\section{Background} |
| 630 |
|
| 631 |
The \leadsheets{} package allows for easy creation of leadsheets but it also |
| 632 |
can be used to create complete songbooks. The basic idea is that songs are |
| 633 |
typeset in the \env{song} environment. Each song gets a number of properties |
| 634 |
(see section~\ref{sec:song-properties}) that determine how the title of the |
| 635 |
song is typeset. For the typesetting of the titles a template mechanism is |
| 636 |
used (see section~\ref{sec:title-templates}). Songs can also be tagged. The |
| 637 |
tags then allow to typeset only songs matching a list of tags that is |
| 638 |
specified via an option. |
| 639 |
|
| 640 |
\begin{figure} |
| 641 |
\centering |
| 642 |
\includegraphics[width=.9\linewidth]{liederbuechlein.jpg} |
| 643 |
\caption{Even before officially publishing this bundle I used it for |
| 644 |
typesetting a small songbook!} |
| 645 |
\label{fig:liederbuch} |
| 646 |
\end{figure} |
| 647 |
|
| 648 |
\section{The \env*{song} Environment} |
| 649 |
|
| 650 |
\begin{environments} |
| 651 |
\environment{song}[\oarg{options}\marg{properties}] |
| 652 |
The main environment used to typeset songs. It has a mandatory argument |
| 653 |
where the song's properties are set |
| 654 |
(\cf\ section~\ref{sec:song-properties}). It also has an optional |
| 655 |
argument for setting options specific to the song. |
| 656 |
\end{environments} |
| 657 |
|
| 658 |
\subsection{A First Example} |
| 659 |
First let's take a look at an example: |
| 660 |
|
| 661 |
\begin{example}[ |
| 662 |
compile, |
| 663 |
graphics={trim={2cm 18cm 2cm 2cm},clip}, |
| 664 |
add-sourcecode-options={literate=}] |
| 665 |
\documentclass{article} |
| 666 |
\usepackage{leadsheets} |
| 667 |
\begin{document} |
| 668 |
|
| 669 |
\begin{song}{title={Mary Had A Little Lamb}, music={Stevie Ray Vaughan}, |
| 670 |
lyrics={traditional}, tags={srv,blues}} |
| 671 |
\begin{verse} |
| 672 |
Mary had a little lamb \\ |
| 673 |
Its fleece was white as snow, yea \\ |
| 674 |
Everywhere the child went \\ |
| 675 |
The little lamb was sure to go, yea |
| 676 |
\end{verse} |
| 677 |
\begin{verse} |
| 678 |
He followed her to school one day \\ |
| 679 |
And broke the teacher's rule \\ |
| 680 |
What a time did they have \\ |
| 681 |
That day at school |
| 682 |
\end{verse} |
| 683 |
\end{song} |
| 684 |
|
| 685 |
\end{document} |
| 686 |
\end{example} |
| 687 |
|
| 688 |
Per default the songtitle simply is a \cs{section}\sarg{} without any other |
| 689 |
additions. This is the songtitle template \titletemplate{minimal}, see |
| 690 |
section~\ref{sec:title-templates} for more details on those templates and how |
| 691 |
to create your own. |
| 692 |
|
| 693 |
\subsection{Using the \env*{song} Environment} |
| 694 |
|
| 695 |
Inside the \env{song} environment a number of additional environments are used |
| 696 |
to specify the different parts of a song. They all are basically the same |
| 697 |
kind of environment, namely an \env*{itemize} environment internally where the |
| 698 |
only \cs*{item} has the name of the environment as option. The \env{verse} |
| 699 |
environment is a little bit different since verses can be numbered. If they |
| 700 |
are then each usage of \env{verse} inside \env{song} will step a verse number |
| 701 |
and print it (as option to the internal \cs*{item}). |
| 702 |
|
| 703 |
\begin{environments} |
| 704 |
\environment{verse}[\oarg{options}] |
| 705 |
An environment for specifying the verses of a song. |
| 706 |
\environment{chorus}[\oarg{options}] |
| 707 |
An environment for specifying the chorus of a song.\\ |
| 708 |
This is the same as \beginenv*\Marg{verse}\Oarg{type=chorus,\meta{options}}. |
| 709 |
\environment{intro}[\oarg{options}] |
| 710 |
An environment for specifying the intro of a song.\\ |
| 711 |
This is the same as \beginenv*\Marg{verse}\Oarg{type=intro,\meta{options}}. |
| 712 |
\environment{interlude}[\oarg{options}] |
| 713 |
An environment for specifying an interlude of a song.\\ |
| 714 |
This is the same as \beginenv*\Marg{verse}\Oarg{type=interlude,\meta{options}}. |
| 715 |
\environment{bridge}[\oarg{bridge}] |
| 716 |
An environment for specifying a bridge of a song.\\ |
| 717 |
This is the same as \beginenv*\Marg{verse}\Oarg{type=bridge,\meta{options}}. |
| 718 |
\end{environments} |
| 719 |
|
| 720 |
These environments and their options are described in more detail in |
| 721 |
sections~\ref{sec:envverse-environment} and~\ref{sec:other-envverse-like}. |
| 722 |
|
| 723 |
\subsection{Options}\label{sec:options} |
| 724 |
|
| 725 |
The options to the \env{song} environment are the same as the general options |
| 726 |
of \leadsheets. This means you can set the following options either local to |
| 727 |
a song or global for the whole document with this command: |
| 728 |
|
| 729 |
\begin{commands} |
| 730 |
\command{setleadsheets}[\marg{options}] |
| 731 |
Setup command for \leadsheets. |
| 732 |
\end{commands} |
| 733 |
|
| 734 |
Although I used the word \enquote{global} above \emph{all options are local to |
| 735 |
the current scope}! |
| 736 |
|
| 737 |
\begin{options} |
| 738 |
\keyval{title-template}{template name}\Default{minimal} |
| 739 |
The songtitle template, see section~\ref{sec:title-templates} for |
| 740 |
details. |
| 741 |
\keyval{chord-cs}{cs}\Default{\cs*{chordname}} |
| 742 |
The command that is used to parse the chords. See |
| 743 |
section~\ref{sec:placing-chords} for details. \meta{cs} needs to be a |
| 744 |
command that takes a mandatory argument. |
| 745 |
\keyval{song-format}{code}\Default |
| 746 |
\meta{code} is inserted \emph{before} the song title at the |
| 747 |
beginning of the \env{song} environment. |
| 748 |
\keyval{text-format}{code}\Default |
| 749 |
\meta{code} is inserted \emph{after} the song title at the |
| 750 |
beginning of the \env{song} environment. |
| 751 |
\keyval{before-song}{code}\Default |
| 752 |
\meta{code}\sinceversion{0.3} is inserted at the beginning of a song |
| 753 |
\emph{before} the title! |
| 754 |
\keyval{after-song}{code}\Default |
| 755 |
\meta{code}\sinceversion{0.3} is inserted after the whole song. |
| 756 |
\keyval{after-title}{code}\Default |
| 757 |
\meta{code}\sinceversion{0.3} is inserted after the title of the song but |
| 758 |
before the body of the environment. |
| 759 |
% \keybool{numbered}\Default{false} |
| 760 |
% Determines wether verses are numbered or not. |
| 761 |
\keyval{print-tags}{list of tags} |
| 762 |
A comma separated list of tags. When specified a song will only be printed |
| 763 |
if it is tagged with at least one of the tags in \meta{list of tags}. |
| 764 |
\keyval{add-to-reset}{list of counters} |
| 765 |
A\sinceversion{0.3} comma separated list of counters which should be |
| 766 |
reset for each song. |
| 767 |
\keybool{obey-lines}\Default{false} |
| 768 |
An experimental option. Use at your own risk! If set to \code{true} then |
| 769 |
inside the \env{verse} like environments end-of-lines will be obeyed and |
| 770 |
start a new line. This comes with a price when using chords, see |
| 771 |
section~\ref{sec:placing-chords:caveat}. |
| 772 |
\keybool{bar-shortcuts}\Default{false} |
| 773 |
Makes the characters \shortcut{:} and \shortcut{\barsymbol} active inside |
| 774 |
the \env{song} environment. See sections~\ref{sec:special-characters} |
| 775 |
and~\ref{sec:typesetting-bars} for more details. |
| 776 |
\keybool{disable-measuring}\Default{false} |
| 777 |
\sinceversion{0.4}This option turns off the song height measuring. This |
| 778 |
makes song title template definitions easier (see section~\ref{sec:title-templates} for |
| 779 |
details). \emph{The song property \property{height} will be set to 0pt then!} |
| 780 |
\end{options} |
| 781 |
|
| 782 |
\subsection{Song Properties}\label{sec:song-properties} |
| 783 |
|
| 784 |
Songs can have a number of properties which basically are used in songtitle |
| 785 |
templates (see section~\ref{sec:title-templates}). One specific property, |
| 786 |
\property{tags}, plays a different role, though. |
| 787 |
|
| 788 |
\begin{properties} |
| 789 |
\prop{title}{title} |
| 790 |
This is the main title of the song. |
| 791 |
\prop{subtitle}{subtitle} |
| 792 |
A subtitle. |
| 793 |
\prop{short-title}{short song title} |
| 794 |
A short title (may be useful in a template that writes the titles in |
| 795 |
\cs*{section}s for a version to be used in the table of contents). |
| 796 |
\prop{sort-title}{song title} |
| 797 |
If not set explicitly this property holds the same value as |
| 798 |
\property{title}. |
| 799 |
\prop{sort-short-title}{short song title} |
| 800 |
If not set explicitly this property holds the same value as |
| 801 |
\property{short-title}. |
| 802 |
\prop{composer}{composer} |
| 803 |
The composer of the song. As of now this accepts an arbitrary entry but |
| 804 |
maybe this will not be supported any more when indexing will be |
| 805 |
implemented. No promises. |
| 806 |
\prop{sort-composer}{composer} |
| 807 |
If not set explicitly this property holds the same value as |
| 808 |
\property{composer}. |
| 809 |
\prop{lyrics}{writer} |
| 810 |
Whoever wrote the lyrics if different from the composer. As of now this |
| 811 |
accepts an arbitrary entry but maybe this will not be supported any more |
| 812 |
when indexing will be implemented. No promises. |
| 813 |
\prop{sort-lyrics}{writer} |
| 814 |
If not set explicitly this property holds the same value as |
| 815 |
\property{writer}. |
| 816 |
\prop{arr}{arranger} |
| 817 |
Whoever arranged the song. As of now this accepts an arbitrary entry but |
| 818 |
maybe this will not be supported any more when indexing will be |
| 819 |
implemented. No promises. |
| 820 |
\prop{sort-arr}{arranger} |
| 821 |
If not set explicitly this property holds the same value as |
| 822 |
\property{arr}. |
| 823 |
\prop{band}{band} |
| 824 |
The band who plays or played the song. |
| 825 |
\prop{sort-band}{band} |
| 826 |
If not set explicitly this property holds the same value as |
| 827 |
\property{band}. |
| 828 |
\prop{interpret}{interpret} |
| 829 |
The interpret of the song. As of now this accepts an arbitrary entry but |
| 830 |
maybe this will not be supported any more when indexing will be |
| 831 |
implemented. No promises. |
| 832 |
\prop{sort-interpret}{interpret} |
| 833 |
If not set explicitly this property holds the same value as |
| 834 |
\property{interpret}. |
| 835 |
\prop{genre}{genre} |
| 836 |
The genre of the song. |
| 837 |
\prop{key}{key} |
| 838 |
The key of the song. This property is used for transposing and must have |
| 839 |
a specific format then, see section~\ref{sec:transposing}. |
| 840 |
\prop{capo}{fret} |
| 841 |
This property is used for transposing and for the \cs{capo} macro, see |
| 842 |
sections~\ref{sec:capo-information} and~\ref{sec:transposing} . |
| 843 |
\prop{tempo}{tempo} |
| 844 |
The tempo of the song. |
| 845 |
\prop{tags}{tags} |
| 846 |
A comma separated list of tags. Those tags play a role for the option |
| 847 |
\option{print-tags}. When that option is used a song is only printed if |
| 848 |
it has at least one of the tags specified in the option. |
| 849 |
\end{properties} |
| 850 |
|
| 851 |
There are three more properties, \property{counter}, \property{ID} and |
| 852 |
\property{height} that cannot be set but are set automatically for each song. |
| 853 |
The \property{counter} simply holds the number of the current song starting |
| 854 |
from \code{1} for the first song. The \property{ID} currently always is |
| 855 |
\code{song\meta{counter}} where \meta{counter} is the current |
| 856 |
\property{counter} value. The property \property{height} holds the height of |
| 857 |
the typeset song in pt. The height is determined by placing the body of the |
| 858 |
respective \env{song} environment in a vertical box and measuring the height |
| 859 |
and depth of the box. This is done in a measuring phase that can and should |
| 860 |
be tested in a songtitle template definition, see |
| 861 |
section~\ref{sec:title-templates} for details. \emph{This is important since |
| 862 |
the property \property{height} is not available in the measuring phase but |
| 863 |
only afterwards!} If the option \option{disable-measuring} has been set the |
| 864 |
property \property{height} will have the value~0pt! |
| 865 |
|
| 866 |
In principle all properties can get list of entries where items are separated |
| 867 |
with \code{\visualizespaces{ and }}. Of course this doesn't make sense for |
| 868 |
each property -- a song does only have one title. But a song can very well |
| 869 |
have more than one composer: think of the Beatles where most songs were |
| 870 |
written by Paul McCartney and John Lennon\footnote{This is not quite true: |
| 871 |
most songs were mostly written either by Paul or John but legally usually |
| 872 |
both are the composers.}. |
| 873 |
|
| 874 |
It is possibly to define further such properties. For details see |
| 875 |
section~\ref{sec:own-templates}. |
| 876 |
|
| 877 |
\subsection{Special Characters}\label{sec:special-characters} |
| 878 |
Inside the \env{song} environment several characters don't have their usual |
| 879 |
catecory codes: |
| 880 |
\begin{labeling}[--]{xxxxx} |
| 881 |
\item[\shortcut{\textasciicircum}] category code 13 (active). It is a |
| 882 |
shortcut for the \cs{chord} command. |
| 883 |
\item[\shortcut{\_}] category code 13 (active). It is a shortcut for the |
| 884 |
\cs{writechord} command. |
| 885 |
\item[\shortcut{\barsymbol}] category code 13 (active). Used for |
| 886 |
typesetting bars. |
| 887 |
\item[\shortcut{:}] category code 13 (active). Used for typesetting bars. |
| 888 |
\item[\code{\#}] category code 12 (other). Used for chord names. |
| 889 |
\end{labeling} |
| 890 |
|
| 891 |
Actually the characters \shortcut{\barsymbol} and \shortcut{:} are \emph{not} |
| 892 |
changed per default. In order to do that you have to use the option |
| 893 |
\option{bar-shortcuts}. |
| 894 |
|
| 895 |
For details on the usage of the characters \shortcut{\barsymbol} and |
| 896 |
\shortcut{:} see section~\ref{sec:typesetting-bars}. The usage of chords is |
| 897 |
explained in section~\ref{sec:placing-chords}. |
| 898 |
|
| 899 |
\subsection{Capo Information}\label{sec:capo-information} |
| 900 |
When you set the \property{capo} property the macro \cs{capo} writes |
| 901 |
\begin{center} |
| 902 |
\GetTranslation{leadsheets/capo}: IV.~\GetTranslation{leadsheets/fret} |
| 903 |
\end{center} |
| 904 |
What it writes \emph{exactly} depends on a few settings: the \property{capo} |
| 905 |
property obviously, which determines the number that is printed. The |
| 906 |
translations for the \enquote{capo} and \enquote{fret} strings (see |
| 907 |
section~\ref{sec:internationalization} for details) and the setting of the |
| 908 |
following option: |
| 909 |
\begin{options} |
| 910 |
\keychoice{capo-nr-format}{arabic,roman,Roman}\Default{Roman} |
| 911 |
The format of the number printed by the \cs{capo} macro. |
| 912 |
\keyval{capo-nr}{code}\Default{\#1.} |
| 913 |
The code to print the number. In the code refer to the number with |
| 914 |
\code{\#1}. |
| 915 |
\end{options} |
| 916 |
|
| 917 |
\section{The \env*{verse} Environment}\label{sec:envverse-environment} |
| 918 |
|
| 919 |
\begin{environments} |
| 920 |
\environment{verse}[\oarg{options}] |
| 921 |
An environment for specifying the verses of a song. |
| 922 |
\environment{verse*}[\oarg{options}] |
| 923 |
The same as the \env{verse} environment but will always be unnumbered |
| 924 |
regardless of any option settings. |
| 925 |
\end{environments} |
| 926 |
|
| 927 |
\begin{example}[ |
| 928 |
compile, |
| 929 |
graphics={trim={2cm 18cm 2cm 2cm},clip}, |
| 930 |
add-sourcecode-options={literate=}] |
| 931 |
\documentclass{article} |
| 932 |
\usepackage{leadsheets} |
| 933 |
\setleadsheets{verse/numbered=true} |
| 934 |
\begin{document} |
| 935 |
|
| 936 |
\begin{song}{title=Foo} |
| 937 |
\begin{verse} |
| 938 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\\ |
| 939 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore\\ |
| 940 |
magna aliquyam erat, sed diam voluptua. |
| 941 |
\end{verse} |
| 942 |
\begin{verse*} |
| 943 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\\ |
| 944 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore\\ |
| 945 |
magna aliquyam erat, sed diam voluptua. |
| 946 |
\end{verse*} |
| 947 |
\begin{verse} |
| 948 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\\ |
| 949 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore\\ |
| 950 |
magna aliquyam erat, sed diam voluptua. |
| 951 |
\end{verse} |
| 952 |
\end{song} |
| 953 |
|
| 954 |
\end{document} |
| 955 |
\end{example} |
| 956 |
|
| 957 |
\subsection{Options}\label{sec:verses-options} |
| 958 |
|
| 959 |
The \env{verse} environment and all related environments have the following |
| 960 |
options: |
| 961 |
|
| 962 |
\begin{options} |
| 963 |
\keyval{format}{code}\Default |
| 964 |
\meta{code} is inserted at the beginning of the environment and can thus |
| 965 |
be used to add formatting, \eg, \keyis{format}{\cs*{itshape}}. |
| 966 |
\keyval{label-format}{code}\Default |
| 967 |
The same for the environment labels. The last command may take the label |
| 968 |
as an argument so you can also use \cs*{textbf} for example. |
| 969 |
\keyval{class}{class-name}\Default{default} |
| 970 |
The\sinceversion{0.2} \env{verse} environment and all related environments |
| 971 |
all belong to a class, the default class is called \code{default}. This |
| 972 |
is of interest when using the \option{remember-chords} and |
| 973 |
\option{recall-chords} options.\label{option:class} |
| 974 |
\end{options} |
| 975 |
|
| 976 |
This can be used either locally, \ie, as option to the corresponding |
| 977 |
environment, or for all environments of the same type using the setup command |
| 978 |
using the following syntax: |
| 979 |
|
| 980 |
\begin{center} |
| 981 |
\cs{setleadsheets}\Marg{\meta{env name}/format = \meta{code}} |
| 982 |
\end{center} |
| 983 |
|
| 984 |
\begin{example} |
| 985 |
\begin{verse}[format=\itshape] |
| 986 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\\ |
| 987 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore\\ |
| 988 |
magna aliquyam erat, sed diam voluptua. |
| 989 |
\end{verse} |
| 990 |
\end{example} |
| 991 |
|
| 992 |
It is also possible so set the formatting for all related environments at |
| 993 |
once: |
| 994 |
\begin{options} |
| 995 |
\keyval{verses-format}{code}\Default |
| 996 |
Sets the format for all \env{verse} like environments. |
| 997 |
\keyval{verses-label-format}{code}\Default |
| 998 |
Sets the label format for all \env{verse} like environments. |
| 999 |
\end{options} |
| 1000 |
Both options are overwritten if the options for a specific environment are |
| 1001 |
set. That is, if you want all environments to have italic shape except for |
| 1002 |
choruses, then you could do |
| 1003 |
\begin{sourcecode} |
| 1004 |
\setleadsheets{ |
| 1005 |
verses-format = \itshape , |
| 1006 |
chorus/format = |
| 1007 |
} |
| 1008 |
\end{sourcecode} |
| 1009 |
|
| 1010 |
\section{Placing Chords}\label{sec:placing-chords} |
| 1011 |
|
| 1012 |
\subsection{The Commands} |
| 1013 |
Inside the \env{song} environment the characters \shortcut{\textasciicircum} |
| 1014 |
and \code{\_} are active characters\footnote{There are more characters with a |
| 1015 |
special function, see |
| 1016 |
section~\ref{sec:special-characters}}. \shortcut{\textasciicircum} is a |
| 1017 |
shortcut for the command \cs{chord}, \shortcut{\_} is a shortcut for |
| 1018 |
\cs{writechord}. Those commands have the following functions: |
| 1019 |
|
| 1020 |
\begin{commands} |
| 1021 |
\command{chord}[\sarg\symarg{-}\marg{chord}\meta{text}\visiblespace] |
| 1022 |
Places \meta{chord} centered above \meta{text}. The starred version |
| 1023 |
gobbles the trailing space while the unstarred version does not. Like the |
| 1024 |
star the dash is optional. It sets the option \option{smash-next-chord} |
| 1025 |
to \code{true}. \meta{text} may be empty but the trailing space |
| 1026 |
\emph{must} be there. If \meta{text} is empty then the chord is place |
| 1027 |
above some horizontal space which can be set with the option |
| 1028 |
\option{empty-chord-dim}. |
| 1029 |
\command{writechord}[\marg{chord}] |
| 1030 |
This command transforms the chord according to the options |
| 1031 |
\option{transpose} and \option{enharmonic} before printing it. This |
| 1032 |
command can/should be used for placing chords inline or for typesetting |
| 1033 |
the \property{key} property in a template. The command is used by |
| 1034 |
\cs{chord} for the actual printing. The command also transforms the |
| 1035 |
chords according to the options \option{input-notation} and |
| 1036 |
\option{output-notation}.\label{cs:writechord} |
| 1037 |
\end{commands} |
| 1038 |
|
| 1039 |
\begin{example}[side-by-side] |
| 1040 |
Text \chord{E7}text \chord*{B7}lon ger text |
| 1041 |
\end{example} |
| 1042 |
|
| 1043 |
\subsection{Usage} |
| 1044 |
Note that per default the width of a chord is not ignored: |
| 1045 |
\begin{example}[side-by-side] |
| 1046 |
text \chord{Gbmi7(b5)}text text |
| 1047 |
\end{example} |
| 1048 |
However, there is an option which sets the width of a chord to zero: |
| 1049 |
\begin{options} |
| 1050 |
\keybool{smash-chords}\Default{false} |
| 1051 |
If set to true the width of the chords set with \cs{chord} is set to |
| 1052 |
zero. |
| 1053 |
\keybool{smash-next-chord}\Default{false} |
| 1054 |
If set to true the width of the next chord set with \cs{chord} is set to |
| 1055 |
zero. |
| 1056 |
\end{options} |
| 1057 |
\begin{example}[side-by-side] |
| 1058 |
\setleadsheets{smash-next-chord=true} |
| 1059 |
text \chord{Gbmi7(b5)}text text \par |
| 1060 |
text \chord{Gbmi7(b5)}text text \par |
| 1061 |
\setleadsheets{smash-chords=true} |
| 1062 |
text \chord{Gbmi7(b5)}text text \par |
| 1063 |
text \chord{Gbmi7(b5)}text text |
| 1064 |
\end{example} |
| 1065 |
|
| 1066 |
Before we forget -- there are more options: |
| 1067 |
\begin{options} |
| 1068 |
\keyval{empty-chord-dim}{dim}\Default{1em} |
| 1069 |
The horizontal space that is inserted if the \meta{text} argument of |
| 1070 |
\cs{chord} is empty. |
| 1071 |
\keyval{align-chords}{col}\Default{c} |
| 1072 |
Determines how a chord is aligned with respect to the word it is placed |
| 1073 |
above of. Valid input is any valid \env*{tabular} column identifier. |
| 1074 |
\keybool{print-chords}\Default{true} |
| 1075 |
If set to false \cs{chord} won't print the chord but will do nothing |
| 1076 |
instead. This options does not affect \cs{writechord}. |
| 1077 |
\end{options} |
| 1078 |
|
| 1079 |
While \cs{chord} is available in the whole document the |
| 1080 |
\code{\textasciicircum} syntax is -- as mentioned before -- only available |
| 1081 |
inside of the \env{song} environment. |
| 1082 |
|
| 1083 |
\begin{example}[ |
| 1084 |
compile, |
| 1085 |
graphics={trim={2cm 16cm 2cm 4cm},clip}, |
| 1086 |
add-sourcecode-options={literate=}] |
| 1087 |
\documentclass{article} |
| 1088 |
\usepackage{leadsheets} |
| 1089 |
\begin{document} |
| 1090 |
|
| 1091 |
\begin{song}{title={Mary Had A Little Lamb}, music={Stevie Ray Vaughan}, |
| 1092 |
lyrics={traditional}, tags={srv,blues}} |
| 1093 |
\begin{verse} |
| 1094 |
^{E7} Mary had a little lamb ^{A7} \\ |
| 1095 |
Its fleece was white as ^{E7}snow, yea \\ |
| 1096 |
Everywhere the child ^{B7}went ^{A7} \\ |
| 1097 |
The little lamb was sure to ^{E7}go, yea |
| 1098 |
\end{verse} |
| 1099 |
\begin{verse} |
| 1100 |
^{E7} He followed her to school one day ^{A7} \\ |
| 1101 |
And broke the teacher's ^{E7}rule \\ |
| 1102 |
What a time did they ^{B7}have ^{A7} \\ |
| 1103 |
That day at ^{E7}school |
| 1104 |
\end{verse} |
| 1105 |
\end{song} |
| 1106 |
|
| 1107 |
\end{document} |
| 1108 |
\end{example} |
| 1109 |
|
| 1110 |
You've probably noticed: chords are printed with \cs{chordname} in the default |
| 1111 |
setting. You can change this with the option \option{chord-cs}. If you do |
| 1112 |
then keep in mind that the input syntax will also change. |
| 1113 |
|
| 1114 |
\subsection{Caveat}\label{sec:placing-chords:caveat} |
| 1115 |
|
| 1116 |
If you use \keyis{obey-lines}{true} you have to be careful when you place |
| 1117 |
chords. If you place a chord over the last word in a line |
| 1118 |
\begin{sourcecode} |
| 1119 |
^{F#mi} You've been ^*{B}run nin', ^*{E}hid in' much too ^{A}long. |
| 1120 |
\end{sourcecode} |
| 1121 |
then the end of line that is used as the mandatory space argument for |
| 1122 |
\cs{chord} may not be recognized as an end of line. Even worse: at the end of |
| 1123 |
a \env{verse} like environment this may cause non-obvious errors. So if |
| 1124 |
you're getting in trouble in these cases you should always insert an explicit |
| 1125 |
space, \eg. by one of the following methods: |
| 1126 |
\begin{sourcecode} |
| 1127 |
^{F#mi} You've been ^*{B}run nin', ^*{E}hid in' much too ^{A}long. {} |
| 1128 |
^{F#mi} You've been ^*{B}run nin', ^*{E}hid in' much too ^{A}long. \empty |
| 1129 |
^{F#mi} You've been ^*{B}run nin', ^*{E}hid in' much too ^{A}long. \relax |
| 1130 |
\end{sourcecode} |
| 1131 |
|
| 1132 |
\subsection{Remembering Chords}\label{sec:remembering-chords} |
| 1133 |
\leadsheets{} has the option |
| 1134 |
\begin{options} |
| 1135 |
\keybool{remember-chords}\Default{false} |
| 1136 |
If set to \code{true} the chords in the \emph{first} appearance of a |
| 1137 |
\env{verse} like environment are remembered. In the next appearances of |
| 1138 |
said environment the shortcut \shortcut{\textasciicircum} has changed its |
| 1139 |
meaning and inserts a chord automatically. |
| 1140 |
\end{options} |
| 1141 |
|
| 1142 |
Let's take at look at an example to see what this means: |
| 1143 |
\begin{example} |
| 1144 |
\definesongtitletemplate{empty}{} |
| 1145 |
\begin{song}[verse/numbered,remember-chords,title-template=empty]{title=foobar} |
| 1146 |
\begin{verse} |
| 1147 |
^{G}Lorem ipsum ^{C}dolor sit ^{E7}amet, consetetur ^{Bb7(b5)}sadipscing |
| 1148 |
\end{verse} |
| 1149 |
\begin{verse} |
| 1150 |
^Lorem ipsum ^dolor sit ^amet, consetetur ^sadipscing |
| 1151 |
\end{verse} |
| 1152 |
\end{song} |
| 1153 |
\end{example} |
| 1154 |
In this example the chords used in the first \env{verse} environment have been |
| 1155 |
remembered and in the second \env{verse} environment the |
| 1156 |
\shortcut{\textasciicircum} shortcut inserted the corresponding chords in the |
| 1157 |
order they had been specified the first time. It is important when using this |
| 1158 |
that you don't use the \shortcut{\textasciicircum} shortcut in subsequent |
| 1159 |
environments more often than the first time. It will produce an error |
| 1160 |
otherwise. You can use it less, of course. |
| 1161 |
|
| 1162 |
The \shortcut{\textasciicircum} shortcut still has the \emph{the same} syntax |
| 1163 |
as \cs{chord} with one exception: it lacks the mandatory argument |
| 1164 |
\meta{chord} (since it's obviously not needed). It has the optional \sarg{} |
| 1165 |
and \code{-}, though, as well as the mandatory space (\visiblespace)! |
| 1166 |
|
| 1167 |
\emph{Please note that \shortcut{\textasciicircum} \emph{can't} be the last |
| 1168 |
token in a line! It then should be followed by a space an an empty group -- |
| 1169 |
similar to the caveat in section~\ref{sec:placing-chords:caveat}.} |
| 1170 |
|
| 1171 |
Each \env{verse} like environment (see section~\ref{sec:other-envverse-like} |
| 1172 |
for more information) is treated uniquely by this mechanism: |
| 1173 |
|
| 1174 |
\begin{example} |
| 1175 |
\definesongtitletemplate{empty}{} |
| 1176 |
\begin{song}[verse/numbered,remember-chords,title-template=empty]{title=foobar} |
| 1177 |
\begin{verse} |
| 1178 |
^{G}Lorem ipsum ^{C}dolor sit ^{E7}amet, consetetur ^{Bb7(b5)}sadipscing |
| 1179 |
\end{verse} |
| 1180 |
\begin{chorus} |
| 1181 |
^{F}Lorem ipsum ^{Gmi}dolor sit amet, consetetur ^{C7}sadipscing |
| 1182 |
\end{chorus} |
| 1183 |
\begin{verse} |
| 1184 |
^Lorem ipsum ^dolor sit ^amet, consetetur ^sadipscing |
| 1185 |
\end{verse} |
| 1186 |
\begin{chorus} |
| 1187 |
^Lorem ipsum ^dolor sit amet, consetetur ^sadipscing |
| 1188 |
\end{chorus} |
| 1189 |
\end{song} |
| 1190 |
\end{example} |
| 1191 |
|
| 1192 |
This is important: \env{verse} and \env{verse*} are treated as two different |
| 1193 |
environments, the same holds for all starred \env{verse} like environments! |
| 1194 |
If you want to recall the chords of a different type of environment, then you |
| 1195 |
can use the option \option{recall-chords}: |
| 1196 |
|
| 1197 |
\begin{example} |
| 1198 |
\definesongtitletemplate{empty}{} |
| 1199 |
\begin{song}[verse/numbered,remember-chords,title-template=empty]{title=foobar} |
| 1200 |
\begin{verse} |
| 1201 |
^{G}Lorem ipsum ^{C}dolor sit ^{E7}amet, consetetur ^{Bb7(b5)}sadipscing |
| 1202 |
\end{verse} |
| 1203 |
\begin{chorus} |
| 1204 |
^{F}Lorem ipsum ^{Gmi}dolor sit amet, consetetur ^{C7}sadipscing |
| 1205 |
\end{chorus} |
| 1206 |
\begin{verse} |
| 1207 |
^Lorem ipsum ^dolor sit ^amet, consetetur ^sadipscing |
| 1208 |
\end{verse} |
| 1209 |
\begin{chorus}[recall-chords=verse-default] |
| 1210 |
^Lorem ipsum ^dolor sit amet, consetetur ^sadipscing |
| 1211 |
\end{chorus} |
| 1212 |
\end{song} |
| 1213 |
\end{example} |
| 1214 |
|
| 1215 |
\section{Transposing}\label{sec:transposing} |
| 1216 |
Provided a song has the property \property{key} \emph{and} the key is given as |
| 1217 |
one of the twelve \enquote{usual} keys, \ie, one of the keys given in |
| 1218 |
table~\ref{tab:key-signatures}, the chords of a song can be transposed. |
| 1219 |
|
| 1220 |
\begin{options} |
| 1221 |
\keyval{transpose}{number} |
| 1222 |
Transposes the chords of a song by \meta{number} of semitones. |
| 1223 |
\meta{number} can be a negative number, then the chords are transposed |
| 1224 |
down. |
| 1225 |
\keychoice{enharmonic}{sharp,flat} |
| 1226 |
Suppose you transpose a song in the key of \writechord{E} down a semitone. |
| 1227 |
\leadsheets{} will then transpose to the key of \writechord{Eb}. It always |
| 1228 |
chooses the key whose signature has less accidentals. You can force a |
| 1229 |
variant, though, by using this option. With \keyis{enharmonic}{sharp} |
| 1230 |
\leadsheets{} would have chosen \writechord{D#} instead of \writechord{Eb}. |
| 1231 |
\keybool{transpose-capo} |
| 1232 |
When this is set to true chords are transposed down on semitone per capo |
| 1233 |
fret. |
| 1234 |
\end{options} |
| 1235 |
|
| 1236 |
The transposing mechanism relies on the \chords{} input syntax which means |
| 1237 |
that if you change \option{chord-cs} horrible things may happen. \emph{So |
| 1238 |
don't change \option{chord-cs} and use \option{transpose} at the same time!} |
| 1239 |
|
| 1240 |
\begin{table}[htbp] |
| 1241 |
\centering |
| 1242 |
\catcode`\#=12 |
| 1243 |
\catcode`\!=6 |
| 1244 |
\def\showsignature!1{\writechord{!1}&\code{!1}}% |
| 1245 |
\caption{Allowed keys for the \property{key} property.} |
| 1246 |
\begin{tabular}{*{12}{l}} |
| 1247 |
\toprule |
| 1248 |
\bfseries Key & \bfseries Input & |
| 1249 |
\bfseries Key & \bfseries Input & |
| 1250 |
\bfseries Key & \bfseries Input & |
| 1251 |
\bfseries Key & \bfseries Input & |
| 1252 |
\bfseries Key & \bfseries Input & |
| 1253 |
\bfseries Key & \bfseries Input \\ |
| 1254 |
\midrule |
| 1255 |
\showsignature{C} && & |
| 1256 |
\showsignature{Cma} && & |
| 1257 |
\showsignature{Ami} \\ |
| 1258 |
\cmidrule(lr){1-4} \cmidrule(lr){5-8} \cmidrule(lr){9-12} |
| 1259 |
\showsignature{G} & \showsignature{F} & |
| 1260 |
\showsignature{Gma} & \showsignature{Fma} & |
| 1261 |
\showsignature{Emi} & \showsignature{Dmi} \\ |
| 1262 |
\showsignature{D} & \showsignature{Bb} & |
| 1263 |
\showsignature{Dma} & \showsignature{Bbma} & |
| 1264 |
\showsignature{Bmi} & \showsignature{Gmi} \\ |
| 1265 |
\showsignature{A} & \showsignature{Eb} & |
| 1266 |
\showsignature{Ama} & \showsignature{Ebma} & |
| 1267 |
\showsignature{F#mi} & \showsignature{Cmi} \\ |
| 1268 |
\showsignature{E} & \showsignature{Ab} & |
| 1269 |
\showsignature{Ema} & \showsignature{Abma} & |
| 1270 |
\showsignature{C#mi} & \showsignature{Fmi} \\ |
| 1271 |
\showsignature{B} & \showsignature{Db} & |
| 1272 |
\showsignature{Bma} & \showsignature{Dbma} & |
| 1273 |
\showsignature{G#mi} & \showsignature{Fbmi} \\ |
| 1274 |
\showsignature{F#} & \showsignature{Gb} & |
| 1275 |
\showsignature{F#ma} & \showsignature{Gbma} & |
| 1276 |
\showsignature{D#mi} & \showsignature{Ebmi} \\ |
| 1277 |
\bottomrule |
| 1278 |
\end{tabular} |
| 1279 |
\label{tab:key-signatures} |
| 1280 |
\end{table} |
| 1281 |
|
| 1282 |
\begin{example}[ |
| 1283 |
compile, |
| 1284 |
graphics={trim={2cm 16cm 2cm 4cm},clip}, |
| 1285 |
add-sourcecode-options={literate=}] |
| 1286 |
\documentclass{article} |
| 1287 |
\usepackage{leadsheets} |
| 1288 |
\begin{document} |
| 1289 |
|
| 1290 |
\begin{song}[transpose=2]{title={Mary Had A Little Lamb}, music={Stevie Ray |
| 1291 |
Vaughan}, lyrics={traditional}, tags={srv,blues},key=E} |
| 1292 |
\begin{verse} |
| 1293 |
^{E7} Mary had a little lamb ^{A7} \\ |
| 1294 |
Its fleece was white as ^{E7}snow, yea \\ |
| 1295 |
Everywhere the child ^{B7}went ^{A7} \\ |
| 1296 |
The little lamb was sure to ^{E7}go, yea |
| 1297 |
\end{verse} |
| 1298 |
\begin{verse} |
| 1299 |
^{E7} He followed her to school one day ^{A7} \\ |
| 1300 |
And broke the teacher's ^{E7}rule \\ |
| 1301 |
What a time did they ^{B7}have ^{A7} \\ |
| 1302 |
That day at ^{E7}school |
| 1303 |
\end{verse} |
| 1304 |
\end{song} |
| 1305 |
|
| 1306 |
\end{document} |
| 1307 |
\end{example} |
| 1308 |
|
| 1309 |
\section{Other \env*{verse}-like Environments}\label{sec:other-envverse-like} |
| 1310 |
Songs can have lots of different kinds of parts: verses, choruses, bridges, |
| 1311 |
intros, outros, and so on. Typographically they're all more or less the same, |
| 1312 |
at least for the purpose of this package. This means we'd ideally have |
| 1313 |
environments for all of these parts with a distinct name in order to get a |
| 1314 |
clean source. At the same time these environments should all behave basically |
| 1315 |
the same. This is what the environments described in the following sections |
| 1316 |
are for. |
| 1317 |
|
| 1318 |
\subsection{Available Environments}\label{sec:avail-envir} |
| 1319 |
|
| 1320 |
\begin{environments} |
| 1321 |
\environment{chorus}[\oarg{options}] |
| 1322 |
An environment for specifying the chorus of a song. |
| 1323 |
\environment{chorus*}[\oarg{options}] |
| 1324 |
The same as \env{chorus} but does not display the label. |
| 1325 |
\environment{intro}[\oarg{options}] |
| 1326 |
An environment for specifying the intro of a song. |
| 1327 |
\environment{intro*}[\oarg{options}] |
| 1328 |
The same as \env{intro} but does not display the label. |
| 1329 |
\environment{interlude}[\oarg{options}] |
| 1330 |
An environment for specifying an interlude of a song. |
| 1331 |
\environment{bridge}[\oarg{bridge}] |
| 1332 |
An environment for specifying a bridge of a song. |
| 1333 |
\environment{info}[\oarg{options}] |
| 1334 |
An environment for specifying arbitrary information. This environment has |
| 1335 |
no label. |
| 1336 |
\environment{solo}[\oarg{options}] |
| 1337 |
An environment for specifying a solo to a song. |
| 1338 |
\environment{solo*}[\oarg{options}] |
| 1339 |
The same as \env{solo} but does not display the label. |
| 1340 |
\end{environments} |
| 1341 |
|
| 1342 |
\subsection{Own \env*{verse}-like Environments} |
| 1343 |
All environments mentioned in the previous section were defined with this |
| 1344 |
command: |
| 1345 |
\begin{commands} |
| 1346 |
\command{newversetype}[\sarg\marg{environment name}\oarg{default options}] |
| 1347 |
This defines an environment \meta{environment name}. This environment |
| 1348 |
uses the verse-type template \versetemplate{itemize} (see |
| 1349 |
section~\ref{sec:verse-type-templates}) unless specified differently in |
| 1350 |
the \meta{default options}. The starred version defines an environment |
| 1351 |
which hides the displayed name. More precisely: the macro \cs{verselabel} |
| 1352 |
that is used in verse-type template definitions prints nothing in an |
| 1353 |
environment defined with \cs{newversetype}\sarg. |
| 1354 |
|
| 1355 |
This also defines a translation string (see |
| 1356 |
section~\ref{sec:internationalization}) \code{leadsheets/\meta{environment |
| 1357 |
name}} with both an empty translation fallback and English translation |
| 1358 |
unless specified differently with the \option{name} option. |
| 1359 |
|
| 1360 |
At last this defines a new counter \meta{environment name} and sets |
| 1361 |
\cs*{the\meta{environment name}} to \code{\cs*{arabic}\Marg{environment |
| 1362 |
name}.}. |
| 1363 |
\end{commands} |
| 1364 |
|
| 1365 |
As mentioned before in section~\ref{sec:verses-options} all environments |
| 1366 |
defined this way have the options \option{format} and \option{label-format}. |
| 1367 |
They have more options. Here's a complete list: |
| 1368 |
\begin{options} |
| 1369 |
\keyval{format}{code}\Default |
| 1370 |
\meta{code} is inserted at the beginning of the environment and can thus |
| 1371 |
be used to add formatting, \eg, \keyis{format}{\cs*{itshape}}. |
| 1372 |
\keyval{label-format}{code}\Default |
| 1373 |
The same for the environment labels. |
| 1374 |
\keyval{after-label}{code}\Default{:} |
| 1375 |
\meta{code} is inserted in the label after the label text. |
| 1376 |
\keyval{name}{name}\Default |
| 1377 |
The translation fallback and English translation of the environment. This |
| 1378 |
should only be used with \cs{newversetype}. Later changes should be made |
| 1379 |
with \cs{DeclareTranslation} (see section~\ref{sec:internationalization}). |
| 1380 |
\keyval{template}{template}\Default{itemize} |
| 1381 |
The verse-type template used for the environment, see |
| 1382 |
section~\ref{sec:verse-type-templates} for details. |
| 1383 |
\keybool{numbered}\Default{false} |
| 1384 |
If set to \code{true} \cs{verselabel} (used in verse-type template |
| 1385 |
definitions, see section~\ref{sec:verse-type-templates}) adds a number |
| 1386 |
after the name. |
| 1387 |
\keybool{named}\Default{true} |
| 1388 |
If set to \code{true} \cs{verselabel} (used in verse-type template |
| 1389 |
definitions, see section~\ref{sec:verse-type-templates}) prints the name |
| 1390 |
of the current environment (as determined by the translation of the |
| 1391 |
corresponding string, see also section~\ref{sec:internationalization}). |
| 1392 |
\keylit{recall-chords}{\meta{environment}-\meta{class}} |
| 1393 |
An option to be used with the \option{remember-chords} mechanism, see |
| 1394 |
section~\ref{sec:remembering-chords} for an example. If you're not using |
| 1395 |
different classes then \meta{class} needs to be \code{default}, see also |
| 1396 |
page~\pageref{option:class}. The \option{class} to a \env{verse}-like |
| 1397 |
environment allows for example to have verses with different chords which |
| 1398 |
are still counted regularly together with the \option{remember-chords} |
| 1399 |
option. |
| 1400 |
\end{options} |
| 1401 |
|
| 1402 |
There are also a number of general options for setting the defaults of some |
| 1403 |
options for all environments: |
| 1404 |
\begin{options} |
| 1405 |
\keyval{verses-format}{code}\Default |
| 1406 |
Sets the format for all \env{verse} like environments. |
| 1407 |
\keyval{verses-label-format}{code}\Default |
| 1408 |
Sets the label format for all \env{verse} like environments. |
| 1409 |
\keyval{verses-after-label}{code}\Default{:} |
| 1410 |
Default \meta{code} that is inserted in the label after the label text of |
| 1411 |
\env{verse} like environments. |
| 1412 |
\end{options} |
| 1413 |
This options only determine the formatting of an environment if the |
| 1414 |
corresponding options of the environment hasn't been set. |
| 1415 |
|
| 1416 |
Let's summarize: the label text of these environments is built of three items |
| 1417 |
in the following order: |
| 1418 |
\begin{enumerate} |
| 1419 |
\item The \meta{code} set with the corresponding \option{label-format} option. |
| 1420 |
\item The label text as defined as second argument to \cs{newversetype} or |
| 1421 |
as declared through the corresponding translation. |
| 1422 |
\item The \meta{code} set with the corresponding \option{after-label} option. |
| 1423 |
\end{enumerate} |
| 1424 |
|
| 1425 |
\begin{example} |
| 1426 |
\newversetype{foo}{Foo} |
| 1427 |
\setleadsheets{ |
| 1428 |
foo/label-format = \bfseries , |
| 1429 |
foo/after-label = ~$\Rightarrow$ |
| 1430 |
} |
| 1431 |
\begin{foo} |
| 1432 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,\\ |
| 1433 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore\\ |
| 1434 |
magna aliquyam erat, sed diam voluptua. |
| 1435 |
\end{foo} |
| 1436 |
\end{example} |
| 1437 |
|
| 1438 |
And just to give you some more examples here is how some of the existing |
| 1439 |
environments are defined: |
| 1440 |
\begin{sourcecode} |
| 1441 |
\newversetype{verse}[ name=Verse, named=false, after-label= ] |
| 1442 |
\newversetype*{verse*} |
| 1443 |
\newversetype{chorus}[ name=Chorus ] |
| 1444 |
\newversetype*{chorus*} |
| 1445 |
\end{sourcecode} |
| 1446 |
|
| 1447 |
\section{Typesetting Bars}\label{sec:typesetting-bars} |
| 1448 |
|
| 1449 |
Sometimes it can be useful to typeset the chord scheme of a song. Then one |
| 1450 |
should be able to indicate start and beginnings of bars, maybe indicate |
| 1451 |
repeats and so on. While this is obviously possible with the macros provided |
| 1452 |
by the \musicsymbols{} package listed in table~\ref{tab:bar-symbols} it may be |
| 1453 |
more convenient to have a shorter syntax. This is why inside the \env{song} |
| 1454 |
environment some characters can be made (or are) active (see |
| 1455 |
section~\ref{sec:special-characters}). For the typesetting of bars this are |
| 1456 |
the characters \shortcut{:} nor \shortcut{\barsymbol}. Per default they are |
| 1457 |
not active, though. If you want to use the shortcut syntax you have to use |
| 1458 |
the option \option{bar-shortcuts}. Here's a short example that emulates the |
| 1459 |
behaviour by setting the characters active explicitly: |
| 1460 |
|
| 1461 |
\begin{example}[add-sourcecode-options={literate=}] |
| 1462 |
\catcode`|=\active |
| 1463 |
\catcode`:=\active |
| 1464 |
|: repeat | this :|: and | this :| \par |
| 1465 |
| this | part | ends | here || \par |
| 1466 |
| the | song | is over | now ||| |
| 1467 |
\end{example} |
| 1468 |
|
| 1469 |
All possibly combinations that have a special definition are shown in the |
| 1470 |
example above. The replacements that are done internally are these: |
| 1471 |
\begin{labeling}[--]{xxxxx} |
| 1472 |
\item[\shortcut{\barsymbol}] \cs{normalbar}\cs*{space} (the space is there |
| 1473 |
because otherwise it eats following spaces which would be annoying) |
| 1474 |
\item[\code{|:}] \cs{leftrepeat} |
| 1475 |
\item[\code{:|}] \cs{rightrepeat} |
| 1476 |
\item[\code{:|:}] \cs{leftrightrepeat} |
| 1477 |
\item[\code{||}] \cs{doublebar} |
| 1478 |
\item[\code{|||}] \cs{stopbar} |
| 1479 |
\end{labeling} |
| 1480 |
|
| 1481 |
\section{Templates}\label{sec:templates} |
| 1482 |
\subsection{Title Templates}\label{sec:title-templates} |
| 1483 |
|
| 1484 |
\subsubsection{Background} |
| 1485 |
The titles of songs set with the \env{song} environment are displayed |
| 1486 |
according to the chosen title template. It is chosen through the option |
| 1487 |
\option{title-template} which can be set with \cs{setleadsheets} or as option |
| 1488 |
to a specific \env{song} environment. \leadsheets{} provides few predefined |
| 1489 |
templates and an easy mechanism to define own templates. |
| 1490 |
|
| 1491 |
\subsubsection{Existing Templates} |
| 1492 |
|
| 1493 |
Currently \leadsheets{} provides two templates: |
| 1494 |
\begin{description} |
| 1495 |
\item[\titletemplate{minimal}] This only typesettes the song title in a |
| 1496 |
\cs{section}\sarg. |
| 1497 |
\item[\titletemplate{tabular}] This typesets the song title in a |
| 1498 |
\cs{section} and prints some song properties in a \env*{tabular} below it. |
| 1499 |
This template needs the \pkg{array}~\cite{pkg:array} package loaded. |
| 1500 |
\end{description} |
| 1501 |
|
| 1502 |
\subsubsection{Own Templates}\label{sec:own-templates} |
| 1503 |
The principle is pretty straight forward: templates are defined with the |
| 1504 |
following command: |
| 1505 |
\begin{commands} |
| 1506 |
\command{definesongtitletemplate}[\marg{name}\marg{code}] |
| 1507 |
This defines the template \meta{name}. |
| 1508 |
\end{commands} |
| 1509 |
Inside of \meta{code} any code can be used. The idea is that you use the |
| 1510 |
commands presented below to insert song properties where you want them. |
| 1511 |
|
| 1512 |
First there are two commands related to defining new properties: |
| 1513 |
\begin{commands} |
| 1514 |
\command{definesongproperty}[\marg{property}] |
| 1515 |
Defines a new property \meta{property}. All existing properties have been |
| 1516 |
defined this way. The command can only be used in the preamble. |
| 1517 |
\command{copysongproperty}[\marg{from}\marg{to}] |
| 1518 |
Copies the values of property \meta{from} to property \meta{to} if |
| 1519 |
property \meta{to} has not been set but property \meta{from} has been. |
| 1520 |
For example all \code{sort-\meta{property}} properties have been treated |
| 1521 |
this way so they have the \meta{property} value as fallback. |
| 1522 |
The command can only be used in the preamble. |
| 1523 |
\end{commands} |
| 1524 |
|
| 1525 |
Then there are a number of commands related to retrieving and using the values |
| 1526 |
of properties. All these commands only make sense inside a title template |
| 1527 |
definition (see section~\ref{sec:title-templates}). Some of the commands are |
| 1528 |
expandable which means they can be used in an \cs*{edef} like context, \ie, |
| 1529 |
they are also suitable for writing the property values to the table of |
| 1530 |
contents or other auxiliary files. |
| 1531 |
\begin{commands} |
| 1532 |
\expandable\command{songproperty}[\marg{property}] |
| 1533 |
Retrieves property \meta{property}. |
| 1534 |
\command{printsongpropertylist}[\oarg{code}\marg{property}\marg{between |
| 1535 |
two}\marg{between more}\marg{between last two}]\Default{\cs*{@firstofone}} |
| 1536 |
Prints a property list \meta{property} separated with \meta{between two} |
| 1537 |
if the list contains only two items and separated with \meta{between more} |
| 1538 |
and \meta{between last two} if the list contains more than two items. |
| 1539 |
\meta{code} is placed directly in front of each item and items are |
| 1540 |
surrounded with braces which means that the last token in \meta{code} may |
| 1541 |
be a macro with a mandatory argument. |
| 1542 |
\command{usesongpropertylist}[\oarg{code}\marg{property}\marg{between}]% |
| 1543 |
\Default{\cs*{@firstofone}} |
| 1544 |
Like \cs{printsongpropertylist} but separates items with \meta{between} |
| 1545 |
regardless of the length of the list. |
| 1546 |
\expandable\command{forsongpropertylist}[\marg{property}\marg{code}] |
| 1547 |
Places all items of the property list \meta{property} in the input stream, |
| 1548 |
each item preceded with \meta{code}. Items are surrounded with braces |
| 1549 |
which means that the last token in \meta{code} may be a macro with a |
| 1550 |
mandatory argument. |
| 1551 |
\expandable\command{ifsongproperty}[\marg{property}\marg{true}\marg{false}] |
| 1552 |
Checks if property \meta{property} has been set. |
| 1553 |
\command{ifanysongproperty}[\Marg{csv list of properties}\marg{true}\marg{false}] |
| 1554 |
\sinceversion{0.4}Checks if any of the properties in \meta{csv list of |
| 1555 |
properties} has been set. |
| 1556 |
\command{ifallsongproperties}[\Marg{csv list of properties}\marg{true}\marg{false}] |
| 1557 |
\sinceversion{0.4}Checks if all of the properties in \meta{csv list of |
| 1558 |
properties} have been set. |
| 1559 |
\command{ifsongpropertiesequal}[\marg{property 1}\marg{property |
| 1560 |
2}\marg{true}\marg{false}] |
| 1561 |
Checks if properties \meta{property 1} and \meta{property 2} have been set |
| 1562 |
to the same value. |
| 1563 |
\expandable\command{ifsongmeasuring}[\marg{true}\marg{false}] |
| 1564 |
\leadsheets{} measures the height of a song body before it typesets it and |
| 1565 |
it can often be necessary in a template to know if the measuring phase is |
| 1566 |
active or not. For example the song property \property{height} should |
| 1567 |
only be used if \emph{not} in the measuring phase: its value gets |
| 1568 |
determined there and is not yet available. |
| 1569 |
\command{expandcode}[\marg{code}] |
| 1570 |
Exhaustively expands \meta{code}. Experienced users won't need this. It |
| 1571 |
is essentially |
| 1572 |
|
| 1573 |
\cs*{begingroup}\cs*{edef}\cs*{x}\Marg{\cs*{endgroup}\meta{code}}\cs*{x}. |
| 1574 |
|
| 1575 |
(More precisely it is a wrapper for the expl3 function \cs*{use:x}.) This |
| 1576 |
means that any \code{\#} needs to doubled. Inside the argument of this |
| 1577 |
commands non-robust macros that should not be expanded need to be prefixed |
| 1578 |
with \cs*{noexpand}. |
| 1579 |
\end{commands} |
| 1580 |
|
| 1581 |
With the right template definition you can index composers, interprets, song |
| 1582 |
titles, \ldots{} You can write tables of contents for properties such as song |
| 1583 |
titles, and so on, and so on. \leadsheets{} does not do this for you and it |
| 1584 |
may require some experience to create templates which do all this. |
| 1585 |
|
| 1586 |
\subsubsection{Examples} |
| 1587 |
In order to give you an idea on how to use songtitle templates I'll show you |
| 1588 |
how the existing ones are defined and one new definition. |
| 1589 |
|
| 1590 |
\paragraph{The \titletemplate*{minimal} template} |
| 1591 |
This is quite short and self-explaining. |
| 1592 |
|
| 1593 |
\begin{sourcecode} |
| 1594 |
\definesongtitletemplate{minimal}{\section*{\songproperty{title}}} |
| 1595 |
\end{sourcecode} |
| 1596 |
|
| 1597 |
\paragraph{A custom template} |
| 1598 |
Now let's see an example for a newly defined template. It's nearly as simple |
| 1599 |
as the \titletemplate{minimal} template. |
| 1600 |
|
| 1601 |
\begin{example}[ |
| 1602 |
compile, |
| 1603 |
graphics={trim={2cm 18cm 2cm 2cm},clip}, |
| 1604 |
add-sourcecode-options={literate=}] |
| 1605 |
\documentclass{article} |
| 1606 |
\usepackage{leadsheets} |
| 1607 |
\definesongtitletemplate{custom}{ |
| 1608 |
\ifsongmeasuring |
| 1609 |
{\section*} |
| 1610 |
{\section}{% |
| 1611 |
\songproperty{title}% |
| 1612 |
\ifsongproperty{music} |
| 1613 |
{ (music by \printsongpropertylist{music}{ \& }{, }{ \& })} |
| 1614 |
{}% |
| 1615 |
} |
| 1616 |
} |
| 1617 |
\setleadsheets{title-template = custom} |
| 1618 |
\begin{document} |
| 1619 |
|
| 1620 |
\begin{song}{title={Mary Had A Little Lamb}, music={Stevie Ray Vaughan}, |
| 1621 |
lyrics={traditional}, tags={srv,blues}} |
| 1622 |
\begin{verse} |
| 1623 |
Mary had a little lamb \\ |
| 1624 |
Its fleece was white as snow, yea \\ |
| 1625 |
Everywhere the child went \\ |
| 1626 |
The little lamb was sure to go, yea |
| 1627 |
\end{verse} |
| 1628 |
\begin{verse} |
| 1629 |
He followed her to school one day \\ |
| 1630 |
And broke the teacher's rule \\ |
| 1631 |
What a time did they have \\ |
| 1632 |
That day at school |
| 1633 |
\end{verse} |
| 1634 |
\end{song} |
| 1635 |
|
| 1636 |
\end{document} |
| 1637 |
\end{example} |
| 1638 |
|
| 1639 |
\paragraph{The \titletemplate*{tabular} template} |
| 1640 |
This one is a lot more advanced and demonstrates various of the available |
| 1641 |
commands. |
| 1642 |
|
| 1643 |
\begin{sourcecode} |
| 1644 |
\definesongtitletemplate{tabular}{ |
| 1645 |
\ifsongmeasuring |
| 1646 |
{\section*} |
| 1647 |
{\section}% |
| 1648 |
{\songproperty{title}} |
| 1649 |
\begingroup\footnotesize |
| 1650 |
\begin{tabular}{ |
| 1651 |
@{} |
| 1652 |
>{\raggedright\arraybackslash}p{.5\linewidth} |
| 1653 |
@{} |
| 1654 |
>{\raggedleft\arraybackslash}p{.5\linewidth} |
| 1655 |
@{} |
| 1656 |
} |
| 1657 |
\ifsongproperty{interpret} |
| 1658 |
{\GetTranslation{leadsheets/interpret}} |
| 1659 |
{}% |
| 1660 |
\ifsongproperty{composer} |
| 1661 |
{% |
| 1662 |
& |
| 1663 |
\GetTranslation{leadsheets/composer}: % |
| 1664 |
\printsongpropertylist{composer}{ \& }{, }{ \& } |
| 1665 |
\ifsongproperty{lyrics} |
| 1666 |
{ |
| 1667 |
\\ & |
| 1668 |
\GetTranslation{leadsheets/lyrics}: % |
| 1669 |
\printsongpropertylist{lyrics}{ \& }{, }{ \& } |
| 1670 |
} |
| 1671 |
{}% |
| 1672 |
} |
| 1673 |
{}% |
| 1674 |
\ifsongproperty{interpret}{\\}{\ifsongproperty{composer}{\\}{}}% |
| 1675 |
\ifsongproperty{genre} |
| 1676 |
{& Genre: \songproperty{genre} \\} |
| 1677 |
{}% |
| 1678 |
\ifsongproperty{tempo} |
| 1679 |
{& Tempo: \songproperty{tempo} \\} |
| 1680 |
{}% |
| 1681 |
\ifsongproperty{key} |
| 1682 |
{% |
| 1683 |
& \setchords{ |
| 1684 |
major = -\GetTranslation{leadsheets/major} , |
| 1685 |
minor = -\GetTranslation{leadsheets/minor} |
| 1686 |
}% |
| 1687 |
\GetTranslation{leadsheets/key}: % |
| 1688 |
\expandcode{\writechord{\songproperty{key}}} \\% |
| 1689 |
} |
| 1690 |
{}% |
| 1691 |
\end{tabular} |
| 1692 |
\par\endgroup |
| 1693 |
} |
| 1694 |
\end{sourcecode} |
| 1695 |
|
| 1696 |
A song using the \titletemplate{tabular} template: |
| 1697 |
|
| 1698 |
\begin{example}[ |
| 1699 |
compile, |
| 1700 |
graphics={trim={2cm 18cm 2cm 2cm},clip}, |
| 1701 |
add-sourcecode-options={literate=}] |
| 1702 |
\documentclass{article} |
| 1703 |
\usepackage{leadsheets} |
| 1704 |
\usepackage{array} |
| 1705 |
\setleadsheets{title-template = tabular} |
| 1706 |
\begin{document} |
| 1707 |
|
| 1708 |
\begin{song}{title={Mary Had A Little Lamb}, interpret={Stevie Ray Vaughan}, |
| 1709 |
genre={blues}, tags={srv,blues},key=E} |
| 1710 |
\begin{verse} |
| 1711 |
^{E7} Mary had a little lamb ^{A7} \\ |
| 1712 |
Its fleece was white as ^{E7}snow, yea \\ |
| 1713 |
Everywhere the child ^{B7}went ^{A7} \\ |
| 1714 |
The little lamb was sure to ^{E7}go, yea |
| 1715 |
\end{verse} |
| 1716 |
\begin{verse} |
| 1717 |
^{E7} He followed her to school one day ^{A7} \\ |
| 1718 |
And broke the teacher's ^{E7}rule \\ |
| 1719 |
What a time did they ^{B7}have ^{A7} \\ |
| 1720 |
That day at ^{E7}school |
| 1721 |
\end{verse} |
| 1722 |
\end{song} |
| 1723 |
|
| 1724 |
\end{document} |
| 1725 |
\end{example} |
| 1726 |
|
| 1727 |
\subsection{Verse-type Templates}\label{sec:verse-type-templates} |
| 1728 |
\subsubsection{Background} |
| 1729 |
Similar to the songtitles also the \env{verse} like environments are typeset |
| 1730 |
using templates. Defining them is just as easy as for the song titles. |
| 1731 |
|
| 1732 |
\subsubsection{Existing Templates} |
| 1733 |
Currently \leadsheets{} provides only one template: |
| 1734 |
\begin{description} |
| 1735 |
\item[\versetemplate{itemize}] Uses an \env*{itemize} environment for |
| 1736 |
typesetting the corresponding environment. |
| 1737 |
\end{description} |
| 1738 |
|
| 1739 |
\subsubsection{Own Templates} |
| 1740 |
Own templates can be defined using these commands: |
| 1741 |
\begin{commands} |
| 1742 |
\command{defineversetypetemplate}[\marg{name}\marg{begin code}\marg{end code}] |
| 1743 |
This defines the template \meta{name}. |
| 1744 |
\command{verselabel} |
| 1745 |
Used inside \cs{defineversetypetemplate}. This determines where the label |
| 1746 |
of the environment using the template will be displayed. |
| 1747 |
\command{verselabelformat} |
| 1748 |
Used inside \cs{defineversetypetemplate}. The format of the current |
| 1749 |
environment as set with the corresponding \option{format} option. |
| 1750 |
\command{verseafterlabel} |
| 1751 |
Used inside \cs{defineversetypetemplate}. The format of the current |
| 1752 |
environment as set with the corresponding \option{after-label} option. |
| 1753 |
\command{versename} |
| 1754 |
Used inside \cs{defineversetypetemplate}. This prints the name of the |
| 1755 |
current environment. |
| 1756 |
\command{versenumber} |
| 1757 |
Used inside \cs{defineversetypetemplate}. Expands to the |
| 1758 |
\cs*{the\meta{environment}} command for the current environment. |
| 1759 |
\command{ifversestarred}[\marg{true}\marg{false}] |
| 1760 |
Can be used inside \cs{defineversetypetemplate} for checking if the |
| 1761 |
current environment was defined by the starred version of |
| 1762 |
\cs{newversetype}. |
| 1763 |
\command{ifversenumbered}[\marg{true}\marg{false}] |
| 1764 |
Can be used inside \cs{defineversetypetemplate} for checking if for the |
| 1765 |
current environment the option \option{numbered} is true or false. |
| 1766 |
\command{ifversenamed}[\marg{true}\marg{false}] |
| 1767 |
Can be used inside \cs{defineversetypetemplate} for checking if for the |
| 1768 |
current environment the option \option{named} is true or false. |
| 1769 |
\command{ifobeylines}[\marg{true}\marg{false}] |
| 1770 |
Checks if for the current song the option \option{obey-lines} is true or |
| 1771 |
false. |
| 1772 |
\end{commands} |
| 1773 |
Since with \cs{defineversetypetemplate} you define a template for an |
| 1774 |
environment it has two argument for code: one for code at the beginning of the |
| 1775 |
environment and one for code at the end. The command \cs{verselabel} |
| 1776 |
internally uses the conditionals. Its definition is equivalent to the |
| 1777 |
following: |
| 1778 |
|
| 1779 |
\begin{sourcecode} |
| 1780 |
\newcommand*\verselabel{% |
| 1781 |
\ifversestarred |
| 1782 |
{} |
| 1783 |
{% |
| 1784 |
\verselabelformat |
| 1785 |
\ifversenamed |
| 1786 |
{% |
| 1787 |
\versename |
| 1788 |
\ifversenumbered{ }{}% |
| 1789 |
} |
| 1790 |
{}% |
| 1791 |
\ifversenumbered |
| 1792 |
{\versenumber} |
| 1793 |
{}% |
| 1794 |
\verseafterlabel |
| 1795 |
}% |
| 1796 |
} |
| 1797 |
\end{sourcecode} |
| 1798 |
|
| 1799 |
\subsubsection{Examples} |
| 1800 |
In order to give you an idea on how to use verse-type templates I'll show you |
| 1801 |
how the existing ones are defined and a few new definitions. |
| 1802 |
|
| 1803 |
\paragraph{The \versetemplate*{itemize} template} |
| 1804 |
This is how the \versetemplate{itemize} is defined. |
| 1805 |
\begin{sourcecode} |
| 1806 |
\makeatletter |
| 1807 |
\defineversetypetemplate{itemize} |
| 1808 |
{% |
| 1809 |
\itemize |
| 1810 |
\@itemdepth=0 |
| 1811 |
\ifobeylines |
| 1812 |
{% |
| 1813 |
\setlength{\parskip}{0pt}% |
| 1814 |
\setleadsheets{ obey-lines-parskip = \parsep }% |
| 1815 |
} |
| 1816 |
{}% |
| 1817 |
\item[{\verselabel}]% |
| 1818 |
} |
| 1819 |
{\enditemize} |
| 1820 |
\makeatother |
| 1821 |
\end{sourcecode} |
| 1822 |
The most interesting part is probably the \cs{ifobeylines} part. When the |
| 1823 |
option \option{obey-lines} is set to true an end of a line inserts a \cs*{par} |
| 1824 |
token. So in order not to get a vertical skip after every line the template |
| 1825 |
sets \cs*{parskip} to zero. With \keyis{obey-lines}{true} an empty line also |
| 1826 |
inserts a \cs*{par} token but it also inserts a vertical space according to |
| 1827 |
the value set with \option{obey-lines-parskip}. This option can only be set |
| 1828 |
in a verse-type template definition (which is why it isn't documented |
| 1829 |
elsewhere). All \env{verse} like environments initialize the length to the |
| 1830 |
current value of \cs*{parskip} \emph{before} the template code is inserted. |
| 1831 |
|
| 1832 |
\paragraph{A \versetemplate*{flushleft} template} |
| 1833 |
An example for a template \versetemplate*{flushleft} that typesets the label |
| 1834 |
in the margin: |
| 1835 |
\begin{example} |
| 1836 |
\defineversetypetemplate{flushleft} |
| 1837 |
{% |
| 1838 |
\noindent\llap{\verselabel\space}% |
| 1839 |
\flushleft |
| 1840 |
\unskip |
| 1841 |
\vspace*{-\baselineskip} |
| 1842 |
\ifobeylines |
| 1843 |
{% |
| 1844 |
\setlength\parskip{0pt} |
| 1845 |
\setleadsheets{ obey-lines-parskip = .5\baselineskip } |
| 1846 |
} |
| 1847 |
{% |
| 1848 |
\setlength\parskip{.5\baselineskip} |
| 1849 |
\vspace*{-\parskip} |
| 1850 |
}% |
| 1851 |
} |
| 1852 |
{\endflushleft} |
| 1853 |
\begin{chorus}[template=flushleft] |
| 1854 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, \\ |
| 1855 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore \\ |
| 1856 |
magna aliquyam erat, sed diam voluptua. |
| 1857 |
|
| 1858 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, \\ |
| 1859 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore \\ |
| 1860 |
magna aliquyam erat, sed diam voluptua. |
| 1861 |
\end{chorus} |
| 1862 |
\end{example} |
| 1863 |
|
| 1864 |
\paragraph{A \versetemplate*{flushright} template} |
| 1865 |
An example for a template \versetemplate*{flushright} that typesets the label |
| 1866 |
in the margin: |
| 1867 |
\begin{example} |
| 1868 |
\defineversetypetemplate{flushright} |
| 1869 |
{% |
| 1870 |
\noindent\llap{\verselabel\space}% |
| 1871 |
\flushright |
| 1872 |
\unskip |
| 1873 |
\vspace*{-\baselineskip} |
| 1874 |
\ifobeylines |
| 1875 |
{% |
| 1876 |
\setlength\parskip{0pt} |
| 1877 |
\setleadsheets{ obey-lines-parskip = .5\baselineskip } |
| 1878 |
} |
| 1879 |
{% |
| 1880 |
\setlength\parskip{.5\baselineskip} |
| 1881 |
\vspace*{-\parskip} |
| 1882 |
}% |
| 1883 |
} |
| 1884 |
{\endflushright} |
| 1885 |
\begin{chorus}[template=flushright] |
| 1886 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, \\ |
| 1887 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore \\ |
| 1888 |
magna aliquyam erat, sed diam voluptua. |
| 1889 |
|
| 1890 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, \\ |
| 1891 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore \\ |
| 1892 |
magna aliquyam erat, sed diam voluptua. |
| 1893 |
\end{chorus} |
| 1894 |
\end{example} |
| 1895 |
|
| 1896 |
As you can see it's not entirely easy to define a template that suits both |
| 1897 |
songs with and without \keyis{obey-lines}{true}. Personally I would forget |
| 1898 |
about that option and not care about it at all in my templates. |
| 1899 |
|
| 1900 |
\paragraph{A \versetemplate*{framed} template} |
| 1901 |
Last but not least an example using the \pkg{mdframed} |
| 1902 |
package~\cite{pkg:mdframed} -- just to show you that everything is possible. |
| 1903 |
The example adapts one of the examples of \pkg{mdframed}'s manual. |
| 1904 |
\begin{example} |
| 1905 |
\defineversetypetemplate{framed} |
| 1906 |
{% |
| 1907 |
\expandcode{% |
| 1908 |
\noexpand\mdframed[ |
| 1909 |
\ifversestarred{}{% |
| 1910 |
frametitle={% |
| 1911 |
\noexpand\tikz[baseline=(current bounding box.east),outer sep=0pt] |
| 1912 |
\noexpand\node[anchor=east,rectangle,fill=blue!20,rounded corners=2pt] |
| 1913 |
{\noexpand\strut\noexpand\verselabel}; |
| 1914 |
}% |
| 1915 |
}, |
| 1916 |
roundcorner = 5pt , |
| 1917 |
linecolor = blue!20 , |
| 1918 |
linewidth = 2pt, |
| 1919 |
topline = true, |
| 1920 |
frametitleaboveskip = \dimexpr-\ht\strutbox\relax , |
| 1921 |
]% |
| 1922 |
}% |
| 1923 |
\setlength\parindent{0pt} |
| 1924 |
\setlength\parskip{\parsep} |
| 1925 |
\ifobeylines |
| 1926 |
{\setleadsheets{ obey-lines-parskip=\parskip }\setlength\parskip{0pt}} |
| 1927 |
{\vspace*{-\parskip}}% |
| 1928 |
} |
| 1929 |
{% |
| 1930 |
\endmdframed |
| 1931 |
\addvspace{\baselineskip}% |
| 1932 |
} |
| 1933 |
\begin{chorus}[template=framed] |
| 1934 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, \\ |
| 1935 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore \\ |
| 1936 |
magna aliquyam erat, sed diam voluptua. |
| 1937 |
|
| 1938 |
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, \\ |
| 1939 |
sed diam nonumy eirmod tempor invidunt ut labore et dolore \\ |
| 1940 |
magna aliquyam erat, sed diam voluptua. |
| 1941 |
\end{chorus} |
| 1942 |
\end{example} |
| 1943 |
|
| 1944 |
\section{Internationalization}\label{sec:internationalization} |
| 1945 |
|
| 1946 |
Th environments described in sections~\ref{sec:envverse-environment} |
| 1947 |
and~\ref{sec:other-envverse-like} as well as a few other words used in |
| 1948 |
\leadsheets{} are translated with the help of the \pkg{translations} |
| 1949 |
package~\cite{pkg:translations}. All predefined and available translation |
| 1950 |
strings are listed in table~\ref{tab:translations}. You can change those |
| 1951 |
translations or add translations for other languages with this command: |
| 1952 |
\begin{commands} |
| 1953 |
\command*{DeclareTranslation}[\marg{language}\marg{string}\marg{translation}] |
| 1954 |
The command provided by the \pkg{translations} package for translating |
| 1955 |
strings. |
| 1956 |
\end{commands} |
| 1957 |
Those translations can be used for example in song title templates (see |
| 1958 |
section~\ref{sec:title-templates}). One of the strings listed in |
| 1959 |
table~\ref{tab:translations} is a little different: the string |
| 1960 |
\code{leadsheets/interpret} is declared as |
| 1961 |
\begin{sourcecode} |
| 1962 |
\DeclareTranslation{English}{leadsheets/interpret} |
| 1963 |
{as interpreted by \printsongpropertylist{interpret}{ \& }{, }{ \& }} |
| 1964 |
\DeclareTranslation{German}{leadsheets/interpret} |
| 1965 |
{wie von \printsongpropertylist{interpret}{ \& }{, }{ \& } interpretiert} |
| 1966 |
\end{sourcecode} |
| 1967 |
which means it uses the song property \property{interpret}. As a consequence |
| 1968 |
it only really can be used inside a \env{song} environment. In other cases as |
| 1969 |
for example in table~\ref{tab:translations} the property part expands to |
| 1970 |
nothing (but the spaces around it are of course there). Also keep in mind |
| 1971 |
that \cs{printsongpropertylist} is not expandable. |
| 1972 |
|
| 1973 |
\begin{table}[htbp] |
| 1974 |
\centering |
| 1975 |
\caption{Predefined translation strings.} |
| 1976 |
\newcommand*\showtranslation[1]{% |
| 1977 |
\texttt{leadsheets/#1} & |
| 1978 |
\GetTranslationFor{English}{leadsheets/#1} & |
| 1979 |
\GetTranslationFor{German}{leadsheets/#1} |
| 1980 |
} |
| 1981 |
\begin{tabular}{lll} |
| 1982 |
\toprule |
| 1983 |
\bfseries String & \bfseries English & \bfseries German \\ |
| 1984 |
\midrule |
| 1985 |
\showtranslation{major} \\ |
| 1986 |
\showtranslation{minor} \\ |
| 1987 |
\showtranslation{chorus} \\ |
| 1988 |
\showtranslation{verse} \\ |
| 1989 |
\showtranslation{composer} \\ |
| 1990 |
\showtranslation{lyrics} \\ |
| 1991 |
\showtranslation{key} \\ |
| 1992 |
\showtranslation{capo} \\ |
| 1993 |
\showtranslation{fret} \\ |
| 1994 |
\showtranslation{interpret} \\ |
| 1995 |
\showtranslation{intro} \\ |
| 1996 |
\showtranslation{interlude} \\ |
| 1997 |
\showtranslation{bridge} \\ |
| 1998 |
\showtranslation{solo} \\ |
| 1999 |
\bottomrule |
| 2000 |
\end{tabular} |
| 2001 |
\label{tab:translations} |
| 2002 |
\end{table} |
| 2003 |
|
| 2004 |
\clearpage |
| 2005 |
\part{The \library*{external} Library and the \cls*{leadsheet} |
| 2006 |
Class}\label{part:external-leadsheet} |
| 2007 |
\dictum[Thelonious Monk]{% |
| 2008 |
Talking about music is like dancing about architecture.% |
| 2009 |
} |
| 2010 |
|
| 2011 |
\section{The Idea} |
| 2012 |
|
| 2013 |
For\sinceversion{0.5} some users -- like myself -- it may be desirable to |
| 2014 |
create leadsheets that can be reused in another document as a compilation of |
| 2015 |
songs. The usual way would be to |
| 2016 |
\begin{itemize} |
| 2017 |
\item either solve this manually by copying the \env{song} environment from |
| 2018 |
one document to the other. This is not ideal, of course. |
| 2019 |
\item place the \env{song} in a file of its own and \cs*{input} it in the |
| 2020 |
different documents. This is easy and safe but requires a total of three |
| 2021 |
files for two documents. That's not really a problem, though, so it is a |
| 2022 |
valid way. |
| 2023 |
\end{itemize} |
| 2024 |
|
| 2025 |
\leadsheets{} now provides a third way. You write the single leadsheet using |
| 2026 |
the \cls{leadsheet} class that comes with this package. Let's call this file |
| 2027 |
\code{single.tex} for the following discussion: |
| 2028 |
\begin{sourcecode} |
| 2029 |
\documentclass{leadsheet} |
| 2030 |
\usepackage[T1]{fontenc} |
| 2031 |
\usepackage[utf8]{inputenc} |
| 2032 |
|
| 2033 |
\begin{document} |
| 2034 |
|
| 2035 |
\begin{song}{ ... } |
| 2036 |
... |
| 2037 |
\end{song} |
| 2038 |
|
| 2039 |
\end{document} |
| 2040 |
\end{sourcecode} |
| 2041 |
|
| 2042 |
You can now include this document as is in another file -- let's call it |
| 2043 |
\code{multiple.tex}: |
| 2044 |
\begin{sourcecode} |
| 2045 |
\documentclass{scrartcl} |
| 2046 |
\usepackage{leadsheets} |
| 2047 |
\useleadsheetslibraries{external} |
| 2048 |
|
| 2049 |
\begin{document} |
| 2050 |
|
| 2051 |
\includeleadsheet{single.tex} |
| 2052 |
|
| 2053 |
\end{document} |
| 2054 |
\end{sourcecode} |
| 2055 |
|
| 2056 |
Depending on the settings this removes the complete preamble from |
| 2057 |
\code{single.tex} and only includes the document body of the file. |
| 2058 |
|
| 2059 |
\section{The \cls*{leadsheet} Class}\label{sec:leadsheet-class} |
| 2060 |
|
| 2061 |
The \cls{leadsheet} class is a class file built upon the \cls{scrartcl} |
| 2062 |
class. It defines a song title template \titletemplate{leadsheet}, makes a |
| 2063 |
few setup choices |
| 2064 |
\begin{sourcecode} |
| 2065 |
\setleadsheets{ |
| 2066 |
title-template = leadsheet , |
| 2067 |
bar-shortcuts , |
| 2068 |
verse/numbered , |
| 2069 |
verses-format = , |
| 2070 |
verses-label-format = \bfseries , |
| 2071 |
info/format = \itshape , |
| 2072 |
chorus/format = \itshape |
| 2073 |
} |
| 2074 |
\end{sourcecode} |
| 2075 |
and sets the header and the footer of the leadsheet pages. |
| 2076 |
|
| 2077 |
\begin{example}[ |
| 2078 |
compile, |
| 2079 |
graphics={trim={2cm 18cm 2cm 2cm},clip}, |
| 2080 |
add-sourcecode-options={literate=}] |
| 2081 |
\documentclass{leadsheet} |
| 2082 |
\usepackage[T1]{fontenc} |
| 2083 |
\usepackage[utf8]{inputenc} |
| 2084 |
\usepackage[ngerman]{babel} |
| 2085 |
|
| 2086 |
\begin{document} |
| 2087 |
|
| 2088 |
\begin{song}{title={Mary Had A Little Lamb}, music={Stevie Ray Vaughan}, |
| 2089 |
interpret={Stevie Ray Vaughan}, lyrics={traditional}, tags={srv,blues}} |
| 2090 |
\begin{verse} |
| 2091 |
Mary had a little lamb \\ |
| 2092 |
Its fleece was white as snow, yea \\ |
| 2093 |
Everywhere the child went \\ |
| 2094 |
The little lamb was sure to go, yea |
| 2095 |
\end{verse} |
| 2096 |
\begin{verse} |
| 2097 |
He followed her to school one day \\ |
| 2098 |
And broke the teacher's rule \\ |
| 2099 |
What a time did they have \\ |
| 2100 |
That day at school |
| 2101 |
\end{verse} |
| 2102 |
\end{song} |
| 2103 |
|
| 2104 |
\end{document} |
| 2105 |
\end{example} |
| 2106 |
|
| 2107 |
The header contains \enquote{\meta{song title} (\meta{interpret})} if the |
| 2108 |
leadsheet has more than one page in total. Otherwise it is empty. |
| 2109 |
|
| 2110 |
The footer contains \enquote{\meta{page} of \meta{pages}} if the leadsheet has |
| 2111 |
more than one page in total. Otherwise it is empty. |
| 2112 |
|
| 2113 |
The class provides the verse type \env{prechorus}: |
| 2114 |
\begin{environments} |
| 2115 |
\environment{prechorus}[\oarg{options}] |
| 2116 |
Environment for marking the pre-chorus of a song. |
| 2117 |
\end{environments} |
| 2118 |
|
| 2119 |
\begin{commands} |
| 2120 |
\command{instruction}[\marg{text}] |
| 2121 |
Short macro to add instructional text. |
| 2122 |
\command{mkinstruction}[\marg{text}] |
| 2123 |
The formatting macro used by \cs{instruction}. You can redefine it in |
| 2124 |
order to change the appearance. The default definition is: \\ |
| 2125 |
\verbcode+\newcommand*\mkinstruction[1]{\emph{#1}}+ |
| 2126 |
\command{choir}[\marg{text}] |
| 2127 |
Short macro to add (background) choir text. |
| 2128 |
\command{mkchoir}[\marg{text}] |
| 2129 |
The formatting macro used by \cs{choir}. You can redefine it in |
| 2130 |
order to change the appearance. The default definition is: \\ |
| 2131 |
\verbcode+\newcommand*\mkchoir[1]{\instruction{\leadsheetstranslate{choir}: #1}}+ |
| 2132 |
\command{lsenparen}[\marg{text}] |
| 2133 |
Short macro to add parentheses around text. Used internally by |
| 2134 |
\cs{instruction}. |
| 2135 |
\command{mklsenparens} |
| 2136 |
The parentheses setting macro used by \cs{lsenparen}. You can redefine it |
| 2137 |
in order to change the parentheses. The default definition is: \\ |
| 2138 |
\verbcode+\newcommand*\mklsenparens{[]}+ \\ |
| 2139 |
\emph{The definition needs to be expandable and to expand to exactly two |
| 2140 |
tokens or braced groups, one for the opening parenthesis and the second |
| 2141 |
for the closing parenthesis!} |
| 2142 |
\command{mklsenparen}[\marg{openen parenthesis}\marg{closing |
| 2143 |
parenthesis}\marg{text}] |
| 2144 |
The formatting macro used by \cs{lsenparen}. You can redefine it in |
| 2145 |
order to change the appearance. The default definition is: \\ |
| 2146 |
\verbcode+\newcommand*\mklsenparen[3]{\textup{#1}#3\textup{#2}}+ |
| 2147 |
\end{commands} |
| 2148 |
|
| 2149 |
Here is an example that demonstrates \cs{choir} and \cs{instruction}. (The |
| 2150 |
code of the example code has been saved in a file called |
| 2151 |
\code{single-leadsheet.tex}. It is used later on again.)\label{single-leadsheet} |
| 2152 |
\begin{example}[compile,graphics={trim={2cm 18cm 2cm 2cm},clip}, |
| 2153 |
add-sourcecode-options={literate=}] |
| 2154 |
\documentclass{leadsheet} |
| 2155 |
\usepackage[T1]{fontenc} |
| 2156 |
\usepackage[utf8]{inputenc} |
| 2157 |
|
| 2158 |
\begin{document} |
| 2159 |
|
| 2160 |
\begin{song}{title=foobar} |
| 2161 |
\begin{verse} |
| 2162 |
\instruction{keyboard only} \\ |
| 2163 |
Lorem ipsum dolor sit amet, consetetur sadipscing \\ |
| 2164 |
\choir{sed diam nonumy eirmod tempor invidunt ut labore et dolore} |
| 2165 |
\end{verse} |
| 2166 |
\begin{prechorus} |
| 2167 |
\instruction{+ band} \\ |
| 2168 |
Lorem ipsum dolor sit amet, consetetur sadipscing |
| 2169 |
\end{prechorus} |
| 2170 |
\end{song} |
| 2171 |
|
| 2172 |
\end{document} |
| 2173 |
\end{example} |
| 2174 |
|
| 2175 |
\section{The \library*{external} Library} |
| 2176 |
|
| 2177 |
Loading the \library{external} library allows to include complete leadsheet |
| 2178 |
documents (\ie, with preamble) into a main document. This requires the |
| 2179 |
included leadsheet to use the \cls{leadsheet} class (see |
| 2180 |
section~\ref{sec:leadsheet-class}). When the file is included the whole |
| 2181 |
preamble of said file will be discarded. This can be changed with an option |
| 2182 |
but then \cs*{usepackage} and \cs*{RequirePackage} will still be disabled and |
| 2183 |
simply do nothing in the included file. |
| 2184 |
|
| 2185 |
\begin{commands} |
| 2186 |
\command{includeleadsheet}[\sarg\oarg{options}\marg{file name}] |
| 2187 |
Include the leadsheet \meta{file name}. \meta{options} apply locally for |
| 2188 |
the included file. The file \meta{file name} may include a complete |
| 2189 |
document preamble. |
| 2190 |
\end{commands} |
| 2191 |
|
| 2192 |
\begin{filecontents*}{single-leadsheet.tex} |
| 2193 |
\documentclass{leadsheet} |
| 2194 |
\usepackage[T1]{fontenc} |
| 2195 |
\usepackage[utf8]{inputenc} |
| 2196 |
|
| 2197 |
\begin{document} |
| 2198 |
|
| 2199 |
\begin{song}{title=foobar} |
| 2200 |
\begin{verse} |
| 2201 |
\instruction{keyboard only} \\ |
| 2202 |
Lorem ipsum dolor sit amet, consetetur sadipscing \\ |
| 2203 |
\choir{sed diam nonumy eirmod tempor invidunt ut labore et dolore} |
| 2204 |
\end{verse} |
| 2205 |
\begin{prechorus} |
| 2206 |
\instruction{+ band} \\ |
| 2207 |
Lorem ipsum dolor sit amet, consetetur sadipscing |
| 2208 |
\end{prechorus} |
| 2209 |
\end{song} |
| 2210 |
|
| 2211 |
\end{document} |
| 2212 |
\end{filecontents*} |
| 2213 |
The next example shows the basic usage by inputting the example file mentioned |
| 2214 |
on page~\pageref{single-leadsheet}. \emph{Notice that the formatting setup by |
| 2215 |
the \cls{leadsheets} is not used}. Also the title template |
| 2216 |
\titletemplate{leadsheet} is not defined in this process. |
| 2217 |
\begin{example}[compile,graphics={trim={2cm 18cm 2cm 2cm},clip}, |
| 2218 |
add-sourcecode-options={literate=}] |
| 2219 |
\documentclass{scrartcl} |
| 2220 |
\usepackage{leadsheets} |
| 2221 |
\useleadsheetslibraries{external} |
| 2222 |
|
| 2223 |
\begin{document} |
| 2224 |
|
| 2225 |
\includeleadsheet{single-leadsheet} |
| 2226 |
|
| 2227 |
\end{document} |
| 2228 |
\end{example} |
| 2229 |
Also notice that the \env{prechorus} environment and the \cs{instruction} and |
| 2230 |
\cs{choir} macros \emph{are} available! \emph{All new macros defined in the |
| 2231 |
\cls{leadsheet} class and described in section~\ref{sec:leadsheet-class} are |
| 2232 |
defined}. If you do not want this then you can use the starred version of |
| 2233 |
\cs{includeleadsheet}. In this process the preamble of the included file is |
| 2234 |
gobbled. It may be desirable not to have the preamble gobbled, though -- |
| 2235 |
because of custom macro definitions for example. |
| 2236 |
\begin{options} |
| 2237 |
\keybool{gobble-preamble}\Default{true} |
| 2238 |
If set to \code{false} \cs{includeleadsheet} will not gobble the preamble |
| 2239 |
of the file it inputs. Using this is dangerous: for it to work |
| 2240 |
\cs*{usepackage} and \cs*{RequirePackage} have to be disabled while the |
| 2241 |
file is included. So including the preamble may lead to more problems |
| 2242 |
than it solves. |
| 2243 |
\end{options} |
| 2244 |
|
| 2245 |
The included leadsheets do not have to be a complete document -- a standard |
| 2246 |
tex file only consisting of the \env{song} environments will work just as |
| 2247 |
nicely. Files that are complete documents but are using another class than |
| 2248 |
\cls{leadsheet} will lead to errors, though. |
| 2249 |
|
| 2250 |
\clearpage |
| 2251 |
\part{Appendix} |
| 2252 |
\dictum[Thelonious Monk]{Wrong is right.} |
| 2253 |
\appendix |
| 2254 |
|
| 2255 |
\end{document} |
| 2256 |
|