Am 22.10.2013 um 10:34 schrieb Keith J. Schultz <[email protected]>:
> HI All,
>
> I remember seeing some seeing what I want to do but I can not find it.
>
> I would like to define a command that takes an optional key-valued list and
> 1 or 2 manditory ones.
>
> Something like
>
> \unexanded\def\MyCommand[#1]#2%
> {%
> \NassiGroupFrame[#1]{#2}%
> }%
\unexanded\def\MyCommand
{\dosingleempty\doMyCommand}
\def\doMyCommand[#1]#2%
{\NassiGroupFrame[#1]{#2}}
> or
>
> \unexanded\def\MyCommand[#1]#2%
> {%
> % extract keyvalue
> \NassiGroupFrame[\width=\extractedvalueone]{hbox to \extractvaletwo{#2}}%
> }%
\unexanded\def\MyCommand
{\dosingleempty\doMyCommand}
\def\doMyCommand[#1]#2%
{\begingroup
\getdummyparameters[valueone=6cm,valuetwo=5cm,#1]
\NassiGroupFrame[width=\dummyparameter{valueone}]{\hbox to
\dummyparameter{valuetwo}{#2}}%
\endgroup}
\MyCommand[valuetwo=4cm]{...}
> where \NassiGroupFrame is a Frame.
>
> To give you an idea why I need this see the MWE below.
> This is a relatively simple example, there will be more complicated frames and
> they will be nested.
>
> Maybe I am chasing windmills and there is a better way and I should use cld
> or lua for
> outputing the Frames so that I can have spacing between the command and avoid
> having
> to use "%" after the first opening "{".
> Or does someone know how it can be done. Is there a way to use ConTeXt to
> write the command
There are ways to ignore the spaces at the begin (\ignorespaces) and end
(\removeunwantedspaces)
of a group but you should rethink first your interface for your commands (why
no start/stop commands).
It can be also useful to draw the whole diagram with Metapost and use the TeX
commands only
to pass the content to Metapost.
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / 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
___________________________________________________________________________________