blob: 7758cbbb26e9ea792d60986dc6f74804b9491d9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|