Am 17.11.2010 um 20:10 schrieb Philipp Gesang:

> Hi Aditya,
> 
> you seem to be familiar with some of the features of the new
> namespace model that I was not able to infer from Wolfgang’s
> code. Could you please comment on what the keys ‘setup’, ‘type’,
> and ‘command’ in ‘\definenamespace’ accomplish?

I’m not Aditya but i hope you will also accept my explanation.

I will start with the first argument and the „type“ key, e.g.

   \definenamespace
     [fancybreak]
     [type=module]

will produce the namespace „@@@@fancybreak“ with the short form
(the name itself has the same length but for TeX it’s only a single
tokens instead of many with the @@@@... form) \????fancybreak.

The is currently only one argument with the name „module“ but
another one like „core“ or „base“ can appear in the future but
this will be then reserved for Hans to replace the \definesystemvariable
command from the core to produce a namespace in the form „@@xx“.

When you define a namespace you should use three or more letters
because two letter namespaces are reserved for Hans itself,
e.g. is already used by the database module.


The second key you need is „name“ because it’s argument is used
when all the „\setup...“ and „\define...“ commands are created.


The key „style“ creates the command „\doset<NAME>attributes“ which
takes two arguments where the first is to change the style (font)
in your new created command and the second for the color.

The setup

   \definenamespace
     [fancybreak]
     [type=module,
      name=fancybreak,
      style=yes]

creates the command \dosetfancybreakattributes which can be used like
\dosetfancybreakattributes\c!style\c!color and will take the „style“
and „color“ argument from the \setupfancybreak command.


The setup key creates the command „\setup<NAME>“ where you can control
whether the commands accepts a list of environment in the two argument
form or only a single environment, e.g. „setup=yes“ let you write

   \setupfancybreak[one][..,..=..,..]

and

   \setupfancybreak[..,..=..,..]

while „setup=list“ let you use

   \setupfancybreak[one,two][..,..=..,..]

and

   \setupfancybreak[..,..=..,..]


The key “command“ creates a bunch of macros, besides the „\define...“
commands to create new environment and commands with your code it creates
the following macros to access the values from your setup commands:

   - \<Name>parameter
   - \named<NAME>parameter
   - \detokenized<NAME>parameter

The command key has like the setup key the two values yes and list,
with „command=yes“ you can write

   \define<NAME>[one][..,..=..,..]

or (clone a setup like \definehead[mysection][section])

   \define<NAME>[two][one]

while „command=list“ allows

    \define<NAME>[one,two][..,..=..,..]

or

   \define<NAME>[two,three][one]


For parent it’s the best to give as argument always the same value
as you defined for the namespace, e.g. for the fancybreak module
one should write „parent=fancybreak“.

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