From fecdcd43eaa7f73e830159293fe22a202803086b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 2 Jul 2015 22:11:48 +0000 Subject: leadsheets (2jul15) git-svn-id: svn://tug.org/texlive/trunk@37735 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/leadsheets/README | 4 +- .../doc/latex/leadsheets/leadsheets_en.pdf | Bin 823201 -> 829455 bytes .../doc/latex/leadsheets/leadsheets_en.tex | 239 +++++++++++---------- .../leadsheets.library.chordnames.code.tex | 83 +++---- .../leadsheets/leadsheets.library.chords.code.tex | 101 +++++++-- .../leadsheets/leadsheets.library.songs.code.tex | 35 ++- .../texmf-dist/tex/latex/leadsheets/leadsheets.sty | 10 +- 7 files changed, 272 insertions(+), 200 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/leadsheets/README b/Master/texmf-dist/doc/latex/leadsheets/README index 458f562b3e8..cd79d7bd78d 100644 --- a/Master/texmf-dist/doc/latex/leadsheets/README +++ b/Master/texmf-dist/doc/latex/leadsheets/README @@ -1,11 +1,11 @@ -------------------------------------------------------------------------- -the LEADSHEETS package v0.1 2015/01/11 +the LEADSHEETS package v0.2 2015/07/02 typesetting leadsheets and songbooks -------------------------------------------------------------------------- Clemens Niederberger -Web: https://github.com/cgnieder/leadsheets/ +Web: http://www.mychemistry.eu/forums/forum/leadsheets/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- Copyright 2014-2015 Clemens Niederberger diff --git a/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.pdf b/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.pdf index 69af371ca47..4a46be6eeb9 100644 Binary files a/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.pdf and b/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.pdf differ diff --git a/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.tex b/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.tex index 118320aa61e..3b2e875a46d 100644 --- a/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.tex +++ b/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.tex @@ -1,5 +1,5 @@ % !arara: pdflatex: { shell: on } -% !arara: biber +% arara: biber % arara: pdflatex % arara: pdflatex \documentclass[load-preamble+]{cnltx-doc} @@ -9,7 +9,7 @@ info = Typesetting leadsheets and songbooks , authors = Clemens Niederberger , email = contact@mychemistry.eu , - url = https://github.com/cgnieder/leadsheets/ , + url = http://www.mychemistry.eu/forums/forum/leadsheets/ , add-cmds = { chord , chordname , definesongtitletemplate , @@ -24,7 +24,7 @@ ifversestarred , newversetype , printsongpropertylist , - setchordnames , + setchords , setleadsheets , songproperty , useleadsheetslibraries , @@ -97,10 +97,10 @@ }% } \newrobustcmd*\musicsymbols{\library{musicsymbols}} -\newrobustcmd*\chordnames{\library{chordnames}} +\newrobustcmd*\chords{\library{chords}} \newrobustcmd*\musejazz{\library{musejazz}} -\setchordnames{format=\libertineLF} +\setchords{format=\libertineLF} \makeatletter \colorlet{property}{cnltxgreen} @@ -195,6 +195,8 @@ so you don't have to think about it any more you can use \begin{sourcecode} \usepackage[full]{leadsheets} \end{sourcecode} +This actually loads every library except the \library{musejazz} library. + If you instead use\packageoption{minimal} \begin{sourcecode} \usepackage[minimal]{leadsheets} @@ -207,6 +209,7 @@ libraries yourself in order to use the package. \command{useleadsheetslibrary}[\marg{library}] With this command one of \leadsheets' libraries can be loaded. \end{commands} + The libraries are divided into two parts: libraries to be loaded by users and auxiliary libraries loaded by other libraries but not to be loaded directly by users. @@ -216,19 +219,19 @@ The user-libraries are the following ones: \item[\library{musicsymbols}] \packageoption{musicsymbols}This library makes the music symbol font provided by MusiX\TeX{} available as text font. It is described in part~\ref{part:musicsymbols-library}. - \item[\library{chordnames}] \packageoption{chordnames}This library defines a + \item[\library{chords}] \packageoption{chords}This library defines a few macros for typesetting of chord symbols. It is described in - part~\ref{part:chordnames-library}. It also loads the + part~\ref{part:chords-library}. It also loads the \library{musicsymbols}library. - \item[\library{musejazz}] \packageoption{musejazz}extends the \chordnames\ + \item[\library{musejazz}] \packageoption{musejazz}extends the \chords\ library to use MuseScore's \enquote{MuseJazz} font, see - section~\ref{sec:musejazz-libr}. It loads the \library{chordnames} + section~\ref{sec:musejazz-libr}. It loads the \library{chords} library. - \item[\library{songs}] \packageoption{songs}This is the main library. It - defines everything necessary for the typesetting of the leadsheets. It - currently loads \emph{all other libraries}, \ie, user libraries \emph{and} - internal libraries. This library is described in - part~\ref{part:leadsheets-library}. + \item[\library{songs}] \packageoption{songs}This is the \emph{main + library}. It defines everything necessary for the typesetting of the + leadsheets. It currently loads \emph{all other libraries}, \ie, user + libraries \emph{and} internal libraries, except for the \library{musejazz} + library. This library is described in part~\ref{part:leadsheets-library}. \end{description} Those libraries can also be loaded as a package option. If you say \begin{sourcecode} @@ -239,7 +242,7 @@ then \emph{only} the \library{musicsymbols} library is loaded. Saying \usepackage[songs]{leadsheets} \end{sourcecode} is the same as using the package \emph{without} any options. ``Without any'' -also means that neither \library{musicsymbols}, \library{chordnames} nor +also means that neither \library{musicsymbols}, \library{chords} nor \library{songs} has been given as class option! There is also a number of auxiliary libraries which are all needed by @@ -254,10 +257,9 @@ the following list gives hints to where some of the concepts are explained: \item[\library{transposing}] This is an auxiliary library not meant to be loaded directly by users. It defines a transposing mechanism for chord symbols. See section~\ref{sec:transposing} for further details. - \item[\library{chords}] This is an auxiliary library not meant to be loaded - directly by users. It defines the necessary macros for printing the - chords in songs as well as the mechanism of remembering and recalling - chord sequences of verses. + \item[\library{chordnames}] This is an auxiliary library not meant to be + loaded directly by users. It defines the necessary macros for printing + chords. \item[\library{templates}] This is an auxiliary library not meant to be loaded directly by users. It defines the necessary macros for \leadsheets' template mechanism. See section~\ref{sec:templates} for @@ -351,20 +353,28 @@ bars: \end{commands} \clearpage -\part{The \library*{chordnames} Library (and the \library*{musejazz} Library)}\label{part:chordnames-library} +\part{The \library*{chords} Library (and the \library*{musejazz} Library)}\label{part:chords-library} \dictum[Wes Montgomery]{% I never practice my guitar -- from time to time I just open the case and throw in a piece of raw meat.% } -\section{The \cs*{chordname} Command} +\begin{figure} + \centering + \includegraphics[scale=.5,trim=0 22cm 10cm 2cm,clip]{ring-of-fire.pdf} + \caption{One possible layout for \leadsheets{} mimicking the typewriter + style.} + \label{fig:leadsheet} +\end{figure} + +\section{The \cs*{writechord} Command} -\chordnames{} provides the command \cs{chordname}\marg{chord} for convenient +\chords{} provides the command \cs{writechord}\marg{chord} for convenient typesetting of chords: \begin{example}[side-by-side] - \chordname{Bb7(#9)} \chordname{Bbb6} - \chordname{C#7(b9)} \chordname{C##13} + \writechord{Bb7(#9)} \writechord{Bbb6} + \writechord{C#7(b9)} \writechord{C##13} \end{example} \begin{commands} @@ -372,64 +382,71 @@ typesetting of chords: Typesetting chords. Inside the argument every \code{\#} will be replaced by $\sharp$ and every \code{b} is replaced with $\flat$. Numerals and parentheses are typeset as superscripts. Everything between parentheses - is always a superscript: \verbcode+\chordname{F#7(#11)}+ - \chordname{F#7(#11)}. + is always a superscript: \verbcode+\writechord{F#7(#11)}+ + \writechord{F#7(#11)}. + \command{writechord}[\marg{chord}] + This command can and actually \emph{should} be used for placing chords + inline. It transforms the chords according to the options knows the + options \option{input-notation} and \option{output-notation}. This + command also transforms the chord according to the options inside of the + \env{song} environment \option{transpose} and \option{enharmonic} before + printing it, see also page~\pageref{cs:writechord}. \end{commands} -There are several token lists that are treated specially inside \cs{chordname}: +There are several token lists that are treated specially inside \cs{writechord}: \begin{labeling}[--]{xxxxx} \item[\code{\^{}}] This token is replaced by \cs*{textsuperscript}. \item[\code{ma}] The symbol for major chords. Per default this is - empty. \verbcode+\chordname{Gma}+ \chordname{Gma}. + empty. \verbcode+\writechord{Gma}+ \writechord{Gma}. \item[\code{mi}] The symbol for minor chords. Per default this is - \code{m}. \verbcode+\chordname{Gmi}+ \chordname{Gmi}. + \code{m}. \verbcode+\writechord{Gmi}+ \writechord{Gmi}. \item[\code{o}] The symbol for diminished chords. Per default this is - \code{\cs*{textsuperscript}\Marg{o}}. \verbcode+\chordname{Go}+ - \chordname{Go}. + \code{\cs*{textsuperscript}\Marg{o}}. \verbcode+\writechord{Go}+ + \writechord{Go}. \item[\code{+}] The symbol for augmented chords. Per default this is - \code{\cs*{textsuperscript}\Marg{+}}. \verbcode!\chordname{G+}! - \chordname{G+}. + \code{\cs*{textsuperscript}\Marg{+}}. \verbcode!\writechord{G+}! + \writechord{G+}. \item[\code{/o}] The symbol for half diminished chords. Per default this is \code{\cs*{textsuperscript}\Marg{\cs*{o}\Marg{}}}. - \verbcode+\chordname{G/o}+ \chordname{G/o}. + \verbcode+\writechord{G/o}+ \writechord{G/o}. \item[\code{\#}] The \enquote{sharp} symbol. Per default this is - \cs{sharp}. \verbcode+\chordname{F#}+ \chordname{F#}. + \cs{sharp}. \verbcode+\writechord{F#}+ \writechord{F#}. \item[\code{\#\#}] The \enquote{double sharp} symbol. Per default this is - \cs{doublesharp}. \verbcode+\chordname{F##}+ \chordname{F##}. + \cs{doublesharp}. \verbcode+\writechord{F##}+ \writechord{F##}. \item[\code{b}] The \enquote{flat} symbol. Per default this is - \cs{flat}. \verbcode+\chordname{Eb}+ \chordname{Eb}. + \cs{flat}. \verbcode+\writechord{Eb}+ \writechord{Eb}. \item[\code{bb}] The \enquote{double flat} symbol. Per default this is - \cs{doubleflat}. \verbcode+\chordname{Ebb}+ \chordname{Ebb}. + \cs{doubleflat}. \verbcode+\writechord{Ebb}+ \writechord{Ebb}. \item[\code{b\#}] Cancelling flat/sharp combination: this is removed. \item[\code{\#b}] Cancelling sharp/flat combination: this is removed. - \item[\code{add}] This is superscripted: \verbcode+\chordname{Gadd9}+ - \chordname{Gadd9}. - \item[\code{sus}] This is superscripted: \verbcode+\chordname{Gsus4}+ - \chordname{Gsus4}. - \item[\code{dim}] This is superscripted: \verbcode+\chordname{Gdim5}+ - \chordname{Gdim5}. - \item[\code{maj7}] This is superscripted: \verbcode+\chordname{Gmaj7}+ - \chordname{Gmaj7}. - \item[\code{maj9}] This is superscripted: \verbcode+\chordname{Gmaj9}+ - \chordname{Gmaj9}. + \item[\code{add}] This is superscripted: \verbcode+\writechord{Gadd9}+ + \writechord{Gadd9}. + \item[\code{sus}] This is superscripted: \verbcode+\writechord{Gsus4}+ + \writechord{Gsus4}. + \item[\code{dim}] This is superscripted: \verbcode+\writechord{Gdim5}+ + \writechord{Gdim5}. + \item[\code{maj7}] This is superscripted: \verbcode+\writechord{Gmaj7}+ + \writechord{Gmaj7}. + \item[\code{maj9}] This is superscripted: \verbcode+\writechord{Gmaj9}+ + \writechord{Gmaj9}. \end{labeling} How these token lists are treated depends on optional settings: \begin{example} - \setchordnames{ + \setchords{ major-seven = $\Delta$ , major-nine = $\Delta$\textsuperscript{9} } - \chordname{Gmaj7} \chordname{Gmaj9} - \chordname{G^6} \chordname{G6} - \chordname{G7^#5} + \writechord{Gmaj7} \writechord{Gmaj9} + \writechord{G^6} \writechord{G6} + \writechord{G7^#5} \end{example} If you want to use the library standalone then you can say: \begin{sourcecode} \usepackage[minimal]{leadsheets} - \useleadsheetslibraries{chordnames} + \useleadsheetslibraries{chords} \end{sourcecode} This also loads the \musicsymbols{} library. @@ -437,12 +454,12 @@ This also loads the \musicsymbols{} library. Options are set with the command \begin{commands} - \command{setchordnames}[\marg{options}] + \command{setchords}[\marg{options}] where \meta{options} is a comma separated list of keyval options. \end{commands} Actually there's a second possibility: options can also be set with the command \cs{setleadsheets} (see section~\ref{sec:options}) if they're preceded -by \code{chordnames/} (including the slash). +by \code{chords/} (including the slash). The options allow detailed customization of how chords are printed. It doesn't change the input syntax. @@ -481,69 +498,55 @@ doesn't change the input syntax. The token list \code{maj9}. \end{options} -There are two further options which concern the different notations of the -pitches \chordname{B} and \chordname{Bb} in German (and a few other European +There are further options which concern the different notations of the pitches +\writechord{B} and \writechord{Bb} in German (and a few other European countries) and English. \begin{options} - \keychoice{input-notation}{literal,german,english}\Default{literal} - If set to \code{german} B should be input as \code{H} and B~flat as - \code{B}. If set to \code{american} B should be input as \code{B} and - B~flat as \code{Bb}. - \keychoice{output-notation}{literal,german,english}\Default{literal} - \setchordnames{output-notation=german}If set to \code{german} B is output - as \chordname{B} and B-flat as \chordname{Bb}. + \keychoice{input-notation}{german,english}\Default{english} + If\changedversion{0.2} set to \code{german} B should be input as \code{H} + and B~flat as \code{B}. If set to \code{english} B should be input as + \code{B} and B~flat as \code{Bb}. + \keychoice{output-notation}{german,english}\Default{english} + \setchords{output-notation=german}If\changedversion{0.2} set to + \code{german} B is output as \writechord{B} and B-flat as \writechord{Bb}. + \keyval{german-B}{code}\Default{B} + Customize\sinceversion{0.2} the output of B~flat when + \keyis{output-notation}{german}. + \keyval{german-H}{code}\Default{H} + Customize\sinceversion{0.2} the output of B when + \keyis{output-notation}{german}. \end{options} -Setting one option to a value other than \code{literal} implicitly sets the -other one to \code{english} except the other option already has been set. -This is shown in the example below. Setting on option to \code{literal} again -also sets the other option to \code{literal}. This also resets the options. -Earlier settings are forgotten. What does that mean? Here is an exercise: -which options are active at each step and at the end? -\begin{sourcecode} - 1. \setchordnames{ input-notation = german } - 2. \setchordnames{ output-notation = german , input-notation = english } - 3. \setchordnames{ input-notation = german } - 4. \setchordnames{ output-notation = english , input-notation = literal } - 5. \setchordnames{ output-notation = german } -\end{sourcecode} -Here's the solution: -\begin{enumerate} - \item \keyis{input-notation}{german} and \keyis{output-notation}{english} - \item \keyis{input-notation}{english} and \keyis{output-notation}{german} - \item \keyis{input-notation}{german} and \keyis{output-notation}{german} - \item \keyis{input-notation}{literal} and \keyis{output-notation}{literal} - \item \keyis{input-notation}{german} and \keyis{output-notation}{english} -\end{enumerate} -The following example shows the effects of different input and output -notations. +Let's see a few examples for the \option{input-notation} and +\option{output-notation} options. + \begin{example} - input and output literal:\par - \chordname{Bb} \chordname{B} \chordname{B#}\par - \chordname{B} \chordname{H} \chordname{H#}\par + input and output English:\par + \writechord{Bb} \writechord{B} \writechord{B#}\par + \writechord{B} \writechord{H} \writechord{H#}\par \medskip - \setchordnames{input-notation=german} + \setchords{input-notation=german} input German and output English:\par - \chordname{Bb} \chordname{B} \chordname{B#}\par - \chordname{B} \chordname{H} \chordname{H#}\par + \writechord{Bb} \writechord{B} \writechord{B#}\par + \writechord{B} \writechord{H} \writechord{H#}\par \medskip - \setchordnames{output-notation=german} + \setchords{output-notation=german} input and output German:\par - \chordname{Bb} \chordname{B} \chordname{B#}\par - \chordname{B} \chordname{H} \chordname{H#}\par + \writechord{Bb} \writechord{B} \writechord{B#}\par + \writechord{B} \writechord{H} \writechord{H#}\par \medskip - \setchordnames{input-notation=english} + \setchords{input-notation=english} input English and output German:\par - \chordname{Bb} \chordname{B} \chordname{B#}\par - \chordname{B} \chordname{H} \chordname{H#}\par + \writechord{Bb} \writechord{B} \writechord{B#}\par + \writechord{B} \writechord{H} \writechord{H#} \end{example} \section{The \library*{musejazz} Library}\label{sec:musejazz-libr} -The \musejazz\ library extends the \chordnames\ library to use +The \musejazz\ library extends the \chords\ library to use MuseScore's\footnote{\url{http://musescore.com/}} font \enquote{MuseJazz} for the chord symbols. The library contains the two lines which explains why it requires \LuaLaTeX\ or \XeLaTeX. Well, and the font, obviously. @@ -561,7 +564,7 @@ Here is a small example of it's usage and the outcome: \usepackage{leadsheets} \useleadsheetslibrary{musejazz} \begin{document} - \Huge\chordname{Bb7(#9)}\space\chordname{F##9} + \Huge\writechord{Bb7(#9)}\space\writechord{F##9} \end{document} \end{example} @@ -886,7 +889,7 @@ following option: \subsection{Options}\label{sec:verses-options} The \env{verse} environment and all related environments have the following -option: +options: \begin{options} \keyval{format}{code}\Default @@ -894,6 +897,11 @@ option: be used to add formatting, \eg, \keyis{format}{\cs*{itshape}}. \keyval{label-format}{code}\Default The same for the environment labels. + \keyval{class}{class-name}\Default{default} + The\sinceversion{0.2} \env{verse} environment and all related environments + all belong to a class, the default class is called \code{default}. This + is of interest when using the \option{remember-chords} and + \option{recall-chords} options.\label{option:class} \end{options} This can be used either locally, \ie, as option to the corresponding @@ -954,7 +962,9 @@ shortcut for the command \cs{chord}, \shortcut{\_} is a shortcut for \option{transpose} and \option{enharmonic} before printing it. This command can/should be used for placing chords inline or for typesetting the \property{key} property in a template. The command is used by - \cs{chord} for the actual printing. + \cs{chord} for the actual printing. The command also transforms the + chords according to the options \option{input-notation} and + \option{output-notation}.\label{cs:writechord} \end{commands} \begin{example}[side-by-side] @@ -1123,7 +1133,7 @@ can use the option \option{recall-chords}: \begin{verse} ^Lorem ipsum ^dolor sit ^amet, consetetur ^sadipscing \end{verse} - \begin{chorus}[recall-chords=verse] + \begin{chorus}[recall-chords=verse-default] ^Lorem ipsum ^dolor sit amet, consetetur ^sadipscing \end{chorus} \end{song} @@ -1140,17 +1150,17 @@ table~\ref{tab:key-signatures}, the chords of a song can be transposed. \meta{number} can be a negative number, then the chords are transposed down. \keychoice{enharmonic}{sharp,flat} - Suppose you transpose a song in the key of \chordname{E} down a semitone. - \leadsheets{} will then transpose to the key of \chordname{Eb}. It always + Suppose you transpose a song in the key of \writechord{E} down a semitone. + \leadsheets{} will then transpose to the key of \writechord{Eb}. It always chooses the key whose signature has less accidentals. You can force a variant, though, by using this option. With \keyis{enharmonic}{sharp} - \leadsheets{} would have chosen \chordname{D#} instead of \chordname{Eb}. + \leadsheets{} would have chosen \writechord{D#} instead of \writechord{Eb}. \keybool{transpose-capo} When this is set to true chords are transposed down on semitone per capo fret. \end{options} -The transposing mechanism relies on the \chordnames{} input syntax which means +The transposing mechanism relies on the \chords{} input syntax which means that if you change \option{chord-cs} horrible things may happen. \emph{So don't change \option{chord-cs} and use \option{transpose} at the same time!} @@ -1158,7 +1168,7 @@ that if you change \option{chord-cs} horrible things may happen. \emph{So \centering \catcode`\#=12 \catcode`\!=6 - \def\showsignature!1{\chordname{!1}&\code{!1}}% + \def\showsignature!1{\writechord{!1}&\code{!1}}% \caption{Allowed keys for the \property{key} property.} \begin{tabular}{*{12}{l}} \toprule @@ -1306,9 +1316,14 @@ They have more options. Here's a complete list: definitions, see section~\ref{sec:verse-type-templates}) prints the name of the current environment (as determined by the translation of the corresponding string, see also section~\ref{sec:internationalization}). - \keyval{recall-chords}{environment} + \keylit{recall-chords}{\meta{environment}-\meta{class}} An option to be used with the \option{remember-chords} mechanism, see - section~\ref{sec:remembering-chords} for an example. + section~\ref{sec:remembering-chords} for an example. If you're not using + different classes then \meta{class} needs to be \code{default}, see also + page~\pageref{option:class}. The \option{class} to a \env{verse}-like + environment allows for example to have verses with different chords which + are still counted reguarly together with the \option{remember-chords} + option. \end{options} There are also a number of general options for setting the defaults of some @@ -1586,7 +1601,7 @@ commands. {}% \ifsongproperty{key} {% - & \setchordnames{ + & \setchords{ major = -\GetTranslation{leadsheets/major} , minor = -\GetTranslation{leadsheets/minor} }% diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex index 0843dcddfa0..8c875b60906 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex @@ -1,12 +1,9 @@ -\LeadsheetsExplLibrary{chordnames} - {2014/08/10 typesetting chord names with easy syntax} +\LeadsheetsExplLibrary{chordnames}{2015/07/02 typesetting chord names with easy syntax} \leadsheets_load_library:n {musicsymbols} -\bool_new:N \l__leadsheets_output_notation_german_bool -\bool_new:N \l__leadsheets_input_notation_german_bool -\bool_new:N \l__leadsheets_notation_literal_bool -\bool_set_true:N \l__leadsheets_notation_literal_bool +% \bool_new:N \l__leadsheets_output_notation_german_bool +% \bool_new:N \l__leadsheets_input_notation_german_bool \tl_new:N \l__leadsheets_chord_tl \tl_new:N \l__leadsheets_tension_tl @@ -17,6 +14,7 @@ \cs_new_protected:Npn \leadsheets_chord_sym:Nnn #1#2#3 { \tl_replace_all:Nnn #1 {#2} {#3} } +\cs_generate_variant:Nn \leadsheets_chord_sym:Nnn {NnV} \tl_new:N \l__leadsheets_sharp_tl \tl_new:N \l__leadsheets_flat_tl @@ -31,6 +29,8 @@ \tl_new:N \l__leadsheets_dim_tl \tl_new:N \l__leadsheets_add_tl \tl_new:N \l__leadsheets_major_seven_tl +\tl_new:N \l__leadsheets_german_B_tl +\tl_new:N \l__leadsheets_german_H_tl \tl_set:Nn \l__leadsheets_sharp_tl {\sharp} \tl_set:Nn \l__leadsheets_flat_tl {\flat} @@ -46,6 +46,8 @@ \tl_set:Nn \l__leadsheets_add_tl {\textsuperscript{add}} \tl_set:Nn \l__leadsheets_major_seven_tl {\textsuperscript{maj7}} \tl_set:Nn \l__leadsheets_major_nine_tl {\textsuperscript{maj9}} +\tl_set:Nn \l__leadsheets_german_B_tl {B} +\tl_set:Nn \l__leadsheets_german_H_tl {H} \group_begin: % for convenient input of sharps: @@ -74,23 +76,10 @@ \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {sus} {\l__leadsheets_sus_tl} \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {^} {\textsuperscript} - \bool_if:NF \l__leadsheets_notation_literal_bool + \bool_if:NT \l__leadsheets_output_notation_german_bool { - % convert to English to German input: - \bool_if:NT \l__leadsheets_input_notation_german_bool - { - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {B} {@@@} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {H} {B} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {@@@} {Bb} - } - % convert to English to German output: - \bool_if:NT \l__leadsheets_output_notation_german_bool - { - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {Bb} {@@@} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {B} {H} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {@@@} {B} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {B#} {H} - } + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {B} \l__leadsheets_german_B_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {H} \l__leadsheets_german_H_tl } \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {#b} {} \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {b#} {} @@ -98,10 +87,10 @@ {\l__leadsheets_doublesharp_tl} \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {bb} {\l__leadsheets_doubleflat_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {#} {\l__leadsheets_sharp_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {b} {\l__leadsheets_flat_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {dim} {\l__leadsheets_dim_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {add} {\l__leadsheets_add_tl} + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {#} \l__leadsheets_sharp_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {b} \l__leadsheets_flat_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {dim} \l__leadsheets_dim_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {add} \l__leadsheets_add_tl \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {0} \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {1} \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {2} @@ -144,7 +133,7 @@ \group_end: } -\keys_define:nn {leadsheets/chordnames} +\keys_define:nn {leadsheets/chords} { format .tl_set:N = \l__leadsheets_format_tl , sharp .tl_set:N = \l__leadsheets_sharp_tl , @@ -161,33 +150,25 @@ dim .tl_set:N = \l__leadsheets_dim_tl , major-seven .tl_set:N = \l__leadsheets_major_seven_tl , major-nine .tl_set:N = \l__leadsheets_major_nine_tl , - output-notation .choice: , - output-notation/literal .code:n = - \bool_set_false:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_output_notation_german_bool - \bool_set_true:N \l__leadsheets_notation_literal_bool , - output-notation/german .code:n = - \bool_set_true:N \l__leadsheets_output_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool , - output-notation/english .code:n = - \bool_set_false:N \l__leadsheets_output_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool , - input-notation .choice: , - input-notation/literal .code:n = - \bool_set_false:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_output_notation_german_bool - \bool_set_true:N \l__leadsheets_notation_literal_bool , - input-notation/german .code:n = - \bool_set_true:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool , - input-notation/english .code:n = - \bool_set_false:N \l__leadsheets_input_notation_german_bool - \bool_set_false:N \l__leadsheets_notation_literal_bool + german-B .tl_set:N = \l__leadsheets_german_B_tl , + german-H .tl_set:N = \l__leadsheets_german_H_tl + % since version 0.2 those are defined in the `chords` library: + % output-notation .choice: , + % input-notation .choice: , } -\NewDocumentCommand \setchordnames {m} - { \keys_set:nn {leadsheets/chordnames} {#1} } +\NewDocumentCommand \setchords {m} + { \keys_set:nn {leadsheets/chords} {#1} } \NewDocumentCommand \chordname {} { \leadsheets_chord: } \endinput + +HISTORY: + +2014/08/10 - first version +2015/05/08 - drop `literal' option for input and output notation + - input/output notation is now handled by the `chords' library + - German output of B and H can be customized +2015/05/22 - improvements to the chord macros +2015/07/02 - this is not a use library any more diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex index 0dce4372717..3dd24ce0dd4 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.chords.code.tex @@ -1,8 +1,12 @@ -\LeadsheetsExplLibrary{chords}{2014/08/10 printing chords} +\LeadsheetsExplLibrary{chords}{2015/07/02 printing chords} \msg_new:nnn {leadsheets} {no-chords} { No~ more~ chords~ left~ for~ verse~ type~ `#1'~ \msg_line_context: } +\leadsheets_load_library:n {chordnames} +\bool_new:N \l__leadsheets_output_notation_german_bool +\bool_new:N \l__leadsheets_input_notation_german_bool + \tl_new:N \l__leadsheets_current_chord_tl \tl_new:N \l__leadsheets_chord_stack_alignment_tl \tl_set:Nn \l__leadsheets_chord_stack_alignment_tl {c} @@ -16,7 +20,7 @@ \prop_new:N \g__leadsheets_chords_sequences_prop -\seq_new:N \l__leadsheets_chords_sequences_seq +\seq_new:N \g__leadsheets_chords_sequences_seq \dim_new:N \l__leadsheets_empty_chord_dim \dim_set:Nn \l__leadsheets_empty_chord_dim {1em} @@ -24,16 +28,6 @@ \cs_new:Npn \leadsheets_chord_print:n #1 {#1} \cs_generate_variant:Nn \leadsheets_chord_print:n {V} -\cs_new_protected:Npn \leadsheets_chord:nnn #1#2#3 - { - \leadsheets_if_record_chords:T - { \seq_put_right:Nn \l__leadsheets_chords_sequences_seq { {#3} } } - \leadsheets_set_chord:nnn - {#1} - {#2} - { \leadsheets_chord_write:n {#3} } - } - \cs_new_protected:Npn \leadsheets_set_chord:nnn #1#2#3 { \bool_if:NTF #1 @@ -59,11 +53,43 @@ #3 } -\cs_new_protected:Npn \leadsheets_chord_write:n #1 +\cs_new_protected:Npn \leadsheets_chord:nnn #1#2#3 { -% \bool_if:NT \l__leadsheets_chord_print_bool -% { - \tl_set:Nn \l__leadsheets_current_chord_tl {#1} + \leadsheets_if_record_chords:T + { \seq_gput_right:Nn \g__leadsheets_chords_sequences_seq { {#3} } } + \leadsheets_set_chord:nnn + {#1} + {#2} + { \leadsheets_chord_write:n {#3} } + } + +\group_begin: + +\cs_new_protected:Npn \leadsheets_chord_write:n + { + \group_begin: + \char_set_catcode_other:N \# + \char_set_catcode_active:N \^ + \__leadsheets_chord_write:n + } + +% for convenient input of sharps: +\char_set_catcode_other:N \# +% because ^ is active in the song environment: +\char_set_catcode_active:N \^ +% # is other so we need another parameter character: +\char_set_catcode_parameter:N \? + +\cs_new_protected:Npn \__leadsheets_chord_write:n ?1 + { + \tl_set:Nn \l__leadsheets_current_chord_tl {?1} + % => convert to English input + \bool_if:NTF \l__leadsheets_input_notation_german_bool + { + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {B} {Bb} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {H} {B} + } + { \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {H} {B} } \bool_if:nT { \leadsheets_if_property_p:Vn \l_leadsheets_current_song_id_tl {key} @@ -87,9 +113,20 @@ {transpose-key} \l_leadsheets_current_song_id_tl } + % => convert to specified output + \bool_if:NT \l__leadsheets_output_notation_german_bool + { + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {Bb} {@@@} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {B} {H} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {@@@} {B} + \tl_replace_all:Nnn \l__leadsheets_current_chord_tl {B#} {H} + } + % => this is \chordname initially: \leadsheets_chord_print:V \l__leadsheets_current_chord_tl -% } + \group_end: } +\group_end: + \cs_generate_variant:Nn \leadsheets_chord_write:n { V } \cs_new_protected:Npn \leadsheets_place_above:nnn #1#2#3 @@ -126,13 +163,22 @@ chord-cs .code:n = \cs_set_protected:Npn \leadsheets_chord_print:n {#1} , chord-cs .initial:n = \chordname , - print-chords .bool_set:N = \l__leadsheets_chord_print_bool + print-chords .bool_set:N = \l__leadsheets_chord_print_bool , + chords/output-notation .choice: , + chords/output-notation/german .code:n = + \bool_set_true:N \l__leadsheets_output_notation_german_bool , + chords/output-notation/english .code:n = + \bool_set_false:N \l__leadsheets_output_notation_german_bool , + chords/input-notation .choice: , + chords/input-notation/german .code:n = + \bool_set_true:N \l__leadsheets_input_notation_german_bool , + chords/input-notation/english .code:n = + \bool_set_false:N \l__leadsheets_input_notation_german_bool } -\NewDocumentCommand \chord {st-m} { \leadsheets_chord:nnn {#1} {#2} {#3} } +\NewDocumentCommand \chord {st-} { \leadsheets_chord:nnn {#1} {#2} } -\NewDocumentCommand \writechord {m} - { \leadsheets_chord_write:n {#1} } +\NewDocumentCommand \writechord {} { \leadsheets_chord_write:n } % -------------------------------------------------------------------------- % record changes for a verse and automatically print them in the next: @@ -174,7 +220,7 @@ \cs_new_protected:Npn \leadsheets_recall_chord:nn #1#2 { - \seq_pop_left:NNF \l__leadsheets_chords_sequences_seq + \seq_pop_left:NNF \g__leadsheets_chords_sequences_seq \l__leadsheets_tmpa_tl { \msg_error:nnV {leadsheets} {no-chords} \l_leadsheets_verse_type_tl } \leadsheets_set_chord:nnn @@ -187,3 +233,14 @@ { \leadsheets_recall_chord:nn {#1} {#2} } \endinput + +HISTORY: + +2014/08/10 - first version +2015/07/02 - input/output notation is done here now instead of in the + `chordnames' library so transposing works with either input + correctly + - options `input-notation' and `output-notation' now directly + belong to the `chords' library. + - this is now a user library + diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex index a669e3cdb8e..3344cdd758b 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.songs.code.tex @@ -1,4 +1,4 @@ -\LeadsheetsExplLibrary{songs}{2014/08/10 typesetting songs} +\LeadsheetsExplLibrary{songs}{2015/07/02 typesetting songs} % -------------------------------------------------------------------------- % messages: @@ -47,6 +47,7 @@ \bool_new:N \l__leadsheets_obey_lines_bool \bool_new:N \l__leadsheets_bar_shorthands_bool \bool_new:N \l__leadsheets_measuring_bool +\bool_new:N \l__leadsheets_recall_verse_type_bool \clist_new:N \l__leadsheets_print_tags_clist @@ -447,6 +448,9 @@ % -------------------------------------------------------------------------- % verses and the like: +\tl_new:N \l__leadsheets_verses_default_class_tl +\tl_set:Nn \l__leadsheets_verses_default_class_tl {default} + \cs_new_protected:Npn \leadsheets_verse_label:n #1 { \bool_if:cF {l__leadsheets_#1_empty_bool} @@ -496,6 +500,7 @@ \bool_if:NTF #1 { \bool_set_true:c {l__leadsheets_#2_empty_bool} } { \bool_set_false:c {l__leadsheets_#2_empty_bool} } + \tl_new:c {l__leadsheets_#2_class_tl} \tl_new:c {l__leadsheets_#2_format_tl} \tl_new:c {l__leadsheets_#2_template_tl} \tl_new:c {l__leadsheets_#2_label_format_tl} @@ -507,6 +512,8 @@ { numbered .bool_set:c = {l__leadsheets_#2_numbered_bool} , named .bool_set:c = {l__leadsheets_#2_named_bool} , + class .tl_set:c = {l__leadsheets_#2_class_tl} , + class .initial:V = \l__leadsheets_verses_default_class_tl , format .code:n = \tl_set:cn {l__leadsheets_#2_format_tl} {##1} , format .initial:n = \l__leadsheets_verses_format_tl , @@ -519,7 +526,9 @@ template .code:n = \tl_set:cn {l__leadsheets_#2_template_tl} {##1} , template .initial:n = itemize , - recall-chords .tl_set:N = \l__leadsheets_recall_verse_type_tl , + recall-chords .code:n = + \tl_set:Nn \l__leadsheets_recall_verse_type_tl {##1} + \bool_set_true:N \l__leadsheets_recall_verse_type_bool , name .code:n = \@trnslt@declare@translation {leadsheets/#2} {fallback} {##1} \@trnslt@declare@translation {leadsheets/#2} {English} {##1} @@ -527,20 +536,27 @@ \NewDocumentEnvironment {#2} {O{}} { \par - \tl_set:Nn \l_leadsheets_verse_type_tl {#2} - \tl_set:Nn \l__leadsheets_recall_verse_type_tl {#2} + \bool_set_false:N \l__leadsheets_recall_verse_type_bool \keys_set:nn {leadsheets/#2} {##1} + \tl_set:Nx \l_leadsheets_verse_type_tl + { #2-\tl_use:c {l__leadsheets_#2_class_tl} } + \bool_if:NF \l__leadsheets_recall_verse_type_bool + { + \tl_set_eq:NN + \l__leadsheets_recall_verse_type_tl + \l_leadsheets_verse_type_tl + } \leadsheets_if_record_chords:T - { \seq_clear:N \l__leadsheets_chords_sequences_seq } + { \seq_gclear:N \g__leadsheets_chords_sequences_seq } \leadsheets_if_recall_chords:T { \prop_get:NVN \g__leadsheets_chords_sequences_prop \l__leadsheets_recall_verse_type_tl \l__leadsheets_tmpa_tl - \seq_clear:N \l__leadsheets_chords_sequences_seq + \seq_gclear:N \g__leadsheets_chords_sequences_seq \tl_map_inline:Nn \l__leadsheets_tmpa_tl - { \seq_put_right:Nn \l__leadsheets_chords_sequences_seq {####1} } + { \seq_gput_right:Nn \g__leadsheets_chords_sequences_seq {####1} } } \leadsheets_verse_begin:n {#2} \tl_use:c {l__leadsheets_#2_format_tl} @@ -550,7 +566,7 @@ { \prop_gput:NVf \g__leadsheets_chords_sequences_prop \l_leadsheets_verse_type_tl - { \seq_use:Nn \l__leadsheets_chords_sequences_seq {} } + { \seq_use:Nn \g__leadsheets_chords_sequences_seq {} } } \leadsheets_verse_end:n {#2} \par @@ -616,6 +632,7 @@ verses-format .tl_set:N = \l__leadsheets_verses_format_tl , verses-label-format .tl_set:N = \l__leadsheets_verses_label_format_tl , verses-after-label .tl_set:N = \l__leadsheets_verses_after_label_tl , + verses-default-class .tl_set:N = \l__leadsheets_verses_default_class_tl , obey-lines .bool_set:N = \l__leadsheets_obey_lines_bool , obey-lines-parskip .skip_set:N = \l__leadsheets_obey_parskip_skip , bar-shortcuts .bool_set:N = \l__leadsheets_bar_shorthands_bool , @@ -629,3 +646,5 @@ } \endinput +2015/05/22: \l__leadsheets_chords_sequences_prop changed into global +2015/07/02: added `class' option to verses diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty index 21e744f36d0..430bde992de 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty @@ -5,9 +5,9 @@ % -------------------------------------------------------------------------- % package information: \ExplSyntaxOn -\tl_const:Nx \c_leadsheets_date_tl {2015/01/11} -\tl_const:Nx \c_leadsheets_version_tl {0.1} -\tl_const:Nx \c_leadsheets_info_tl {Typesetting leadsheets and songbooks} +\tl_const:Nn \c_leadsheets_date_tl {2015/07/02} +\tl_const:Nn \c_leadsheets_version_tl {0.2} +\tl_const:Nn \c_leadsheets_info_tl {Typesetting leadsheets and songbooks} \ProvidesExplPackage {leadsheets} @@ -134,9 +134,9 @@ musicsymbols .code:n = \bool_set_true:N \l__leadsheets_with_options_bool \leadsheets_load_library:n {musicsymbols} , - chordnames .code:n = + chords .code:n = \bool_set_true:N \l__leadsheets_with_options_bool - \leadsheets_load_library:n {chordnames} , + \leadsheets_load_library:n {chords} , musejazz .code:n = \bool_set_true:N \l__leadsheets_with_options_bool \leadsheets_load_library:n {musejazz} , -- cgit v1.2.3