🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #1536

Re: Ignoring text in LaTeX

#1536
From: Tom Hofmann
Date: Thu, 12 Apr 1990 06:44
70 lines
3180 bytes
In article <7147@cps3xx.UUCP> smithda@cpsvax.cps.msu.edu (J. Daniel Smith) writes:
|Has anyone written a "comment" environment for LaTeX?  The text
|between "\begin{comment}" and "\end{comment}" would not be typeset by
|LaTeX. 

Some time ago, I wrote an environment which allows to "switch" the
included text on and off.  Here it is:

--------- cut here -----------------------------------------------------

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Technical Details
Message-ID: <1990Apr12.064451.1608@cgch.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!cernvax!chx400!cgch!wtho
References: <7147@cps3xx.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!cernvax!chx400!cgch!wtho
From: wtho@cgch.uucp (Tom Hofmann)
Newsgroups: comp.text.tex
Subject: Re: Ignoring text in LaTeX
Keywords: LaTeX, comments, styles
Message-ID: <1990Apr12.064451.1608@cgch.uucp>
Date: 12 Apr 90 06:44:51 GMT
References: <7147@cps3xx.UUCP>
Sender: news@cgch.uucp (USENET News Agent)
Reply-To: wtho@cgch.UUCP (Tom Hofmann)
Organization: CIBA-GEIGY AG, Basle, Switzerland
Lines: 70