%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ------------------------------------------------------------------------------------- %
% - musixguit - musixguit.sty --------------------------------------------------------- %
% - musixtex and guitar --------------------------------------------------------------- %
% ------------------------------------------------------------------------------------- %
% - Clemens Niederberger -------------------------------------------------------------- %
% - 2011/03/07 ------------------------------------------------------------------------ %
% ------------------------------------------------------------------------------------- %
% - http://www.niederberger-berlin.net/2011/01/latex-und-noten-fuer-klassische-gitarre/ %
% - kontakt@niederberger-berlin.net --------------------------------------------------- %
% ------------------------------------------------------------------------------------- %
% Copyright 2011 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.                          %
%                                                                                       %
% This work consists of the files musixguit.sty and musixguit_de.tex                    %
% ------------------------------------------------------------------------------------- 
% - Version 1.0, 15.08.2009                                                             %
%   Basisversion                                                                        %
% ------------------------------------------------------------------------------------- %
% - Version 1.1, 24.01.2010:                                                            %
%   Befehle \finger und \lage verbessert,                                               %
%   Befehle \Finger, \saite und barree hinzugef"ugt.                                    %
% ------------------------------------------------------------------------------------- %
% - Version 1.2, 20.01.2011:                                                            %
%   Umgebung `song' hinzugef"ugt.                                                       %
% - Version 1.2.1, 07.06.2011                                                           %
%   unnötige Abhängigkeit von AMSmath entfernt                                          %
% - Version 1.2.2, 07.06.2011                                                           %
%   falsche Fehlermeldung korrigiert                                                    %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\mg@version{v1.2.2}
\def\mg@date@de{07. M\"arz 2011}
\def\mg@date@en{March 07. 2011}
\ProvidesPackage{musixguit}[2011/03/07]
\typeout{musixguit \mg@version}
\typeout{2011/03/07 Clemens Niederberger}
\typeout{musixTeX and guitar}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - auf `setspace' ueberpruefen ------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\IfFileExists{setspace.sty}{
  \RequirePackage{setspace}
}{% ... oder Fehler ausgeben
  \PackageError{musixguit}{%
    The `setspace' package is apparently unavailable.\MessageBreak
    You need to install it from CTAN or where else you\MessageBreak
    get your LaTeX packages from.%
  }{%
    `musixguit' needs to have the `setspace' package installed.\MessageBreak
    You have to install it from CTAN or wherever you like\MessageBreak
    to get your LaTeX packages instead.
  }
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - auf `musixtex' ueberpruefen ------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\IfFileExists{musixtex.sty}{
  \RequirePackage{musixtex}
}{% ... oder Fehler ausgeben
  \PackageError{musixguit}{%
    The `musixtex' package is apparently unavailable.\MessageBreak
    You need to install it from CTAN or where else you\MessageBreak
    you like to get your LaTeX packages from.%
  }{%
    `musixguit' is a MUSICAL package which only makes sense\MessageBreak
    in combination with the `musixtex' package. You NEED to install\MessageBreak
    it from CTAN or wherever you like to get your LaTeX packages\MessageBreak
    instead.
  }
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - Erweiterungen einbinden ----------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input musixper.tex                              % Perkussion
\input musixgui.tex                              % Gitarre

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - \chord{#1}{#2} -------------------------------------------------------------------- %
% ------------------------------------------------------------------------------------- %
% - Dieser Befehl setzt den Akkord in #1 ueber #2 ------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength\len
\newlength\laen
\providecommand\chord[2]{%
\settowidth\len{\scriptsize~#1}%
\settowidth\laen{~}%
\raisebox{10pt}{{\scriptsize~#1}}\hspace{-\len}#2%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - \beginsong ------------------------------------------------------------------------ %
% ------------------------------------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{song}{%
\begin{spacing}{1.8}%
}{%
\end{spacing}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - \B, \K, \T ------------------------------------------------------------------------ %
% ------------------------------------------------------------------------------------- %
% - Die Befehle \B und \K schreiben ein b bzw. ein # ---------------------------------- %
% - auch in normalem Text. ------------------------------------------------------------ %
% - Der Befehl \T schreibt eine senkrechte Linie, die --------------------------------- %
% - den Beginn eines Taktes andeuten soll. -------------------------------------------- %
% ------------------------------------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand\B{\ensuremath{\flat}}
\providecommand\K{\ensuremath{\sharp}}
\providecommand\T{\ensuremath{\vert}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - In Kombination mit `musixtex':                                                      %
%   \strike, \teil{} \finger{} \lage{}                                                  %
% - Alle Befehle sind innerhalb \notes...\enotes zu                                     %
%   verwenden!                                                                          %
% ------------------------------------------------------------------------------------- %
% - Der Befehl \strike schreibt einen diagonalen                                        %
% - Balken in die Notenzeile, der eine Vierteltaktzeit                                  %
%   andeutet, aber den Rhythmus nicht n"aher                                            %
%   spezifiziert.                                                                       %
% - Der Befehl \teil{#1}, markiert einen Takt als den                                   %
%   ersten des Stueck-Teiles #1.                                                        %
% - Der Befehl \finger{#1}{#2} schreibt die Zahl #2 als                                 %
%   Fingersatz-Angabe auf Notenh"ohe #1. Es wird em-                                    %
%   pfohlen, die Notenh"ohe der zu bezeichnenden Note                                   %
%   zu verwenden.                                                                       %
% - Mit dem Befehl \lage{#1} kann man die Fingersatzlage                                %
%   #1 angeben. Die Lage ist mit arabischen Ziffern                                     %
%   anzugeben.                                                                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% KLASSIK
\providecommand\finger[2]{{\zcharnote{#2}{\scriptsize\sf #1}}}
\providecommand\Finger[2]{\raise -\internote\hbox{\lcharnote{#2}{\scriptsize\sf #1~}}}
\providecommand\saite[2]{\zcharnote{#2}{\hspace{-1mm}\textcircled{\hspace{-1pt}\scriptsize #1}}}
\newcounter{lage}
\providecommand\lage[3][0]{\setcounter{lage}{#2}\raise #1\internote\hbox{\zcharnote{#3}{\small\scshape\Roman{lage}}}}

% \barree{N}{20}{30pt}{3} #1 = pitch, #2 = senrechte Länge in Notenhöhen #3 waagerechte Länge noteskip, #4 = Lage
\newcounter{barree}
\newcounter{barreee}
\newcounter{laenge}
\newlength{\lena}
\newlength{\lenb}
\newcommand\barree[4]{%
  \setcounter{lage}{#4}%
  \settowidth{\lena}{\small\scshape\Roman{lage}}%
  \setlength{\lenb}{#3\noteskip}%
  \addtolength{\lenb}{-\lena}%
  \setcounter{barree}{#2}%
  \addtocounter{barree}{-2}
  \setcounter{barreee}{#2}%
  \addtocounter{barreee}{-1}%
  \raise \value{barreee}\internote\hbox{\zcharnote{#1}{\small\scshape\Roman{lage}}}%
  \raise #2\internote\hbox{\zcharnote{#1}{\hspace{\the\lena}\rule{\lenb}{.5pt}}}%
  \raise \value{barreee}\Internote\hbox{\zcharnote{#1}{\hspace{#3\noteskip}\rule{.5pt}{3pt}}}%
  \bracket #1{#2}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% JAZZ
\providecommand\strike{\loffset{0}{\ibl0n9}\roffset{2}{\tbl0}}
\providecommand\strk{\zcharnote i{\musixchar118}}
\providecommand\teil[1]{\uptext{\loffset{2.5}{\circleit{#1}}}}
\providecommand\picku[1][n]{\zcharnote{#1}{\smallnotesize\upbow}}
\providecommand\pickd[1][n]{\zcharnote{#1}{\smallnotesize\downbow}}
\providecommand\tpickd{\;\downbow~~}
\providecommand\tpicku{\upbow~~}
\providecommand\release[1][h]{\zcharnote{#1}{\roff{\huge\sf ,}}}