ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: multiple line comments
Date: Tue, 28 Mar 2006 18:13:56 +0200	[thread overview]
Message-ID: <442960C4.80505@wxs.nl> (raw)
In-Reply-To: <Pine.WNT.4.63.0603281003420.3288@nqvgln>

Aditya Mahajan wrote:
> <--- On Mar 28, Taco Hoekwater wrote --->
>
>   
>> andrea valle wrote:
>>     
>>> Dear all,
>>> It's a bit tiring to start many lines always  with %.
>>> Is it possibile to have multiple line comments like in C
>>>
>>> \*
>>> comments here
>>> *\
>>>       
>> \iffalse
>>  comments here
>> \fi
>>     
>
> Be careful with this. From the UK tex FAQ
>
> The simple \newcommand{\gobble}[1]{} and \iffalse ... \fi aren't 
> really satisfactory (as a general solution) for comments, since the 
> matter being skipped is nevertheless scanned by TeX, not always as you 
> would expect. The scanning imposes restrictions on what you're allowed 
> to skip; this may not be a problem in today's job, but could return to 
> bite you tomorrow. For an example of surprises that may come to bite 
> you, consider the following example (derived from real user 
> experience):
>
> \iffalse % ignoring this bit
> consider what happens if we
> use \verb|\iftrue| -- a surprise
> \fi
>
> The \iftrue is spotted by TeX as it scans, ignoring the \verb command; 
> so the \iffalse isn't terminated by the following \fi. Also, \gobble 
> is pretty inefficient at consuming anything non-trivial, since all the 
> matter to be skipped is copied to the argument stack before being 
> ignored.
>   
This one is pretty safe: 

\startbuffer[comment]
    bla
    \startbuffer
    bla \iftrue \startbuffer bla bla
    bla \stopbuffer bla bla
    \stopbuffer
    bla
    bla
\stopbuffer

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

  reply	other threads:[~2006-03-28 16:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-28 10:04 andrea valle
2006-03-28 10:24 ` Taco Hoekwater
2006-03-28 11:09   ` Hans Hagen
2006-03-28 11:47     ` andrea valle
2006-03-28 12:32       ` Hans Hagen
2006-03-28 13:03         ` andrea valle
2006-03-28 15:05   ` Aditya Mahajan
2006-03-28 16:13     ` Hans Hagen [this message]
2006-03-28 16:37       ` Hans Hagen
2006-03-29  7:16         ` r.ermers
2006-03-28 21:30     ` John R. Culleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=442960C4.80505@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).