Am 03.05.2012 um 17:18 schrieb Aditya Mahajan:

> On Thu, 3 May 2012, Wolfgang Schuster wrote:
> 
>> You assume \definelinenumbering has a second argument for the settings but 
>> this isn’t the case
> 
> D'oh.
> 
>> and you need \setuplinenumbering to set them.
> 
> I also needed to change \setvalue to \setevalue in the example, and add an 
> \expanded to get it to work.

In MkIV \setuevalue is better the \setevalue and \normalunexpanded is faster 
than \expanded.

The problem in your approach is that you can only set the style and color value 
with \definewhatever
where I think it’s better to use \setupwhatever.

\unprotect

\installnamespace                    {whatever}
\installcommandhandler \????whatever {whatever} \????whatever

\appendtoks
  \definelinenumbering[\currentwhatever]%
\to \everydefinewhatever

\appendtoks
  \setuevalue{\e!start\currentwhatever}{\whatever_start[\currentwhatever]}%
  \setuevalue{\e!stop\currentwhatever }{\whatever_stop                   }%
\to \everydefinewhatever

\appendtoks
  \normalexpanded{\setuplinenumbering
    [\currentwhatever]
    [\c!color=\whateverparameter\c!numbercolor,
     \c!style=\whateverparameter\c!numberstyle]}%
\to \everysetupwhatever

\unexpanded\def\whatever_start[#1]%
  {\begingroup
   \edef\currentwhatever{#1}%
   \startlinenumbering[\currentwhatever]}

\unexpanded\def\whatever_stop
  {\stoplinenumbering
   \endgroup}

\protect

\definewhatever[testing][numbercolor=red,numberstyle=bold]
\setupwhatever [testing][numbercolor=blue]

\starttext
\starttesting
\input knuth
\stoptesting
\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
___________________________________________________________________________________

Reply via email to