Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

is there a \begin{ignore} environment ?

1,201 views
Skip to first unread message

Iain Donaldson

unread,
Nov 16, 1993, 1:13:18 PM11/16/93
to
Is there such a thing as a comment block in LaTeX which would prevent the enclosed material from being interpreted. I am thinking of something along the lines of
\begin{ignore}
STUFF to keep in the .tex file but which won't contribute to the .dvi file
\end{ignore}

It's a real turn-off to have to put a % comment mark at the front of every line of a block. It would be a big bonus if the comment block could test conditionals as well but maybe that's too much to ask for now. I don't want to have to learn TeX in order to do this so I would welcome suggestions that stay within LaTeX or which are potted TeX solutions.
---
Iain Donaldson
------------------------------------------------------------------------------
JANET: <i...@uk.ac.strath.cad> | TEL: (+44) 41-552-4400 x2374
INTERNET: <iad%cad.strath.ac.uk@nsfnet-relay>| FAX: (+44) 41-552-3148
BITNET: <iad%cad.strath.ac.uk@ukacrl | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CAD Centre, University of Strathclyde, James Weir Building, Glasgow, G1 1XJ, UK

Arto V. Viitanen

unread,
Nov 17, 1993, 3:33:03 AM11/17/93
to
>>>>> "Iain" == "Iain Donaldson" <i...@cad.strath.ac.uk> writes:

Iain> NNTP-Posting-Host: kelvin.cad.strath.ac.uk

Iain> Is there such a thing as a comment block in LaTeX which would prevent
Iain> the enclosed material from being interpreted. I am thinking of
Iain> something along the lines of
Iain> \begin{ignore}
Iain> STUFF to keep in the .tex
Iain> file but which won't contribute to the .dvi file
Iain> \end{ignore}

AMSLaTeX comes with a style verbatim, which has a comment environment, which
does exactly that. If you don't like the idea to switch from LaTeX to
AMSLaTeX, get AucTeX for Emacs. It has a command to put %'s around a
region, and to remove them when needed.

Robin Fairbairns

unread,
Nov 17, 1993, 5:28:24 AM11/17/93
to
In article <2cb57u$h...@loch2.cc.strath.ac.uk>, i...@cad.strath.ac.uk ("Iain Donaldson") writes:
|> Is there such a thing as a comment block in LaTeX which would
|> prevent the enclosed material from being interpreted. I am
|> thinking of something along the lines of
|>
|> \begin{ignore}
|> STUFF to keep in the .tex file but which won't contribute to the .dvi file
|> \end{ignore}

Get verbatim.sty from macros/latex/distribs/verbatim/ on a CTAN host;
this defines an environment \begin{comment} stuff \end{comment}

Aliter, from macros/latex/contrib/misc/, get comment.sty; this defines
a configurable mechanism, giving you both the above and the
wherewithal to define different sections that may or may not be
excluded.

|> It's a real turn-off to have to put a % comment mark at the front
|> of every line of a block.

Poor you. AUCTeX mode, within emacs, will do this to a region at the
touch of a key or two.

|> It would be a big bonus if the comment
|> block could test conditionals as well but maybe that's too much to

|> ask for now. [...]

If you mean, "conditionally exclude this bit", then comment.sty will
give you the solution. If you mean "recognise conditionals within
this bit", you're out of luck: all solutions (including commenting-
out) proceed by ignoring the entire commented text, including any
control sequence therein.
--
Robin (Campaign for Real Radio 3) Fairbairns r...@cl.cam.ac.uk
U of Cambridge Computer Lab, Pembroke St, Cambridge CB2 3QG, UK

Eyal Doron

unread,
Nov 17, 1993, 6:58:53 AM11/17/93
to
In article <2cb57u$h...@loch2.cc.strath.ac.uk> i...@cad.strath.ac.uk ("Iain Donaldson") writes:
>From: i...@cad.strath.ac.uk ("Iain Donaldson")
>Subject: is there a \begin{ignore} environment ?
>Date: 16 Nov 1993 18:13:18 GMT
>Keywords: LaTeX comments ignore

>Is there such a thing as a comment block in LaTeX which would prevent the
>enclosed material from being interpreted. I am thinking of something along
>the lines of
>\begin{ignore}
>STUFF to keep in the .tex file but which won't contribute to the .dvi file
>\end{ignore}

>It's a real turn-off to have to put a % comment mark at the front of every
>line of a block. It would be a big bonus if the comment block could test
>conditionals as well but maybe that's too much to ask for now. I don't want
>to have to learn TeX in order to do this so I would welcome suggestions that
>stay within LaTeX or which are potted TeX solutions.
>---
>Iain Donaldson

Indeed there is, and very good it is too. There is a style file "comment.sty"
which does exactly what you want, and more. You can find it on CTAN servers,
which for you means "ftp.tex.ac.uk". Just tell it

quote site index comment.sty

and it will find it for you.

Eyal Doron

zach@igd.fhg.de (G. Zachmann)

unread,
Dec 5, 1993, 12:16:53 PM12/5/93
to

Much simpler: get comment.sty from Victor Eijkhout
should be in all the CTANs.

--

Gabriel Zachmann
_
/-------------------------------- | ___ ---------------------------------\
| On ne voit bien qu'avec le coeur, |/_ \ |
| l'essentiel est invisible aux yeux | _ | email: za...@igd.fhg.de |
| ( Antoine de St.-Exupery ) | __ |/ |
\-------------------------------- \__ / ---------------------------------/
\

Gernot Salzer

unread,
Dec 7, 1993, 9:08:36 AM12/7/93
to
>In article <AV.93Nov...@ohdake.cs.uta.fi>, a...@ohdake.cs.uta.fi (Arto V. Viitanen) writes:
>> >>>>> "Iain" == "Iain Donaldson" <i...@cad.strath.ac.uk> writes:
>>
>> Iain> NNTP-Posting-Host: kelvin.cad.strath.ac.uk
>>
>> Iain> Is there such a thing as a comment block in LaTeX which would prevent
>> Iain> the enclosed material from being interpreted. I am thinking of
>> Iain> something along the lines of
>> Iain> \begin{ignore}
>> Iain> STUFF to keep in the .tex
>> Iain> file but which won't contribute to the .dvi file
>> Iain> \end{ignore}
>>
>> AMSLaTeX comes with a style verbatim, which has a comment environment, which
>> does exactly that. If you don't like the idea to switch from LaTeX to
>> AMSLaTeX, get AucTeX for Emacs. It has a command to put %'s around a
>> region, and to remove them when needed.
>
>Much simpler: get comment.sty from Victor Eijkhout
>should be in all the CTANs.

Another simple solution: Put the line
\newif\ifignore
into the preamble. Usage:

Text to go into the document
\ifignore %%%% Start of comment
Text to be ignored
\fi %%%% End of comment
Text to go into the document

Nice side-effect: By just putting the command \ignoretrue at the beginning of
your document, you can include all of the previously ignored comments into the
output. Of course, you can have different kinds of comments: just use different
words instead of 'ignore', i.e.:
\newif\iffoo
\newif\ifbar
%\footrue %%% Switch for 'foo'-version
%\bartrue %%% Switch for 'bar'-version
....
Text to go into all versions of the document.
\iffoo
Text for the 'foo'-version of the document.
\fi
Text to go into all versions of the document.
\ifbar
Text for the 'bar'-version of the document.
\fi
Text to go into all versions of the document.
This allows you to maintain different versions of the document without
duplicating shared text.

Gernot Salzer

0 new messages