On Wed, 17 Nov 2010, Wolfgang Schuster wrote:
I’m not Aditya but i hope you will also accept my explanation.
This is a much better explanation than I could have written. Just a few points:
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
In order to use these commads, you must set a value for \current<name>. For example, if you have \define<name>[one][width=10cm] In order to access the value of width of "one", you must do: \def\current<name>{one} \<name>parameter{width} (I do not remember the distinction between \<name>parameter, \named<name>paramter, and \detokenized<name>parameters).
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]
I did not know that cloning was possible. The \defineenumeration commands allows for \defineenumeration[new][old][..=..] This clones a selected options from old to new (using copyparamters) and then sets the values of the third arguments. Would it make sense to add support for \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“.
I thought that you have to write "parent=\????fancybreak". Aditya