ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* multiple line comments
@ 2006-03-28 10:04 andrea valle
  2006-03-28 10:24 ` Taco Hoekwater
  0 siblings, 1 reply; 11+ messages in thread
From: andrea valle @ 2006-03-28 10:04 UTC (permalink / raw)


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
*\

I wasn't able to find anything like it in manual.

In this case, what about a \startcomment \stopccoment syntax?

Or maybe is it possible to have a user defined command?
\comment{
comments here
}


Thanks

-a-

Andrea Valle
DAMS - Facoltà di Scienze della Formazione
Università degli Studi di Torino
http://www.semiotiche.it/andrea
andrea.valle@unito.it

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 10:04 multiple line comments andrea valle
@ 2006-03-28 10:24 ` Taco Hoekwater
  2006-03-28 11:09   ` Hans Hagen
  2006-03-28 15:05   ` Aditya Mahajan
  0 siblings, 2 replies; 11+ messages in thread
From: Taco Hoekwater @ 2006-03-28 10:24 UTC (permalink / raw)




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

Cheers, Taco

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 10:24 ` Taco Hoekwater
@ 2006-03-28 11:09   ` Hans Hagen
  2006-03-28 11:47     ` andrea valle
  2006-03-28 15:05   ` Aditya Mahajan
  1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2006-03-28 11:09 UTC (permalink / raw)


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
>   
or 

\startmode[my comment]

\stopmode 

Hans 

-----------------------------------------------------------------
                                          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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 11:09   ` Hans Hagen
@ 2006-03-28 11:47     ` andrea valle
  2006-03-28 12:32       ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: andrea valle @ 2006-03-28 11:47 UTC (permalink / raw)


Ah! I was pretty sure there was a way...Better, two.
(just to understand, in some way they're two hacks, aren't they?)

Thanks

-a-




On 28 Mar 2006, at 13:09, Hans Hagen wrote:

> 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
>>
> or
>
> \startmode[my comment]
>
> \stopmode
>
> Hans
>
> -----------------------------------------------------------------
>                                           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
> -----------------------------------------------------------------
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
Andrea Valle
DAMS - Facoltà di Scienze della Formazione
Università degli Studi di Torino
http://www.semiotiche.it/andrea
andrea.valle@unito.it

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 11:47     ` andrea valle
@ 2006-03-28 12:32       ` Hans Hagen
  2006-03-28 13:03         ` andrea valle
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2006-03-28 12:32 UTC (permalink / raw)


andrea valle wrote:
> Ah! I was pretty sure there was a way...Better, two.
> (just to understand, in some way they're two hacks, aren't they?)
>   
no, features 

there is also (slow): 

\starthiding 

\stophiding 

or 

\def\startmycomment{\gobbleuntil\stopmycomment} 

\startmycomment 
.... 
\stopmycomment 

(\startcomment is something different) 

Hans 

-----------------------------------------------------------------
                                          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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 12:32       ` Hans Hagen
@ 2006-03-28 13:03         ` andrea valle
  0 siblings, 0 replies; 11+ messages in thread
From: andrea valle @ 2006-03-28 13:03 UTC (permalink / raw)


> no, features

Thanks, they are so many...:-)

Best
-a-


Andrea Valle
DAMS - Facoltà di Scienze della Formazione
Università degli Studi di Torino
http://www.semiotiche.it/andrea
andrea.valle@unito.it

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 10:24 ` Taco Hoekwater
  2006-03-28 11:09   ` Hans Hagen
@ 2006-03-28 15:05   ` Aditya Mahajan
  2006-03-28 16:13     ` Hans Hagen
  2006-03-28 21:30     ` John R. Culleton
  1 sibling, 2 replies; 11+ messages in thread
From: Aditya Mahajan @ 2006-03-28 15:05 UTC (permalink / raw)


<--- 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.


Aditya

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 15:05   ` Aditya Mahajan
@ 2006-03-28 16:13     ` Hans Hagen
  2006-03-28 16:37       ` Hans Hagen
  2006-03-28 21:30     ` John R. Culleton
  1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2006-03-28 16:13 UTC (permalink / raw)


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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 16:13     ` Hans Hagen
@ 2006-03-28 16:37       ` Hans Hagen
  2006-03-29  7:16         ` r.ermers
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2006-03-28 16:37 UTC (permalink / raw)


Hans Hagen wrote:
> This one is pretty safe: 
>
> \startbuffer[comment]
>     bla
>     \startbuffer
>     bla \iftrue \startbuffer bla bla
>     bla \stopbuffer bla bla
>     \stopbuffer
>     bla
>     bla
> \stopbuffer
\starthiding
\stophiding

does not support nesting in the way buffers do (simply because it was 
not enabled); i added a few lines to the buffer handler, so that now we 
can say:

\definebuffer[mycomment][local=yes]

and have 

\startmycomment 
.... 
\stopmycomment

(this extension will be available in the next release) 

(btw, in a similar fashion verbatim supports some nesting, which was needed in order to be able to write manuals) 

Hans  


-----------------------------------------------------------------
                                          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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 15:05   ` Aditya Mahajan
  2006-03-28 16:13     ` Hans Hagen
@ 2006-03-28 21:30     ` John R. Culleton
  1 sibling, 0 replies; 11+ messages in thread
From: John R. Culleton @ 2006-03-28 21:30 UTC (permalink / raw)


On Tuesday 28 March 2006 10:05, 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

When faced with such problems I just comment out a group of lines
with one command in my Gvim editor. 

for example after entering five lines of comments I could use this
command:

:.,-4 s/^/%/

Try it, you might like it :)
-- 
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf

Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: multiple line comments
  2006-03-28 16:37       ` Hans Hagen
@ 2006-03-29  7:16         ` r.ermers
  0 siblings, 0 replies; 11+ messages in thread
From: r.ermers @ 2006-03-29  7:16 UTC (permalink / raw)


Hi all,

I do the following:

\def\com#1{\blank{\bf commentaar:} {\em #1} ---}
%\def\com#1{}

When I need the comments in my printed text, I put a % for the second 
line. Simple.

Kind regards,

Robert


Hans Hagen wrote:

>Hans Hagen wrote:
>  
>
>>This one is pretty safe: 
>>
>>\startbuffer[comment]
>>    bla
>>    \startbuffer
>>    bla \iftrue \startbuffer bla bla
>>    bla \stopbuffer bla bla
>>    \stopbuffer
>>    bla
>>    bla
>>\stopbuffer
>>    
>>
>\starthiding
>\stophiding
>
>does not support nesting in the way buffers do (simply because it was 
>not enabled); i added a few lines to the buffer handler, so that now we 
>can say:
>
>\definebuffer[mycomment][local=yes]
>
>and have 
>
>\startmycomment 
>.... 
>\stopmycomment
>
>(this extension will be available in the next release) 
>
>(btw, in a similar fashion verbatim supports some nesting, which was needed in order to be able to write manuals) 
>
>Hans  
>
>
>-----------------------------------------------------------------
>                                          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
>-----------------------------------------------------------------
>
>_______________________________________________
>ntg-context mailing list
>ntg-context@ntg.nl
>http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
>  
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-03-29  7:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-28 10:04 multiple line comments 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
2006-03-28 16:37       ` Hans Hagen
2006-03-29  7:16         ` r.ermers
2006-03-28 21:30     ` John R. Culleton

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).