From 2639cda39baf8b76bc02b0e2cd4e426570ee46d5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 19 Aug 2016 21:44:56 +0000 Subject: leadsheets (19aug16) git-svn-id: svn://tug.org/texlive/trunk@41890 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/leadsheets/README | 4 +- .../doc/latex/leadsheets/leadsheets_en.pdf | Bin 836428 -> 913056 bytes .../doc/latex/leadsheets/leadsheets_en.tex | 340 +++++++++++++++++++-- .../texmf-dist/tex/latex/leadsheets/leadsheet.cls | 187 ++++++++++++ .../leadsheets.library.chordnames.code.tex | 74 +++-- .../leadsheets/leadsheets.library.chords.code.tex | 68 +++-- .../leadsheets.library.external.code.tex | 181 +++++++++++ .../leadsheets.library.musejazz.code.tex | 1 - .../leadsheets.library.musicsymbols.code.tex | 32 +- .../leadsheets.library.properties.code.tex | 43 ++- .../leadsheets.library.shorthands.code.tex | 48 +-- .../leadsheets/leadsheets.library.songs.code.tex | 270 ++++++++++------ .../leadsheets.library.templates.code.tex | 15 +- .../leadsheets.library.translations.code.tex | 73 +++-- .../leadsheets.library.transposing.code.tex | 1 - .../texmf-dist/tex/latex/leadsheets/leadsheets.sty | 84 ++++- 16 files changed, 1151 insertions(+), 270 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/leadsheets/leadsheet.cls create mode 100644 Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.external.code.tex (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/leadsheets/README b/Master/texmf-dist/doc/latex/leadsheets/README index 955c3c8222d..b9aa292acc4 100644 --- a/Master/texmf-dist/doc/latex/leadsheets/README +++ b/Master/texmf-dist/doc/latex/leadsheets/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the LEADSHEETS package v0.3a 2016/02/02 +the LEADSHEETS package v0.5 2016/08/18 typesetting leadsheets and songbooks @@ -28,9 +28,11 @@ The leadsheets bundle consists of the following files leadsheets.library..code.tex: * chordnames * chords + * external * musejazz * musicsymbols * properties + * shorthands * songs * templates * translations diff --git a/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.pdf b/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.pdf index 8bed560bd85..1bbdd730d63 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 2c1e3acbbb4..4ac2ee677f5 100644 --- a/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.tex +++ b/Master/texmf-dist/doc/latex/leadsheets/leadsheets_en.tex @@ -1,20 +1,22 @@ -% !arara: pdflatex: { shell: on } -% arara: biber -% arara: pdflatex -% arara: pdflatex +% arara: pdflatex: { shell: on , action: nonstopmode } +% !arara: biber +% !arara: pdflatex +% !arara: pdflatex \documentclass[load-preamble+]{cnltx-doc} -\usepackage{leadsheets} +\usepackage{leadsheets,bookmark} \setcnltx{ package = leadsheets , info = Typesetting leadsheets and songbooks , authors = Clemens Niederberger , email = contact@mychemistry.eu , - url = http://www.mychemistry.eu/forums/forum/leadsheets/ , + url = https://github.com/cgnieder/leadsheets/ , add-cmds = { - chord , chordname , + choir , chord , chordname , definesongtitletemplate , defineversetypetemplate , expandcode , + ifallsongproperties , + ifanysongproperty , ifobeylines , ifsongmeasuring , ifsongpropertiesequal , @@ -22,6 +24,14 @@ ifversenamed , ifversenumbered , ifversestarred , + includeleadsheet , + instruction , + leadsheetstranslate , + lsenparen , + mkchoir , + mkinstruction , + mklsenparen , + mklsenparens , newversetype , printsongpropertylist , setchords , @@ -42,6 +52,7 @@ endmdframed , mdframed , newfontfamily , + newrobustcmd , musejazz } , add-envs = { @@ -52,7 +63,8 @@ info , interlude , intro , intro* , - outro , outro * + outro , outro * , + prechorus , prechorus* , solo , solo* , song , verse @@ -227,11 +239,14 @@ The user-libraries are the following ones: library to use MuseScore's \enquote{MuseJazz} font, see section~\ref{sec:musejazz-libr}. It loads the \library{chords} library. - \item[\library{songs}] \packageoption{songs}This is the \emph{main + \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}. + library. This library is described in part~\ref{part:leadsheets-songs-library}. + \item[\library{external}] \packageoption{external}enables to include + external leadsheet documents using the \cls{leadsheets} class into a main + document, see part~\ref{part:external-leadsheet} for details. \end{description} Those libraries can also be loaded as a package option. If you say \begin{sourcecode} @@ -254,6 +269,9 @@ the following list gives hints to where some of the concepts are explained: loaded directly by users. It defines the necessary macros for song properties. See section~\ref{sec:song-properties} for more details on the concept. + \item[\library{shorthands}] This is an auxiliary library not meant to be + loaded directly by users. It provides means for defining shorthand + characters. \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. @@ -315,6 +333,8 @@ they're not explained here. \showsymbol{wholerest} & \showsymbol{halfrest} \\ \showsymbol{quarterrest} & \showsymbol{eighthrest} \\ \showsymbol{sixteenthrest} \\ + \midrule + \showsymbol{Break} \\ \bottomrule \end{tabular} \label{tab:musicsymbols} @@ -352,8 +372,15 @@ bars: The distance between two bar rules as in \cs{doublebar} or \cs{stopbar}. \end{commands} +Finally \musicsymbols{} provides a macro for adding an abitrary meter: +\begin{commands} + \command{meter}[\marg{numerator}\marg{denominator}] + \sinceversion{0.5}For example \verbcode+\meter{6}{8}+: \meter{6}{8} +\end{commands} + \clearpage -\part{The \library*{chords} Library (and the \library*{musejazz} Library)}\label{part:chords-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.% @@ -491,7 +518,9 @@ doesn't change the input syntax. \keyval{major}{code}\Default The token list \code{ma}. \keyval{minor}{code}\Default{m} - The token list \code{mi}. + The token list \code{mi}. This option knows a special value. If you set + \keyis{minor}{lowercase} then minor chords are converted to lowercase + letters. This means an input \code{Dmi} becomes \code{d}. \keyval{major-seven}{code}\Default{\cs*{textsuperscript}\Marg{maj7}} The token list \code{maj7}. \keyval{major-nine}{code}\Default{\cs*{textsuperscript}\Marg{maj9}} @@ -558,7 +587,7 @@ requires \LuaLaTeX\ or \XeLaTeX. Well, and the font, obviously. Here is a small example of it's usage and the outcome: -\begin{example}[compile,program=lualatex,max-pages=1,add-frame=false] +\begin{example}[compile,program=xelatex,max-pages=1,add-frame=false] % compile with LuaLaTeX or XeLaTeX \documentclass[margin=4mm]{standalone} \usepackage{leadsheets} @@ -569,7 +598,7 @@ Here is a small example of it's usage and the outcome: \end{example} \clearpage -\part{The \library*{songs} Library}\label{part:leadsheets-library} +\part{The \library*{songs} Library}\label{part:leadsheets-songs-library} \dictum[Jeff Beck]{% I don't care about the rules. If I don't break the rules at least ten times every song then I'm not doing my job.% @@ -581,7 +610,7 @@ The \leadsheets{} package allows for easy creation of leadsheets but it also can be used to create complete songbooks. The basic idea is that songs are typeset in the \env{song} environment. Each song gets a number of properties (see section~\ref{sec:song-properties}) that determine how the title of the -song is typeset. For the typesetting of the titles a template mechansim is +song is typeset. For the typesetting of the titles a template mechanism is used (see section~\ref{sec:title-templates}). Songs can also be tagged. The tags then allow to typeset only songs matching a list of tags that is specified via an option. @@ -722,6 +751,10 @@ Although I used the word \enquote{global} above \emph{all options are local to Makes the characters \shortcut{:} and \shortcut{\barsymbol} active inside the \env{song} environment. See sections~\ref{sec:special-characters} and~\ref{sec:typesetting-bars} for more details. + \keybool{disable-measuring}\Default{false} + \sinceversion{0.4}This option turns of the song height measuring. This + makes song title template definitions easier (see section~\ref{sec:title-templates} for + details). \emph{The song property \property{height} will be set to 0pt then!} \end{options} \subsection{Song Properties}\label{sec:song-properties} @@ -796,15 +829,17 @@ templates (see section~\ref{sec:title-templates}). One specific property, There are three more properties, \property{counter}, \property{ID} and \property{height} that cannot be set but are set automatically for each song. The \property{counter} simply holds the number of the current song starting -from \code{1} for the first song. The \property{ID} currently always ia +from \code{1} for the first song. The \property{ID} currently always is \code{song\meta{counter}} where \meta{counter} is the current \property{counter} value. The property \property{height} holds the height of the typeset song in pt. The height is determined by placing the body of the respective \env{song} environment in a vertical box and measuring the height -and depth of the box. This is done in a measuring phase that can be tested in -a songtitle template definition, see section~\ref{sec:title-templates} for -details. \emph{ This is important since the property \property{height} is not -available in the measuring phase but only afterwards!} +and depth of the box. This is done in a measuring phase that can and should +be tested in a songtitle template definition, see +section~\ref{sec:title-templates} for details. \emph{This is important since + the property \property{height} is not available in the measuring phase but + only afterwards!} If the option \option{disable-measuring} has been set the +property \property{height} will have the value~0pt! In principle all properties can get list of entries where items are separated with \code{\visualizespaces{ and }}. Of course this doesn't make sense for @@ -1107,7 +1142,7 @@ as \cs{chord} with one exception: it lacks the mandatory argument and \code{-}, though, as well as the mandatory space (\visiblespace)! Each \env{verse} like environment (see section~\ref{sec:other-envverse-like} -for more information) is treated uniquely by this mechansim: +for more information) is treated uniquely by this mechanism: \begin{example} \definesongtitletemplate{empty}{} @@ -1424,7 +1459,7 @@ The titles of songs set with the \env{song} environment are displayed according to the chosen title template. It is chosen through the option \option{title-template} which can be set with \cs{setleadsheets} or as option to a specific \env{song} environment. \leadsheets{} provides few predefined -templates and an easy mechansim to define own templates. +templates and an easy mechanism to define own templates. \subsubsection{Existing Templates} @@ -1488,16 +1523,22 @@ contents or other auxiliary files. mandatory argument. \expandable\command{ifsongproperty}[\marg{property}\marg{true}\marg{false}] Checks if property \meta{property} has been set. + \command{ifanysongproperty}[\Marg{csv list of properties}\marg{true}\marg{false}] + \sinceversion{0.4}Checks if any of the properties in \meta{csv list of + properties} has been set. + \command{ifallsongproperties}[\Marg{csv list of properties}\marg{true}\marg{false}] + \sinceversion{0.4}Checks if all of the properties in \meta{csv list of + properties} have been set. \command{ifsongpropertiesequal}[\marg{property 1}\marg{property 2}\marg{true}\marg{false}] Checks if properties \meta{property 1} and \meta{property 2} have been set to the same value. \expandable\command{ifsongmeasuring}[\marg{true}\marg{false}] \leadsheets{} measures the height of a song body before it typesets it and - it can be necessary in a template to know if the measuring phase is active - or not. For example the song property \property{height} should only be - used if \emph{not} in the measuring phase: it's value get's determined - there and is not yet available. + it can often be necessary in a template to know if the measuring phase is + active or not. For example the song property \property{height} should + only be used if \emph{not} in the measuring phase: it's value get's + determined there and is not yet available. \command{expandcode}[\marg{code}] Exhaustively expands \meta{code}. Experienced users won't need this. It is essentially @@ -1934,10 +1975,255 @@ that \cs{printsongpropertylist} is not expandable. \end{table} \clearpage -\part{Appendix} +\part{The \library*{external} Library and the \cls*{leadsheet} + Class}\label{part:external-leadsheet} \dictum[Thelonious Monk]{% Talking about music is like dancing about architecture.% } + +\section{The Idea} + +For\sinceversion{0.5} some users -- like myself -- it may be desirable to +create leadsheets that can be reused in another document as a compilation of +songs. The usual way would be to +\begin{itemize} + \item either solve this manually by copying the \env{song} environment from + one document to the other. This is not ideal, of course. + \item place the \env{song} in a file of its own and \cs*{input} it in the + different documents. This is easy and safe but requires a total of three + files for two documents. That's not really a problem, though, so it is a + valid way. +\end{itemize} + +\leadsheets{} now provides a third way. You write the single leadsheet using +the \cls{leadsheet} class that comes with this package. Let's call this file +\code{single.tex} for the following discussion: +\begin{sourcecode} + \documentclass{leadsheet} + \usepackage[T1]{fontenc} + \usepackage[utf8]{inputenc} + + \begin{document} + + \begin{song}{ ... } + ... + \end{song} + + \end{document} +\end{sourcecode} + +You can now include this document as is in another file -- let's call it +\code{multiple.tex}: +\begin{sourcecode} + \documentclass{scrartcl} + \usepackage{leadsheets} + \useleadsheetslibraries{external} + + \begin{document} + + \includeleadsheet{single.tex} + + \end{document} +\end{sourcecode} + +Depending on the settings this removes the complete preamble from +\code{single.tex} and only includes the document body of the file. + +\section{The \cls*{leadsheet} Class}\label{sec:leadsheet-class} + +The \cls{leadsheet} class is a class file built upon the \cls{scrartcl} +class. It defines a song title template \titletemplate{leadsheet}, makes a +few setup choices +\begin{sourcecode} + \setleadsheets{ + title-template = leadsheet , + bar-shortcuts , + verse/numbered , + verses-format = , + verses-label-format = \bfseries , + info/format = \itshape , + chorus/format = \itshape + } +\end{sourcecode} +and sets the header and the footer of the leadsheet pages. + +\begin{example}[ + compile, + graphics={trim={2cm 18cm 2cm 2cm},clip}, + add-sourcecode-options={literate=}] + \documentclass{leadsheet} + \usepackage[T1]{fontenc} + \usepackage[utf8]{inputenc} + \usepackage[ngerman]{babel} + + \begin{document} + + \begin{song}{title={Mary Had A Little Lamb}, music={Stevie Ray Vaughan}, + interpret={Stevie Ray Vaughan}, lyrics={traditional}, tags={srv,blues}} + \begin{verse} + Mary had a little lamb \\ + Its fleece was white as snow, yea \\ + Everywhere the child went \\ + The little lamb was sure to go, yea + \end{verse} + \begin{verse} + He followed her to school one day \\ + And broke the teacher's rule \\ + What a time did they have \\ + That day at school + \end{verse} + \end{song} + + \end{document} +\end{example} + +The header contains \enquote{\meta{song title} (\meta{interpret})} if the +leadsheet has more than one page in total. Otherwise it is empty. + +The footer contains \enquote{\meta{page} of \meta{pages}} if the leadsheet has +more than one page in total. Otherwise it is empty. + +The class provides the verse type \env{prechorus}: +\begin{environments} + \environment{prechorus}[\oarg{options}] + Environment for marking the pre-chorus of a song. +\end{environments} + +\begin{commands} + \command{instruction}[\marg{text}] + Short macro to add instructional text. + \command{mkinstruction}[\marg{text}] + The formatting macro used by \cs{instruction}. You can redefine it in + order to change the appearance. The default definition is: \\ + \verbcode+\newcommand*\mkinstruction[1]{\emph{#1}}+ + \command{choir}[\marg{text}] + Short macro to add (background) choir text. + \command{mkchoir}[\marg{text}] + The formatting macro used by \cs{choir}. You can redefine it in + order to change the appearance. The default definition is: \\ + \verbcode+\newcommand*\mkchoir[1]{\instruction{\leadsheetstranslate{choir}: #1}}+ + \command{lsenparen}[\marg{text}] + Short macro to add parentheses around text. Used internally by + \cs{instruction}. + \command{mklsenparens} + The parentheses setting macro used by \cs{lsenparen}. You can redefine it + in order to change the parentheses. The default definition is: \\ + \verbcode+\newcommand*\mklsenparens{[]}+ \\ + \emph{The definition needs to be expandable and to expand to exactly two + tokens or braced groups, one for the opening parenthesis and the second + for the closing parenthesis!} + \command{mklsenparen}[\marg{openen parenthesis}\marg{closing + parenthesis}\marg{text}] + The formatting macro used by \cs{lsenparen}. You can redefine it in + order to change the appearance. The default definition is: \\ + \verbcode+\newcommand*\mklsenparen[3]{\textup{#1}#3\textup{#2}}+ +\end{commands} + +Here is an example that demonstrates \cs{choir} and \cs{instruction}. (The +code of the example code has been saved in a file called +\code{single-leadsheet.tex}. It is used later on again.)\label{single-leadsheet} +\begin{example}[compile,graphics={trim={2cm 18cm 2cm 2cm},clip}, + add-sourcecode-options={literate=}] + \documentclass{leadsheet} + \usepackage[T1]{fontenc} + \usepackage[utf8]{inputenc} + + \begin{document} + + \begin{song}{title=foobar} + \begin{verse} + \instruction{keyboard only} \\ + Lorem ipsum dolor sit amet, consetetur sadipscing \\ + \choir{sed diam nonumy eirmod tempor invidunt ut labore et dolore} + \end{verse} + \begin{prechorus} + \instruction{+ band} \\ + Lorem ipsum dolor sit amet, consetetur sadipscing + \end{prechorus} + \end{song} + + \end{document} +\end{example} + +\section{The \library*{external} Library} + +Loading the \library{external} library allows to include complete leadsheet +documents (\ie, with preamble) into a main document. This requires the +included leadsheet to use the \cls{leadsheet} class (see +section~\ref{sec:leadsheet-class}). When the file is included the whole +preamble of said file will be discarded. This can be changed with an option +but then \cs*{usepackage} and \cs*{RequirePackage} will still be disabled and +simply do nothing in the included file. + +\begin{commands} + \command{includeleadsheet}[\sarg\oarg{options}\marg{file name}] + Include the leadsheet \meta{file name}. \meta{options} apply locally for + the included file. The file \meta{file name} may include a complete + document preamble. +\end{commands} + +\begin{filecontents*}{single-leadsheet.tex} +\documentclass{leadsheet} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} + +\begin{document} + +\begin{song}{title=foobar} +\begin{verse} + \instruction{keyboard only} \\ + Lorem ipsum dolor sit amet, consetetur sadipscing \\ + \choir{sed diam nonumy eirmod tempor invidunt ut labore et dolore} +\end{verse} +\begin{prechorus} + \instruction{+ band} \\ + Lorem ipsum dolor sit amet, consetetur sadipscing +\end{prechorus} +\end{song} + +\end{document} +\end{filecontents*} +The next example shows the basic usage by inputting the example file mentioned +on page~\pageref{single-leadsheet}. \emph{Notice that the formatting setup by + the \cls{leadsheets} is not used}. Also the title template +\titletemplate{leadsheet} is not defined in this process. +\begin{example}[compile,graphics={trim={2cm 18cm 2cm 2cm},clip}, + add-sourcecode-options={literate=}] + \documentclass{scrartcl} + \usepackage{leadsheets} + \useleadsheetslibraries{external} + + \begin{document} + + \includeleadsheet{single-leadsheet} + + \end{document} +\end{example} +Also notice that the \env{prechorus} environment and the \cs{instruction} and +\cs{choir} macros \emph{are} available! \emph{All new macros defined in the + \cls{leadsheet} class and described in section~\ref{sec:leadsheet-class} are + defined}. If you do not want this then you can use the starred version of +\cs{includeleadsheet}. In this process the preamble of the included file is +gobbled. It may be desirable not to have the preamble gobbled, though -- +because of custom macro definitions for example. +\begin{options} + \keybool{gobble-preamble}\Default{true} + If set to \code{false} \cs{includeleadsheet} will not gobble the preamble + of the file it inputs. Using this is dangerous: for it to work + \cs*{usepackage} and \cs*{RequirePackage} have to be disabled while the + file is included. So including the preamble may lead to more problems + than it solves. +\end{options} + +The included leadsheets do not have to be a complete document -- a standard +tex file only consisting of the \env{song} environments will work just as +nicely. Files that are complete documents but are using another class than +\cls{leadsheet} will lead to errors, though. + +\clearpage +\part{Appendix} +\dictum[Thelonious Monk]{Wrong is right.} \appendix \end{document} + diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheet.cls b/Master/texmf-dist/tex/latex/leadsheets/leadsheet.cls new file mode 100644 index 00000000000..ab584ee80dd --- /dev/null +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheet.cls @@ -0,0 +1,187 @@ +% -------------------------------------------------------------------------- +% the LEADSHEETS package +% +% typesetting leadsheets and songbooks +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2014-2016 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +\ProvidesClass{leadsheet}[2016/07/21 v0.5 leadsheets class (part of the leadsheets package)] +\LoadClassWithOptions{scrartcl} + +\RequirePackage{leadsheets} + +\RequirePackage{etoolbox} +\RequirePackage{translations} + +\defleadsheetstranslation{Fallback}{page}{page} +\defleadsheetstranslation{Fallback}{of}{of} +\defleadsheetstranslation{Fallback}{music}{music} +\defleadsheetstranslation{Fallback}{text}{text} +\defleadsheetstranslation{Fallback}{as-played-by}{as played by} +\defleadsheetstranslation{Fallback}{choir}{choir} + +\defleadsheetstranslation{German}{page}{Seite} +\defleadsheetstranslation{German}{of}{von} +\defleadsheetstranslation{German}{music}{Musik} +\defleadsheetstranslation{German}{text}{Text} +\defleadsheetstranslation{German}{as-played-by}{wie gespielt von} +\defleadsheetstranslation{German}{choir}{Chor} + +\providecommand*\ls@songtitle{} +\providecommand*\ls@songinterpret{} + +\definesongproperty{language} + +\newbool{ls@comma} +\newrobustcmd*\ls@addcomma{% + \ifbool{ls@comma}{, }{}% + \boolfalse{ls@comma}% +} + +\newrobustcmd*\ls@printproperty[2]{% + \ifsongproperty{#1}{% + \ls@addcomma + #2% + \booltrue{ls@comma}% + }{}% +} + +\definesongtitletemplate{leadsheet}{% + \section*{% + \songproperty{title}% + \ifsongproperty{subtitle}{ (\songproperty{subtitle})}{}% + } + \xdef\ls@songtitle{\songproperty{title}}% + \ifsongproperty{composer} + {% + \ifsongproperty{lyrics} + {% + \leadsheetstranslate{lyrics}: + \printsongpropertylist{lyrics}{ \& }{, }{ \& }, + \booltrue{ls@comma}% + } + {}% + \leadsheetstranslate{music}: + \printsongpropertylist{composer}{ \& }{, }{ \& }% + \booltrue{ls@comma}% + } + {% + \ifsongproperty{lyrics} + {% + \leadsheetstranslate{lyrics}: + \printsongpropertylist{lyrics}{ \& }{, }{ \& }% + \ifsongproperty{music}{, }{}% + \booltrue{ls@comma}% + } + {}% + \ifsongproperty{music} + {% + \ifsongproperty{lyrics} + {} + {\leadsheetstranslate{lyrics} \& }% + \leadsheetstranslate{music}: + \printsongpropertylist{music}{ \& }{, }{ \& }% + \booltrue{ls@comma}% + } + {}% + }% + \ifsongproperty{band} + {% + \ls@addcomma + \leadsheetstranslate{as-played-by}: + \songproperty{band}% + \xdef\ls@songinterpret{\songproperty{band}}% + \booltrue{ls@comma}% + }{% + \ifsongproperty{interpret} + {% + \ls@addcomma + \leadsheetstranslate{as-played-by}: + \songproperty{interpret}% + \xdef\ls@songinterpret{\songproperty{interpret}}% + \booltrue{ls@comma}% + } + {}% + }% + \ifsongproperty{key} + {% + \ls@addcomma + \leadsheetstranslate{key}: + \expandcode{\writechord{\songproperty{key}}} + } + {}% + \ifsongproperty{language} + {% + \ifboolexpr{ + test {\leadsheetsifpackageloaded{babel}} or + test {\leadsheetsifpackageloaded{poyglossia}} + }{\expandcode{\noexpand\selectlanguage{\songproperty{language}}}} + {}% + } + {}% +} + +\setleadsheets{ + title-template = leadsheet , + bar-shortcuts , + verse/numbered , + verses-format = , + verses-label-format = \bfseries , + info/format = \itshape , + chorus/format = \itshape +} + +\RequirePackage{scrlayer-scrpage,zref-totpages} +\pagestyle{scrheadings} +\rohead{} +\cohead{% + \ifnum\ztotpages>1 + \ifnum\value{page}=1 + \else + \ls@songtitle + \ifdefvoid\ls@songinterpret{}{ (\ls@songinterpret)}% + \fi + \fi +} +\cofoot{% + \ifnum\ztotpages>1 + \leadsheetstranslate{page}~\thepage~% + \leadsheetstranslate{of}~\ztotpages + \fi +} + +\LeadsheetSurvive +\provideversetype{prechorus}[name=Prechorus] +\provideversetype*{prechorus*}[name=Prechorus] + +\providerobustcmd*\lsenparen[1]{% + \expandcode{\noexpand\mklsenparen\mklsenparens{\unexpanded{#1}}}% +} +\providecommand*\mklsenparens{[]} +\providecommand*\mklsenparen[3]{\textup{#1}#3\textup{#2}} + +\providerobustcmd*\instruction[1]{\lsenparen{\mkinstruction{#1}}} +\providecommand*\mkinstruction[1]{\emph{#1}} + +\providerobustcmd*\choir[1]{\null\qquad\mkchoir{#1}} +\providecommand*\mkchoir[1]{\instruction{\leadsheetstranslate{choir}: #1}} +\LeadsheetEndSurvive + +\endinput +2016/08/17 - first version added to `leadsheets' 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 4342d33d69b..9fe740fcc62 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 @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -22,19 +21,20 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\LeadsheetsExplLibrary{chordnames}{2015/07/02 typesetting chord names with easy syntax} +\LeadsheetsExplLibrary{chordnames}{2016/07/05 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 - \tl_new:N \l__leadsheets_chord_tl \tl_new:N \l__leadsheets_tension_tl \tl_new:N \l__leadsheets_format_tl \cs_new_protected:Npn \leadsheets_tension_sym:Nn #1#2 - { \tl_replace_all:Nnn #1 {#2} { \textsuperscript{#2} } } + { \tl_replace_all:Nnn #1 {#2} { \textsuperscript {#2} } } + +\cs_new_protected:Npn \leadsheets_tension_sym:Nnn #1#2#3 + { \tl_replace_all:Nnn #1 {#2} { \textsuperscript {#3} } } +\cs_generate_variant:Nn \leadsheets_tension_sym:Nnn {NnV} \cs_new_protected:Npn \leadsheets_chord_sym:Nnn #1#2#3 { \tl_replace_all:Nnn #1 {#2} {#3} } @@ -93,12 +93,9 @@ \cs_gset_protected:Npn \leadsheets_chord_aux:n !1 { \tl_set:Nn \l__leadsheets_chord_tl {!1} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {maj7} - {\l__leadsheets_major_seven_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {maj9} - {\l__leadsheets_major_nine_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {sus} - {\l__leadsheets_sus_tl} + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {maj7} \l__leadsheets_major_seven_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {maj9} \l__leadsheets_major_nine_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {sus} \l__leadsheets_sus_tl \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {^} {\textsuperscript} \bool_if:NT \l__leadsheets_output_notation_german_bool { @@ -107,10 +104,8 @@ } \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {#b} {} \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {b#} {} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {##} - {\l__leadsheets_doublesharp_tl} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {bb} - {\l__leadsheets_doubleflat_tl} + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {##} \l__leadsheets_doublesharp_tl + \leadsheets_chord_sym:NnV \l__leadsheets_chord_tl {bb} \l__leadsheets_doubleflat_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 @@ -125,12 +120,9 @@ \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {7} \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {8} \leadsheets_tension_sym:Nn \l__leadsheets_chord_tl {9} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {/o} - {\textsuperscript{\l__leadsheets_half_dim_tl}} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {o} - {\textsuperscript{\l__leadsheets_full_dim_tl}} - \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {+} - {\textsuperscript{\l__leadsheets_aug_tl}} + \leadsheets_tension_sym:NnV \l__leadsheets_chord_tl {/o} \l__leadsheets_half_dim_tl + \leadsheets_tension_sym:NnV \l__leadsheets_chord_tl {o} \l__leadsheets_full_dim_tl + \leadsheets_tension_sym:NnV \l__leadsheets_chord_tl {+} \l__leadsheets_aug_tl \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {(} { \leadsheets_tension:w( } \leadsheets_chord_sym:Nnn \l__leadsheets_chord_tl {mi} @@ -140,12 +132,31 @@ \tl_replace_all:Nnn \l__leadsheets_chord_tl {\textsuperscript\textsuperscript} {\textsuperscript} + \bool_if:NT \l__leadsheets_lowercase_minor_bool + { + \tl_put_left:Nn \l__leadsheets_chord_tl { \__leadsheets_start_minor:w } + \tl_put_right:Nn \l__leadsheets_chord_tl { \q_stop } + } +% \show \l__leadsheets_chord_tl \tl_use:N \l__leadsheets_chord_tl \group_end: } \group_end: +% lowercase letters for minor chords: +\bool_new:N \l__leadsheets_lowercase_minor_bool + +\cs_new_protected:Npn \__leadsheets_start_minor:w #1 \q_stop + { + \tl_if_in:nnTF {#1} {\l__leadsheets_minor_tl} + { \__leadsheets_revert_minor:w #1 \q_stop } + {#1} + } + +\cs_new_protected:Npn \__leadsheets_revert_minor:w #1 \l__leadsheets_minor_tl #2 \q_stop + { \tl_lower_case:n {#1} #2 } + \cs_new_protected:Npn \leadsheets_tension:w (#1) { \group_begin: @@ -168,14 +179,23 @@ full-dim .tl_set:N = \l__leadsheets_full_dim_tl , aug .tl_set:N = \l__leadsheets_aug_tl , major .tl_set:N = \l__leadsheets_major_tl , - minor .tl_set:N = \l__leadsheets_minor_tl , + minor .code:n = + \str_if_eq:nnTF {#1} {lowercase} + { + \bool_set_true:N \l__leadsheets_lowercase_minor_bool + \tl_clear:N \l__leadsheets_minor_tl + } + { + \bool_set_false:N \l__leadsheets_lowercase_minor_bool + \tl_set:Nn \l__leadsheets_minor_tl {#1} + } , sus .tl_set:N = \l__leadsheets_sus_tl , add .tl_set:N = \l__leadsheets_add_tl , 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 , german-B .tl_set:N = \l__leadsheets_german_B_tl , - german-H .tl_set:N = \l__leadsheets_german_H_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: , @@ -195,4 +215,8 @@ HISTORY: - 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 +2015/07/02 - this is not a user library any more +2016/07/05 - with option `minor=lowercase' minor chords are now printed with + lowercase letters; requires user input `Dmi' in order to get `d'; + lowercase letters can of course be input directly but then are + immune to transposing 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 96be6e7c483..0cea01229a3 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 @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -22,12 +21,13 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\LeadsheetsExplLibrary{chords}{2015/07/02 printing chords} +\LeadsheetsExplLibrary{chords}{2016/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 @@ -114,28 +114,31 @@ \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} - && - ( \l__leadsheets_transpose_bool || \l__leadsheets_transpose_capo_bool ) - } - { - \leadsheets_transpose:xVN - { \leadsheets_get_property:Vn \l_leadsheets_current_song_id_tl {key} } - \l__leadsheets_transpose_steps_int - \l__leadsheets_current_chord_tl - } - \bool_if:nTF - { - ! \leadsheets_if_property_p:Vn \l_leadsheets_current_song_id_tl {key} - && - ( \l__leadsheets_transpose_bool || \l__leadsheets_transpose_capo_bool ) - } + \leadsheets_if_library:nT {songs} { - \msg_warning:nnV {leadsheets} - {transpose-key} - \l_leadsheets_current_song_id_tl + \bool_if:nT + { + \leadsheets_if_property_p:Vn \l_leadsheets_current_song_id_tl {key} + && + ( \l__leadsheets_transpose_bool || \l__leadsheets_transpose_capo_bool ) + } + { + \leadsheets_transpose:xVN + { \leadsheets_get_property:Vn \l_leadsheets_current_song_id_tl {key} } + \l__leadsheets_transpose_steps_int + \l__leadsheets_current_chord_tl + } + \bool_if:nTF + { + ! \leadsheets_if_property_p:Vn \l_leadsheets_current_song_id_tl {key} + && + ( \l__leadsheets_transpose_bool || \l__leadsheets_transpose_capo_bool ) + } + { + \msg_warning:nnV {leadsheets} + {transpose-key} + \l_leadsheets_current_song_id_tl + } } % => convert to specified output \bool_if:NT \l__leadsheets_output_notation_german_bool @@ -158,7 +161,8 @@ \bool_if:NTF \l__leadsheets_chord_print_bool { \group_begin: - \leadsheets_ignore_lines: + \leadsheets_if_library:nT {songs} + { \leadsheets_ignore_lines: } \bool_if:NT \g__leadsheets_smash_next_chord_bool { \bool_set_true:N \l__leadsheets_smash_chords_bool @@ -235,13 +239,6 @@ { \prg_return_false: } } -\cs_new:Npn \leadsheets_remember_or_recall_chords:w - { - \leadsheets_if_recall_chords:TF - { \recallchord } - { \chord } - } - \cs_new_protected:Npn \leadsheets_recall_chord:nn #1#2 { \seq_pop_left:NNF \g__leadsheets_chords_sequences_seq @@ -256,6 +253,13 @@ \NewDocumentCommand \recallchord {st-} { \leadsheets_recall_chord:nn {#1} {#2} } +\NewDocumentCommand \getorprintchord {} + { + \leadsheets_if_recall_chords:TF + { \recallchord } + { \chord } + } + \endinput HISTORY: @@ -267,4 +271,4 @@ HISTORY: - options `input-notation' and `output-notation' now directly belong to the `chords' library. - this is now a user library - +2016/07/02 - \getorprintchord diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.external.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.external.code.tex new file mode 100644 index 00000000000..13c5c13c9ac --- /dev/null +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.external.code.tex @@ -0,0 +1,181 @@ +% -------------------------------------------------------------------------- +% the LEADSHEETS package +% +% typesetting leadsheets and songbooks +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2014-2016 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +\LeadsheetsExplLibrary{external} + {2016/08/18 include external leadsheets into a main file} + +\msg_new:nnn {leadsheets} {class-not-registered} + { + You've~ tried~ to~ include~ the~ leadsheet~ `#1'~ which~ uses~ the~ + document~ class~ `#2'.~ However,~ this~ class~ is~ not~ yet~ registered.~ + You~ can~ register~ it~ using~ the~ option~ `register-class'. + } + +\msg_new:nnn {leadsheets} {file-not-found} + { + You've~ tried~ to~ include~ the~ leadsheet~ `#1'.~ However,~ I~ can't~ + find~ the~ file~ `#1'.~ Please~ make~ sure~ the~ file~ exists~ in~ a~ + path~ where~ TeX~ can~ find~ it. + } + +\cs_generate_variant:Nn \msg_error:nnnn {nnV} + +\cs_new_protected:Npn \__leadsheets_disable_document_env: + { + \cs_set_protected:Npn \document + { + \cs_set_protected:Npn \enddocument + { \tex_endinput:D } + } + } + +% -------------------------------------------------------------------------- +% don't allow any class per default +\seq_new:N \l__leadsheets_external_classes_seq + +\cs_new_protected:Npn \leadsheets_add_external_class:n #1 + { + \seq_put_right:Nn \l__leadsheets_external_classes_seq {#1} + \seq_remove_duplicates:N \l__leadsheets_external_classes_seq + } +\cs_generate_variant:Nn \leadsheets_add_external_class:n {V} + +\leadsheets_add_external_class:n {leadsheet} + +\prg_new_conditional:Npnn \leadsheets_if_is_external_class:n #1 {p,T,F,TF} + { + \seq_if_in:NnTF \l__leadsheets_external_classes_seq {#1} + { \prg_return_true: } + { \prg_return_false: } + } + +\bool_new:N \l__leadsheets_gobble_preamble_bool + +\keys_define:nn {leadsheets} + { + gobble-preamble .bool_set:N = \l__leadsheets_gobble_preamble_bool , + gobble-preamble .initial:n = true , + register-class .code:n = + \clist_map_inline:nn {#1} + { + \tl_set:Nx \l__leadsheets_tmpa_tl { \tl_trim_spaces:n {##1} } + \leadsheets_add_external_class:V \l__leadsheets_tmpa_tl + } + } + +\cs_new_protected:Npn \leadsheets_documentclass:wnw + { + \peek_meaning:NTF [ % ] + { \__leadsheets_documentclass:wnw } + { \__leadsheets_documentclass:nw } + } + +\cs_new_protected:Npn \__leadsheets_documentclass:wnw [#1] + { \__leadsheets_documentclass:nw } + +\cs_new_protected:Npn \__leadsheets_documentclass:nw #1 + { + \peek_meaning:NTF [ % ] + { \__leadsheets_documentclass_aux:nw {#1} } + { \__leadsheets_documentclass:n {#1} } + } + +\cs_new_protected:Npn \__leadsheets_documentclass_aux:nw #1[#2] + { \__leadsheets_documentclass:n {#1} } + +\cs_new_protected:Npn \__leadsheets_documentclass:n #1 + { + \leadsheets_if_is_external_class:nF {#1} + { + \msg_error:nnVn {leadsheets} {class-not-registered} + \l__leadsheets_current_leadsheet_tl + {#1} + } + \RenewDocumentCommand \usepackage {omo} {} + \RenewDocumentCommand \RequirePackage {omo} {} + \__leadsheets_disable_document_env: + \bool_if:NT \l__leadsheets_gobble_preamble_bool + { \__leadsheets_gobble_preamble:wn } + } + +% include a file into a leadsheet only reading code between \LeadsheetSurvive +% and \LeadsheetEndSurvive +\cs_new_protected:Npn \leadsheets_include_external_file:nn #1#2 + { + \tl_set_from_file:Nnn \l__leadsheets_tmpa_tl + {} + { #1 \tl_if_blank:nF {#2} {.} #2 } + \cs_set:Npn \LeadsheetSurvive ##1 \LeadsheetEndSurvive ##2 \q_stop + { ##1 \__leadsheets_extract_survival:ww ##2 \q_stop } + \__leadsheets_include_external_file_aux:V \l__leadsheets_tmpa_tl + } + +\cs_new_protected:Npn \__leadsheets_include_external_file_aux:n #1 + { \__leadsheets_extract_survival:ww #1 \LeadsheetSurvive\LeadsheetSurvive \q_stop } +\cs_generate_variant:Nn \__leadsheets_include_external_file_aux:n {V} + +\cs_new_protected:Npn \__leadsheets_extract_survival:ww + #1 \LeadsheetSurvive #2 \LeadsheetSurvive #3 \q_stop + { + \tl_if_blank:nF {#3} + { \LeadsheetSurvive #2 \LeadsheetSurvive #3 \q_stop } + } + +\NewDocumentCommand \AddExternalFile {mm} + { \leadsheets_include_external_file:nn {#1} {#2} } +\NewDocumentCommand \AddExternalClass {m} + { \leadsheets_include_external_file:nn {#1} {cls} } +\NewDocumentCommand \AddExternalPackage {m} + { \leadsheets_include_external_file:nn {#1} {sty} } + +\cs_new_protected:Npn \__leadsheets_gobble_preamble:wn #1 \begin #2 + { + \str_if_eq:nnTF {#2} {document} + { \begin {#2} } + { \__leadsheets_gobble_preamble:wn } + } + +\cs_new_protected:Npn \leadsheets_include_leadsheet:nn #1#2 + { + \file_if_exist:nTF {#2} + { + \group_begin: + \keys_set:nn {leadsheets} {#1} + \tl_set:Nn \l__leadsheets_current_leadsheet_tl {#2} + \cs_set_eq:NN \documentclass \leadsheets_documentclass:wnw + \file_input:n {#2} + \group_end: + } + { \msg_error:nnn {leadsheets} {file-not-found} {#2} } + } + +\NewDocumentCommand \includeleadsheet {sO{}m} + { + \IfBooleanF {#1} + { \leadsheets_include_external_file:nn {leadsheet} {cls} } + \leadsheets_include_leadsheet:nn {#2} {#3} + } + +\endinput + +2016/08/18 - first version diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musejazz.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musejazz.code.tex index 6e13b570c12..6f74b0c3614 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musejazz.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musejazz.code.tex @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musicsymbols.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musicsymbols.code.tex index 02cf93aa5a8..893b69e7fd5 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musicsymbols.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.musicsymbols.code.tex @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -22,7 +21,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\LeadsheetsLibrary{musicsymbols}{2015/07/13 musical symbols} +\LeadsheetsLibrary{musicsymbols}{2016/02/15 musical symbols} \RequirePackage{etoolbox} % define a LaTeX font that uses the `musix' font from MusiXTeX: @@ -54,7 +53,7 @@ } % define the symbols -\renewrobustcmd*\sharp {\musicsymbol[.2ex]{4}\kern-.06em} +\renewrobustcmd*\sharp {\kern.05em\musicsymbol[.2ex]{4}\kern-.05em} \renewrobustcmd*\flat {\kern-.05em\musicsymbol{2}\kern-.06em} \renewrobustcmd*\natural {\musicsymbol{6}\kern-.06em} \newrobustcmd*\doublesharp {\kern.05em\musicsymbol{5}\kern-.05em} @@ -70,6 +69,17 @@ \newrobustcmd*\eighthrest {\musicsymbol[-1.5ex]{?}\kern.5em} \newrobustcmd*\sixteenthrest {\kern.05em\musicsymbol[-1.5ex]{@}\kern.5em} +\RequirePackage{amsmath} +\newrobustcmd*\meter[2]{% + \ensuremath{% + \genfrac{}{}{0pt}{}% + {\text{\textbf{#1}}}% + {\text{\textbf{#2}}}% + }% +} + +\newrobustcmd*\Break{\ensuremath{\perp}} + \newcommand*\leadsheets@size{\f@size pt} \newlength\leadsheets@barheight @@ -89,25 +99,26 @@ \newrobustcmd*\leadsheets@repeatcolon{% \leavevmode \setlength\leadsheets@barheight\leadsheets@size - \raise.1\leadsheets@barheight\hbox{:}% + \raise.1\leadsheets@barheight\hbox{\textup{:}}% } \newrobustcmd*\leadsheets@interbar{\kern\interbarwidth\relax} -\newrobustcmd*\normalbar{% +\newrobustcmd*\leadsheets@normalbar{% \genericbar{\normalbarwidth}% } +\newrobustcmd*\normalbar{\leadsheets@normalbar} \newrobustcmd*\leftrepeat{% \leadsheets@thickbar \leadsheets@interbar - \normalbar + \leadsheets@normalbar \leadsheets@repeatcolon } \newrobustcmd*\rightrepeat{% \leadsheets@repeatcolon - \normalbar + \leadsheets@normalbar \leadsheets@interbar \leadsheets@thickbar } @@ -121,13 +132,13 @@ } \newrobustcmd*\doublebar{% - \normalbar + \leadsheets@normalbar \leadsheets@interbar - \normalbar + \leadsheets@normalbar } \newrobustcmd*\stopbar{% - \normalbar + \leadsheets@normalbar \leadsheets@interbar \leadsheets@thickbar } @@ -136,3 +147,4 @@ 2014/08/10 - initial release 2015/07/13 - scale musix font by 1.5 => else the symbols are rather small! +2016/01/15 - \Break; improvements of bars diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.properties.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.properties.code.tex index f434525a50d..1b587975dea 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.properties.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.properties.code.tex @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -22,7 +21,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\LeadsheetsExplLibrary{properties}{2014/08/10 song properties} +\LeadsheetsExplLibrary{properties}{2016/05/18 song properties} \cs_generate_variant:Nn \tl_if_eq:nnTF {x} @@ -60,6 +59,35 @@ \cs_generate_variant:Nn \leadsheets_if_property:nnT { V } \cs_generate_variant:Nn \leadsheets_if_property_p:nn { V } +\prg_new_protected_conditional:Npnn \leadsheets_if_any_property:nn #1#2 {T,F,TF} + { + \bool_set_false:N \l__leadsheets_tmpa_bool + \clist_map_inline:nn {#1} + { + \prop_if_in:cnT {l__leadsheets_songs_#2_prop} {#1} + { \bool_set_true:N \l__leadsheets_tmpa_bool } + } + \bool_if:NTF \l__leadsheets_tmpa_bool + { \prg_return_true: } + { \prg_return_false: } + } +\cs_generate_variant:Nn \leadsheets_if_any_property:nnTF {V} + +\prg_new_protected_conditional:Npnn \leadsheets_if_all_properties:nn #1#2 {T,F,TF} + { + \bool_set_false:N \l__leadsheets_tmpa_bool + \clist_map_inline:nn {#1} + { + \prop_if_in:cnTF {l__leadsheets_songs_#2_prop} {#1} + { \bool_set_true:N \l__leadsheets_tmpa_bool } + { \bool_set_false:N \l__leadsheets_tmpa_bool } + } + \bool_if:NTF \l__leadsheets_tmpa_bool + { \prg_return_true: } + { \prg_return_false: } + } +\cs_generate_variant:Nn \leadsheets_if_all_properties:nnTF {V} + \prg_new_protected_conditional:Npnn \leadsheets_if_properties_eq:nnn #1#2#3 {T,F,TF} { \tl_if_eq:xxTF @@ -171,15 +199,25 @@ \DeclareExpandableDocumentCommand \ifsongproperty {m} { \leadsheets_if_property:VnTF \l_leadsheets_current_song_id_tl {#1} } +\NewDocumentCommand \ifanysongproperty {m} + { \leadsheets_if_any_property:VnTF \l_leadsheets_current_song_id_tl {#1} } + +\NewDocumentCommand \ifallsongproperties {m} + { \leadsheets_if_all_properties:VnTF \l_leadsheets_current_song_id_tl {#1} } + \DeclareExpandableDocumentCommand \ifsongmeasuring {} { \leadsheets_if_measuring:TF } \NewDocumentCommand \ifsongpropertiesequal {mm} { \leadsheets_if_properties_eq:VnnTF \l_leadsheets_current_song_id_tl {#1} {#2} } +% #1: property 1 +% #2: property 2 \NewDocumentCommand \ifsongpropertyequal {mm} { \leadsheets_if_property_eq:VnnTF \l_leadsheets_current_song_id_tl {#1} {#2} } +% #1: property +% #2: tokenlist \NewDocumentCommand \definesongproperty {m} { \leadsheets_define_property:n {#1} } \@onlypreamble\definesongproperty @@ -190,3 +228,4 @@ \endinput 2015/07/05: enable usage of # in the key property +2016/05/18: new commands \ifanysongproperty and \ifallsongproperties diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.shorthands.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.shorthands.code.tex index 184db99e233..eeaa4934b76 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.shorthands.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.shorthands.code.tex @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -23,45 +22,46 @@ % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- \LeadsheetsExplLibrary{shorthands} - {2014/08/10 definition and activation of shorthands} + {2016/06/29 definition and activation of shorthands} -\seq_new:N \l__leadsheets_shorthands_seq +\seq_new:N \l__leadsheets_shorthands_seq -\group_begin: -\char_set_catcode_active:N \~ - -\cs_new_protected:Npn \leadsheets_define_shorthand:Npn #1 +\cs_new_protected:Npn \leadsheets_define_shorthand:NN #1#2 { \seq_if_in:NnF \l__leadsheets_shorthands_seq {#1} { \seq_put_right:Nn \l__leadsheets_shorthands_seq {#1} } - \group_begin: - \__leadsheets_define_shorthand_aux_i:np {#1} + \char_set_active_eq:NN #1#2 + } + +\cs_new_protected:Npn \leadsheets_remove_shorthand:N #1 + { + \leadsheets_define_shorthand:NN #1 \c_empty_tl + \seq_remove_all:Nn \l__leadsheets_shorthands_seq {#1} + \prop_remove:Nn \l__leadsheets_shorthands_prop {#1} } -\cs_new_protected:Npn \__leadsheets_define_shorthand_aux_i:np #1#2# +\prg_new_conditional:Npnn \leadsheets_if_shorthand:N #1 {p,T,F,TF} { - \char_set_lccode:nn {`~} {`#1} - \__leadsheets_define_shorthand_aux_ii:nn {#2} + \seq_if_in:NnTF \l__leadsheets_shorthands_seq {#1} + { \prg_return_true: } + { \prg_return_false: } } -\cs_new_protected:Npn \__leadsheets_define_shorthand_aux_ii:nn #1#2 - { \tl_to_lowercase:n { \group_end: \cs_set:Npn ~ } #1 {#2} } +\cs_new_protected:Npn \leadsheets_for_all_shorthands_do:n #1 + { \seq_map_inline:Nn \l__leadsheets_shorthands_seq {#1} } -\group_end: +\cs_new_protected:Npn \leadsheets_activate_shorthand:N #1 + { \leadsheets_if_shorthand:NT #1 { \char_set_catcode_active:N #1 } } \cs_new_protected:Npn \leadsheets_activate_shorthands:n #1 - { - \tl_map_inline:nn {#1} - { - \seq_if_in:NnT \l__leadsheets_shorthands_seq {##1} - { \char_set_catcode_active:N ##1 } - } - } + { \tl_map_inline:nn {#1} { \leadsheets_activate_shorthand:N ##1 } } \cs_new_protected:Npn \leadsheets_activate_all_shorthands: { - \seq_map_inline:Nn \l__leadsheets_shorthands_seq - { \char_set_catcode_active:N ##1 } + \leadsheets_for_all_shorthands_do:n + { \leadsheets_activate_shorthand:N ##1 } } \endinput +2016/06/29 - breaking change: \leadsheets_define_shorthand:Npn is now + \leadsheets_define_shorthand:NN 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 63e3fc12832..546c36b43d6 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 @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -22,7 +21,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\LeadsheetsExplLibrary{songs}{2016/02/02 typesetting songs} +\LeadsheetsExplLibrary{songs}{2016/07/02 typesetting songs} % -------------------------------------------------------------------------- % messages: @@ -45,6 +44,12 @@ transposing~ mechanism~ \msg_line_context: } +\msg_new:nnn {leadsheets} {verse-exists} + { + The~ verse~ type~ `#1'~ you~ are~ about~ to~ define~ \msg_line_context: + \c_space_tl already~ exists. + } + % -------------------------------------------------------------------------- % variables: \tl_const:Nn \c_leadsheets_sharp_tl {sharp} @@ -74,6 +79,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_disable_measuring_bool \bool_new:N \l__leadsheets_recall_verse_type_bool \clist_new:N \l__leadsheets_print_tags_clist @@ -105,9 +111,7 @@ % -------------------------------------------------------------------------- % define shorthands -\leadsheets_define_shorthand:Npn ^ {\leadsheets_remember_or_recall_chords:w} -\leadsheets_define_shorthand:Npn _ {\writechord} -\leadsheets_define_shorthand:Npn | #1 +\cs_new_protected:Npn \leadsheets_bar:w #1 { \str_case:nnF {#1} { @@ -123,7 +127,7 @@ {\doublebar} } -\leadsheets_define_shorthand:Npn : +\cs_new_protected:Npn \leadsheets_bar_repeat: { \peek_charcode_remove:NTF | {\__leadsheets_checkrepeat:} @@ -136,6 +140,11 @@ {\rightrepeat} } +\leadsheets_define_shorthand:NN ^ \getorprintchord +\leadsheets_define_shorthand:NN _ \writechord +\leadsheets_define_shorthand:NN | \leadsheets_bar:w +\leadsheets_define_shorthand:NN : \leadsheets_bar_repeat: + % -------------------------------------------------------------------------- % the `song' environment: \NewDocumentEnvironment {song} { O{} } @@ -213,30 +222,30 @@ % -------------------------------------------------------------------------- % define song properties: -\definesongproperty {title} -\definesongproperty {subtitle} -\definesongproperty {short-title} -\definesongproperty {sort-title} -\definesongproperty {sort-short-title} -\definesongproperty {composer} -\definesongproperty {sort-composer} -\definesongproperty {music} -\definesongproperty {sort-music} -\definesongproperty {lyrics} -\definesongproperty {sort-lyrics} -\definesongproperty {arr} -\definesongproperty {sort-arr} -\definesongproperty {band} -\definesongproperty {sort-band} -\definesongproperty {genre} -\definesongproperty {interpret} -\definesongproperty {sort-interpret} -\definesongproperty {key} -\definesongproperty {capo} -\definesongproperty {tempo} -\definesongproperty {tags} -\definesongproperty {counter} -\definesongproperty {ID} +\leadsheets_define_property:n {title} +\leadsheets_define_property:n {subtitle} +\leadsheets_define_property:n {short-title} +\leadsheets_define_property:n {sort-title} +\leadsheets_define_property:n {sort-short-title} +\leadsheets_define_property:n {composer} +\leadsheets_define_property:n {sort-composer} +\leadsheets_define_property:n {music} +\leadsheets_define_property:n {sort-music} +\leadsheets_define_property:n {lyrics} +\leadsheets_define_property:n {sort-lyrics} +\leadsheets_define_property:n {arr} +\leadsheets_define_property:n {sort-arr} +\leadsheets_define_property:n {band} +\leadsheets_define_property:n {sort-band} +\leadsheets_define_property:n {genre} +\leadsheets_define_property:n {interpret} +\leadsheets_define_property:n {sort-interpret} +\leadsheets_define_property:n {key} +\leadsheets_define_property:n {capo} +\leadsheets_define_property:n {tempo} +\leadsheets_define_property:n {tags} +\leadsheets_define_property:n {counter} +\leadsheets_define_property:n {ID} % properties that should take the value of another property if they're not set % explicitly: @@ -282,8 +291,8 @@ \tl_set:Nn \l_leadsheets_current_song_id_tl {#1} \tl_put_right:Nn \l__leadsheets_song_body_tl { - \leadsheets_songtitle: - \leadsheets_check_capo: + \__leadsheets_check_capo: + \__leadsheets_songtitle: \tl_use:N \l__leadsheets_songtext_format_tl } \tl_put_right:NV \l__leadsheets_song_body_tl @@ -315,10 +324,9 @@ } } -\cs_new:Npn \leadsheets_end_song:n #1 +\cs_new_protected:Npn \leadsheets_end_song:n #1 { - \bool_set_true:N \l__leadsheets_measuring_bool - \leadsheets_reset_counters: + \__leadsheets_start_measuring:nw {#1} \tl_put_left:NV \l__leadsheets_song_body_tl \l__leadsheets_song_pre_hook_tl \tl_put_right:NV \l__leadsheets_song_body_tl @@ -334,15 +342,43 @@ } pt } - \bool_set_false:N \l__leadsheets_measuring_bool - \leadsheets_reset_counters: + \__leadsheets_stop_measuring: \tl_use:N \l__leadsheets_song_body_tl } +\cs_new_protected:Npn \__leadsheets_save_macro:N #1 + { \cs_set_eq:cN { __leadsheets_ \cs_to_str:N #1 } #1 } + +\cs_new_protected:Npn \__leadsheets_restore_macro:N #1 + { + \cs_set_eq:Nc #1 { __leadsheets_ \cs_to_str:N #1 } + \cs_undefine:c { __leadsheets_ \cs_to_str:N #1 } + } + +\cs_new_protected:Npn \__leadsheets_start_measuring:nw #1#2 \__leadsheets_stop_measuring: + { + \bool_if:NF \l__leadsheets_disable_measuring_bool + { \bool_set_true:N \l__leadsheets_measuring_bool } + \bool_if:NTF \l__leadsheets_measuring_bool + { + \__leadsheets_save_macro:N \if@filesw + \__leadsheets_reset_counters: \@fileswfalse #2 + \__leadsheets_restore_macro:N \if@filesw + } + { \leadsheets_set_property:nnn {#1} {height} {0pt} } + \__leadsheets_stop_measuring: + } + +\cs_new_protected:Npn \__leadsheets_stop_measuring: + { + \bool_set_false:N \l__leadsheets_measuring_bool + \__leadsheets_reset_counters: + } + \cs_new_protected:Npn \leadsheets_add_to_reset:n #1 { \seq_put_right:Nn \l__leadsheets_reset_counters_seq {#1} } -\cs_new_protected:Npn \leadsheets_reset_counters: +\cs_new_protected:Npn \__leadsheets_reset_counters: { \seq_map_inline:Nn \l__leadsheets_reset_counters_seq { \setcounter {##1} {0} } @@ -394,13 +430,6 @@ { \prg_return_true: } } -\keys_define:nn { leadsheets } - { - print-tags .code:n = - \bool_set_true:N \l__leadsheets_print_selected_bool - \clist_set:Nn \l__leadsheets_print_tags_clist {#1} - } - % -------------------------------------------------------------------------- % predefined title templates \definesongtitletemplate {minimal} @@ -458,7 +487,7 @@ % -------------------------------------------------------------------------- % capo settings: -\cs_new_protected:Npn \leadsheets_check_capo: +\cs_new_protected:Npn \__leadsheets_check_capo: { \leadsheets_if_property:VnTF \l_leadsheets_current_song_id_tl {capo} { @@ -475,7 +504,7 @@ } } -\cs_new:Npn \leadsheets_capo_number_print:n #1 {#1.} +\cs_new_protected:Npn \leadsheets_capo_number_print:n #1 {#1.} \cs_new_protected:Npn \leadsheets_capo: { @@ -539,21 +568,37 @@ \ignorespacesafterend } -\cs_new_protected:Npn \leadsheets_new_verse_type:Nnn #1#2#3 +\seq_new:N \l__leadsheets_verse_types_seq + +\prg_new_conditional:Npnn \leadsheets_if_verse_type_exist:n #1 {p,T,F,TF} + { + \seq_if_in:NnTF \l__leadsheets_verse_types_seq {#1} + { \prg_return_true: } + { \prg_return_false: } + } + +% #1: boolean +% #2: name +% #3: options +\cs_new_protected:Npn \__leadsheets_new_verse_type:nnn #1#2#3 { - \bool_new:c {l__leadsheets_#2_empty_bool} - \bool_new:c {l__leadsheets_#2_numbered_bool} - \bool_new:c {l__leadsheets_#2_named_bool} + \seq_put_right:Nn \l__leadsheets_verse_types_seq {#2} + \clist_map_inline:nn {empty,numbered,named} + { + \bool_if_exist:cF {l__leadsheets_#2_##1_bool} + { \bool_new:c {l__leadsheets_#2_##1_bool} } + } \bool_set_true:c {l__leadsheets_#2_named_bool} - \bool_if:NTF #1 + \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} - \tl_new:c {l__leadsheets_#2_after_label_tl} - \newcounter {#2} + \clist_map_inline:nn {class,format,template,label_format,after_label} + { + \tl_if_exist:cF {l__leadsheets_#2_##1_tl} + { \tl_new:c {l__leadsheets_#2_##1_tl} } + } + \cs_if_exist:cF {the#2} + { \newcounter {#2} } \leadsheets_add_to_reset:n {#2} \tl_set:cn {the#2} { \arabic {#2} . } \keys_define:nn {leadsheets/#2} @@ -578,8 +623,8 @@ \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} + \leadsheets_declare_translation:nnn {fallback} {#2} {##1} + \leadsheets_declare_translation:nnn {English} {#2} {##1} } \NewDocumentEnvironment {#2} {O{}} { @@ -603,9 +648,6 @@ { \seq_gclear:N \g__leadsheets_chords_sequences_seq } \leadsheets_if_recall_chords:T { - % \prop_show:N \g__leadsheets_chords_sequences_prop - % \tl_show:N \l__leadsheets_recall_verse_type_tl - % \seq_show:N \g__leadsheets_chords_sequences_seq \prop_get:NVN \g__leadsheets_chords_sequences_prop \l__leadsheets_recall_verse_type_tl @@ -627,28 +669,50 @@ \leadsheets_verse_end:n {#2} \par } - \@trnslt@declare@translation {leadsheets/#2} {fallback} {} - \@trnslt@declare@translation {leadsheets/#2} {English} {} + \leadsheets_declare_translation:nnn {fallback} {#2} {} + \leadsheets_declare_translation:nnn {English} {#2} {} \keys_set:nn {leadsheets/#2} {#3} } +% #1: boolean +% #2: name +% #3: options +\cs_new_protected:Npn \leadsheets_new_verse_type:nnn #1#2#3 + { + \leadsheets_if_verse_type_exist:nTF {#2} + { \msg_error:nnn {leadsheets} {verse-exists} {#2} } + { \__leadsheets_new_verse_type:nnn {#1} {#2} {#3} } + } + +% #1: boolean +% #2: name +% #3: options +\cs_new_protected:Npn \leadsheets_provide_verse_type:nnn #1#2#3 + { + \leadsheets_if_verse_type_exist:nF {#2} + { \__leadsheets_new_verse_type:nnn {#1} {#2} {#3} } + } + \NewDocumentCommand \newversetype {smO{}} - { \leadsheets_new_verse_type:Nnn #1 {#2} {#3} } + { \leadsheets_new_verse_type:nnn {#1} {#2} {#3} } + +\NewDocumentCommand \provideversetype {smO{}} + { \leadsheets_provide_verse_type:nnn {#1} {#2} {#3} } \cs_undefine:N \verse \cs_undefine:N \endverse \newversetype {verse} [ name=Verse, named=false, after-label= ] -\newversetype*{verse*} +\newversetype*{verse*} [ name=Verse ] \newversetype {chorus} [ name=Chorus ] -\newversetype*{chorus*} +\newversetype*{chorus*} [ name=Chorus ] \newversetype {intro} [ name=Intro ] \newversetype*{intro*} [ name=Intro ] \newversetype {outro} [ name=Outro ] \newversetype {interlude} [ name=Interlude ] \newversetype {bridge} [ name=Bridge ] \newversetype*{info} -\newversetype*{solo*} +\newversetype*{solo*} [ name=Solo ] \newversetype {solo} [ name=Solo ] % -------------------------------------------------------------------------- @@ -669,41 +733,47 @@ % -------------------------------------------------------------------------- -\keys_define:nn { leadsheets } +\keys_define:nn {leadsheets} { - title-template .tl_set:N = \l__leadsheets_songtitle_template_tl , - title-template .initial:n = minimal , - text-format .tl_set:N = \l__leadsheets_songtext_format_tl , - song-format .tl_set:N = \l__leadsheets_song_format_tl , - verse/type .choice: , - verse/type/verse .code:n = + title-template .tl_set:N = \l__leadsheets_songtitle_template_tl , + title-template .initial:n = minimal , + text-format .tl_set:N = \l__leadsheets_songtext_format_tl , + song-format .tl_set:N = \l__leadsheets_song_format_tl , + verse/type .choice: , + verse/type/verse .code:n = \tl_set:Nn \l_leadsheets_verse_type_tl {verse} , - verse/type/unknown .code:n = + verse/type/unknown .code:n = \msg_warning:nnn {leadsheets} {unknown-verse-type} {#1} \tl_set:Nn \l_leadsheets_verse_type_tl {verse} , - verse/format .tl_set:N = \l__leadsheets_verse_format_tl , - verse/format .initial:n = \l__leadsheets_verses_format_tl , - verse/label-format .tl_set:N = \l__leadsheets_verse_label_format_tl , - verse/label-format .initial:n = \l__leadsheets_verses_label_format_tl , - 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 , - capo-nr-format .choices:nn = + verse/format .tl_set:N = \l__leadsheets_verse_format_tl , + verse/format .initial:n = \l__leadsheets_verses_format_tl , + verse/label-format .tl_set:N = \l__leadsheets_verse_label_format_tl , + verse/label-format .initial:n = \l__leadsheets_verses_label_format_tl , + 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 , + bar-shortcuts .initial:n = true , + capo-nr-format .choices:nn = { arabic , roman , Roman } { \tl_set:NV \l__leadsheets_capo_number_format_tl \l_keys_choice_tl } , - capo-nr-format .initial:n = {Roman} , - capo-nr .code:n = + capo-nr-format .initial:n = {Roman} , + capo-nr .code:n = \cs_set_protected:Npn \leadsheets_capo_number_print:n ##1 {#1} , - capo-nr .initial:n = #1. , - before-song .tl_set:N = \l__leadsheets_song_pre_hook_tl , - after-song .tl_set:N = \l__leadsheets_song_post_hook_tl , - after-title .tl_set:N = \l__leadsheets_song_mid_hook_tl , - add-to-reset .code:n = - \clist_map_inline:nn {#1} { \leadsheets_add_to_reset:n {##1} } + capo-nr .initial:n = #1. , + before-song .tl_set:N = \l__leadsheets_song_pre_hook_tl , + after-song .tl_set:N = \l__leadsheets_song_post_hook_tl , + after-title .tl_set:N = \l__leadsheets_song_mid_hook_tl , + add-to-reset .code:n = + \clist_map_inline:nn {#1} { \leadsheets_add_to_reset:n {##1} } , + print-tags .code:n = + \bool_set_true:N \l__leadsheets_print_selected_bool + \clist_set:Nn \l__leadsheets_print_tags_clist {#1} , + disable-measuring .bool_set:N = \l__leadsheets_disable_measuring_bool , + disable-measuring .initial:n = false } \endinput @@ -713,3 +783,9 @@ 2015/07/27: new options `before-song', `after-song', `after-title' and `add-to-reset' 2015/02/02: enable to recall chords even if verse is used the first time +2016/05/18: new option `disable-measuring' + set \@fileswfalse during the measuring phase + if measuring is disabled the `height' property is set to 0pt +2016/06/29: - adapt to changed shorthand library + - activate bar-shortcuts per default +2016/07/02: fix issue when \capo is used in a title template diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.templates.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.templates.code.tex index bb6e2b98639..c4b908ff6ae 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.templates.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.templates.code.tex @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -31,11 +30,11 @@ \tl_new:N \l__leadsheets_songtitle_template_tl \prop_new:N \l__leadsheets_songtitle_template_prop -\NewDocumentCommand \songtitle {} { \leadsheets_songtitle: } +% \NewDocumentCommand \songtitle {} { \leadsheets_songtitle: } % the following is shamelessly adapted from the `needspace' package by % Peter Wilson and Herries Press: -\cs_new:Npn \leadsheets_needspace:n #1 +\cs_new_protected:Npn \__leadsheets_needspace:n #1 { \group_begin: \dim_set:Nn \l__leadsheets_tmpa_dim { #1 } @@ -49,13 +48,13 @@ \group_end: } -\cs_new_protected:Npn \leadsheets_songtitle: +\cs_new_protected:Npn \__leadsheets_songtitle: { - \leadsheets_use_songtitle_template:V \l__leadsheets_songtitle_template_tl - \leadsheets_needspace:n { 3\baselineskip } + \__leadsheets_use_songtitle_template:V \l__leadsheets_songtitle_template_tl + \__leadsheets_needspace:n { 3\baselineskip } } -\cs_new_protected:Npn \leadsheets_use_songtitle_template:n #1 +\cs_new_protected:Npn \__leadsheets_use_songtitle_template:n #1 { \prop_get:NnNTF \l__leadsheets_songtitle_template_prop {#1} @@ -63,7 +62,7 @@ { \l__leadsheets_tmpa_tl } { \msg_error:nnnn {leadsheets} {unknown-template} {songtitle} {#1} } } -\cs_generate_variant:Nn \leadsheets_use_songtitle_template:n { V } +\cs_generate_variant:Nn \__leadsheets_use_songtitle_template:n { V } \cs_new_protected:Npn \leadsheets_define_songtitle_template:nn #1#2 { \prop_put:Nnn \l__leadsheets_songtitle_template_prop {#1} {#2} } diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.translations.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.translations.code.tex index 83726462dfe..b3cb9bc52a5 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.translations.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.translations.code.tex @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -22,48 +21,62 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\LeadsheetsExplLibrary{translations}{2014/08/10 dictionary for leadsheets} +\LeadsheetsExplLibrary{translations}{2016/06/28 dictionary for leadsheets} \cs_new:Npn \leadsheets_translation:n #1 - { \GetTranslation{leadsheets/#1} } + { \GetTranslation {leadsheets/#1} } \cs_generate_variant:Nn \leadsheets_translation:n { V } -\DeclareTranslation {German} {leadsheets/chorus} {Refrain} -\DeclareTranslation {German} {leadsheets/verse} {Strophe} +\cs_new_protected:Npn \leadsheets_declare_translation:nnn #1#2#3 + { \declaretranslation {#1} {leadsheets/#2} {#3} } +\cs_generate_variant:Nn \leadsheets_translation:n { V } + +\NewDocumentCommand \defleadsheetstranslation {mmm} + { \leadsheets_declare_translation:nnn {#1} {#2} {#3} } -\DeclareTranslationFallback {leadsheets/composer} {Composer} -\DeclareTranslation {English} {leadsheets/composer} {Composer} -\DeclareTranslation {German} {leadsheets/composer} {Komponist} +\DeclareExpandableDocumentCommand \leadsheetstranslate {m} + { \leadsheets_translation:n {#1} } -\DeclareTranslationFallback {leadsheets/lyrics} {Lyrics} -\DeclareTranslation {English} {leadsheets/lyrics} {Lyrics} -\DeclareTranslation {German} {leadsheets/lyrics} {Text} +\leadsheets_declare_translation:nnn {German} {chorus} {Refrain} +\leadsheets_declare_translation:nnn {German} {verse} {Strophe} -\DeclareTranslationFallback {leadsheets/key} {Key} -\DeclareTranslation {English} {leadsheets/key} {Key} -\DeclareTranslation {German} {leadsheets/key} {Tonart} +\leadsheets_declare_translation:nnn {Fallback} {composer} {composer} +\leadsheets_declare_translation:nnn {English} {composer} {composer} +\leadsheets_declare_translation:nnn {German} {composer} {Komponist} -\DeclareTranslationFallback {leadsheets/interpret} +\leadsheets_declare_translation:nnn {Fallback} {lyrics} {lyrics} +\leadsheets_declare_translation:nnn {English} {lyrics} {lyrics} +\leadsheets_declare_translation:nnn {German} {lyrics} {Text} + +\leadsheets_declare_translation:nnn {Fallback} {key} {key} +\leadsheets_declare_translation:nnn {English} {key} {key} +\leadsheets_declare_translation:nnn {German} {key} {Tonart} + +\leadsheets_declare_translation:nnn {Fallback} {interpret} {as~ interpreted~ by~ \printsongpropertylist{interpret}{~\&~}{,~}{~\&~}} -\DeclareTranslation {English} {leadsheets/interpret} +\leadsheets_declare_translation:nnn {English} {interpret} {as~ interpreted~ by~ \printsongpropertylist{interpret}{~\&~}{,~}{~\&~}} -\DeclareTranslation {German} {leadsheets/interpret} +\leadsheets_declare_translation:nnn {German} {interpret} {wie~ von~ \printsongpropertylist{interpret}{~\&~}{,~}{~\&~}~ interpretiert} -\DeclareTranslationFallback {leadsheets/major} {major} -\DeclareTranslation {English} {leadsheets/major} {major} -\DeclareTranslation {German} {leadsheets/major} {Dur} +\leadsheets_declare_translation:nnn {Fallback} {major} {major} +\leadsheets_declare_translation:nnn {English} {major} {major} +\leadsheets_declare_translation:nnn {German} {major} {Dur} + +\leadsheets_declare_translation:nnn {Fallback} {minor} {minor} +\leadsheets_declare_translation:nnn {English} {minor} {minor} +\leadsheets_declare_translation:nnn {German} {minor} {Moll} -\DeclareTranslationFallback {leadsheets/minor} {minor} -\DeclareTranslation {English} {leadsheets/minor} {minor} -\DeclareTranslation {German} {leadsheets/minor} {Moll} +\leadsheets_declare_translation:nnn {Fallback} {capo} {capo} +\leadsheets_declare_translation:nnn {English} {capo} {capo} +\leadsheets_declare_translation:nnn {German} {capo} {Kapo} -\DeclareTranslationFallback {leadsheets/capo} {Capo} -\DeclareTranslation {English} {leadsheets/capo} {Capo} -\DeclareTranslation {German} {leadsheets/capo} {Kapo} +\leadsheets_declare_translation:nnn {Fallback} {fret} {fret} +\leadsheets_declare_translation:nnn {English} {fret} {fret} +\leadsheets_declare_translation:nnn {German} {fret} {Bund} -\DeclareTranslationFallback {leadsheets/fret} {fret} -\DeclareTranslation {English} {leadsheets/fret} {fret} -\DeclareTranslation {German} {leadsheets/fret} {Bund} +\tex_endinput:D -\endinput +2014/08/10: first version +2016/05/18: new command: \leadsheets_declare_translation:nnn +2016/06/28: new commands \leadsheetstranslate, \defleadsheetstranslation diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.transposing.code.tex b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.transposing.code.tex index eaacc95f3f9..627728194db 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.transposing.code.tex +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.library.transposing.code.tex @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger diff --git a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty index 21dcd6f1078..fd6bd689700 100644 --- a/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty +++ b/Master/texmf-dist/tex/latex/leadsheets/leadsheets.sty @@ -5,7 +5,6 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: http://www.mychemistry.eu/forums/forum/leadsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2014-2016 Clemens Niederberger @@ -28,15 +27,15 @@ % -------------------------------------------------------------------------- % package information: \ExplSyntaxOn -\tl_const:Nn \c_leadsheets_date_tl {2016/02/02} -\tl_const:Nn \c_leadsheets_version_tl {0.3a} -\tl_const:Nn \c_leadsheets_info_tl {Typesetting leadsheets and songbooks} +\tl_const:Nn \leadsheetsdate {2016/08/18} +\tl_const:Nn \leadsheetsversion {0.5} +\tl_const:Nn \leadsheetsinfo {Typesetting leadsheets and songbooks} \ProvidesExplPackage {leadsheets} - {\c_leadsheets_date_tl} - {\c_leadsheets_version_tl} - {\c_leadsheets_info_tl \c_space_tl (CN)} + {\leadsheetsdate} + {\leadsheetsversion} + {\leadsheetsinfo \c_space_tl (CN)} % -------------------------------------------------------------------------- % messages: @@ -72,15 +71,54 @@ \tl_new:N \l__leadsheets_tmpb_tl \tl_new:N \l__leadsheets_tmpc_tl \tl_new:N \l__leadsheets_tmpd_tl +\tl_new:N \g__leadsheets_tmpa_tl + \bool_new:N \l__leadsheets_tmpa_bool + \dim_new:N \l__leadsheets_tmpa_dim + \seq_new:N \l__leadsheets_tmpa_seq \seq_new:N \l__leadsheets_tmpb_seq + \int_new:N \l__leadsheets_tmpa_int \int_new:N \l__leadsheets_tmpb_int \int_new:N \l__leadsheets_tmpc_int + \box_new:N \l__leadsheets_tmpa_box +% -------------------------------------------------------------------------- +\prg_new_conditional:Npnn \leadsheets_if_package_loaded:n #1 {p,T,F,TF} + { + \cs_if_exist:cTF {ver@#1.sty} + { \prg_return_true: } + { \prg_return_false: } + } + +\DeclareExpandableDocumentCommand \leadsheetsifpackageloaded {m} + { \leadsheets_if_package_loaded:nTF {#1} } + +% % -------------------------------------------------------------------------- +% \seq_new:N \l__leadsheets_safed_commands_seq + +% \cs_new_protected:Npn \leadsheets_safe_define_protected:Npn #1 +% { +% \seq_if_in:NnTF \l__leadsheets_safed_commands_seq {#1} +% {} % error +% { +% \seq_gput_right:Nn \l__leadsheets_safed_commands_seq {#1} +% \cs_gset_eq:cN {__leadsheets_ \cs_to_str:N #1:} #1 +% \cs_set_protected:Npn #1 +% } +% } + +% \cs_new_protected:Npn \leadsheets_restore:N #1 +% { +% \seq_if_in:NnTF \l__leadsheets_safed_commands_seq {#1} +% { \cs_set_eq:Nc #1 {__leadsheets_ \cs_to_str:N #1:} } +% {} % error +% \seq_gremove_all:Nn \l__leadsheets_safed_commands_seq {#1} +% } + % -------------------------------------------------------------------------- % library mechanism: \tl_const:Nn \c__leadsheets_library_extension_tl {code.tex} @@ -95,9 +133,19 @@ \__leadsheets_load_library:V \l__leadsheets_tmpa_tl } +\prg_new_conditional:Npnn \leadsheets_if_library:n #1 {p,T,F,TF} + { + \cs_if_exist:cTF {leadsheets-library-#1-loaded} + { \prg_return_true: } + { \prg_return_false: } + } + +\DeclareExpandableDocumentCommand \leadsheetsiflibrary {m} + { \leadsheets_if_library:nTF {#1} } + \cs_new_protected:Npn \__leadsheets_load_library:n #1 { - \cs_if_exist:cF {leadsheets-library-#1-loaded} + \leadsheets_if_library:nF {#1} { \file_if_exist:nTF {\c__leadsheets_library_prefix_tl.#1.\c__leadsheets_library_extension_tl} @@ -118,14 +166,17 @@ \ProvidesFile {\c__leadsheets_library_prefix_tl.#1.\c__leadsheets_library_extension_tl} [ - \c_leadsheets_date_tl + \leadsheetsdate \c_space_tl - v \c_leadsheets_version_tl + v \leadsheetsversion \c_space_tl leadsheets~ library~ `#1'~ #2 ] } +% +\cs_new:Npn \LeadsheetSurvive #1 \LeadsheetEndSurvive {#1} + % -------------------------------------------------------------------------- % one of those defines a leadsheets library, either using expl syntax or 2e % package syntax: @@ -166,6 +217,9 @@ songs .code:n = \bool_set_true:N \l__leadsheets_with_options_bool \leadsheets_load_library:n {songs} , + external .code:n = + \bool_set_true:N \l__leadsheets_with_options_bool + \leadsheets_load_library:n {external} , minimal .code:n = \bool_set_true:N \l__leadsheets_with_options_bool , full .code:n = @@ -180,7 +234,8 @@ properties , transposing , templates , - translations + translations , + external } } \ProcessKeysOptions{leadsheets} @@ -188,7 +243,12 @@ \bool_if:NF \l__leadsheets_with_options_bool { \leadsheets_load_library:n {songs} } - % -------------------------------------------------------------------------- \tex_endinput:D +2016/08/18 - new commands: \leadsheetsifpackageloaded, \leadsheetsiflibrary + - new class `leadsheet' + - new library `external' + - minor chords can now be typeset with lowercase letters + (chordnames) + -- cgit v1.2.3