%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                   %
%      Made by Gabriel Ruprecht     %
%                                   %
% This work is published under the  %
% LaTeX project public license 1.3  %
%                                   %
%       Package version 1.1.0       %
%            2025-01-20             %
%                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesPackage{liederbuch}[version 1.1.0]
\RequirePackage{etoolbox}
\RequirePackage{environ}
\RequirePackage{xparse}
\RequirePackage{pgfmath}

\RequirePackage{liederbuch-listofsongs}

%expands twice:
%\edef\expandhere{\unexpanded\expandafter\expandafter\expandafter{\xy}}


%%%%%%%%%%%%%
%%% Babel %%%
%%%%%%%%%%%%%

%Make sure Babel is loaded before Liederbuch - part 1
\newif\ifGFM@babel@loaded@before@LB
\GFM@babel@loaded@before@LBfalse


\@ifpackageloaded{babel}
{%
%Make sure Babel is loaded before Liederbuch - part 2
\GFM@babel@loaded@before@LBtrue
%
\input{liederbuch-babel.sty}%
%
%%%This is obsolete code now:
%%Make German quotes less fragile - part 1:
%\let\GFM@protect@glqq\glqq%
%\let\GFM@protect@grqq\grqq%
%%
%\def\glqq{\unexpanded{\glqq}}%
%\def\grqq{\unexpanded{\grqq}}%
%%
%%
%%
%\AtBeginDocument{%
%%
%%Make German quotes less fragile - part 2:
%\let\glqq\GFM@protect@glqq%
%\let\grqq\GFM@protect@grqq%
%%
%}%
%
%
}{}%@ifpackageloaded{babel}

\AtBeginDocument{%
%Make sure Babel is loaded before Liederbuch - part 3
\ifGFM@babel@loaded@before@LB%
\else%
    \@ifpackageloaded{babel}{%
        \PackageError{liederbuch.sty}{You must load babel before liederbuch, not after}{I will continue anyway and hope for the best. Some things might break.}%
    }{}%
\fi%
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 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 metadata %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% parse metadata
%unpackages a list of data in the form of [first=xy & second = xz& third= som3thing ...]
%This creates the macros:
%\GFM@LB@lied@<songbookname>@<song variant>@<song number>@first{xy}
%\GFM@LB@lied@<songbookname>@<song variant>@<song number>@second{xz}
%\GFM@LB@lied@<songbookname>@<song variant>@<song number>@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%
			    \PackageError{liederbuch}{Too many metadata elements (>1000 elements)}{Check your metadata definitions in your source songbook, the one you imported / built in the preamble.}%
		\fi%
		\expandafter\ifx\csname tempList\the\ipp\endcsname\relax%
			\loopingfalse\relax%
		\else%
		    %select parse list element and copy to temp:
            \expandafter\let%
                \expandafter\temp%
                \csname tempList\the\ipp\endcsname\relax%
			\edef\tempA{\expandafter\choppyA\temp}%
            %expand temp twice and save to tempB, 
            %weird stuff, don't touch:
			\edef\tempB{%
                \unexpanded\expandafter%
                \expandafter\expandafter%
                {%
			    \expandafter\choppyB\temp%
			    }%
            }%
            %trim spaces on both:
            \trim@spaces@in{\tempA}%
            \trim@spaces@in{\tempB}%
            %
            %Most important line is here:
            %
            \global\cslet{GFM@LB@lied@\GFM@LB@songbook @\GFM@LB@variant @\GFM@LB@number @\tempA}{\tempB}%songbook@song variant@song number
            \advance\ipp by1\relax%
        \fi%
    \iflooping\repeat%
    }%
}}%


