% \def\fileversion{1.5}\def\filedate{2001/10/08}\def\docdate{2001/10/08}
%\iffalse These lines are necessary for the doc and docstrip utilities
%<*asciidocu>

%%#
%%# Author:
%%#
%%# M. V\"ath      vaeth@mathematik.uni-wuerzburg.de
%%#
%%# The author thanks
%%#     Donald Arseneau <asnd@triumf.ca>
%%#     Dan Luecking    <luecking@uark.edu>
%%# and a colleague who does not want to be named here.

%%#############################################################################
%%#
%%#  guitar.sty - typesetting guitar chords over song texts.
%%#
%%#############################################################################

%%#
%%# This package should run with plain TeX, LaTeX 2.09, and LaTeX 2e.
%%# Actually, it should actually run with all TeX formats.
%%#

%%# This is not the only package available for typesetting guitar songs.
%%# The following packages are also available (and possibly also others:
%%# I do not claim that this list is complete).
%%#
%%# 1. gchords.sty   http://www.damtp.cam.ac.uk/user/kp229/gchords/
%%# 2. songbook.sty  http://www.rath.ca/Misc/Songbook/
%%#    or on CTAN:   macros/latex/contrib/supported/songbook/
%%# 3. guitarTeX (which is not a `pure' (La)TeX solution):
%%#                  http://rz-home.de/~jmiltz/guitartex/
%%#
%%# The packages 1. and 2. have somewhat different intentions.
%%# It should be possible to combine them with the current package
%%# without any severe problems.

