ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Macro argument handling problem!
@ 2011-04-21 10:28 Verhaag, G.C.H.M.
  2011-04-21 11:32 ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Verhaag, G.C.H.M. @ 2011-04-21 10:28 UTC (permalink / raw)
  To: ntg-context

Hi,

I try this example from the wiki page System Macros/Argument handling:

\def\dodefinesomething[#1][#2]%
   {\getparameters[\??xx#1][#2]}

\def\definesomething%
   {\dodoubleargumentwithset\dodefinesomething}

\starttext
  \definesomething[alfa][variable=test]
\stoptext


Running this yields

! Undefined control sequence

I'm trying to write a few macros with optional delimited arguments with 
key-value sets and started reading the appropriate pages, but can't 
figure out why this example fails to run.

Anybody any idea?

Regards,
Gerard Verhaag
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Macro argument handling problem!
  2011-04-21 10:28 Macro argument handling problem! Verhaag, G.C.H.M.
@ 2011-04-21 11:32 ` Wolfgang Schuster
  2011-04-21 11:35   ` luigi scarso
  2011-04-23  9:19   ` Verhaag, G.C.H.M.
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfgang Schuster @ 2011-04-21 11:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1440 bytes --]


Am 21.04.2011 um 12:28 schrieb Verhaag, G.C.H.M.:

> Hi,
> 
> I try this example from the wiki page System Macros/Argument handling:
> 
> \def\dodefinesomething[#1][#2]%
>  {\getparameters[\??xx#1][#2]}
> 
> \def\definesomething%
>  {\dodoubleargumentwithset\dodefinesomething}
> 
> \starttext
> \definesomething[alfa][variable=test]
> \stoptext
> 
> 
> Running this yields
> 
> ! Undefined control sequence
> 
> I'm trying to write a few macros with optional delimited arguments with key-value sets and started reading the appropriate pages, but can't figure out why this example fails to run.
> 
> Anybody any idea?

I guess the message comes from your namespace which is in this form
only allowed in unprotected mode, to enter you need \unprotect before
and \protect after your command declarations. Another problem is that
you use a system namespace (two “?” and two letters) but for modules
we use now four “?” and also more than two letter, e.g.

\def\????something{@@@@something}

\def\definesomething
  {\dodoubleargumentwithset\dodefinesomething}

\def\dodefinesomething[#1][#2]%
  {\getparameters[\????something#1][#2]}

You should also take a look at the \definenamespace command which
creates the \define… and \setup… commands for you:

- http://wiki.contextgarden.net/Module_Namespaces
- http://tex.stackexchange.com/questions/15157/how-to-make-a-ruler/15185#15185

Wolfgang



[-- Attachment #1.2: Type: text/html, Size: 2119 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Macro argument handling problem!
  2011-04-21 11:32 ` Wolfgang Schuster
@ 2011-04-21 11:35   ` luigi scarso
  2011-04-21 11:41     ` Wolfgang Schuster
  2011-04-23  9:19   ` Verhaag, G.C.H.M.
  1 sibling, 1 reply; 5+ messages in thread
From: luigi scarso @ 2011-04-21 11:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Apr 21, 2011 at 1:32 PM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 21.04.2011 um 12:28 schrieb Verhaag, G.C.H.M.:
>
> Hi,
>
> I try this example from the wiki page System Macros/Argument handling:
>
> \def\dodefinesomething[#1][#2]%
>  {\getparameters[\??xx#1][#2]}
>
> \def\definesomething%
>  {\dodoubleargumentwithset\dodefinesomething}
>
> \starttext
> \definesomething[alfa][variable=test]
> \stoptext
>
>
> Running this yields
>
> ! Undefined control sequence
>
> I'm trying to write a few macros with optional delimited arguments with
> key-value sets and started reading the appropriate pages, but can't figure
> out why this example fails to run.
>
> Anybody any idea?
>
> I guess the message comes from your namespace which is in this form
> only allowed in unprotected mode, to enter you need \unprotect before
> and \protect after your command declarations



! Undefined control sequence.

system          > tex > error on line 8 in file test.tex: Undefined
control sequence ...

 1     \unprotect
 2     \def\definesomething%
 3      {\dodoubleargumentwithset\dodefinesomething}
 4     \def\dodefinesomething[#1][#2]%
 5      {\getparameters[\??xx#1][#2]}
 6     \protect
 7     \starttext
 8 >>   \definesomething[alfa][variable=test]
 9     \stoptext
10
11
12

<argument> \??xx
                 alfa
\setsomevalue #1#2->\@EA \def \csname #1
                                        #2\endcsname
\p!doassign ...EAEA \setsomevalue \fi \fi {#1}{#2}
                                                  {#3}
\xprocesscommaitem ...@relax@ #1==\empty \@relax@
                                                  \@EAEAEA \xprocesscommaite...
\xdogetparameters #1]->\xprocesscommaitem #1,]
                                              ,\@relax@
\next1 #1,->\@@dodowithsetcommand {#1}
                                      \doprocesscommaitem
...
l.8  \definesomething[alfa][variable=test]


-- 
luigi
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Macro argument handling problem!
  2011-04-21 11:35   ` luigi scarso
@ 2011-04-21 11:41     ` Wolfgang Schuster
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Schuster @ 2011-04-21 11:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 21.04.2011 um 13:35 schrieb luigi scarso:

> On Thu, Apr 21, 2011 at 1:32 PM, Wolfgang Schuster
> <schuster.wolfgang@googlemail.com> wrote:
>> 
>> Am 21.04.2011 um 12:28 schrieb Verhaag, G.C.H.M.:
>> 
>> Hi,
>> 
>> I try this example from the wiki page System Macros/Argument handling:
>> 
>> \def\dodefinesomething[#1][#2]%
>>  {\getparameters[\??xx#1][#2]}
>> 
>> \def\definesomething%
>>  {\dodoubleargumentwithset\dodefinesomething}
>> 
>> \starttext
>> \definesomething[alfa][variable=test]
>> \stoptext
>> 
>> 
>> Running this yields
>> 
>> ! Undefined control sequence
>> 
>> I'm trying to write a few macros with optional delimited arguments with
>> key-value sets and started reading the appropriate pages, but can't figure
>> out why this example fails to run.
>> 
>> Anybody any idea?
>> 
>> I guess the message comes from your namespace which is in this form
>> only allowed in unprotected mode, to enter you need \unprotect before
>> and \protect after your command declarations
> 
> 
> 
> ! Undefined control sequence.
> 
> system          > tex > error on line 8 in file test.tex: Undefined
> control sequence ...
> 
> 1     \unprotect
> 2     \def\definesomething%
> 3      {\dodoubleargumentwithset\dodefinesomething}
> 4     \def\dodefinesomething[#1][#2]%
> 5      {\getparameters[\??xx#1][#2]}
> 6     \protect
> 7     \starttext
> 8 >>   \definesomething[alfa][variable=test]
> 9     \stoptext
> 10
> 11
> 12
> 
> <argument> \??xx
>                 alfa
> \setsomevalue #1#2->\@EA \def \csname #1
>                                        #2\endcsname
> \p!doassign ...EAEA \setsomevalue \fi \fi {#1}{#2}
>                                                  {#3}
> \xprocesscommaitem ...@relax@ #1==\empty \@relax@
>                                                  \@EAEAEA \xprocesscommaite...
> \xdogetparameters #1]->\xprocesscommaitem #1,]
>                                              ,\@relax@
> \next1 #1,->\@@dodowithsetcommand {#1}
>                                      \doprocesscommaitem
> ...
> l.8  \definesomething[alfa][variable=test]

\definenamespace
  [something]
  [   type=module,
      name=something,
   command=yes]

\starttext
\definesomething[alfa][variable=test]
\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] 5+ messages in thread

* Re: Macro argument handling problem!
  2011-04-21 11:32 ` Wolfgang Schuster
  2011-04-21 11:35   ` luigi scarso
@ 2011-04-23  9:19   ` Verhaag, G.C.H.M.
  1 sibling, 0 replies; 5+ messages in thread
From: Verhaag, G.C.H.M. @ 2011-04-23  9:19 UTC (permalink / raw)
  To: ntg-context

On 04/21/2011 01:32 PM, Wolfgang Schuster wrote:
>
> Am 21.04.2011 um 12:28 schrieb Verhaag, G.C.H.M.:
>
>> Hi,
>>
>> I try this example from the wiki page System Macros/Argument handling:
>>
>> \def\dodefinesomething[#1][#2]%
>>  {\getparameters[\??xx#1][#2]}
>>
>> \def\definesomething%
>>  {\dodoubleargumentwithset\dodefinesomething}
>>
>> \starttext
>> \definesomething[alfa][variable=test]
>> \stoptext
>>
>>
>> Running this yields
>>
>> ! Undefined control sequence
>>
>> I'm trying to write a few macros with optional delimited arguments 
>> with key-value sets and started reading the appropriate pages, but 
>> can't figure out why this example fails to run.
>>
>> Anybody any idea?
>
> I guess the message comes from your namespace which is in this form
> only allowed in unprotected mode, to enter you need \unprotect before
> and \protect after your command declarations. Another problem is that
> you use a system namespace (two “?” and two letters) but for modules
> we use now four “?” and also more than two letter, e.g.
>
> \def\????something{@@@@something}
>
> \def\definesomething
>   {\dodoubleargumentwithset\dodefinesomething}
>
> \def\dodefinesomething[#1][#2]%
>   {\getparameters[\????something#1][#2]}
>
> You should also take a look at the \definenamespace command which
> creates the \define… and \setup… commands for you:
>
> - http://wiki.contextgarden.net/Module_Namespaces
> - 
> http://tex.stackexchange.com/questions/15157/how-to-make-a-ruler/15185#15185
>
> Wolfgang
>
>
Hi,

Thanks for the tips and the references to the appropriate wiki pages!

Regards,
Gerard Verhaag
___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2011-04-23  9:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-21 10:28 Macro argument handling problem! Verhaag, G.C.H.M.
2011-04-21 11:32 ` Wolfgang Schuster
2011-04-21 11:35   ` luigi scarso
2011-04-21 11:41     ` Wolfgang Schuster
2011-04-23  9:19   ` Verhaag, G.C.H.M.

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