%tweakMetadata allows completing or editing metadata 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 o o o o}{%
	{%
		%Multilines
%		\ifx\multiline\undefined%
			\DeclareDocumentCommand{\multiline}{m m m o o o o}{%
				\parbox[c]{##1}{%
					\newdimen\temp%
					\temp=\dimexpr\f@size pt%				
					\vskip 0.27\temp\relax%
					\makebox[\linewidth]{##2}%
					\spaceBetweenSongLyrics%
					\makebox[\linewidth]{##3}%
                    \IfNoValueTF{##4}{}{%
						\spaceBetweenSongLyrics%
						\makebox[\linewidth]{##4}%
					}%
                    \IfNoValueTF{##5}{}{%
						\spaceBetweenSongLyrics%
						\makebox[\linewidth]{##5}%
					}%
                    \IfNoValueTF{##6}{}{%
						\spaceBetweenSongLyrics%
						\makebox[\linewidth]{##6}%
					}%
                    \IfNoValueTF{##7}{}{%
						\spaceBetweenSongLyrics%
						\makebox[\linewidth]{##7}%
					}%
%					\vskip 0.27\temp%%
				}%
			}%
%		\fi% multiline undefined?
		%
		\noindent%
		\begin{minipage}{#1}%
			\relax%
			\spaceBeforeNotes%
			\makebox[\linewidth]{#2}%
			\relax\mbox{}\spaceAfterNotes%
			\spaceBeforeSongLyrics%
			\GFM@LB@songLyrics{#3}%
            \IfNoValueTF{#4}{}{%
				\spaceBetweenSongLyrics%
				\GFM@LB@songLyrics{#4}%
			}%
            \IfNoValueTF{#5}{}{%
				\spaceBetweenSongLyrics%
				\GFM@LB@songLyrics{#5}%
			}%
            \IfNoValueTF{#6}{}{%
				\spaceBetweenSongLyrics%
				\GFM@LB@songLyrics{#6}%
			}%
            \IfNoValueTF{#7}{}{%
				\spaceBetweenSongLyrics%
				\GFM@LB@songLyrics{#7}%
			}%
            \IfNoValueTF{#8}{}{%
				\spaceBetweenSongLyrics%
				\GFM@LB@songLyrics{#8}%
			}%
			\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}

%automatic strophe numbering
\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}
}


%Set a verse separator
\long\def\setVerseSeparator#1{%
  \long\def\GFM@LB@verseSeparator{#1}%
}

%default value
\long\def\GFM@LB@verseSeparator{ }%

%strophe environment
\NewEnviron{strophe}[1][-1]{%
  % The verse command shall only be available inside strophe to minimize possible interference.
  \DeclareDocumentCommand{\verse}{o}{%
    \unskip\null\IfNoValueTF{##1}{\GFM@LB@verseSeparator}{##1%
    \null\ignorespaces}%
  }%
%
%
%
  \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}%
}%


%%%%%%%%%%%%%%%%%%%%%%%%
%%%                  %%%
%%% Automatic labels %%%
%%%                  %%%
%%%%%%%%%%%%%%%%%%%%%%%%


\newif\ifGFM@LB@duplicate@label@warning%
\GFM@LB@duplicate@label@warningtrue

\def\LBduplicateLabelWarningOn{%
    \GFM@LB@duplicate@label@warningtrue%
}%

\def\LBduplicateLabelWarningOff{%
    \GFM@LB@duplicate@label@warningoff%
}%

\def\GFM@LB@iteratedLabel#1{%
    \ifcsundef{c@#1counter}{%
        \newcounter{#1counter}%
        \setcounter{#1counter}{1}%
        \label{#1}%
    }{%
        \label{#1_\alph{#1counter}}%
        \stepcounter{#1counter}%
        \ifGFM@LB@duplicate@label@warning%
        \PackageWarning{liederbuch.sty - line 546}{You included [Songbook: \GFM@LB@songbook ][Number: \GFM@LB@number ][Variant: \GFM@LB@variant ] more than once. Is this intentional? You can switch this message off via \unexpanded{\LBduplicateLabelWarningOff}. Warning occured}%
        \fi%
    }%
}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Environments for creating  %%%
%%% the songbooks (liederbuch) %%%
%%% and the songs (lied)       %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{liedcounter}
\setcounter{liedcounter}{0}

%liederbuch environment
\NewEnviron{liederbuch}[2][]{%
\def\GFM@LB@songbook{#2}%
%%lied environment %cslet
\NewEnviron{lied}[3][]{% 
%##1=metadata ##2=variant ##3=nummer
\def\GFM@LB@variant{##2}%
\def\GFM@LB@number{##3}%
\edef\GFM@LB@expandedName{GFM@LB@lied@\GFM@LB@songbook @\GFM@LB@variant @\GFM@LB@number}%
\GFM@LB@unpackage{##1}%
\GFM@LB@unpackage{#1}%
\global\cslet{\GFM@LB@expandedName liedBody}\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
\def\GFM@LB@songbook{#1}%
\def\GFM@LB@number{#2}%
\def\GFM@LB@variant{#3}%
\edef\GFM@LB@expandedName{GFM@LB@lied@\GFM@LB@songbook @\GFM@LB@variant @\GFM@LB@number}%
\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt}%
%
%
\NewDocumentCommand{\print}{O{\empty} m}{%
    \expandafter\ifx\csname \GFM@LB@expandedName @##2\endcsname\relax%
    \else%
        ##1%
    \fi%
    \csname \GFM@LB@expandedName @##2\endcsname%
    \mbox{}%
}%
%
\expandafter\ifx\csname\GFM@LB@expandedName liedBody\endcsname\relax%
    \PackageError{liederbuch}{You tried to call the song \GFM@LB@expandedName , but it doesn't exist.}{Verify, that the song exists. Check songbook, songnumber and variant.}%
\else%
    %
    \GFM@LB@Head%
    %
    \xdef\@currentlabelname{%
        \csname%
        \GFM@LB@expandedName @title%
        \endcsname%
    }%
    %
    % (Hyper)ref functionality:
    \refstepcounter{liedcounter}%
%    \let\GFM@currentlabel\@currentlabel%
    %
    % Labeling, so each song can be referred to
    % by a well-known label:
    \GFM@LB@iteratedLabel{%
        LBsong%
        _\GFM@LB@songbook %
        _\GFM@LB@variant %
        _\GFM@LB@number %
    }%
    %
    % adds song to list of songs
    \csname GFM@LB@addcontentsline\endcsname% For safety, in case an invalid style name was selected.
    %
    \setcounter{staveLineNumber}{1}%reset note line counter
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%
    \csuse{\GFM@LB@expandedName liedBody}%
    %%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    \GFM@LB@Foot%
    %
    %
\fi%
%
%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}%
%
%
}%local
%\let\@currentlabel\GFM@currentlabel
\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{3pt 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%