% If you have access to (reasonable new) docstrip TeXfiles, you should run
% tex/latex on the file
%   `guitar.ins'
% to produce the files `guitar.sty', `guitar.txt' and `guitar.tex'.
% (In case `guitar.ins' is lost: You can find its content in the last
%  few lines of the file you are currently reading between the
%  lines %<*insfile> and %</insfile>;
%  BTW: You should name this file here `guitar.dtx' before you run tex
%  on guitar.ins).
%
% The file `guitar.txt' contains a `brief' (but complete) ascii
% documentation. If you have additionally access to LaTeX 2e, you may run
% latex on the generated file `guitar.tex' to produce `guitar.dvi' which
% contains a more luxury documentation.
%
% If you do not have access to the docstrip TeXfiles you may simply
% copy/rename this file here into
%   `guitar.sty'
% to use the package and read the ascii documentation in this file.
% The ascii documentation (the content of `guitar.txt') consists of all
% lines in this file which start with %%# (this is the above block and another
% (very large) block which follows soon).
%
% But I do not recommended this, because TeX will need more time to read this
% longer file, and because there might be a (very slight) incompatibility if
% you use it (namely if you load `guitar.sty' with some *extremely* strange
% catcodes).
% I recommend in this case instead to generate the file `guitar.sty' as
% anything between the lines %<*package> and %</package> by hand.
% (This is not precisely the file which you get with the docstrip TeXfiles,
% but a reasonable good substitute. To speed up loading, you may also
% eliminate all lines starting with `% ' in `guitar.sty').
% For your information: The file `guitar.tex' produced by the docstrip
% TeXfiles is anything between the lines %<*driver> and %</driver>
% (with a line containing \endinput and two comment lines appended)
%
%
% In any case, you end up with the file `guitar.sty'.
%
% If you can generate `guitar.tex', you will probably want to stop
% reading now and instead read the `luxury' documentation in `guitar.dvi'.
%
% Otherwise, you have to make due with the following ascii documentation.
%
%
% \fi\catcode\#14\relax\iffalse  (This line is needed for the doc utility)
%

%%# To use guitar, you have to put `guitar.sty' in a path where TeX looks
%%# for its input files. The TeX documents using guitar need the
%%# following modifications in their header:
%%#
%%# a) If you use LaTeX2.09, use guitar as a style option, e.g.
%%#      \documentstyle[guitar]{article}
%%#    or
%%#      \documentstyle[guitar,12pt]{article}
%%# b) If you use LaTeX2e, put in the preamble the command
%%#      \usepackage{guitar}
%%# c) If you use some other (non-LaTeX) format, you will probably have to
%%#    insert a line like
%%#          \catcode`\@=11\input guitar.sty\catcode`\@=12\relax
%%#
%%# For TeX-insiders:
%%# The only LaTeX-specific commands used in `guitar.sty' are:
%%#
%%#   \newenvironment
%%#   \newcommand (only in the form \newcommand{\command}{} to ensure that
%%#                 \command was not defined before)
%%#   \newsavebox
%%#   \newlength
%%#   \RequirePackage
%%#   \ProvidesPackage
%%#   \typeout
%%#
%%#   The above commands are used only if they are defined
%%#   (otherwise, the plainTeX are used).
%%#

%%#
%%# Usage:
%%#

%%# The general usage is very simple:
%%#
%%# \guitarChord{Bb}Really. \guitarChord{G#}Oh yes.
%%#
%%# This puts the chord "B flat" and "G sharp" over the "R" resp. "O".
%%# (in the chord, "b" and "#" always translate into "flat" resp. "sharp").
%%# When you switch into "magic" mode, you can even use [...] instead of
%%# \guitarChord{...}.
%%# E.g., in LaTeX, you can just write
%%#
%%# \begin{guitar}
%%# [Cm]This [Bb]is a [G#]very [Gm]simple song.
%%# You can still use any [\TeX]macros in the chord text.
%%# Actually, each accord reads a second argument over
%%# which it is [A]{centered}.
%%# By default, the linefeeds in the source lead to linebreaks %
%%# in the output, unless you put a percentage sign at the end of the line. %
%%# If a single line gets too long, the wrapped lines are right-aligned.
%%# To force the wrapping use \verb|\newline|\newline like here.
%%# To stretch the first line, use \verb|\linebreak|\linebreak like here.
%%#
%%# Two subsequent linefeeds in the source start a new verse.
%%#
%%#
%%# Three or more subsequent linefeeds in the source start a new verse with a %
%%# slightly larger space.
%%#
%%# Unfortunately, if the chords get too long, they may [Ebm+7]o[G#]verlap.
%%# To avoid this, the following solutions are supported:
%%#
%%# 1. If the token after your chord is a space, like in "[Ebm+7] space",
%%#    this space is stretched.
%%#    Note that this is different from the notation "[Ebm+7]{ }space".
%%# 2. Inside words, put a _ at the end like for [Ebm+7_]O[G#]K.
%%# 3. Outside words, put a | at the end like for [Ebm+7|]{OK}[G#|].
%%# If the chord is short enough (compared to its argument) then the symbols
%%# | and _ do not harm like in [E|]{long} or [E_]{long}er.
%%#
%%# You may (and in plainTeX you must) replace "\begin{guitar}" and
%%# "\end{guitar}" by "\guitarOn" and "\guitarOff", respectively.
%%#
%%# If you only want to put the guitar chords as above but do not like the
%%# feature concerning the linefeeds, you can use the environment
%%# \begin{guitarMagic}
%%# \end{guitarMagic}
%%# or the respective commands \guitarMagicOn and \guitarMagicOff.
%%# Similarly, you can also use only the linefeed feature by the environment
%%# \begin{guitarCr}
%%# \end{guitarCr}
%%# or the respective commands \guitarCrOn and \guitarCrOff.
%%#
%%# As a matter of fact, you can also e.g. use \guitarCrOff *within* a
%%# {guitar} environment, but then you have to use \guitarCrOn before you
%%# end the environment to have a proper nesting of modes.
%%#

%%#
%%# Customization
%%#

%%# The output of the "#" and "b" tokens in the chords is generated by the two
%%# commands
%%#
%%#       \guitarSharp
%%#       \guitarFlat
%%#
%%# Thus, for, example the customization
%%#
%%#       \def\guitarSharp{$^{\sharp}$}
%%#
%%# will make the sharp symbol be written as an upper index.

%%# In a similar way, the macros
%%#
%%#       \guitarEndLine
%%#       \guitarEndPar
%%#       \guitarEndDoublePar
%%#
%%# are expanded when the song text contains one, two, or three (or more)
%%# linefeeds.\par

%%# After the macro
%%#
%%#       \guitarNoChord
%%#
%%# has been used, no chords are output anymore. You can make the effect
%%# local by putting this command in a group. (\guitarNoChord redefines the
%%# macros which are responsible for the actual output of the chords - see the
%%# description at the end).
%%#
%%# The command
%%#
%%#       \guitarPreAccord
%%#
%%# is expanded before the actual chord is typeset: You can change this
%%# definition to e.g. modify the font used for the chord. By default, this
%%# command contains a \strut which ensures that the lines with chords
%%# usually all have the same height.
%%# The macro \guitarPreAccord may also use and modify the macro
%%#
%%#       \guitarAccord
%%#
%%# which contains the actual chord which is then output (you may use this
%%# feature to e.g. calculate a modulation in \guitarPreAccord or to
%%# replace the text of \guitarAccord by some graphic equivalent).
%%#
%%# It is guaranteed that the macros \guitarPreAccord and \guitarAccord
%%# are expanded precisely once.
%%# In contrast, it might happen that the argument of the chord (i.e. the
%%# text over which the chord is put) is expanded twice.
%%# (The doubled expansion could have been avoided, but the price were that
%%# in some cases the TeX kerning mechanism would then fail if the argument
%%# is a syllable of some word which is continued afterwards).
%%#
%%# Whenever the "guitar" mode or the "linefeed" mode is turned
%%# on or off, the corresponding macro
%%#
%%#       \guitarMagicOnHook
%%#       \guitarMagicOffHook
%%#       \guitarCrOnHook
%%#       \guitarCrOffHook
%%#
%%# is expanded (for switching on, the macro is expanded even before the
%%# necessary catcode changes are done, and for switching off, the macro
%%# is expanded after the catcodes have been restored).
%%# In the current defaults, a group is opened and closed in
%%# \guitarCrOnHook and \guitarCrOffHook: This is the reason why these
%%# commands must be properly nested.
%%# (The reason for this group is that"\parindent should be changed locally).
%%#
%%# In the current implementation, TeX forgets everything following the magic
%%# tokens "|" and "_" in the chord (because these symbols are intended to be
%%# the last one in the chord). If you want to use these tokens within a chord:
%%# They loose their magic meaning if they occur in a braced context
%%# (i.e. between { and }). If you regularly have to use these tokens within
%%# chords, you can change the default choice of this tokens by the respective
%%# commands
%%#
%%#       \toolboxMakeSplit{token}{guitarSplitDist}
%%#       \toolboxMakeSplit{token}{guitarSplitMerge}
%%#
%%# (See the "toolbox" package for details of the command \toolboxMakeSplit
%%# used here).
%%# It should be pointed out that {token} may actually be a *sequence*
%%# of tokens, so that for the `magic tokens' "|" and "_" you may instead use
%%# whole phrases if you prefer.
%%#
%%# Some fine tuning of the spacing can be done by redefining
%%#
%%#       \guitarCalcDim
%%#
%%# When this macro is called, the skip register
%%#
%%#       \guitarDim
%%#
%%# contains the width of the chord which should be put over the text.
%%# After \guitarCalcDim has been expanded, it is ensured that at least
%%# \guitarDim (horizontal) space is reserved for the chord. Thus, if
%%# \guitarCalcDim increases e.g. \guitarDim by 2pt (which is the
%%# default behavior of \guitarCalcDim), then 2pt more space is reserved
%%# for the chord than its actual size: This ensures that two subsequent
%%# chords are always separated by some space.
%%#
%%# Finally, you can modify the macros which do the actual setting of the
%%# chords: This setting is done by the commands
%%#
%%#       \guitarPut
%%#       \guitarPutOnSpace
%%#       \guitarPutDist
%%#       \guitarPutMerge
%%#
%%# which with the exception of \guitarPutOnSpace all expect one argument
%%# (namely the text on which they should be put). The command
%%# \guitarPutOnSpace is called, if a space followed the chord argument.
%%# Similarly, \guitarPutDist and \guitarPutMerge are called if the chord
%%# argument ended with the magic symbol "|" respectively "_".
%%# Before one of the above four macros is called, the chord text is stored in
%%# the macro \guitarAccord (and has not been expanded to this time); also the
%%# argument has not been expanded to this time. The above four macros are also
%%# responsible for the appropriate expansion (also of the expansion of the
%%# macros \guitarCalcDim and \guitarPreAccord, if
%%# the latter should still keep their meaning).
%%# The above four macros may freely use the skip register \guitarDim and the
%%# box register \guitarBox (which are both not used or
%%# modified by the other macros of this package).
%%#

%%#
%%# Possible Problems:
%%#

%%# The special treatment of [ # b and linefeed is realized by a changing of
%%# catcodes. This may cause essentially two sorts of problems:
%%#
%%# 1. In some cases, you will want to avoid the automatic replacement of '#'
%%#    and 'b'. For example, in [\textbf{F#}] or in \guitarChord{\textbf{F#}}
%%#    the "b" of "\textbf" gets replaced which is of course not what you want.
%%#    To avoid this replacement, there is a  * version of the respective
%%#    commands, i.e. the above example works in the intended way if you write
%%#    instead [*\textbf{F\guitarSharp}] or
%%#    \guitarChord*{\textbf{F\guitarSharp}}
%%#    (you have to use the command "\guitarSharp", because due to the * also
%%#    the # would not be replaced).
%%#
%%# 2. There are some situations in which catcodes are set too early,
%%#    e.g. if you use the macros within the argument of certain macros.
%%#    In this case, these symbols keep their usual \TeX\ meaning
%%#    (which may either lead to an error in case of "#" (and sometimes "[") or
%%#    just to a false output). If this happens to you, you have to replace at
%%#    the corresponding place the above one-symbol shortcuts by their longer
%%#    macro equivalents. In other words: You might have to replace in
%%#    certain special situations some occurrences of the symbols according to
%%#    the following table:
%%#
%%#    [...]        ->   \guitarChord{...}
%%#    #            ->   \guitarSharp
%%#    b            ->   \guitarFlat
%%#    linefeed     ->   \guitarEndLine
%%#    2 linefeeds  ->   \guitarEndPar
%%#    3+ linefeeds ->   \guitarEndDoublePar
%%#


%  This is the end of the ascii documentation
%</asciidocu>
%\fi\catcode\#6\relax
%
% \iffalse
%<*metainfo>
% \fi

% \def\basename{guitar}

%% \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         \~}

% \CheckSum{485}

% \iffalse
%   \RecordChanges
% \fi
% \def\mypar{}
% \def\ChangesTab{}\let\orichanges\changes
% \def\changes#1#2#3{\orichanges{#1}{#2}{#3}
%   \expandafter\def\expandafter\ChangesTab\expandafter{\ChangesTab
%   \item[v#1 {\mdseries(\emph{#2})}] {#3.}}}
% \newcommand{\cmdcite}[1]{\texttt{\textbackslash#1}}
% \newcommand{\filecite}[1]{\texttt{#1}}
%
% \changes{1.5}{2001/08/27}{Included references to other packages in
%   documentation; slightly modified the \cmdcite{typeout} of the package name}
% \changes{1.4}{2001/08/27}{Introduced \texttt{*} versions to avoid changing
%   of catcodes in special situation}
% \changes{1.3}{2001/08/24}{Improved technique of right-alignment thanks to
%   valuable hints of Donald Arseneau \texttt{<asnd@triumf.ca>}. Introduced
%   \cmdcite{\guitarFirstLeft} and made \cmdcite{guitarFirstFlush} the default}
% \changes{1.2}{2001/08/21}{Right-alignment of broken lines. Added remarks
%   about catcode-changes in the documentation}
% \changes{1.1}{2001/08/19}{First release}
%
% \iffalse
%
% The following part is the code needed to compile the documentation.
% We do some trickery here, because we want that this file here could be used
% for *both*: Compiling the documentation *and* as `guitar.sty'
% (if really required).
% Everything between the lines %<*driver> and %</driver>
% goes to the file `guitar.tex'.
%
% \fi
\ifcat @a% If this test is positive, then `@' has letter catcode which means
%          that this file is loaded as a style file (or as described in the
%          install section of the documentation).
\def\TemporaryDummy{}
\else\long\def\TemporaryDummy{%
%
%
% \iffalse
%</metainfo>
%<*driver>
\documentclass{ltxdoc}
\usepackage{guitar}
\OnlyDescription%% Comment this out, or
%%\AlsoImplementation%% uncomment this line, if you want to see the source.

%% If you want an index, uncomment one of the following lines.
%% After running latex a first time, you have to use
%%      makeindex -s gind.ist guitar
%% Then run latex again.
%%\CodelineIndex% comment this out if you want an index referring to codelines
%%\PageIndex% comment this out if you want an index referring to pages
%%\OldMakeindex% uncomment this line, if your MakeIndex is pre-v2.9

\setlength\hfuzz{15pt}
\hbadness=7000
\begin{document}
\DocInput{guitar.dtx}
\end{document}
%</driver>
%<*metainfo>
% \fi
}
\fi\TemporaryDummy\let\TemporaryDummy\undefined
%
% \iffalse
%          Personal macros used for the doc utility:
% \fi
% \MakeShortVerb{"}
% \def\bracemeta#1{\texttt{\{}\meta{#1}\texttt{\}}}
% \def\cmdmeta{\textbackslash\meta}
% \def\nocomment{}
% \def\myspace{\texttt{\textvisiblespace}}
% \toolboxMakeSplit{/}{guitarSplitDist}

% \title{The \texttt{guitar} package\relax
%\thanks{This  file has version number \fileversion, last revised \filedate.}}
% \author{Martin V\"ath\relax
%\thanks{\texttt{vaeth@mathematik.uni-wuerzburg.de}}
%{}\thanks{The author thanks
% Donald Arseneau \texttt{<asnd@triumf.ca>},
% Dan Luecking \texttt{<luecking@uark.edu>},
% and a colleague who does not want to be named here.}}
% \date{\docdate}
% \maketitle

% \begin{abstract}
% This package allows you to typeset guitar chords over song texts.
% This package requires the \filecite{toolbox} package.
% To typeset graphical chords, you need an additional package like e.g.\
% \filecite{gchords.sty}, available from
% \texttt{http://www.damtp.cam.ac.uk/user/kp229/gchords/}
% \end{abstract}

% You may copy this package freely, as long as you distribute only unmodified
% and complete versions.\par
%
% This is not the only package available for typesetting guitar songs.
% The following packages are also available (and possibly also others:
% I do not claim that this list is complete).
% \begin{enumerate}
% \item \filecite{gchords.sty};
%       \texttt{http://www.damtp.cam.ac.uk/user/kp229/gchords/}
% \item \filecite{songbook.sty};
%       \texttt{http://www.rath.ca/Misc/Songbook/}\newline
%    (or on CTAN: \texttt{macros/latex/contrib/supported/songbook/})
% \item guitar\TeX\ (which is not a `pure' (La)\TeX solution):\newline
%       \texttt{http://rz-home.de/\~{ }jmiltz/guitartex/}
% \end{enumerate}
% The packages 1.\ and 2.\ have somewhat different intentions.
% It should be possible to combine them with the current package
% without any severe problems.

% \tableofcontents

%
% \section{Changes}
%
% \begin{description}
%    \def\mypar{\par}\ChangesTab
% \end{description}
%
%
% \section{Installation}
%
% This package should run with plain \TeX, \LaTeX 2.09, and \LaTeXe.
% Actually, it should actually run with all \TeX\ formats.

% To use \filecite{guitar}, you have to put the file \filecite{guitar.sty}
% in a path where \TeX\ looks for its input files. The \TeX\ documents using
% \filecite{guitar} need the following modifications in their header:
%
% \begin{itemize}
% \item If you use \LaTeXe, put in the preamble the command
%   \begin{verbatim}
%     \usepackage{guitar}\end{verbatim}
%
% \item If you use \LaTeX 2.09, use "guitar" as a style option, e.g.\
%   \begin{verbatim}
%     \documentstyle[guitar]{article}\end{verbatim}
%    or
%   \begin{verbatim}
%     \documentstyle[guitar,12pt]{article}\end{verbatim}
%
% \item If you use some other (non-\LaTeX) format, you will probably have to
%    insert a line like
% \begin{verbatim}
% \catcode`\@=11\input guitar.sty\catcode`\@=12\relax\end{verbatim}
%
% \end{itemize}
%
% For \TeX-insiders:
% The only \LaTeX-specific commands used in "guitar.sty" are:
%
% \begin{itemize}
% \item "\newenvironment"
% \item "\newcommand" (used only in the form "\newcommand{"\meta{command}"}{}"
%       to ensure that \meta{command} was not defined before)
% \item "\newsavebox"
% \item "\newlength"
% \item "\RequirePackage"
% \item "\ProvidesPackage"
% \item "\typeout"
% \end{itemize}
% The above commands are used only if they are defined
% (otherwise, the plain\TeX\ substitutes are used).
%
% \section{Example and Usage}
%
% The general usage is very simple:
% \DescribeMacro{\guitarChord}\begin{verbatim}
% \guitarChord{Bb}Really. \guitarChord{G#}Oh yes.\end{verbatim}
% produces the output
% \begin{quote}
% \guitarChord{Bb}Really. \guitarChord{G#}Oh yes.
% \end{quote}
% (in the chord, "b" and "#" always translate into $\flat$ resp. $\sharp$).
% When you switch into ``magic'' mode, you can even use "[...]" instead of
% "\guitarChord{...}".
% E.g., in \LaTeX, you can just write
% \DescribeEnv{guitar}\begin{verbatim}
%\begin{guitar}
%[Cm]This [Bb]is a [G#]very [Gm]simple song.
%You can still use any [\TeX]macros in the chord text.
%Actually, each accord reads a second argument over which it is [A]{centered}.
%By default, the linefeeds in the source lead to linebreaks %
%in the output, unless you put a percentage sign at the end of the line. %
%If a single line gets too long, the wrapped lines are right-aligned.
%To force the wrapping use \verb|\newline|\newline like here.
%To stretch the first line, use \verb|\linebreak|\linebreak like here.
%
%Two subsequent linefeeds in the source start a new verse.
%
%
%Three or more subsequent linefeeds in the source start a new verse with a %
%slightly larger space on top.
%\end{guitar}\end{verbatim}
% This will produce the output
% \begin{quote}
% \begin{guitar}
% [Cm]This [Bb]is a [G#]very [Gm]simple song.
% You can still use any [\TeX]macros in the chord text.
% Actually, each accord reads a second argument over which it is ^^A
% [A]{centered}.
% By default, the linefeeds in the source lead to linebreaks ^^A
% in the output, unless you put a percentage sign at the end of the line. ^^A
% If a single line gets too long, the wrapped lines are right-aligned.
% To force the wrapping use "\newline"\newline like here.
% To stretch the first line, use "\linebreak"\linebreak like here.
%
% Two subsequent linefeeds in the source start a new verse.
%
%
% Three or more subsequent linefeeds in the source start a new verse with a ^^A
% slightly larger space on top.
% \end{guitar}\end{quote}
% \noindent
% Unfortunately, if the chords get too long, they may overlap.
% For example, "[Ebm+7]O[G#]K" produces the unreadable output
% \begin{guitar}[Ebm+7]O[G#]K\end{guitar}.
% To avoid this, the following solutions are supported:
% \begin{enumerate}
% \item
% If the token after your chord is a space, like in ``"a[Ebm+7] space"'', this
% space is stretched: \begin{guitar}a[Ebm+7] space\end{guitar}.
% Note that this is different from the notation "a[Ebm+7]{ }space" which
% produces instead: \begin{guitarMagic}a[Ebm+7]{ }space\end{guitarMagic}.
% \item
% Inside words, you can put a "_" at the end like for "[Ebm+7_]O[G#]K".
% This stretches the word: \begin{guitarMagic}[Ebm+7_]O[G#]K\end{guitarMagic}.
% \item
% Outside words, you can put a "|" at the end like for
% "[Ebm+7|]{OK}[G#|].[C#m]"\textvisiblespace\,:
% \begin{guitarMagic}[Ebm+7/]{OK}[G#/].[C#m] \end{guitarMagic}
% \end{enumerate}
% If the chord is short enough (compared to its argument) then the symbols
% "|" and "_" do not harm: "[E|]{long}" and "[E_]{long}er" produce
% \begin{guitarMagic}[E/]{long} and [E_]{long}er\end{guitarMagic}.\bigskip\par
%
% You may (and in plain\TeX\ you must) replace "\begin{guitar}" and
% "\end{guitar}" by \DescribeMacro{\guitarOn}"\guitarOn" and
% \DescribeMacro{\guitarOff}"\guitarOff", respectively.
%
% If you only want to put the guitar chords as above but do not like the
% feature concerning the linefeeds, you can use the environment
% \begin{verbatim}
% \begin{guitarMagic}
% \end{guitarMagic}\end{verbatim}\DescribeEnv{guitarMagic}
% or the respective commands
% \DescribeMacro{\guitarMagicOn}"\guitarMagicOn" and
% \DescribeMacro{\guitarMagicOff}"\guitarMagicOff".
% Similarly, you can also use only the linefeed feature by the environment
% \begin{verbatim}
% \begin{guitarCr}
% \end{guitarCr}\end{verbatim}\DescribeEnv{guitarCr}
% or the respective commands \DescribeMacro{\guitarCrOn}"\guitarCrOn" and
% \DescribeMacro{\guitarCrOff}"\guitarCrOff".
%
% As a matter of fact, you can also e.g.\ use "\guitarCrOff" \emph{within} a
% "{guitar}" environment, but then you have to use "\guitarCrOn" before you
% end the environment to have a proper nesting of modes.
%
% \section{Customization}
%
% If you want that the first line in a broken phrase is always left-aligned
% (i.e.\ the spaces between words are not enlarged to fill the line), enter
% before your line the command
% \begin{quote}
% \DescribeMacro{\guitarFirstLeft}"\guitarFirstLeft"
% \end{quote}
% You can switch back into the default mode with
% \begin{quote}
% \DescribeMacro{\guitarFirstLeft}"\guitarFirstFlush"
% \end{quote}
% The output of the "#" and "b" tokens in the chords is generated by the two
% commands
% \begin{quote}
% \DescribeMacro{\guitarSharp}"\guitarSharp"\\
% \DescribeMacro{\guitarFlat}"\guitarFlat".
% \end{quote}
% Thus, for, example the customization
% \begin{verbatim}
% \def\guitarSharp{$^{\sharp}$}\end{verbatim}
% will make the chord "[F#]" look like {\footnotesize F$^{\sharp}$}
% (instead of the default {\footnotesize F$\sharp$}).\par
%
% In a similar way, the macros
% \begin{quote}
% \DescribeMacro{\guitarEndLine}"\guitarEndLine"\\
% \DescribeMacro{\guitarEndPar}"\guitarEndPar"\\
% \DescribeMacro{\guitarEndDoublePar}"\guitarEndDoubePar"
% \end{quote}
% are expanded when the song text contains one, two, or three (or more)
% linefeeds.\par
%
% After the macro
% \begin{quote}
% \DescribeMacro{\guitarNoChord}"\guitarNoChord"
% \end{quote}
% has been used, no chords are output anymore. You can make the effect
% local by putting this command in a group. ("\guitarNoChord" redefines the
% macros which are responsible for the actual output of the chords -- see the
% description at the end).\par
%
% The command
% \begin{quote}
% \DescribeMacro{\guitarPreAccord}"\guitarPreAccord"
% \end{quote}
% is expanded before the actual chord is typeset: You can change this
% definition to e.g.\ modify the font used for the chord. By default, this
% command contains a "\strut" which ensures that the lines with chords
% usually all have the same height.
% The macro "\guitarPreAccord" may also use and modify the macro
% \begin{quote}
% \DescribeMacro{\guitarAccord}"\guitarAccord"
% \end{quote}
% which contains the actual chord which is then output (you may use this
% feature to e.g.\ calculate a modulation in "\guitarPreAccord" or to
% replace the text of "\guitarAccord" by some graphic equivalent).
%
% It is guaranteed that the macros "\guitarPreAccord" and "\guitarAccord"
% are expanded precisely once.
% In contrast, it might happen that the argument of the chord (i.e.\ the
% text over which the chord is put) is expanded twice.
% (The doubled expansion could have been avoided, but the price were that
% in some cases the \TeX\ kerning mechanism would then fail if the argument
% is a syllable of some word which is continued afterwards).
% \par
%
% Whenever the ``guitar'' mode or the ``linefeed'' mode is turned
% on or off, the corresponding macro
% \begin{quote}
% \DescribeMacro{\guitarMagicOnHook}"\guitarMagicOnHook"\\
% \DescribeMacro{\guitarMagicOffHook}"\guitarMagicOffHook"\\
% \DescribeMacro{\guitarCrOnHook}"\guitarCrOnHook"\\
% \DescribeMacro{\guitarCrOffHook}"\guitarCrOffHook"
% \end{quote}
% is expanded (for switching on, the macro is expanded even before the
% necessary catcode changes are done, and for switching off, the macro
% is expanded after the catcodes have been restored).
% In the current defaults, a group is opened and closed in
% "\guitarCrOnHook" and "\guitarCrOffHook": This is the reason why these
% commands must be properly nested.
% (The reason for this group is that "\parindent" should be changed locally).
% \par
%
% In the current implementation, \TeX\ forgets everything following the magic
% tokens "|" and "_" in the chord (because these symbols are intended to be
% the last one in the chord). If you want to use these tokens within a chord:
% They loose their magic meaning if they occur in a braced context
% (i.e.\ between "{" and "}"). If you regularly have to use these tokens within
% chords, you can change the default choice of this tokens by the respective
% commands
% \begin{quote}
% \DescribeMacro{\guitarSplitDist}"\toolboxMakeSplit"\bracemeta{token}\relax
%"{guitarSplitDist}"\\
% \DescribeMacro{\guitarSplitMerge}"\toolboxMakeSplit"\bracemeta{token}\relax
%"{guitarSplitMerge}".
% \end{quote}
% (See the \filecite{toolbox} package for details of the command
% \DescribeMacro{\toolboxMakeSplit}"\toolboxMakeSplit" used here).
% It should be pointed out that \meta{token} may actually be a \emph{sequence}
% of tokens, so that for the `magic tokens' "|" and "_" you may instead use
% whole phrases if you prefer.
% \par
%
% Some fine tuning of the spacing can be done by redefining
% \begin{quote}
% \DescribeMacro{\guitarCalcDim}"\guitarCalcDim".
% \end{quote}
% When this macro is called, the skip register
% \begin{quote}
% \DescribeMacro{\guitarDim}"\guitarDim"
% \end{quote}
% contains the width of the chord which should be put over the text.
% After "\guitarCalcDim" has been expanded, it is ensured that at least
% "\guitarDim" (horizontal) space is reserved for the chord. Thus, if
% "\guitarCalcDim" increases e.g.\ "\guitarDim" by "2pt" (which is the
% default behavior of "\guitarCalcDim"), then "2pt" more space is reserved
% for the chord than its actual size: This ensures that two subsequent
% chords are always separated by some space.\par
%
% Finally, you can modify the macros which do the actual setting of the chords:
% This setting is done by the commands
% \begin{quote}
% \DescribeMacro{\guitarPut}"\guitarPut"\\
% \DescribeMacro{\guitarPutOnSpace}"\guitarPutOnSpace"\\
% \DescribeMacro{\guitarPutDist}"\guitarPutDist"\\
% \DescribeMacro{\guitarPutMerge}"\guitarPutMerge"
% \end{quote}
% which with the exception of "\guitarPutOnSpace" all expect one argument
% (namely the text on which they should be put). The command
% "\guitarPutOnSpace" is called, if a space followed the chord argument.
% Similarly, "\guitarPutDist" and "\guitarPutMerge" are called if the chord
% argument ended with the magic symbol "|" respectively "_".\par
% Before one of the above four macros is called, the chord text is stored in
% the macro "\guitarAccord" (and has not been expanded to this time); also the
% argument has not been expanded to this time. The above four macros are also
% responsible for the appropriate expansion (also of the expansion of the
% macros \DescribeMacro{\guitarCalcDim}"\guitarCalcDim" and
% \DescribeMacro{\guitarPreAccord}"\guitarPreAccord", if
% the latter should still keep their meaning).
% The above four macros may freely use the skip register
% \DescribeMacro{\guitarDim}"\guitarDim" and the box register
% \DescribeMacro{\guitarBox}"\guitarBox" (which are both not used or
% modified by the other macros of this package).
%
%
% \section{Possible Problems}
%
% The special treatment of "[" "#" "b" and \meta{linefeed} is realized by a
% changing of catcodes. This may cause essentially two sorts of problems:
% \begin{enumerate}
% \item
% In some cases, you will want to avoid the automatic replacement of "#"
% and "b". For example, in "[\textbf{F#}]" or in "\guitarChord{\textbf{F#}}"
% the "b" of "\textbf" gets replaced which is of course not what you want.
% To avoid this replacement, there is a "*"~version of the respective
% commands, i.e.\ the above example works in the intended way if you write
% instead "[*\textbf{F\guitarSharp}]" or
% "\guitarChord*{\textbf{F\guitarSharp}}"
% (you have to use the command "\guitarSharp", because due to the "*" also
% the "#" would not be replaced).
% \item
% There are some situations in which catcodes are set
% too early, e.g.\ if you use the macros within the argument of certain
% macros. In this case, these symbols keep their usual \TeX\ meaning
% (which may either lead to an error in case of "#" (and sometimes "[") or
% just to a false output). If this happens to you, you have to replace at
% the corresponding place the above one-symbol shortcuts by their longer
% macro equivalents. In other words: You might have to replace in
% certain special situations some occurrences of the symbols according to
% the following table:
% \bigskip\par
% \begin{tabular}[T]{l@{$\quad\to\quad$}l}
% "[...]"    &"\guitarChord{...}"\\
% "#"             &"\guitarSharp"\\
% "b"             &"\guitarFlat"\\
% linefeed        &"\guitarEndLine"\\
% $2$ linefeeds   &"\guitarEndPar"\\
% $3{+}$ linefeeds&"\guitarEndDoublePar"
% \end{tabular}
% \end{enumerate}
%
% \iffalse
%</metainfo>
% \fi
% \iffalse--------------------------------------------------------------\fi
% \StopEventually{\PrintChanges}
%                     \section{Implementation}
%
% \iffalse--------------------------------------------------------------
%
%
%<*package>
% \fi
%    \begin{macrocode}
%%
%% This file was generated by the docstrip utility from guitar.dtx.
%% You may distribute this file only together with the source guitar.dtx
%% (and if possible with guitar.ins) and only if these files are unmodified.
%%
%% Author:
%%
%% M. V\"ath      vaeth@mathematik.uni-wuerzburg.de
%%

\ifx\typeout\undefined
  \def\tbx@tmp{\immediate\write17}\expandafter\tbx@tmp
\else
  \expandafter\typeout
\fi{guitar.sty by M. Vaeth: Guitar chords over song texts 1.5}

\ifx\ProvidesPackage\undefined\else
  \ProvidesPackage{guitar}[2001/10/08 v1.5]
\fi
\ifx\RequirePackage\undefined
  \ifx\toolboxDef\undefined
    \input toolbox.sty
  \fi
\else
  \RequirePackage{toolbox}[2001/04/08]
\fi
\ifx\toolboxIfNextGobbling\undefined
  \errmessage{guitar.sty requires toolbox.sty version 2.0 or higher}
\fi

\ifx\newenvironment\undefined\else
  \newenvironment{guitar}{\guitarOn}{\guitarOff}
  \newenvironment{guitarMagic}{\guitarMagicOn}{\guitarMagicOff}
  \newenvironment{guitarCr}{\guitarCrOn}{\guitarCrOff}
\fi

\ifx\newcommand\undefined\else
  \newcommand{\guitarChord}{}

  \newcommand{\guitarOn}{}
  \newcommand{\guitarOff}{}
  \newcommand{\guitarMagicOn}{}
  \newcommand{\guitarMagicOff}{}
  \newcommand{\guitarCrOn}{}
  \newcommand{\guitarCrOff}{}

  \newcommand{\guitarSharp}{}
  \newcommand{\guitarFlat}{}
  \newcommand{\guitarMagicOnHook}{}
  \newcommand{\guitarMagicOffHook}{}
  \newcommand{\guitarCrOnHook}{}
  \newcommand{\guitarCrOffHook}{}
  \newcommand{\guitarEndLine}{}
  \newcommand{\guitarEndPar}{}
  \newcommand{\guitarEndDoublePar}{}
  \newcommand{\guitarCalcDim}{}
  \newcommand{\guitarPreAccord}{}

  \newcommand{\guitarPut}{}
  \newcommand{\guitarPutOnSpace}{}
  \newcommand{\guitarPutDist}{}
  \newcommand{\guitarPutMerge}{}

  \newcommand{\guitarNoChord}{}

  \newcommand{\guitarAccord}{}
  \newcommand{\guitarSplitDist}{}
  \newcommand{\guitarSplitMerge}{}
\fi

%    \end{macrocode}
% \begin{macro}{\guitarBox}\nocomment
%    \begin{macrocode}
\ifx\newsavebox\undefined
  \newbox\guitarBox
\else
  \newsavebox{\guitarBox}
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarBox}\nocomment
%    \begin{macrocode}
\ifx\newlength\undefined
  \newskip\guitarDim
\else
  \newlength{\guitarDim}
\fi

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarSharp}\nocomment
%    \begin{macrocode}
\def\guitarSharp{$\sharp$}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarFlat}\nocomment
%    \begin{macrocode}
\def\guitarFlat{$\flat$}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarCalcDim}\nocomment
%    \begin{macrocode}
\def\guitarCalcDim{\advance\guitarDim by 2pt}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarPreAccord}\nocomment
%    \begin{macrocode}
\def\guitarPreAccord{\footnotesize\strut}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarMagicOnHook}\nocomment
%    \begin{macrocode}
\let\guitarMagicOnHook\toolboxEmpty
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarMagicOffHook}\nocomment
%    \begin{macrocode}
\let\guitarMagicOffHook\toolboxEmpty
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarCrOnHook}\nocomment
%    \begin{macrocode}
\def\guitarCrOnHook{\begingroup\leftskip 0pt plus 1fill\relax
  \parindent 0pt\leavevmode\gtr@CrOnHook\nobreak\hskip-\leftskip\relax
  \finalhyphendemerits=0\everypar{\nobreak\hskip-\leftskip\relax}\sloppy\relax
  \linepenalty=50\relax\parskip0pt\relax}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarFirstLeft}\nocomment
%    \begin{macrocode}
\def\guitarFirstLeft{\def\gtr@CrOnHook
  {\rightskip 0pt plus 1fil\relax\parfillskip 0pt\relax}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarFirstFlush}\nocomment
%    \begin{macrocode}
\def\guitarFirstFlush{\let\gtr@CrOnHook\toolboxEmpty}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@CrOnHook}\nocomment
%    \begin{macrocode}
\guitarFirstFlush
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarCrOffHook}\nocomment
%    \begin{macrocode}
\let\guitarCrOffHook\endgroup
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarEndLine}\nocomment
%    \begin{macrocode}
\def\guitarEndLine{\par\leavevmode}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarEndPar}\nocomment
%    \begin{macrocode}
\def\guitarEndPar{\medskip\par\leavevmode}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarEndDoublePar}\nocomment
%    \begin{macrocode}
\def\guitarEndDoublePar{\bigskip\par\leavevmode}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarPut}\nocomment
%    \begin{macrocode}
\def\guitarPut#1{\setbox0\hbox{\strut#1}\leavevmode
  \raise\ht0\hbox to 0pt{\hbox to\wd0{\guitarPreAccord
    \hfill\guitarAccord\hfill\hss}\hss}#1}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarPutOnSpace}\nocomment
%    \begin{macrocode}
\def\guitarPutOnSpace{\leavevmode\raise\ht\strutbox
  \hbox{\guitarPreAccord\guitarAccord}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarPutDist}\nocomment
%    \begin{macrocode}
\def\guitarPutDist{\gtr@distMerge\hfil}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarPutMerge}\nocomment
%    \begin{macrocode}
\def\guitarPutMerge{\gtr@distMerge\hrulefill}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@distMerge}\nocomment
%    \begin{macrocode}
\def\gtr@distMerge#1#2{\setbox\guitarBox\hbox{\strut#2}%
  \setbox0\hbox{\guitarPreAccord\guitarAccord}\leavevmode
  \guitarDim=\wd0\relax\guitarCalcDim
  \ifdim\wd\guitarBox<\guitarDim% Accord is too large:
    \hbox to 0pt{\raise\ht\guitarBox\hbox{\copy0}\hss}%
    \hbox to\guitarDim{\box\guitarBox#1}%
    \let\guitarAccord\toolboxEmpty%now used as a temporary variable.
  \else
    \hbox to 0pt{\raise\ht\guitarBox
      \hbox to\wd\guitarBox{\hfil\box0\hfil}\hss}%
    \def\guitarAccord{#2}%
  \fi\guitarAccord}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarNoChord}\nocomment
%    \begin{macrocode}
\def\guitarNoChord{\def\guitarPut##1{##1}%
   \let\guitarPutDist\guitarPut
   \let\guitarPutMerge\guitarPut
   \let\guitarPutOnSpace\toolboxSpace}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarSplitDist}\nocomment
%    \begin{macrocode}
\toolboxMakeSplit{|}{guitarSplitDist}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarSplitMerge}\nocomment
%    \begin{macrocode}
\toolboxMakeSplit{_}{guitarSplitMerge}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarOn}\nocomment
%    \begin{macrocode}
\def\guitarOn{\guitarCrOn\guitarMagicOn}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarOff}\nocomment
%    \begin{macrocode}
\def\guitarOff{\guitarMagicOff\guitarCrOff}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarMagicOn}\nocomment
%    \begin{macrocode}
\def\guitarMagicOn{\guitarMagicOnHook\gtr@magicOn\gtr@ignorespaces}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarMagicOff}\nocomment
%    \begin{macrocode}
\def\guitarMagicOff{\gtr@magicOff\guitarMagicOffHook}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@crMagicCondOn}
% During the scanning of the chord and its argument, we switch off
% the magic meaning of "[" and of linefeeds. After the scanning, the codes are
% restored again with "\gtr@crMagicCondOn". Of course, we have to take care
% that we switch on the catcodes only if we `are' in the corresponding mode.
% We thus have to redefine the commands executed by "\gtr@crMagicCondOn" when
% we change the mode.
%    \begin{macrocode}
\def\gtr@crMagicCondOn{\gtr@magicCondOn\gtr@crCondOn}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@crMagicCondOff}
% "\gtr@crMagicCondOff" is the opposite of "\gtr@crMagicOn" and used to
% switch off the catcodes during the scanning of the chord and its argument.
%    \begin{macrocode}
\def\gtr@crMagicCondOff{\gtr@magicCondOff\gtr@crCondOff}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@magicOn}\nocomment
%    \begin{macrocode}
\def\gtr@magicOn{\gtr@magicOnCat
  \let\gtr@magicCondOff\gtr@magicOffCat
  \let\gtr@magicCondOn\gtr@magicOnCat}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@magicOn}\nocomment
%    \begin{macrocode}
\def\gtr@magicOff{\gtr@magicOffCat
  \let\gtr@magicCondOff\toolboxEmpty
  \let\gtr@magicCondOn\toolboxEmpty}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@magicOnCat}\nocomment
%    \begin{macrocode}
\def\gtr@magicOnCat{\catcode`\[=13\relax}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{[}\nocomment
%    \begin{macrocode}
\gtr@magicOnCat\def[{\gtr@chordTest\gtr@scanBrace}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@magicOffCat}\nocomment
%    \begin{macrocode}
\def\gtr@magicOffCat{\catcode`\[=12\relax}
\gtr@magicOff

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@scanBrace}\nocomment
%    \begin{macrocode}
\def\gtr@scanBrace#1]{\gtr@parse{#1}}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@scanBrace}\nocomment
%    \begin{macrocode}
\def\guitarChord{\gtr@chordTest\gtr@parse}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@chordTest}\nocomment
% "\gtr@chordTest"\bracemeta{arg} first disables the magic catcodes for "[".
% Unless the next token is a "*", it enables the magic catcodes for
% "#" and "b" (the "*" is gobbled). Then \meta{arg} is expanded.
% It should be noted that the scanning for "*" happens with catcodes
% for "#" and "b" enabled (this is necessary to parse properly, e.g.\ "[b]").
%    \begin{macrocode}
\def\gtr@chordTest#1{\gtr@crMagicCondOff\gtr@change
  \toolboxIfNextGobbling*{\gtr@normal#1}{#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@parse}\nocomment
% "\gtr@parse"\bracemeta{chrd} parses the chord \meta{chord} and possibly a
% following space (gobbling). Depending on what it finds, it expands the
% corresponding "\guitarPut..." command.
%    \begin{macrocode}
\def\gtr@parse#1{\gtr@normal
  \guitarSplitDist{#1}\guitarAccord\gtr@dist
  \expandafter
    \guitarSplitMerge\expandafter{\guitarAccord}\guitarAccord\gtr@merge
  \toolboxIfNextGobbling\toolboxSpaceToken
  {\gtr@crMagicCondOn\guitarPutOnSpace}\gtr@para}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@para}\nocomment
%    \begin{macrocode}
\def\gtr@para#1{\gtr@crMagicCondOn
  \ifx\gtr@dist\undefined
    \ifx\gtr@merge\undefined
      \let\gtr@tmp\guitarPut
    \else
      \let\gtr@tmp\guitarPutMerge
    \fi
  \else
    \let\gtr@tmp\guitarPutDist
  \fi\gtr@tmp{#1}}

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@change}\nocomment
%    \begin{macrocode}
\def\gtr@change{\catcode`\#=13\catcode`b=13\relax}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{#}\nocomment
%    \begin{macrocode}
\gtr@change\def#{\guitarSharp}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{b}\nocomment
%    \begin{macrocode}
\def b{\guitarFlat}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@normal}\nocomment
%    \begin{macrocode}
\def\gtr@normal{\catcode`\#=6\catcode`b=11\relax}
\gtr@normal

%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarCrOn}\nocomment
%    \begin{macrocode}
\def\guitarCrOn{\guitarCrOnHook\gtr@crOn\gtr@ignorespaces}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\guitarCrOff}\nocomment
%    \begin{macrocode}
\def\guitarCrOff{\gtr@crOff\guitarCrOffHook}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@crOn}\nocomment
%    \begin{macrocode}
\def\gtr@crOn{\gtr@crOnCat
  \let\gtr@crCondOff\gtr@crOffCat
  \let\gtr@crCondOn\gtr@crOnCat}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@crOn}\nocomment
%    \begin{macrocode}
\def\gtr@crOff{\gtr@crOffCat
  \let\gtr@crCondOff\toolboxEmpty
  \let\gtr@crCondOn\toolboxEmpty}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\gtr@crOnCat}\nocomment
%    \begin{macrocode}
\def\gtr@crOnCat{\catcode`\^^M=13\relax}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{linefeed}\nocomment
%    \begin{macrocode}
\gtr@crOnCat\def^^M{\toolboxIfNextGobbling^^M\gtr@par\guitarEndLine}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{gtr@par}\nocomment
%    \begin{macrocode}
\def\gtr@par{\toolboxIfNextGobbling^^M\gtr@dblpar\guitarEndPar}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{gtr@dblpar}\nocomment
%    \begin{macrocode}
\def\gtr@dblpar{\toolboxIfNextGobbling^^M\gtr@dblpar\guitarEndDoublePar}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{gtr@ignorespaces}\nocomment
%    \begin{macrocode}
\def\gtr@ignorespaces{\toolboxIfNextGobbling^^M\gtr@ignorespaces\ignorespaces}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{gtr@crOffCat}\nocomment
%    \begin{macrocode}
\def\gtr@crOffCat{\catcode`\^^M=5\relax}%
\gtr@crOff

%    \end{macrocode}
% \end{macro}
%
% \iffalse
%</package>
% \fi
% \Finale\PrintIndex
%
%
%
% \iffalse
%<*metainfo>
% \fi
\iffalse -------------------------------------------------------------
%
% Just in case that for some reason the file `guitar.ins' got lost:
% The content of this file is between the lines %<*insfile> and %</insfile>.
%
%\iffalse
%</metainfo>
%<*insfile>
\def\batchfile{guitar.ins}
\input docstrip.tex
\keepsilent
\nopreamble
\generateFile{guitar.sty}{f}{\from{guitar.dtx}{package}}
\generateFile{guitar.txt}{f}{\from{guitar.dtx}{asciidocu}}
\generateFile{guitar.tex}{f}{\from{guitar.dtx}{driver}}
%%\generateFile{guitar.ins.dup}{f}{\from{guitar.dtx}{insfile}}

\Msg{***************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the}
\Msg{* file 'guitar.sty' into a directory searched by TeX.}
\Msg{*}
\Msg{*}
\Msg{* Run the file guitar.tex through LaTeX to produce the}
\Msg{* documentation or read the ascii documentation in guitar.txt}
\Msg{*}
\Msg{*}
\Msg{***************************************************************}
\endbatchfile
%</insfile>
%<*metainfo>
% \fi
\fi
% \iffalse
%</metainfo>
% \fi
\endinput

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "guitar.tex"
%%% End: 
