From: "Keith J. Schultz" <schultzk@uni-trier.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Need help defining command.
Date: Tue, 22 Oct 2013 14:50:47 +0200 [thread overview]
Message-ID: <42BD3192-4E5B-45D7-AD3A-74B1044CA841@uni-trier.de> (raw)
In-Reply-To: <549F71B5-2659-4E3E-8DC1-301D94771017@gmail.com>
Hi Wolfgang,
Am 22.10.2013 um 11:31 schrieb Wolfgang Schuster <schuster.wolfgang@gmail.com>:
>
> Am 22.10.2013 um 10:34 schrieb Keith J. Schultz <schultzk@uni-trier.de>:
>
>> 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).
I thought about that, but I do not know I could use start/-commands in this context!
regards
Keith
___________________________________________________________________________________
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
___________________________________________________________________________________
prev parent reply other threads:[~2013-10-22 12:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 8:34 Keith J. Schultz
2013-10-22 9:31 ` Wolfgang Schuster
2013-10-22 12:45 ` Keith J. Schultz
2013-10-22 12:50 ` Keith J. Schultz [this message]
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=42BD3192-4E5B-45D7-AD3A-74B1044CA841@uni-trier.de \
--to=schultzk@uni-trier.de \
--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).