ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: \definenamespace (was: The visual counter module)
Date: Wed, 17 Nov 2010 22:53:20 +0100	[thread overview]
Message-ID: <8B256D52-298A-462A-9BDD-BBC4A5BF3B67@gmail.com> (raw)
In-Reply-To: <20101117191032.GD20635@aides>


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	other threads:[~2010-11-17 21:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 23:16 The visual counter module Aditya Mahajan
2010-11-15  9:37 ` Hans Hagen
2010-11-16 19:01 ` Mathieu Boespflug
2010-11-17 19:10 ` Philipp Gesang
2010-11-17 21:53   ` Wolfgang Schuster [this message]
2010-11-18  0:36     ` \definenamespace (was: The visual counter module) Philipp Gesang
2010-11-18  3:56       ` Wolfgang Schuster
2010-11-18  9:02         ` Philipp Gesang
2010-11-18 21:20     ` Aditya Mahajan
2010-11-18 22:12       ` Wolfgang Schuster
2010-11-19  1:05         ` Aditya Mahajan
2010-11-19 17:35           ` \definenamespace Wolfgang Schuster
2010-11-19 17:56             ` \definenamespace Hans Hagen
2010-11-19 18:05               ` \definenamespace Aditya Mahajan
2010-11-19 18:45                 ` \definenamespace Hans Hagen
2010-11-19 18:48               ` \definenamespace Wolfgang Schuster
2010-11-19 20:12                 ` \definenamespace Vianney le Clément
2010-11-19 20:31                   ` \definenamespace Hans Hagen
2010-11-19 17:11 ` The visual counter module Willi Egger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8B256D52-298A-462A-9BDD-BBC4A5BF3B67@gmail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).