%%
%% This is file `songbook.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% songbook.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright 1992--2002 Christopher Rath <christopher@rath.ca>
%% 
%% This package is free software; you can redistribute it and/or
%% modify it under the terms of the GNU Lesser General Public
%% License as published by the Free Software Foundation; either
%% version 2.1 of the License, or (at your option) any later
%% version.
%% 
%% This package is distributed in the hope that it will be
%% useful, but WITHOUT ANY WARRANTY; without even the implied
%% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
%% PURPOSE.  See the GNU Lesser General Public License for more
%% details.
%% 
%% The list of all files belonging to the LaTeX Songbook Style is
%% given in the file `relnotes.txt'.
%% 
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                      %%
%%        I D E N T I F I C A T I O N   P A R T         %%
%%                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% rcsid = @(#)$Id: songbook.dtx,v 1.13 2007/02/04 04:12:40 rathc Exp $
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{songbook}[2007/02/03 v4.3 All purpose Songbook style]
\typeout{Document Subclass: songbook 2007/02/03 v4.3 All purpose Songbook style}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                      %%
%%          I N I T I A L   C O D E   P A R T           %%
%%                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%========================================================
%%  E A R L Y   P A C K A G E   D E P E N D E N C I E S  %
%%========================================================
\RequirePackage{calc}

%%========================================================
%%              I F   C O N S T R U C T S                %
%%========================================================
\newif\ifChordBk        \ChordBkfalse
\newif\ifOverhead       \Overheadfalse
\newif\ifWordBk         \WordBkfalse
\newif\ifWordsOnly      \WordsOnlyfalse
\newif\ifNotWordsOnly   \NotWordsOnlyfalse
\newif\ifSBinSongEnv    \SBinSongEnvfalse
\newif\ifCompactSongMode\CompactSongModefalse
\newif\ifExcludeSong    \ExcludeSongfalse
\newif\ifPrintAllSongs  \PrintAllSongsfalse
\newif\ifSamepageMode   \SamepageModefalse
\newif\ifSongEject      \SongEjecttrue
\newif\ifSBpaperAfour   \SBpaperAfourfalse
\newif\ifSBpaperAfive   \SBpaperAfivefalse
\newif\ifSBpaperBfive   \SBpaperBfivefalse
\newif\ifSBpaperLtr     \SBpaperLtrfalse
\newif\ifSBpaperLgl     \SBpaperLglfalse
\newif\ifSBpaperExc     \SBpaperExcfalse
%%========================================================
%%                      F O N T S                        %
%%========================================================
\newcommand{\ChBassFont}{\normalsize\bf\sf}     % = cmss12 at 12.0pt
\newcommand{\ChFont}{\large\fontfamily{\sfdefault}%
  \fontseries{sbc}\fontshape{n}\selectfont}     %=cmssbc12 at 14.4pt
\newcommand{\ChBkFont}{\ChFont\fontseries{m}    %
  \selectfont}                                  % =cmssm12 at 14.4pt
\newcommand{\CpyRtFont}{\footnotesize}          % = cmr10  at 10pt
\newcommand{\CpyRtInfoFont}{\tiny}              % = cmss8  at  8pt
\newcommand{\STitleFont}{\large\bf\sf}          % = cmss12 at 14.4pt
\newcommand{\STitleKeyFont}{\large}             % = cmr12  at 14.4pt
\font\STNFont=cmtt12 at 20pt
\newcommand{\STitleNumberFont}{\STNFont}        % = cmtt12 at 20pt
\newcommand{\ScriptRefFont}{\footnotesize}      % = cmr10  at 10pt
\newcommand{\WandMFont}{\footnotesize}          % = cmr10  at 10pt
\newcommand{\SBBracketTagFont}{\small\bf\sf}    % = cmss10 at 10.0pt
\newcommand{\SBBridgeTagFont}{\SBEndTagFont}    % = cmss10 at 10.9pt
\newcommand{\SBChorusTagFont}{\small\bf\sf}     % = cmss10 at 10.9pt
\newcommand{\SBEndTagFont}{\small\bf\sf}        % = cmss10 at 10.9pt
\newcommand{\SBIntroTagFont}{\SBEndTagFont}     % = cmss10 at 10.9pt
\font\SBOBFont=cmss17 at 30pt
\newcommand{\SBOccursBrktFont}{\SBOBFont}       % = cmss17 at 30pt
\newcommand{\SBOccursTagFont}{\small\bf\sf}     % = cmss10 at 10.0pt
\newcommand{\SBVerseNumberFont}{\small\bf\sf}   % = cmss10 at 10.9pt
\newcommand{\SBSectionNumberFont}{\small\bf\sf} % = cmss10 at 10.9pt

\newcommand{\SBMargNoteFont}{\scriptsize}       % = cmti8  at  8pt
\newcommand{\SBRefFont}{\SBMargNoteFont}        % = cmti8  at  8pt
\newcommand{\SBDefaultFont}{\fontfamily{\rmdefault}%
  \large}                                       % = cmr12  at 14.4pt
\newcommand{\SBLyricNoteFont}{\footnotesize\sf} % = cmss10 at 10pt
\newcommand{\SBOHContTagFont}{\small\bf\sf\itshape} % = cmss10 at 10.9pt

%%========================================================
%%    C O N F I G U R A B L E   D I M E N S I O N S      %
%%========================================================
\newcommand{\HangAmt}            {1.5em}
\newcommand{\LeftMarginSBBracket}{2.85em}
\newcommand{\LeftMarginSBChorus} {4em}
\newcommand{\LeftMarginSBSection}{\LeftMarginSBChorus}
\newcommand{\LeftMarginSBVerse}  {\LeftMarginSBChorus}
\newcommand{\SBChordRaise}       {2.25ex}
\newcommand{\SBOldChordRaise}    {2.90ex}
\newcommand{\SBRuleRaiseAmount}  {0.57ex}
\newcommand{\SpaceAboveSTitle}   {0.5in}
\newcommand{\SpaceAfterTitleBlk} {-1.75ex}
\newcommand{\SpaceAfterChorus}   {\vspace{0ex plus0ex  minus3ex}}
\newcommand{\SpaceAfterOpGroup}  {\vspace{0ex plus0ex  minus3ex}}
\newcommand{\SpaceAfterSBBracket}{\vspace{2ex plus1ex  minus1ex}}
\newcommand{\SpaceAfterSection}  {\vspace{0ex plus0ex  minus3ex}}
\newcommand{\SpaceAfterSong}     {\vspace{0ex plus10ex minus3ex}}
\newcommand{\SpaceAfterVerse}    {\vspace{0ex plus0ex  minus3ex}}
\newcommand{\SpaceBeforeSBBracket}{\vspace{1ex plus1ex  minus1ex}}

\newlength{\chSpaceTolerance}   \setlength{\chSpaceTolerance}{1.5mm}
\newlength{\chMiniSpace}        \setlength{\chMiniSpace}     {0.3mm}
\newlength{\sbBaselineSkipAmt}  \setlength{\sbBaselineSkipAmt}{0pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                      %%
%%     D E C L A R A T I O N   O F   O P T I O N S      %%
%%                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%=======================================================%
%%          P A P E R S I Z E   O P T I O N S            %
%%=======================================================%
\DeclareOption{a4paper}{% Paper size: 210mm x 297mm
  \SBpaperAfourtrue
  \SBpaperAfivefalse
  \SBpaperBfivefalse
  \SBpaperLtrfalse
  \SBpaperLglfalse
  \SBpaperExcfalse
}

\DeclareOption{a5paper}{% Paper size: 148mm x 210mm
  \SBpaperAfourfalse
  \SBpaperAfivetrue
  \SBpaperBfivefalse
  \SBpaperLtrfalse
  \SBpaperLglfalse
  \SBpaperExcfalse
}

\DeclareOption{b5paper}{% Paper size: 176mm x 250mm
  \SBpaperAfourfalse
  \SBpaperAfivefalse
  \SBpaperBfivetrue
  \SBpaperLtrfalse
  \SBpaperLglfalse
  \SBpaperExcfalse
}

\DeclareOption{letterpaper}{% Paper size: 8.5in x 11in
  \SBpaperAfourfalse
  \SBpaperAfivefalse
  \SBpaperBfivefalse
  \SBpaperLtrtrue
  \SBpaperLglfalse
  \SBpaperExcfalse
}

\DeclareOption{legalpaper}{% Paper size: 8.5in x 14in
  \SBpaperAfourfalse
  \SBpaperAfivefalse
  \SBpaperBfivefalse
  \SBpaperLtrfalse
  \SBpaperLgltrue
  \SBpaperExcfalse
}

\DeclareOption{executivepaper}{% Paper size: 7.25in x 10.5in
  \SBpaperAfourfalse
  \SBpaperAfivefalse
  \SBpaperBfivefalse
  \SBpaperLtrfalse
  \SBpaperLglfalse
  \SBpaperExctrue
}

%%=======================================================%
%%         C O M P A C T S O N G   O P T I O N           %
%%=======================================================%
\DeclareOption{compactsong}{%
  %%%
  % Set flag to indicate the user wants compact song mode.
  \CompactSongModetrue
}

%%=======================================================%
%%       P R I N T A L L S O N G S   O P T I O N         %
%%=======================================================%
\DeclareOption{printallsongs}{%
  %%%
  % Set flag to indicate the user wants to print all songs.
  \PrintAllSongstrue
}

%%=======================================================%
%%      S O N G B O O K   C O R E   O P T I O N S        %
%%=======================================================%
\DeclareOption{chordbk}{%
  \ChordBktrue
  \WordBkfalse
  \Overheadfalse
  \WordsOnlyfalse
  \NotWordsOnlytrue
  \SongEjecttrue

  \voffset=-1.00in
  \hoffset=-1.00in

  \ifSBpaperAfour
    \topmargin=0.5in
    \headheight=0.21in
    \headsep=0.2in
    \textheight=10.0in
    \footskip=0.19in
    %
    \oddsidemargin=0.618in
    \evensidemargin=1.4in
    \textwidth=6.25in
    \marginparsep=0.2in
    \marginparwidth=0.8in
  \else\ifSBpaperAfive
    \topmargin=6.0mm
    \headheight=5.334mm
    \headsep=2.666mm
    \textheight=185.17mm
    \footskip=4.826mm
    %
    \oddsidemargin=12.0mm
    \evensidemargin=30.0mm
    \textwidth=106.0mm
    \marginparsep=3.68mm
    \marginparwidth=20.32mm
    \renewcommand{\ChBassFont}{\small\bf\sf}        % = cmss12 at 11.0pt
    \renewcommand{\ChFont}{\normalsize\fontfamily{\sfdefault}%
      \fontseries{sbc}\fontshape{n}\selectfont}     %=cmssbc12 at 12.0pt
    \renewcommand{\ChBkFont}{\ChFont\fontseries{m}  %
      \selectfont}                                  % =cmssm12 at 12.0pt
    \renewcommand{\SBDefaultFont}{\normalsize}      % = cmr12  at 12.0pt
    \renewcommand{\SBOccursBrktFont}{\large\bf\sf}  % = cmss10 at 10.9pt
  \else\ifSBpaperBfive
    \topmargin=10.0mm
    \headheight=5.334mm
    \headsep=5.0mm
    \textheight=214.84mm
    \footskip=4.826mm
    %
    \oddsidemargin=20.0mm
    \evensidemargin=34.0 mm
    \textwidth=122.0mm
    \marginparsep=3.68mm
    \marginparwidth=20.32mm
    \renewcommand{\ChBassFont}{\small\bf\sf}        % = cmss12 at 11.0pt
    \renewcommand{\ChFont}{\normalsize\fontfamily{\sfdefault}%
      \fontseries{sbc}\fontshape{n}\selectfont}     %=cmssbc12 at 12.0pt
    \renewcommand{\ChBkFont}{\ChFont\fontseries{m}  %
      \selectfont}                                  % =cmssm12 at 12.0pt
    \renewcommand{\SBDefaultFont}{\normalsize}      % = cmr12  at 12.0pt
    \renewcommand{\SBOccursBrktFont}{\large\bf\sf}  % = cmss10 at 10.9pt
  \else\ifSBpaperLtr
    \topmargin=0.5in
    \headheight=0.21in
    \headsep=0.20in
    \textheight=9.4in
    \footskip=0.19in
    %
    \oddsidemargin=0.75in
    \evensidemargin=1.5in
    \textwidth=6.25in
    \marginparsep=0.2in
    \marginparwidth=0.8in
  \else\ifSBpaperLgl
    \topmargin=0.5in
    \headheight=0.21in
    \headsep=0.20in
    \textheight=12.4in
    \footskip=0.19in
    %
    \oddsidemargin=0.75in
    \evensidemargin=1.5in
    \textwidth=6.25in
    \marginparsep=0.2in
    \marginparwidth=0.8in
  \else\ifSBpaperExc
    \topmargin=0.25in
    \headheight=0.21in
    \headsep=0.165in
    \textheight=9.435in
    \footskip=0.19in
    %
    \oddsidemargin=0.5in
    \evensidemargin=1.25in
    \textwidth=5.5in
    \marginparsep=0.2in
    \marginparwidth=0.8in
  \fi\fi\fi\fi\fi\fi

  \raggedbottom

  \ifCompactSongMode
    \renewcommand{\ChBassFont}{\small\bf\sf}        % = cmss12 at 11.0pt
    \renewcommand{\ChFont}{\normalsize\fontfamily{\sfdefault}%
      \fontseries{sbc}\fontshape{n}\selectfont}     %=cmssbc12 at 12.0pt
    \renewcommand{\ChBkFont}{\ChFont\fontseries{m}  %
      \selectfont}                                  % =cmssm12 at 12.0pt
    \renewcommand{\SBDefaultFont}{\normalsize}      % = cmr12  at 12.0pt
    \renewcommand{\SBOccursBrktFont}{\large\bf\sf}  % = cmss10 at 10.9pt

    \setlength{\columnsep}{0.25in}

    \addtolength{\textwidth}     {\marginparsep + \marginparwidth}
    \addtolength{\evensidemargin}{-\marginparsep - \marginparwidth}
    \setlength  {\marginparsep}  {0in}
    \setlength  {\marginparwidth}{0in}

    \setlength{\chSpaceTolerance}{1.0mm}

    \renewcommand{\HangAmt}            {1.5em}
    \renewcommand{\LeftMarginSBChorus} {2em}
    \renewcommand{\LeftMarginSBSection}{\LeftMarginSBChorus}
    \renewcommand{\LeftMarginSBVerse}  {\LeftMarginSBChorus}
  \fi
}

\DeclareOption{wordbk}{%
  \ChordBkfalse
  \WordBktrue
  \Overheadfalse
  \WordsOnlytrue
  \NotWordsOnlyfalse
  \SongEjectfalse

  \renewcommand{\SBDefaultFont}{\normalsize}
  \font\mySTNFont=cmtt12 at 17pt
  \renewcommand{\STitleNumberFont}{\mySTNFont}
  \renewcommand{\CpyRtFont}{\scriptsize}
  \renewcommand{\WandMFont}{\scriptsize}
  \renewcommand{\ScriptRefFont}{\scriptsize}
  \renewcommand{\SBOccursBrktFont}{\large\bf\sf}

  \renewcommand{\SpaceAboveSTitle}   {0.25in}
  \renewcommand{\LeftMarginSBChorus} {1.5em}
  \renewcommand{\LeftMarginSBSection}{\LeftMarginSBChorus}
  \renewcommand{\LeftMarginSBVerse}  {\LeftMarginSBChorus}

  \voffset=-1.00in
  \hoffset=-1.00in

  \ifSBpaperAfour
    \topmargin=0.5in
    \headheight=0.21in
    \headsep=0.2in
    \textheight=10.0in
    \footskip=0.19in
    %
    \oddsidemargin=0.618in
    \evensidemargin=0.4in
    \textwidth=7.25in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \else\ifSBpaperAfive
    \topmargin=6.0mm
    \headheight=5.334mm
    \headsep=2.666mm
    \textheight=185.17mm
    \footskip=4.826mm
    %
    \oddsidemargin=12.0mm
    \evensidemargin=6.0mm
    \textwidth=130.0mm
    \marginparsep=0.0mm
    \marginparwidth=0.0mm
  \else\ifSBpaperBfive
    \topmargin=10.0mm
    \headheight=5.334mm
    \headsep=5.0mm
    \textheight=214.84mm
    \footskip=4.826mm
    %
    \oddsidemargin=20.0mm
    \evensidemargin=10.0mm
    \textwidth=146.0mm
    \marginparsep=0.0mm
    \marginparwidth=0.0mm
  \else\ifSBpaperLtr
    \topmargin=0.5in
    \headheight=0.21in
    \headsep=0.10in
    \textheight=9.4in
    \footskip=0.29in
    %
    \oddsidemargin=0.75in
    \evensidemargin=0.5in
    \textwidth=7.25in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \else\ifSBpaperLgl
    \topmargin=0.5in
    \headheight=0.21in
    \headsep=0.20in
    \textheight=12.4in
    \footskip=0.19in
    %
    \oddsidemargin=0.75in
    \evensidemargin=0.5in
    \textwidth=7.25in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \else\ifSBpaperExc
    \topmargin=0.25in
    \headheight=0.21in
    \headsep=0.165in
    \textheight=9.435in
    \footskip=0.19in
    %
    \oddsidemargin=0.5in
    \evensidemargin=0.25in
    \textwidth=6.5in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \fi\fi\fi\fi\fi\fi

  \raggedright

  \ifCompactSongMode
    \typeout{``compactsong'' mode not implemented for Wordbk mode.}
    \CompactSongModefalse
  \fi
}

\DeclareOption{overhead}{%
  \ChordBkfalse
  \WordBkfalse
  \Overheadtrue
  \WordsOnlytrue
  \NotWordsOnlyfalse
  \SongEjecttrue

  \def\@mss{cmssdc10}
  \renewcommand{\SBDefaultFont}{\LARGE\bf\sf}
  \renewcommand{\STitleNumberFont}{\Large\sf}
  \renewcommand{\STitleFont}{\LARGE\sf}
  \renewcommand{\CpyRtFont}{\normalsize\rm}
  \renewcommand{\CpyRtInfoFont}{\normalsize\rm}
  \renewcommand{\WandMFont}{\normalsize\rm}
  \renewcommand{\ScriptRefFont}{\normalsize\rm}
  \renewcommand{\SBLyricNoteFont}{\normalsize\rm}
  \renewcommand{\SBChorusTagFont}{\Large\sf}
  \renewcommand{\SBVerseNumberFont}{\Large\sf}
  \renewcommand{\SBSectionNumberFont}{\Large\sf}
  \renewcommand{\SBOccursTagFont}{\Large\sf}
  \renewcommand{\SBOccursBrktFont}{\huge\sf}
  \renewcommand{\SBBracketTagFont}{\Large\sf}
  \renewcommand{\SBOHContTagFont}{\Large\sf\itshape}

  \renewcommand{\SpaceAboveSTitle}   {0.25in}
  \renewcommand{\LeftMarginSBBracket}{2.25em}
  \renewcommand{\LeftMarginSBChorus} {1.5em}
  \renewcommand{\LeftMarginSBSection}{\LeftMarginSBChorus}
  \renewcommand{\LeftMarginSBVerse}  {\LeftMarginSBChorus}

  \renewcommand{\baselinestretch}{.9}

  \voffset=-1.00in
  \hoffset=-1.00in

  \ifSBpaperAfour
    \topmargin=0.25in
    \headheight=0.25in
    \headsep=0.0in
    \textheight=10.3in
    \footskip=0.2in
    %
    \oddsidemargin=1.134in
    \evensidemargin=1.134in
    \textwidth=6.0in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \else\ifSBpaperAfive
    \topmargin=0.0mm
    \headheight=5.334mm
    \headsep=0.0mm
    \textheight=193.666mm
    \footskip=4.826mm
    %
    \oddsidemargin=9.0mm
    \evensidemargin=9.0mm
    \textwidth=130.0mm
    \marginparsep=0.0mm
    \marginparwidth=0.0mm
  \else\ifSBpaperBfive
    \topmargin=0.666mm
    \headheight=5.334mm
    \headsep=0.0mm
    \textheight=229.0mm
    \footskip=4.826mm
    %
    \oddsidemargin=15.0mm
    \evensidemargin=15.0mm
    \textwidth=146.0mm
    \marginparsep=0.0mm
    \marginparwidth=0.0mm
  \else\ifSBpaperLtr
    \topmargin=0.25in
    \headheight=0.25in
    \headsep=0.0in
    \textheight=9.75in
    \footskip=0.2in
    %
    \oddsidemargin=1.25in
    \evensidemargin=1.25in
    \textwidth=6.0in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \else\ifSBpaperLgl
    \topmargin=0.25in
    \headheight=0.25in
    \headsep=0.0in
    \textheight=12.8in
    \footskip=0.2in
    %
    \oddsidemargin=1.25in
    \evensidemargin=1.25in
    \textwidth=6.0in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \else\ifSBpaperExc
    \topmargin=0.25in
    \headheight=0.21in
    \headsep=0.0in
    \textheight=9.6in
    \footskip=0.19in
    %
    \oddsidemargin=0.625in
    \evensidemargin=0.625in
    \textwidth=6.0in
    \marginparsep=0.0in
    \marginparwidth=0.0in
  \fi\fi\fi\fi\fi\fi

  \raggedright
  \raggedbottom

  \ifCompactSongMode
    \typeout{``compactsong'' mode not implemented for Overhead mode.}
    \CompactSongModefalse
  \fi
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                      %%
%%       E X E C U T I O N   O F   O P T I O N S        %%
%%                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ExecuteOptions{letterpaper}
\ProcessOptions

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                      %%
%%       P A C K A G E   L O A D I N G   P A R T        %%
%%                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage{conditionals}

\RequirePackage{ifthen}

\ifCompactSongMode
  \RequirePackage{multicol}[1999/05/25]
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                      %%
%%              M A I N   C O D E   P A R T             %%
%%                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\AtBeginDocument{%
  \setbox0=\hbox{}
  %
  \ifChordBk\setbox0=\hbox{1}\fi
  \ifWordBk\setbox0=\hbox{1}\fi
  \ifOverhead\setbox0=\hbox{1}\fi
  %
  \ifthenelse{\wd0 = 0}
    {\errmessage{No songbook option (i.e., type) specified.
        Specify a songbook mode in your usepackage
        statement; one of: [chordbk], [wordbk], or [overhead]}}
    {\relax}

  \SBDefaultFont
}

%%========================================================
%%      C O N S T A N T S   &   V A R I A B L E S        %
%%========================================================

\newcounter{SBSongCnt}
\newcounter{SBSectionCnt}
\newcounter{SBVerseCnt}

\newcommand{\OHContPgFtrTag}     {continued on next page\ldots}
\newcommand{\OHContPgHdrTag}     {\theSBSongCnt\ --- \theSongTitle, continued\ldots}
\newcommand{\SBBaseLang}  {English}
\newcommand{\SBBridgeTag}        {Bridge:}
\newcommand{\SBChorusTag}        {Ch:}
\newcommand{\SBContinueTag}      {cont\ldots}
\newcommand{\SBEndTag}           {End:}
\newcommand{\SBIntersyllableRule}{\hrulefill}
\newcommand{\SBIntroTag}         {Intro:}
\newcommand{\SBPubDom}           {Public Domain}
\newcommand{\SBUnknownTag}       {Unknown}
\newcommand{\SBWAndMTag}         {W\&M:}
\newcommand{\Songbook}           {\textrm{Song$\flat$ook}}

\newcommand{\theSongComposer}{the Composer}
\newcommand{\theSongComposerU}{the ComposerU}
\newcommand{\theSongCopyRt}{the Copyright}
\newcommand{\theSongKey}{the Key}
\newcommand{\theSongLicense}{the License}
\newcommand{\theSongScriptRef}{the Scripture}
\newcommand{\theSongTitle}{the Title}
\newcommand{\theXlatnBy}{the Translator}
\newcommand{\theXlatnLang}{the Language}
\newcommand{\theXlatnPerm}{the Permission}
\newcommand{\theXlatnTitle}{the Translation Title}

%%=======================================================%
%%          S P E C I A L   C H A R A C T E R S          %
%%=======================================================%

\newcommand{\SBem}{\ifWordsOnly\relax\else---\fi}

\newcommand{\SBen}{\ifWordsOnly\relax\else--\fi}

%%%
\newcommand{\SBContinueMark}{%
  \setbox0=\hbox{\rightmark}
  \ifthenelse{\lengthtest{\wd0 = 0pt}}
  {\relax}%
  {\SBContinueTag}%
  }

\newcommand{\OHContPgFtr}{%
  \ifOverhead
    \vskip .25in
    \centerline{\SBOHContTagFont\OHContPgFtrTag}
  \else%
    \relax%
  \fi}
\newcommand{\OHContPgHdr}{%
  \ifOverhead
    \centerline{\SBOHContTagFont\OHContPgHdrTag}
    \vskip .25in
  \else%
    \relax%
  \fi}

%%=======================================================%
%%          T A B L E   O F   C O N T E N T S            %
%%                                                       %
%%                A N D   I N D I C E S                  %
%%=======================================================%
\def\makeArtistIndex{\if@filesw \newwrite\@artistIndexfile
  \immediate\openout\@artistIndexfile=\jobname.aIdx
  \def\artistIndex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrArtistIndex}\typeout
  {Writing index file \jobname.aIdx }\fi}

\def\@wrArtistIndex#1#2{\let\thepage\relax
   \xdef\@gtempa{\write\@artistIndexfile{\string
      \indexentry{#1}{#2}}}\endgroup\@gtempa
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\artistIndex{\@bsphack\begingroup \@sanitize\@artistIndex}

\def\@artistIndex#1#2{\endgroup\@esphack}

\def\makeKeyIndex{\if@filesw \newwrite\@keyIndexfile
  \immediate\openout\@keyIndexfile=\jobname.kIdx
  \def\keyIndex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrKeyIndex}\typeout
  {Writing index file \jobname.kIdx }\fi}

\def\@wrKeyIndex#1#2{\let\thepage\relax
   \xdef\@gtempa{\write\@keyIndexfile{\string
      \indexentry{#1}{#2}}}\endgroup\@gtempa
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\keyIndex{\@bsphack\begingroup \@sanitize\@keyIndex}

\def\@keyIndex#1#2{\endgroup\@esphack}

\def\makeTitleIndex{\if@filesw \newwrite\@titleIndexfile
  \immediate\openout\@titleIndexfile=\jobname.tIdx
  \def\titleIndex{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrTitleIndex}\typeout
  {Writing index file \jobname.tIdx }\fi}

\def\@wrTitleIndex#1#2{\let\thepage\relax
   \xdef\@gtempa{\write\@titleIndexfile{\string
      \indexentry{#1}{#2}}}\endgroup\@gtempa
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\titleIndex{\@bsphack\begingroup \@sanitize\@titleIndex}

\def\@titleIndex#1#2{\endgroup\@esphack}

\def\makeTitleContents{\if@filesw \newwrite\@titleContentsfile
  \immediate\openout\@titleContentsfile=\jobname.toc
  \def\titleContents{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrTitleContents}\typeout
  {Writing table of contents file \jobname.toc }\fi}

\def\@wrTitleContents#1#2{\let\thepage\relax
   \xdef\@gtempa{\write\@titleContentsfile{\string
       \item\ \theSBSongCnt. #1\protect\hbox{, \thepage}}}\endgroup\@gtempa
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\titleContents{\@bsphack\begingroup \@sanitize\@titleContents}

\def\@titleContents#1#2{\endgroup\@esphack}

\newcommand{\SBtocSEntry}[3]{#1. \textit{#2}\hbox{, #3}}

\def\makeTitleContentsSkip{\if@filesw \newwrite\@titleContentsSkipfile
  \immediate\openout\@titleContentsSkipfile=\jobname.tocS
  \def\titleContentsSkip{\@bsphack\begingroup
             \def\protect####1{\string####1\space}\@sanitize
             \@wrTitleContentsSkip}\typeout
  {Writing table of contents (skipped) file \jobname.tocS }\fi}

\def\@wrTitleContentsSkip#1#2{\let\thepage\relax
   \xdef\@gtempa{\write\@titleContentsSkipfile{\string
       \item\ \protect\SBtocSEntry{\theSBSongCnt}{#1}{\thepage}}}\endgroup\@gtempa
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}

\def\titleContentsSkip{\@bsphack\begingroup \@sanitize\@titleContentsSkip}

\def\@titleContentsSkip#1#2{\endgroup\@esphack}

\newcommand{\FLineIdx}[1]{\titleIndex{#1@{\it #1\/}}{\theSBSongCnt}}

%%=======================================================%
%%           S O M E   O T H E R   H O O K S             %
%%=======================================================%

\newcommand{\SBChorusMarkright}[1]{\markright{#1}}

\newcommand{\SBVerseMarkright}[1]{\markright{#1}}

\newcommand{\SBSectionMarkright}[1]{\markright{\alph{#1}}}

\newcommand{\SongMarkboth}[2]{\markboth{#1}{#2}}

\newcommand{\STitleMarkboth}[2]{\markboth{#1}{#2}}

%%=======================================================%
%%       M I S C E L L A N E O U S   M A C R O S         %
%%=======================================================%

\newcommand{\CpyRt}[3][Y]{%
  \if#1Y\begin{center}\fi
    \if\blank{#2}%
      \if\blank{#3}%
        {\CpyRtFont\copyright \SBUnknownTag{} \CpyRtInfoFont}%
      \else
        {\CpyRtFont\copyright \SBUnknownTag{} \CpyRtInfoFont #3}%
      \fi%
    \else%
      \ifthenelse{\equal{#2}{\SBPubDom}}
      {%then
        {\CpyRtFont #2 \CpyRtInfoFont #3}%
      }{%else
        {\CpyRtFont\copyright #2 \CpyRtInfoFont #3}%
      }%fi
    \fi%
  \if#1Y\end{center}\fi
}

\newcommand{\ScriptRef}[2][Y]{%
  \if#1Y\begin{center}\fi
    {\ScriptRefFont #2}%
  \if#1Y\end{center}\fi
}


\newcommand{\WAndM}[2][Y]{%
  \if#1Y\begin{center}\fi
    \if\blank{#2}%
      {\WandMFont\SBWAndMTag ~\SBUnknownTag}%
    \else
      {\WandMFont\SBWAndMTag ~#2}%
    \fi
  \if#1Y\end{center}\fi
}

\newcommand{\sbSetsbBaselineSkipAmt}{
  \ifChordBk%
    \setbox0=\hbox{\strut\raise\SBChordRaise\hbox{\ChFont\sbChord{}A\relax\strut}A}%
    \setlength{\sbBaselineSkipAmt}{\ht0 + \dp0}%
  \else%
    \setlength{\sbBaselineSkipAmt}{\baselineskip}%
  \fi%
}

%%=======================================================%
%%    P R I M A R Y   S O N G B O O K   M A C R O S      %
%%=======================================================%

%%%
\newcommand{\STitle}[3][Y]{%
  \setcounter{SBVerseCnt}{0}%
  \setcounter{SBSectionCnt}{0}%
  \ifExcludeSong\relax%
    \else\keyIndex{{\protect\sbChord#3\protect\relax} -- #2}{\theSBSongCnt}\fi%
  \vspace{\SpaceAboveSTitle}%
  \if#1Y\begin{center}\fi
    {\STitleNumberFont\theSBSongCnt}{\STitleFont\ --- #2}%
    \ifWordsOnly\relax\else{\STitleKeyFont\ [{\sbChord#3\relax}]}\fi%
  \if#1Y\end{center}\fi
  \STitleMarkboth{#2}{\relax}%
  }

\newenvironment{song}[7][Y]{                    % Comment markers to negate
  \if#1Y\ExcludeSongfalse\else\ExcludeSongtrue\fi% the newline.
  \ifPrintAllSongs\ExcludeSongfalse\fi          %
  \SongMarkboth{\relax}{\relax}                 %
  \SBinSongEnvtrue                              %
  \renewcommand{\SBinSongEnv}{\True}            %
  \ifWordsOnly                                  %
    \setlength{\parindent}{0pt}                 %
  \fi                                           %
  \renewcommand{\theSongComposer}{#5}           %
  \if\blank{#5}                                 %
    \renewcommand{\theSongComposerU}{\SBUnknownTag}%
  \else                                         %
    \renewcommand{\theSongComposerU}{#5}        %
  \fi                                           %
  \renewcommand{\theSongCopyRt}{#4}             %
  \renewcommand{\theSongKey}{#3}                %
  \renewcommand{\theSongLicense}{#7}            %
  \renewcommand{\theSongScriptRef}{#6}          %
  \renewcommand{\theSongTitle}{#2}              %
  \renewcommand{\theXlatnBy}{}                  %
  \renewcommand{\theXlatnLang}{\SBBaseLang}     %
  \renewcommand{\theXlatnPerm}{}                %
  \renewcommand{\theXlatnTitle}{}               %
  %
  \addtocounter{SBSongCnt}{1}                   %
  %
  \ifExcludeSong                                %
    \titleContentsSkip{\theSongTitle}{\theSongKey}%
  \else                                         %
    \titleIndex{\theSongTitle}{\theSBSongCnt}   %
    \titleContents{\theSongTitle}{\theSongKey}  %
    \artistIndex{\theSongComposerU+\theSongTitle}{\theSBSongCnt}%
  \fi                                           %
  \ifExcludeSong\setbox2=\vbox\bgroup\fi%
  \ifSamepageMode%
    \begin{samepage}%
  \fi%
  \begin{center}
    \STitle[N]{\theSongTitle}{#3}\\
    \vspace{-.5ex}
    \CpyRt[N]{#4}{#7}\\
    \vspace{-.5ex}
    \WAndM[N]{#5}\\
    \if\given{#6}%
      \vspace{-.75ex}
      \ScriptRef[N]{\theSongScriptRef}\\
    \fi%
  \end{center}%
  \vspace{\SpaceAfterTitleBlk}
  \ifCompactSongMode
    \begin{multicols*}{2}
      \raggedcolumns
  \fi
  \SBDefaultFont%
  }%
{\ifSamepageMode%
    \end{samepage}%
  \fi%
  \ifCompactSongMode
    \end{multicols*}
  \fi
  \ifSongEject%
    \vfill\pagebreak%
  \else%
    \SpaceAfterSong\pagebreak[1]%
  \fi%
  \ifExcludeSong\egroup\setbox2=\hbox{}\fi%
  \renewcommand{\SBinSongEnv}{\False}%
  \SBinSongEnvfalse%
  }

\newcommand{\CBExcl}{\ifChordBk N\else Y\fi}
\newcommand{\OHExcl}{\ifOverhead N\else Y\fi}
\newcommand{\WBExcl}{\ifWordBk N\else Y\fi}
\newcommand{\WOExcl}{\ifWordsOnly N\else Y\fi}
\newenvironment{xlatn}[3]{% Comment marker negates the newline.
        \renewcommand{\theXlatnBy}{#3}%
        \renewcommand{\theXlatnPerm}{#2}%
        \renewcommand{\theXlatnTitle}{#1}%
        %
        \titleIndex{\theXlatnTitle}{\theSBSongCnt}%
        \titleContents{\theXlatnTitle}{\theSongKey}%
        %
        \begin{center}
          \STitle[N]{\theXlatnTitle}{\theSongKey}\\
          \CpyRt[N]{\theSongCopyRt}{\theSongLicense}\\
          \if\nil{#2}%
            \relax%
          \else%
            \vspace{-.5ex}
            {\CpyRtFont\theXlatnPerm}\\
          \fi
          \if\nil{#3}%
            \relax%
          \else%
            \vspace{-.5ex}
            {\CpyRtFont\theXlatnBy}\\
          \fi
        \end{center}%
        %
        \setcounter{SBVerseCnt}{0}%
        \setcounter{SBSectionCnt}{0}%
}{\relax}
\newenvironment{songTranslation}[4]{% Comment marker negates the newline.
        \renewcommand{\theXlatnBy}{#4}%
\begin{xlatn}{#2}{#3}{#4}%
}{\end{xlatn}}
\def\sbChord#1{%
  \ifx#1\relax%
    \let\next=\relax%
  \else%
    \ifx#1##% double sharp because we're inside a \def
      $\sharp$%
    \else%
      \ifx#1b%
        $\flat$%
      \else%
        \ifx#1/%
          \ChBassFont /%
        \else%
          \ifx#1[%
            \bgroup\ChBkFont [\egroup%
          \else%
            \ifx#1]%
              \bgroup\ChBkFont ]\egroup%
            \else%
              #1%
            \fi%
          \fi%
        \fi%
      \fi%
    \fi%
    \let\next=\sbChord%
  \fi%
  \next%
}

%%%
\newcommand{\Ch}[2]{{%
  \ifChordBk%
    \setbox1=\hbox{\ChFont\sbChord#1\relax\strut}%
    \setbox0=\hbox{#2}%
    \ifdim\wd1<\wd0%
      \strut\raise\SBChordRaise\copy1\kern-\wd1\copy0%
    \else%
      \strut\copy0\kern-\wd0\strut\raise\SBChordRaise\copy1%
    \fi%
  \else%
    #2%
  \fi}}

\newcommand{\ChX}[2]{%
  \ifWordsOnly%
    \if\nil{#2}%
      \ignorespaces%
    \else%
      #2%
    \fi%
  \else%
    \Ch{#1}{#2}%
  \fi}

\newlength{\chCriticDim}
\newlength{\chSpaceDim}
\newcommand{\Chr}[2]{{%
  \ifChordBk
    \setbox1=\hbox{\ChFont\sbChord#1\relax\strut}%
    \setbox0=\hbox{#2}%
    \setlength{\chCriticDim}{\wd0 - \chSpaceTolerance}%
    \advance\chCriticDim by 2\chMiniSpace%
    \ifdim\wd1>\chCriticDim%
      \chCriticDim \wd1%
      \advance\chCriticDim by -\wd0%
      \advance\chCriticDim by -\chSpaceTolerance%
      \advance\chCriticDim by -2\chMiniSpace%
      \ifdim\chCriticDim>0mm%
        \chSpaceDim \wd1%
        \advance\chSpaceDim by -\wd0%
        \advance\chSpaceDim by \chSpaceTolerance%
      \else%
        \chSpaceDim\chSpaceTolerance%
      \fi%
      \chCriticDim \chSpaceDim%
      \advance\chCriticDim by 2\chMiniSpace%
      \strut\raise\SBChordRaise\copy1\kern-\wd1\ifdim\wd0=0mm\kern-2\chMiniSpace\fi%
      \copy0\hbox to\chCriticDim{\hss%
        \raise\SBRuleRaiseAmount\hbox to\chSpaceDim{\SBIntersyllableRule}\hss}%
    \else%
      \strut\raise\SBChordRaise\copy1\kern-\wd1%
      \copy0%
    \fi%
  \else%
    #2%
  \fi}%
}

\newcommand{\SBMargNote}[1]{%
  \ifExcludeSong%
    \relax%
  \else\ifWordsOnly%
    \relax%
  \else\ifCompactSongMode%
    \footnote{{\SBMargNoteFont{#1}}}%
  \else%
    \marginpar{{\begin{flushleft}\SBRefFont{#1}\end{flushleft}}}%
  \fi\fi\fi}

\newcommand{\SBRef}[2]{%
  \ifExcludeSong%
    \relax%
  \else\ifWordsOnly%
    \relax%
  \else\ifCompactSongMode%
    \footnotetext[0]{{\SBRefFont{\em #1}, {#2}.}}%
  \else%
    \marginpar{{\begin{flushleft}\SBRefFont{\em #1}, {#2}.\end{flushleft}}}%
  \fi\fi\fi}

\newenvironment{SBVerse}{%
  \sbSetsbBaselineSkipAmt%
  \bgroup%
  \addtocounter{SBVerseCnt}{1}%
  \SBVerseMarkright{\theSBVerseCnt}%
  \begin{list}{{\SBVerseNumberFont\theSBVerseCnt .}}
    {\setlength {\leftmargin}   {\LeftMarginSBVerse + \HangAmt}
      \setlength{\itemindent}   {-\HangAmt}
      \setlength{\listparindent}{-\HangAmt}
      \setlength{\parsep}       {0pt}
      \setlength{\baselineskip} {\sbBaselineSkipAmt}
    }%
    \item}
{\end{list}%
 \egroup%
 \SpaceAfterVerse}

\newenvironment{SBVerse*}{%
  \sbSetsbBaselineSkipAmt%
  \bgroup%
  \begin{list}{{\SBVerseNumberFont }}
    {\setlength {\leftmargin}   {\LeftMarginSBVerse + \HangAmt}
      \setlength{\itemindent}   {-\HangAmt}
      \setlength{\listparindent}{-\HangAmt}
      \setlength{\parsep}       {0pt}
      \setlength{\baselineskip} {\sbBaselineSkipAmt}
      }%
    \item}
{\end{list}%
 \egroup%
 \SpaceAfterVerse}

\newenvironment{SBSection}{%
  \sbSetsbBaselineSkipAmt%
  \bgroup%
  \addtocounter{SBSectionCnt}{1}%
  \SBSectionMarkright{SBSectionCnt}
  \begin{list}{{\SBSectionNumberFont\alph{SBSectionCnt})}}
    {\setlength {\leftmargin}   {\LeftMarginSBSection + \HangAmt}
      \setlength{\itemindent}   {-\HangAmt}
      \setlength{\listparindent}{-\HangAmt}
      \setlength{\parsep}       {0pt}
      \setlength{\baselineskip} {\sbBaselineSkipAmt}
      }%
    \item}
{\end{list}%
 \egroup%
 \SpaceAfterSection}

\newenvironment{SBSection*}{%
  \sbSetsbBaselineSkipAmt%
  \bgroup%
  \begin{list}{{\SBSectionNumberFont }}
    {\setlength {\leftmargin}   {\LeftMarginSBSection + \HangAmt}
      \setlength{\itemindent}   {-\HangAmt}
      \setlength{\listparindent}{-\HangAmt}
      \setlength{\parsep}       {0pt}
      \setlength{\baselineskip} {\sbBaselineSkipAmt}
      }%
    \item}
{\end{list}%
 \egroup%
 \SpaceAfterSection}

\newenvironment{SBChorus}{%
  \sbSetsbBaselineSkipAmt%
  \bgroup%
  \SBChorusMarkright{\SBChorusTag}
  \begin{list}{{\SBChorusTagFont\SBChorusTag}}
    {\setlength {\leftmargin}   {\LeftMarginSBChorus + \HangAmt}
      \setlength{\itemindent}   {-\HangAmt}
      \setlength{\listparindent}{-\HangAmt}
      \setlength{\parsep}       {0pt}
      \setlength{\baselineskip} {\sbBaselineSkipAmt}
      }%
    \item}
{\end{list}%
 \egroup%
 \SpaceAfterChorus%
}

\newenvironment{SBChorus*}{%
  \sbSetsbBaselineSkipAmt%
  \bgroup%
  \begin{list}{{\SBChorusTagFont }}
    {\setlength {\leftmargin}   {\LeftMarginSBChorus + \HangAmt}
      \setlength{\itemindent}   {-\HangAmt}
      \setlength{\listparindent}{-\HangAmt}
      \setlength{\parsep}       {0pt}
      \setlength{\baselineskip} {\sbBaselineSkipAmt}
      }%
    \item}
{\end{list}%
 \egroup%
 \SpaceAfterChorus}

%%%
\newenvironment{SBOpGroup}{%
  \sbSetsbBaselineSkipAmt%
  \bgroup%
  \begin{list}{\hbox{}}
    {\setlength {\leftmargin}   {\HangAmt}
      \setlength{\itemindent}   {-\HangAmt}
      \setlength{\listparindent}{-\HangAmt}
      \setlength{\topsep}       {0pt}
      \setlength{\parsep}       {0pt}
      \setlength{\labelwidth}   {0pt}
      \setlength{\labelsep}     {0pt}
      \setlength{\baselineskip} {\sbBaselineSkipAmt}
      }%
    \item}
{\end{list}%
 \egroup%
 \SpaceAfterOpGroup}

\newcommand{\SBBridge}[1]{%
  \ifWordsOnly%
    \relax%
  \else%
    \sbSetsbBaselineSkipAmt%
    \bgroup%
    \begin{list}{{\SBBridgeTagFont\SBBridgeTag}}
      {\setlength {\leftmargin}  {\LeftMarginSBChorus}%
        \setlength{\parsep}      {0pt}
        \setlength{\baselineskip}{\sbBaselineSkipAmt}
        }%
      \item #1
    \end{list}%
    \egroup\par
  \fi}

\newcommand{\SBEnd}[2][N]{%
  \ifthenelse{\equal{\ifWordsOnly Y\fi}{Y}
    \and \equal{N}{#1}}%
  {\relax}%
  {\sbSetsbBaselineSkipAmt%
   \bgroup%
    \begin{list}{{\SBEndTagFont\SBEndTag}}
      {\setlength {\leftmargin}  {\LeftMarginSBChorus}
        \setlength{\parsep}      {0pt}
        \setlength{\baselineskip}{\sbBaselineSkipAmt}
        }%
    \item #2
    \end{list}%
    \egroup\par}
  }

\newcommand{\SBIntro}[2][N]{%
  \ifthenelse{\equal{\ifWordsOnly Y\fi}{Y}
    \and \equal{N}{#1}}%
  {\relax}%
  {\sbSetsbBaselineSkipAmt%
   \bgroup%
    \begin{list}{{\SBIntroTagFont\SBIntroTag}}%
      {\setlength {\leftmargin}  {\LeftMarginSBChorus}%
        \setlength{\parsep}      {0pt}
        \setlength{\baselineskip}{\sbBaselineSkipAmt}
        }%
      \item #2
      \vspace{-\topsep}%\vspace{-\partopsep}%
    \end{list}%
    \egroup\par}%
  }

\newenvironment{SBBracket}[1]{%
  \SpaceBeforeSBBracket
  \sbSetsbBaselineSkipAmt%
  \setbox0=\hbox to \LeftMarginSBBracket{\parbox{\LeftMarginSBBracket}%
    {\flushright{\hspace{0pt}\SBBracketTagFont #1}}}%
  \hbox\bgroup%
    \rightskip=\LeftMarginSBBracket%
    $\raisebox{1.25ex}{\copy0}%
    \left\lbrack%
      \vcenter\bgroup%
        \begin{list}{\hbox{}}%                          %
          {\setlength {\leftmargin}   {\HangAmt + 0.5em}% This list
            \setlength{\rightmargin}  {\LeftMarginSBBracket}%
            \setlength{\itemindent}   {-\HangAmt}%      % been copied
            \setlength{\listparindent}{-\HangAmt}%      % verbatim from
            \setlength{\topsep}       {0pt}%            % the SBOpGroup
            \setlength{\parsep}       {0pt}%            % environment,
            \setlength{\labelwidth}   {0pt}%            % above and then
            \setlength{\labelsep}     {0pt}%            % modified slightly.
            \setlength{\baselineskip} {\sbBaselineSkipAmt}%
            }%                                          %
          \item%
}{%
        \end{list}%
      \egroup%
    \right.$%
    \rightskip=0pt
  \egroup
  \SpaceAfterSBBracket
}

\newenvironment{SBBracket*}[1]{%
  \SpaceBeforeSBBracket
  \sbSetsbBaselineSkipAmt%
  \ifNotWordsOnly
    \setbox0=\hbox to \LeftMarginSBBracket{\parbox{\LeftMarginSBBracket}%
      {\flushright{\hspace{0pt}\SBBracketTagFont #1}}}%
    \hbox\bgroup%
      \rightskip=\LeftMarginSBBracket%
      $\raisebox{1.25ex}{\copy0}%
      \left\lbrack%
        \vcenter\bgroup%
  \fi
        \begin{list}{\hbox{}}%                          %
          {\setlength {\leftmargin}   {\HangAmt + 0.5em}% This list
            \setlength{\rightmargin}  {\LeftMarginSBBracket}%
            \setlength{\itemindent}   {-\HangAmt}%      % been copied
            \setlength{\listparindent}{-\HangAmt}%      % verbatim from
            \setlength{\topsep}       {0pt}%            % the SBOpGroup
            \setlength{\parsep}       {0pt}%            % environment,
            \setlength{\labelwidth}   {0pt}%            % above and then
            \setlength{\labelsep}     {0pt}%            % modified slightly.
            \setlength{\baselineskip} {\sbBaselineSkipAmt}%
            }%                                          %
          \item%
}{%
        \end{list}%
  \ifNotWordsOnly
        \egroup%
      \right.$%
      \rightskip=0pt
    \egroup
  \fi
  \SpaceAfterSBBracket
}

\newenvironment{SBOccurs}[1]{%
  {\SBOccursTagFont #1\SBOccursBrktFont [}
  }
{{\SBOccursBrktFont ]}}

\newenvironment{SBExtraKeys}[1]{%
  \ifWordsOnly%
    \relax%
  \else%
    #1
  \fi}
{}

\newcommand{\CBPageBrk}[1][N]{%
  \ifChordBk%
    \ifCompactSongMode
      \ifthenelse{\equal{#1}{N}}
      {\relax}
      {\vfill\pagebreak}
    \else
      \vfill\pagebreak
    \fi
  \fi}

\newcommand{\CSColBrk}{%
  \ifCompactSongMode%
    \columnbreak%
  \fi}

\newcommand{\NotWOPageBrk}{%
  \ifWordsOnly%
    \relax%
  \else%
    \pagebreak
  \fi}

\newcommand{\OHPageBrk}{%
  \ifOverhead%
    \pagebreak
  \fi}

\newcommand{\WBPageBrk}{%
  \ifWordBk%
    \pagebreak
  \fi}

\newcommand{\WOPageBrk}{%
  \ifWordsOnly%
    \pagebreak
  \fi}

%%=======================================================%
%%            O B S O L E T E   M A C R O S              %
%%=======================================================%

%%=======================================================%
%%          D E P R E C A T E D   M A C R O S            %
%%=======================================================%

%%%
\newcommand{\False}{0}
\newcommand{\True}{1}
\newcommand{\ChordBk}{\False}
\newcommand{\Overhead}{\False}
\newcommand{\SongEject}{\True}
\newcommand{\WordBk}{\False}
\newcommand{\WordsOnly}{\False}
\newcommand{\SBinSongEnv}{\False}

\endinput
%%
%% End of file `songbook.sty'.
