🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #1637

Re: Skipping sections of input

#1637
From: Ron Peierls
Date: Wed, 30 May 1990 18:44
45 lines
2187 bytes
In article <2544@media-lab.MEDIA.MIT.EDU> djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes:
>I'm looking for a way to block out large portions of input from a
>Latex document.  This is so I can prevent the printing out of selected
.......
>could just do something like
>    \begin {blockcomment}
>    blah...blah...blah
>    \end {blockcomment}
> Everything between the begin and end would be ignored.  Does anyone
.........
   There is a very simple way of skipping blocks of text which works 
very well, except when it fails, but let's start with it.

Included Text.......
\iffalse
 Text to be skipped .....
\fi
Text to be included....

This works since \iffalse skips all tokens until it reaches \fi, which is
what tou want. It even is smart enough to ignore most macro expansions
along the way. Unfortunately a few things cause problems: for example,if a
macro is used inside the skipped section which was defined as \outer\def..
then, since that is illegal within the skipped portion of a conditional, it
runs into trouble. Other \if..  \fi pairs in the skipped text can sometimes
cause problems also. The solution I have used, which seems to work so far
is:

\gdef\startskip{\catcode`\!=0 \catcode`\\=12 \iffalse}
\gdef\endskip{\catcode`\\=0 `catcode`\!=12}

and then to use 

Text to include......
\startskip
Text to skip.......
!fi \endskip

I have not found any way of eliminating the need for the explicit
sequence <escape token><character "f"><character "i"> to appear. 

AMSTeX has a \comment....\endcomment macro pair which is quite
complex and skips explicitly one line at a time, so is relatively
inefficient on large blocks. And there are other complicyted solutions in
other stles, but this needs no special style.
Technical Details
Message-ID: <1904@bnlux0.bnl.gov>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!samsung!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!wuarchive!udel!sbcs!bnlux0!peierls
References: <2544@media-lab.MEDIA.MIT.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!samsung!sdd.hp.com!zaphod.mps.ohio-state.edu!uwm.edu!wuarchive!udel!sbcs!bnlux0!peierls
From: peierls@bnlux0.bnl.gov (Ron Peierls)
Newsgroups: comp.text.tex
Subject: Re: Skipping sections of input
Message-ID: <1904@bnlux0.bnl.gov>
Date: 30 May 90 18:44:09 GMT
References: <2544@media-lab.MEDIA.MIT.EDU>
Organization: Brookhaven National Lab, Upton, NY
Lines: 45