On Sun, Jan 9, 2011 at 11:13 PM, Philipp A. <flying-sheep@web.de> wrote:
hi list,

skip to the many %%% if you just want to help me ;)

i need to make a macro which consists of ten optional arguments. it wouldn’t be too ugly to require to write the following to use it, since it outputs a 3×3 matrix with an adjacent tenth item, but tex can’t handle ten arguments afaik.


syntax idea:
empty:
\bigcrafting%
{}{}{}%
{}{}{}{}%
{}{}{}%

partly filled:
\bigcrafting%
{}{}{}%
{planks}{planks}{}{workbench}%
{planks}{planks}{}%

how it should look:
CraftingWorkbenchIO.png

ok, since using empty “required” arguments aren’t elegent, either, i wanted to get into key=value sets, but ran into the next problem:

i wanted to instead define bigcrafting to work like this:
\bigcrafting
  [21=planks, 22=planks,
   31=planks, 32=planks]
  [workbench]

but \getparameters can’t handle numerical values.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

As Hans wrote it's possible, but I like the to use "row" for row, "col" for column and "c" for cell 
i.e
\def\BigCrafting[#1]%
{\getparameters[Ph][c11={},c12={},c13={},
c21={},c22={},c23={},c24={},
c31={},c32={},c33={},#1]
\bTABLE
\bTR\bTD\getvalue{Phc11}\eTD\bTD\getvalue{Phc12}\eTD\bTD\getvalue{Phc13}\eTD\eTR
\bTR\bTD\getvalue{Phc21}\eTD\bTD\getvalue{Phc22}\eTD\bTD\getvalue{Phc23}\eTD\bTD\getvalue{Phc24}\eTD\eTR
\bTR\bTD\getvalue{Phc31}\eTD\bTD\getvalue{Phc32}\eTD\bTD\getvalue{Phc33}\eTD\eTR
\eTABLE
}
\starttext
\BigCrafting[c11=FOO,c33=GOO,c22=BOO,c24=Zoo]
\BigCrafting[c11=FOO,c24=GOO]
\stoptext

You can also use a better namespace
\def\BigCrafting[#1]%
\unprotect
\getparameters[flying-sheep@web.de:][c11={},c12={},c13={},
c21={},c22={},c23={},c24={},
c31={},c32={},c33={},#1]
\getvalue{flying-sheep@web.de:c11}%% 
\getvalue{flying-sheep@web.de:c12}%% and so on
\protect
}

--
luigi