ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* define command
@ 2008-11-14 11:58 Alan STONE
  2008-11-14 12:05 ` Wolfgang Schuster
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alan STONE @ 2008-11-14 11:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 373 bytes --]

Hi,

For example

\define\somemacro[3]{...}

gets invoked with

\somemacro{#1}{#2}{#3}

How do you get rid of those repeating pesky curly brackets and
invoke a user defined macro with

\somemacro{#1,#2,#3}

instead ?  :O)

-- 
Best,
Alan

* TeX engine = LuaTeX
* ConTeXt  minimals ver: 2008.56.06 19:11 MKIV  fmt: 2008.11.10  int:
english/english
* Ubuntu 8.04 Hardy Heron

[-- Attachment #1.2: Type: text/html, Size: 481 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: define command
  2008-11-14 11:58 define command Alan STONE
@ 2008-11-14 12:05 ` Wolfgang Schuster
  2008-11-14 13:09 ` luigi scarso
  2008-11-14 16:15 ` Aditya Mahajan
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2008-11-14 12:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 14.11.2008 um 12:58 schrieb Alan STONE:

> Hi,
>
> For example
>
> \define\somemacro[3]{...}
>
> gets invoked with
>
> \somemacro{#1}{#2}{#3}
>
> How do you get rid of those repeating pesky curly brackets and
> invoke a user defined macro with
>
> \somemacro{#1,#2,#3}


\starttext

\def\somemacro#1%
   {\def\dosomemacro##1{(##1)}%
    \processcommalist[#1]\dosomemacro}

\somemacro{A,B,C}

\stoptext

http://wiki.contextgarden.net/System_Macros/Comma_Separated_Lists
http://wiki.contextgarden.net/Inside_ConTeXt

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: define command
  2008-11-14 11:58 define command Alan STONE
  2008-11-14 12:05 ` Wolfgang Schuster
@ 2008-11-14 13:09 ` luigi scarso
  2008-11-14 16:15 ` Aditya Mahajan
  2 siblings, 0 replies; 4+ messages in thread
From: luigi scarso @ 2008-11-14 13:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 616 bytes --]

On Fri, Nov 14, 2008 at 12:58 PM, Alan STONE
<software.list.1es9s@gmail.com>wrote:

> Hi,
>
> For example
>
> \define\somemacro[3]{...}
>
> gets invoked with
>
> \somemacro{#1}{#2}{#3}
>
> How do you get rid of those repeating pesky curly brackets and
> invoke a user defined macro with
>
> \somemacro{#1,#2,#3}
>


Not what you want, but I have found useful this

\def\SomeMacro[#1]{%
\getparameters[SOMEMACRO][#1]
%%
%%now you have \csname SOMEMACRO{}\endcsname
%%
%%
}

\SomeMacro[foo=2,boo=4,goo=\TeX, my name is =joe]

\SOMEMACROfoo
\SOMEMACROboo
\SOMEMACROgoo
\csname SOMEMACROmy name is\endcsname


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 985 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: define command
  2008-11-14 11:58 define command Alan STONE
  2008-11-14 12:05 ` Wolfgang Schuster
  2008-11-14 13:09 ` luigi scarso
@ 2008-11-14 16:15 ` Aditya Mahajan
  2 siblings, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2008-11-14 16:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 14 Nov 2008, Alan STONE wrote:

> Hi,
>
> For example
>
> \define\somemacro[3]{...}
>
> gets invoked with
>
> \somemacro{#1}{#2}{#3}
>
> How do you get rid of those repeating pesky curly brackets and
> invoke a user defined macro with
>
> \somemacro{#1,#2,#3}
>
> instead ?  :O)

Others have replied how to define this if you want arbitrary number of 
parameters. But if you want something similar to \somemacro#1#2#3 you can 
use (the is some extra book-keeing because you want {..} as delimiters. 
Which means you either change catcodes, or do this shuffling around of 
arguments)

\def\somemacro#1%
    {\dosomemaco[#1]}

\def\dosomemacro[#1,#2,#3]%
   {whatever you want the macro to be}

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-11-14 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14 11:58 define command Alan STONE
2008-11-14 12:05 ` Wolfgang Schuster
2008-11-14 13:09 ` luigi scarso
2008-11-14 16:15 ` Aditya Mahajan

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).