🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #1551

Re: Ignoring text in LaTeX

#1551
From: J. Daniel Smith
Date: Wed, 11 Apr 1990 15:36
71 lines
3223 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. 
Well, I did some hacking on my own and came up with a set of macros to
do what I wanted.  I'm not sure about all the \catcode stuff, but my
intent was to make the argument as small as possible by turning most
of the characters into comment characters.  I tried this with the
entire latex.tex file between \begin{comment} and \end{comment} and it
worked ok (i.e. nothing was printed).  Without the \catcode stuff I
overflowed TeX's memory.  

   Dan
------
%
% J. Daniel Smith
% 7 April 1990
%
% comment.sty
%
% All text between \begin{comment} and \end{comment} is ignored by
% LaTeX.  Modified from the verbatim macros of LaTeX.
%
\typeout{Document Style option `comment' <7 Apr 90>.}
%
\catcode`@=11
%
\def\c@tend{\catcode`@=14\catcode``=14}
\def\c@mmentcat{
        \let\c@=\catcode
	\c@`!=14 \c@`"=14 \c@`\#=14
	\c@`\$=14 \c@`\&=14 \c@`'=14 \c@`(=14
	\c@`)=14 \c@`*=14 \c@`+=14 \c@`,=14 \c@`-=14
	\c@`.=14 \c@`/=14 \c@`0=14 \c@`1=14 \c@`2=14
	\c@`3=14 \c@`4=14 \c@`5=14 \c@`6=14 \c@`7=14
	\c@`8=14 \c@`9=14 \c@`:=14 \c@`;=14 \c@`<=14
	\c@`==14 \c@`>=14 \c@`?=14 \c@`@=14 \c@`A=14
	\c@`B=14 \c@`C=14 \c@`D=14 \c@`E=14 \c@`F=14
	\c@`G=14 \c@`H=14 \c@`I=14 \c@`J=14 \c@`K=14
	\c@`L=14 \c@`M=14 \c@`N=14 \c@`O=14 \c@`P=14
	\c@`Q=14 \c@`R=14 \c@`S=14 \c@`T=14 \c@`U=14
	\c@`V=14 \c@`W=14 \c@`X=14 \c@`Y=14 \c@`Z=14
	\c@`[=14 \c@`]=14 \c@`^=14 \c@`_=14
	\c@`a=14 \c@`f=14 \c@`g=14 \c@`h=14 \c@`i=14
	\c@`j=14 \c@`k=14 
	\c@`q=14 \c@`s=14
	\c@`u=14 \c@`v=14 \c@`w=14 \c@`x=14
	\c@`y=14 \c@`z=14 \c@`|=14
	\c@`~=14 \c@` =14\c@tend}
%
\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |long|gdef|@xcomment#1\end{comment}[|end[comment]]
|endgroup

\def\@comment{\let\do\@makeother \dospecials\c@mmentcat}

\newenvironment{comment}{\@comment\@xcomment}{}
%
\catcode`@=12
%
=========================================================================
J. Daniel Smith                      Internet: smithda@cpsvax.cps.msu.edu
Michigan State University              BITNET: smithdan@msuegr
East Lansing, Michigan                 Usenet: uunet!frith!smithda

All such expressions as sqrt(-1), sqrt(-2)... are neither nothing, nor
greater than nothing, nor less than nothing, which necessarily
constitutes them imaginary or impossible.
                         - L. Euler
=========================================================================
Technical Details
Message-ID: <7167@cps3xx.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!sequent!upba!cps3xx!cpsvax!smithda
References: <7147@cps3xx.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!sequent!upba!cps3xx!cpsvax!smithda
From: smithda@cpsvax.cps.msu.edu (J. Daniel Smith)
Newsgroups: comp.text.tex
Subject: Re: Ignoring text in LaTeX
Keywords: LaTeX, comments, styles
Message-ID: <7167@cps3xx.UUCP>
Date: 11 Apr 90 15:36:07 GMT
References: <7147@cps3xx.UUCP>
Sender: usenet@cps3xx.UUCP
Reply-To: smithda@cpsvax.UUCP (J. Daniel Smith)
Organization: Michigan State University, Computer Science Department
Lines: 71