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
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.
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
>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
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 ) | __ |/ |
\-------------------------------- \__ / ---------------------------------/
\
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