ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* counters identifying notes
@ 2013-06-21 17:40 Pablo Rodríguez
  2013-06-21 21:07 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Rodríguez @ 2013-06-21 17:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have the following code:

    \definenumber[lnt]
    \setupnote[linenote][paragraph=yes]

    \def\variant#1#2{%
    \startlinenote[0]{#1] #2}#1%
    \stoplinenote[0]}

    \starttext
    \startlinenumbering
    \variant{body text}{variant}
    \stoplinenumbering
    \stoptext

And I would like to make \variant operative, so I thought I could
replace 0 with a counter, redefining it so:

    \def\variant#1#2{%
    \startlinenote[\getnumber[lnt]]{#1] #2}#1%
    \stoplinenote[\getnumber[lnt]]%
    \incrementnumber[lnt]}

But it doesn't work.

How could I make that \variant handles a different reference for the
linenote each time is invoked?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: counters identifying notes
  2013-06-21 17:40 counters identifying notes Pablo Rodríguez
@ 2013-06-21 21:07 ` Wolfgang Schuster
  2013-06-22 11:25   ` Pablo Rodríguez
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2013-06-21 21:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 21.06.2013 um 19:40 schrieb Pablo Rodríguez <oinos@web.de>:

> Dear list,
> 
> I have the following code:
> 
>    \definenumber[lnt]
>    \setupnote[linenote][paragraph=yes]
> 
>    \def\variant#1#2{%
>    \startlinenote[0]{#1] #2}#1%
>    \stoplinenote[0]}
> 
>    \starttext
>    \startlinenumbering
>    \variant{body text}{variant}
>    \stoplinenumbering
>    \stoptext
> 
> And I would like to make \variant operative, so I thought I could
> replace 0 with a counter, redefining it so:
> 
>    \def\variant#1#2{%
>    \startlinenote[\getnumber[lnt]]{#1] #2}#1%
>    \stoplinenote[\getnumber[lnt]]%
>    \incrementnumber[lnt]}
> 
> But it doesn't work.
> 
> How could I make that \variant handles a different reference for the
> linenote each time is invoked?
> 
> Many thanks for your help,


1. Use came case for your own command names to avoid conflicts with core commands.

2. Don’t use simple numbers as reference names.

3. You can’t use nested brackets which causes problems with the parser for the arguments. What you have to do in this such a case is to hide the pair with braces, e.g. [{[…]}].

4. ConTeXt has another counter mechanism which doesn’t has this problem.

\newcounter\LineNote

\setupnote[linenote][paragraph=yes]

\define[2]\Variant
  {\increment\LineNote
   \startlinenote[LineNote:\LineNote]{#1 #2}
   #1%
   \stoplinenote[LineNote:\LineNote]}

\starttext

\startlinenumbering
\Variant{body text}{variant}
\stoplinenumbering

\inline[LineNote:1]

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: counters identifying notes
  2013-06-21 21:07 ` Wolfgang Schuster
@ 2013-06-22 11:25   ` Pablo Rodríguez
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Rodríguez @ 2013-06-22 11:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 21/06/13 23:07, Wolfgang Schuster wrote:
> Am 21.06.2013 um 19:40 schrieb Pablo Rodríguez <oinos@web.de>:
>> [..]
>> And I would like to make \variant operative, so I thought I could
>> replace 0 with a counter, redefining it so:
>>
>>    \def\variant#1#2{%
>>    \startlinenote[\getnumber[lnt]]{#1] #2}#1%
>>    \stoplinenote[\getnumber[lnt]]%
>>    \incrementnumber[lnt]}
> 
> 1. Use came case for your own command names to avoid conflicts with
> core commands.
> 
> 2. Don’t use simple numbers as reference names.
> 
> 3. You can’t use nested brackets which causes problems with the
> parser for the arguments. What you have to do in this such a case is
> to hide the pair with braces, e.g. [{[…]}].
> 
> 4. ConTeXt has another counter mechanism which doesn’t has this
> problem
> 
> \newcounter\LineNote

Many thanks for your advice, Wolfgang.


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2013-06-22 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-21 17:40 counters identifying notes Pablo Rodríguez
2013-06-21 21:07 ` Wolfgang Schuster
2013-06-22 11:25   ` Pablo Rodríguez

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