\ProvidesPackage{liederbuch} \RequirePackage{etoolbox} \RequirePackage{environ} \RequirePackage{xparse} \RequirePackage{pgfmath} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Special music characters %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\repeatleft}{\raisebox{-0.28em}{\hspace{0.075em}\rule{0.075em}{1em}\hspace{0.075em}\rule{0.025em}{1em}\hspace{-0.01em}}:} \newcommand{\repeatright}{:\raisebox{-0.28em}{\hspace{-0.01em}\rule{0.025em}{1em}\hspace{0.075em}\rule{0.075em}{1em}\hspace{0.075em}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Handling of the meta data %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% parse meta data %unpackages a list of data in the form of [first=xy & second = xz& third= som3thing ...] %This creates the macros: %\GFM@LB@lied@@@@first{xy} %\GFM@LB@lied@@@@second{xz} %\GFM@LB@lied@@@@third{som3thing} %... \NewDocumentCommand{\GFM@LB@unpackage}{m}{{% %As '=' is not available in the tag text, we make it available again. & stays available via \& \gdef\equals{=}% \@ifundefined{inputList}{% \DeclareListParser{\inputList}{&}% }{}% % % % {% \newcount\ipp\relax% \ipp=0\relax% \renewcommand{\do}[1]{% \csdef{tempList\the\ipp}{##1&}% \global\advance\ipp by1\relax% }% \inputList{#1}% \def\choppyA##1=##2&{##1}% \def\choppyB##1=##2&{##2}% \newif\iflooping\relax% \loopingtrue\relax% \ipp=0\relax% \loop% \ifnum\ipp>1000\relax% \loopingfalse\relax% \wlog{Error: Too much meta data (>1000 Elements)}% \fi% \expandafter\ifx\csname tempList\the\ipp\endcsname\relax% \loopingfalse\relax% \else% \edef\temp{\csuse{tempList\the\ipp}}% \edef\tempA{\expandafter\choppyA\temp}% \edef\tempB{\expandafter\choppyB\temp}% \trim@spaces@in{\tempA}% \trim@spaces@in{\tempB}% % %Most important line is here: % \global\csedef{GFM@LB@lied@\GFM@LB@LiederbuchNameTmp @\GFM@LB@LiederbuchVariantTmp @\GFM@LB@LiederbuchNumberTmp @\tempA}{\expandafter\noexpand\tempB}%songbook@song variant@song number \advance\ipp by1\relax% \fi% \iflooping\repeat% }% }}% %tweakMetadata allows completing or editing meta data of a certain song. \def\tweakMetadata#1#2#3#4{{%structure is analogue to \LBsong \def\GFM@LB@LiederbuchNameTmp{#1}%songbook \def\GFM@LB@LiederbuchNumberTmp{#2}%song number \def\GFM@LB@LiederbuchVariantTmp{#3}%song variant \GFM@LB@unpackage{#4}% }}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Environment and commands for %%% %%% notes + lyrics in native LaTeX font %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newdimen\GFM@LB@NT@tempDimA% \newdimen\GFM@LB@NT@tempDimB% \newdimen\GFM@LB@NT@tempDimC% \newcommand{\GFM@LB@songLyrics}[1]{% \vskip 0pt%backwards compability \nopagebreak[4]% {% make commands local \nopagebreak[4]% \GFM@LB@NT@tempDimA=0pt% \noindent% %If no unit is given (i.e. [10] instead of [10pt]), %percent linewidth is assumed ([10] = 0.1\linewidth) \DeclareDocumentCommand{\nspace}{s m}{% \pgfmathparse{##2}% \ifpgfmathunitsdeclared% \ifx##1\BooleanTrue% \hspace*{##2}% \else% \hspace{##2}% \fi% \else% \GFM@LB@NT@tempDimC=0.01\linewidth\relax% \ifx##1\BooleanTrue% \hspace*{##2\GFM@LB@NT@tempDimC}% \else% \hspace{##2\GFM@LB@NT@tempDimC}% \fi% \fi% }% \DeclareDocumentCommand{\ns}{s O{0 pt}}{% \pgfmathparse{##2}% \ifpgfmathunitsdeclared% \GFM@LB@NT@tempDimB=\dimexpr##2\relax% \else% \GFM@LB@NT@tempDimB=##2\linewidth\relax% \divide\GFM@LB@NT@tempDimB by 100\relax% \fi% \ifx##1\BooleanTrue% {% \divide\GFM@LB@NT@tempDimA by2\relax% \divide\GFM@LB@NT@tempDimB by2\relax% \hskip 0pt plus 1fill minus 1fill\relax% \hspace{\dimexpr\GFM@LB@NT@tempDimB - \GFM@LB@NT@tempDimA}% -% \hspace{\dimexpr\GFM@LB@NT@tempDimB - \GFM@LB@NT@tempDimA}% \hskip 0pt plus 1fill minus 1fill\relax% }% \else% \hspace*{0.5\dimexpr\f@size pt}% %compensates the - in ns* (not totally) \hskip 0pt plus 2fill minus 2fill% \hspace{\dimexpr\GFM@LB@NT@tempDimB - \GFM@LB@NT@tempDimA}% \fi% \global\GFM@LB@NT@tempDimA=\dimexpr\GFM@LB@NT@tempDimB\relax% }%\ns %%%%%%%%%% most important line is here: \makebox[\linewidth]{% \GFM@LB@NT@tempDimC=\dimexpr\f@size pt\relax% % \parbox[t][0.5\GFM@LB@NT@tempDimC]{0pt}{}% orig. statt 0.5 war 1.65 #1}% %%%%%%%%%% most important line END \GFM@LB@NT@tempDimA=0pt% %reset to avoid sideeffects otherwhere. \pagebreak[3]% }% END make commands local \pagebreak[3]% \vskip 0pt\relax%backward compatibility? }% \newdimen\tempdimA% \newcounter{staveLineNumber}% \setcounter{staveLineNumber}{1}% \newcounter{GFM@staveLineNumberBreakPointA}% \newcounter{GFM@staveLineNumberBreakPointB}% \newcounter{GFM@staveLineNumberBreakPointC}% \newcounter{GFM@staveLineNumberBreakPointD}% \newcounter{GFM@staveLineNumberBreakPointE}% \newcounter{GFM@staveLineNumberBreakPointF}% %usage: \forcePageBreakAfterStaveLine{3}[4][2]... \NewDocumentCommand\forcePageBreakAfterStaveLine{m O{0} O{0} O{0} O{0} O{0}}{ \setcounter{GFM@staveLineNumberBreakPointA}{#1} \setcounter{GFM@staveLineNumberBreakPointB}{#2} \setcounter{GFM@staveLineNumberBreakPointC}{#3} \setcounter{GFM@staveLineNumberBreakPointD}{#4} \setcounter{GFM@staveLineNumberBreakPointE}{#5} \setcounter{GFM@staveLineNumberBreakPointF}{#6} } \NewDocumentCommand\notenzeile{O{\linewidth} m m O{\empty} O{\empty} O{\empty} O{\empty} O{\empty}}{% {% %Multilines \ifx\multiline\undefined% \NewDocumentCommand{\multiline}{m m m O{\empty} O{\empty} O{\empty} O{\empty}}{% \parbox[c]{##1}{% \newdimen\temp% \temp=\dimexpr\f@size pt% \vskip 0.27\temp\relax% \makebox[\linewidth]{##2}% \spaceBetweenSongLyrics% \makebox[\linewidth]{##3}% \ifx##4\empty% \else% \spaceBetweenSongLyrics% \makebox[\linewidth]{##4}% \fi% \ifx##5\empty% \else% \spaceBetweenSongLyrics% \makebox[\linewidth]{##5}% \fi% \ifx##6\empty% \else% \spaceBetweenSongLyrics% \makebox[\linewidth]{##6}% \fi% \ifx##7\empty% \else% \spaceBetweenSongLyrics% \makebox[\linewidth]{##7}% \fi% % \vskip 0.27\temp%% }% }% \fi% multiline undefined? % \noindent% \begin{minipage}{#1}% \relax% \spaceBeforeNotes% \makebox[\linewidth]{#2}% \relax\mbox{}\spaceAfterNotes% \spaceBeforeSongLyrics% \GFM@LB@songLyrics{#3}% \ifx#4\empty% \else% \spaceBetweenSongLyrics% \GFM@LB@songLyrics{#4}% \fi% \ifx#5\empty% \else% \spaceBetweenSongLyrics% \GFM@LB@songLyrics{#5}% \fi% \ifx#6\empty% \else% \spaceBetweenSongLyrics% \GFM@LB@songLyrics{#6}% \fi% \ifx#7\empty% \else% \spaceBetweenSongLyrics% \GFM@LB@songLyrics{#7}% \fi% \ifx#8\empty% \else% \spaceBetweenSongLyrics% \GFM@LB@songLyrics{#8}% \fi% \spaceAfterSongLyrics% \end{minipage}\vskip0pt% \ifnum\c@GFM@staveLineNumberBreakPointA=\c@staveLineNumber\relax% \newpage% \fi% \ifnum\c@GFM@staveLineNumberBreakPointB=\c@staveLineNumber\relax% \newpage% \fi% \ifnum\c@GFM@staveLineNumberBreakPointC=\c@staveLineNumber\relax% \newpage% \fi% \ifnum\c@GFM@staveLineNumberBreakPointD=\c@staveLineNumber\relax% \newpage% \fi% \ifnum\c@GFM@staveLineNumberBreakPointE=\c@staveLineNumber\relax% \newpage% \fi% \ifnum\c@GFM@staveLineNumberBreakPointF=\c@staveLineNumber\relax% \newpage% \fi% \stepcounter{staveLineNumber}%Counter for the current stave line }% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Environment for strophes %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Control of the page break in strophes \newif\ifpageBreakAllowed \pageBreakAllowedfalse %default \newlength{\GFM@LB@indent@temp@length} \newcounter{GFM@strophe@counter} \setcounter{GFM@strophe@counter}{-1} \newcounter{GFM@stropheNumberBreakPointA} \newcounter{GFM@stropheNumberBreakPointB} \newcounter{GFM@stropheNumberBreakPointC} \newcounter{GFM@stropheNumberBreakPointD} \newcounter{GFM@stropheNumberBreakPointE} \newcounter{GFM@stropheNumberBreakPointF} %usage: \forcePageBreakAfterStrophe{3}[4][2]... \NewDocumentCommand\forcePageBreakAfterStrophe{m O{0} O{0} O{0} O{0} O{0}}{ \setcounter{GFM@stropheNumberBreakPointA}{#1} \setcounter{GFM@stropheNumberBreakPointB}{#2} \setcounter{GFM@stropheNumberBreakPointC}{#3} \setcounter{GFM@stropheNumberBreakPointD}{#4} \setcounter{GFM@stropheNumberBreakPointE}{#5} \setcounter{GFM@stropheNumberBreakPointF}{#6} } %automatic strophe numbering \NewEnviron{strophe}[1][-1]{ \ifnum#1=-1% %leer \else% \setcounter{GFM@strophe@counter}{#1}% \fi% \penalty-1500\relax% \ifpageBreakAllowed% \penalty1500\relax% \spaceBeforeStrophe% \arabic{GFM@strophe@counter}.~\BODY% \penalty1500\relax% \spaceAfterStrophe% \else% %% Alternative (worse) implementation: %% \GFM@LB@indent@temp@length\parindent% %% \noindent% %% \parbox{\linewidth}{% \begin{samepage}% \parindent \GFM@LB@indent@temp@length\indent% \penalty1500\relax% \spaceBeforeStrophe% \arabic{GFM@strophe@counter}.~\BODY% \penalty1500\relax% \spaceAfterStrophe% %% }%parbox \end{samepage}% \fi% \ifnum\c@GFM@stropheNumberBreakPointA=\c@GFM@strophe@counter\relax% \newpage% \fi% \ifnum\c@GFM@stropheNumberBreakPointB=\c@GFM@strophe@counter\relax% \newpage% \fi% \ifnum\c@GFM@stropheNumberBreakPointC=\c@GFM@strophe@counter\relax% \newpage% \fi% \ifnum\c@GFM@stropheNumberBreakPointD=\c@GFM@strophe@counter\relax% \newpage% \fi% \ifnum\c@GFM@stropheNumberBreakPointE=\c@GFM@strophe@counter\relax% \newpage% \fi% \ifnum\c@GFM@stropheNumberBreakPointF=\c@GFM@strophe@counter\relax% \newpage% \fi% \stepcounter{GFM@strophe@counter}% }% %%%%%%%%%%%%%%% %%% Spacing %%% %%%%%%%%%%%%%%% %%% Head \def\setSpaceBeforeHeadValue#1{\def\spaceBeforeHeadValue{#1}} \def\setSpaceAfterHeadValue#1{\def\spaceAfterHeadValue{#1}} %%% Notes \def\setSpaceBeforeNotesValue#1{\def\spaceBeforeNotesValue{#1}} \def\setSpaceAfterNotesValue#1{\def\spaceAfterNotesValue{#1}} %%% Strophes \def\setSpaceBeforeStropheValue#1{\def\spaceBeforeStropheValue{#1}} \def\setSpaceAfterStropheValue#1{\def\spaceAfterStropheValue{#1}} %%% Song lyrics \def\setSpaceBeforeSongLyricsValue#1{\def\spaceBeforeSongLyricsValue{#1}} \def\setSpaceBetweenSongLyricsValue#1{\def\spaceBetweenSongLyricsValue{#1}} \def\setSpaceAfterSongLyricsValue#1{\def\spaceAfterSongLyricsValue{#1}} %%% Foot \def\setSpaceBeforeFootValue#1{\def\spaceBeforeFootValue{#1}} \def\setSpaceAfterFootValue#1{\def\spaceAfterFootValue{#1}} %%% Horizontal spacing \def\setSpaceStropheIndentValue#1{\def\spaceStropheIndentValue{#1}} \def\setSpaceHeadIndentValue#1{\def\spaceHeadIndentValue{#1}} \def\setSpaceFootIndentValue#1{\def\spaceFootIndentValue{#1}} %%% Arranging the space values \def\spaceBeforeHead{\vskip\spaceBeforeHeadValue\relax\noindent\mbox{}\hskip\spaceHeadIndentValue\mbox{}} \def\spaceAfterHead{\relax\vskip\spaceAfterHeadValue\relax} \def\spaceBeforeNotes{\relax\vskip\spaceBeforeNotesValue\relax} \def\spaceAfterNotes{\relax\vskip\spaceAfterNotesValue\relax} \def\spaceBeforeStrophe{\relax\vskip\spaceBeforeStropheValue\noindent\hskip\spaceStropheIndentValue\relax} \def\spaceAfterStrophe{\relax\vskip\spaceAfterStropheValue\relax} \def\spaceBeforeSongLyrics{\relax\vskip\spaceBeforeSongLyricsValue\relax} \def\spaceBetweenSongLyrics{\relax\vskip\spaceBetweenSongLyricsValue\relax} \def\spaceAfterSongLyrics{\relax\vskip\spaceAfterSongLyricsValue \relax} \def\spaceBeforeFoot{\relax\vskip\spaceBeforeFootValue \noindent \hskip\spaceFootIndentValue\relax} \def\spaceAfterFoot{\relax\vskip\spaceAfterFootValue\relax} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Styling of header and footer %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\LBHead}[1]{% \long\def\GFM@LB@Head{\spaceBeforeHead #1\relax\spaceAfterHead\mbox{}}% }% \newcommand{\LBFoot}[1]{% \long\def\GFM@LB@Foot{\spaceBeforeFoot #1\relax\spaceAfterFoot}% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Environments for creating %%% %%% the songbooks (liederbuch) %%% %%% and the songs (lied) %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %liederbuch environment \NewEnviron{liederbuch}[2][]{% \def\GFM@LB@LiederbuchNameTmp{#2}% %%lied environment %cslet \NewEnviron{lied}[3][]{% %##1=meta data ##2=variant ##3=nummer \def\GFM@LB@LiederbuchVariantTmp{##2}% \def\GFM@LB@LiederbuchNumberTmp{##3}% \GFM@LB@unpackage{##1}% \GFM@LB@unpackage{#1}% \global\cslet{liedBody;\GFM@LB@LiederbuchNameTmp;##2;##3}\BODY% }% \BODY% Without this, the command sequences inside the environment won't be defined. That means, the whole content of the songbook (liederbuch) is thrown away. } %Forward onto environment \newcommand{\LBsong}[3]{% %#1=songbook #2=number #3=variant {%local \setlength{\parindent}{0pt}% \setlength{\parskip}{0pt}% % % \NewDocumentCommand{\print}{O{\empty} m}{% \expandafter\ifx\csname GFM@LB@lied@#1@#3@#2@##2\endcsname\relax% \else% ##1% \fi% \csname GFM@LB@lied@#1@#3@#2@##2\endcsname% \mbox{}% }% \GFM@LB@Head% % \setcounter{staveLineNumber}{1}%reset note line counter % %%%%%%%%%%%%%%%%%%%%%%%%%% \csuse{liedBody;#1;#3;#2}% %%%%%%%%%%%%%%%%%%%%%%%%%% % %reset page break points = no page breaks: \setcounter{GFM@staveLineNumberBreakPointA}{0}% \setcounter{GFM@staveLineNumberBreakPointB}{0}% \setcounter{GFM@staveLineNumberBreakPointC}{0}% \setcounter{GFM@staveLineNumberBreakPointD}{0}% \setcounter{GFM@staveLineNumberBreakPointE}{0}% \setcounter{GFM@staveLineNumberBreakPointF}{0}% \setcounter{GFM@stropheNumberBreakPointA}{0}% \setcounter{GFM@stropheNumberBreakPointB}{0}% \setcounter{GFM@stropheNumberBreakPointC}{0}% \setcounter{GFM@stropheNumberBreakPointD}{0}% \setcounter{GFM@stropheNumberBreakPointE}{0}% \setcounter{GFM@stropheNumberBreakPointF}{0}% % % \GFM@LB@Foot% % % }%local \penalty-3500% }% %%%%%%%%%%%%%%%%%%%%%% %%% %%% %%% Default values %%% %%% %%% %%%%%%%%%%%%%%%%%%%%%% %%% Default header and footer %%% \long\def\GFM@LB@Head{\spaceBeforeHead\mbox{}\print{title} \ \newline \print{composer}\spaceAfterHead }%Standardwerte \long\def\GFM@LB@Foot{\spaceBeforeFoot\mbox{}\print{source} \hfill \print{date}\spaceAfterFoot}%Standardwerte \setSpaceBeforeHeadValue{0pt plus 3pt} \setSpaceAfterHeadValue{0pt plus 3pt} \setSpaceBeforeNotesValue{0pt plus 1pt} \setSpaceAfterNotesValue{0pt plus 1pt} \setSpaceBeforeStropheValue{0pt plus 1pt} \setSpaceAfterStropheValue{0pt plus 3pt} \setSpaceBetweenSongLyricsValue{0pt plus 3pt} \setSpaceBeforeSongLyricsValue{0pt plus 1pt} \setSpaceAfterSongLyricsValue{0pt plus 3pt} \setSpaceBeforeFootValue{0pt plus 3pt} \setSpaceAfterFootValue{0pt plus 70pt} \setSpaceStropheIndentValue{0pt} \setSpaceHeadIndentValue{0pt} \setSpaceFootIndentValue{0pt} %%%%%%%%%%%%%% %%% Styles %%% %%%%%%%%%%%%%% %\moderncvstyle{casual} %\moderncvcolor{blue} % %\def\GFMliederbuchStyle#1#2{% %%openStyle % % % % %%test if %} % %\GFM@LB@color#1#2{% %%if #1 = '0' => ifndef \farbzähler => def + \fz=0 : \fz=0 : \fz++ % %} %number of colors used in a style. It has to match the number defined in the color scheme \newcount\GFM@LB@numberOfColors \GFM@LB@numberOfColors=3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%Altlasten %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%