%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File "annotation.sty" (by Tom Hofmann, E-mail: wtho@cgch.UUCP)
% 1989-10-30
% 
% This File contains the definition of a LaTeX environment "annotation"
% which allows to alternatively print or suppress parts of the document.
%
%
% Usage:
%
%    - Declare "annotation" as documentstyle option or include this file
%      by "\input{annotation.sty}"
%    - Embed annotations in "\begin{annotation}" and "\end{annotation}"
%    - To print the document including the annotations write "\printnotes"
%      before the first annotation. Alternatively, write "\suppressnotes"
%      to print without annotations.
%    - The default setting is "\printnotes".
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% (1) Definition of the environment "annotation" when notes are
%     to be printed.

\def\printnotes{\def\annotation{}}	% "\endannotation" can be missing

% (2) Definition of the environment "annotation" when notes are not
%     to be printed.

%     Make '{' and '}' "other characters" and make '(' and ')'
%     "begingroup" and "endgroup" resp.  Thus make it possible
%     to have "\end{annotation}" as part of a macro definition.

\begingroup\makeatletter		% since the catcodes of '{' and '}'
\catcode`{=12\relax\catcode`}=12\relax	% will change, use \begingroup and
\catcode`(=1\relax \catcode`)=2\relax	% \endgroup instead.

\gdef\suppressnotes(%

%     Make '{' and '}' searchable when expanding the macro by giving them
%     the same catcode in the subsequent text as in the macro definition.

	  \gdef\annotation(\catcode`{=12\relax\catcode`}=12\relax\@NOTE)

%     Skip text between "\begin{annotaion}" and "\end{annotation}"
%     (inclusive), but return an "\end{annotation}" command to LaTeX for
%     the correct environment handling (see below).

	  \long\gdef\@NOTE##1\end{annotation}(\@ENDNOTE))


\endgroup				% End of the enchantment.

%     Generate an environment-end command conformable to LaTeX.

{\makeatletter\gdef\@ENDNOTE{\end{annotation}}}

\printnotes				% This is the default setting.

%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

