[Tex/LaTex] How to define a command that takes more than 18 arguments

macros

This question is based on this answer.
It is a continuation of my previous qestion regarding list of values in latex.

According to first link there is a limitation on the number of arguments I have faced with.

I tried to use specified approach and it works well.

But what if I want to have more than 18 arguments?

Is it possible to use such approach recursively?

For example I want to define a function with 25 arguments. Is it possible to use next:

\newcommand\ParseOptMenuItemStoreA[9]{%
    \def\tempa{#1}%
    \def\tempb{#2}%
    \def\tempc{#3}%
    \def\tempd{#4}%
    \def\tempe{#5}%
    \def\tempf{#6}%
    \def\tempg{#7}%
    \def\temph{#8}%
    \def\tempi{#9}%
    \ParseOptMenuItemStoreB
}

\newcommand\ParseOptMenuItemStoreB[9]{%
    \def\tempj{#1}%
    \def\tempk{#2}%
    \def\templ{#3}%
    \def\tempm{#4}%
    \def\tempn{#5}%
    \def\tempo{#6}%
    \def\tempp{#7}%
    \def\tempq{#8}%
    \def\tempr{#9}%
    \ParseOptMenuItem
}

\newcommand\ParseOptMenuItem[7]{%
    % Access to arguments #1-#18 via \tempa-\tempr and to argument #19-#25 via #1-#7.
}

I tried to compile it but I got an error:

! Missing number, treated as zero.
<to be read again>
               \protect
l.40 }  

So what I do wrong?

UPDATE 19.08.2015:

I have used next construction to achieve my goals:

\newcommand{\ParseOptMenuItemList}[1]
{
\def\tmplist{#1}%
\@tempcnta=\z@
\@for\tmp:=\tmplist\do{\advance\@tempcnta\@ne
\expandafter\let\csname temp\@roman\@tempcnta\endcsname\tmp
}%
\makebox[\linewidth][r]{%
    \begin{tabular}{lc}
        Possible values: \ifthenelse{\equal{\tempi}{}}{}{& \tempi\\}
        \ifthenelse{\equal{\tempii}{}}{}{& \tempii\\}
        \ifthenelse{\equal{\tempiii}{}}{}{& \tempiii\\}
        \ifthenelse{\equal{\tempiv}{}}{}{& \tempiv\\}
        \ifthenelse{\equal{\tempv}{}}{}{& \tempv\\}
        \ifthenelse{\equal{\tempvi}{}}{}{& \tempvi\\}
        \ifthenelse{\equal{\tempvii}{}}{}{& \tempvii\\}
        \ifthenelse{\equal{\tempviii}{}}{}{& \tempviii\\}
        \ifthenelse{\equal{\tempix}{}}{}{& \tempix\\}
        \ifthenelse{\equal{\tempx}{}}{}{& \tempx\\}
        \ifthenelse{\equal{\tempxi}{}}{}{& \tempxi\\}
        \ifthenelse{\equal{\tempxii}{}}{}{& \tempxii\\}
        \ifthenelse{\equal{\tempxiii}{}}{}{& \tempxiii\\}
        \ifthenelse{\equal{\tempxiv}{}}{}{& \tempxiv\\}
        \ifthenelse{\equal{\tempxv}{}}{}{& \tempxv\\}
        \ifthenelse{\equal{\tempxvi}{}}{}{& \tempxvi\\}
        \ifthenelse{\equal{\tempxvii}{}}{}{& \tempxvii\\}
        \ifthenelse{\equal{\tempxviii}{}}{}{& \tempxviii\\}
      Default value: & \tempxix\\
    \end{tabular}
}
}

\ParseOptMenuItemList takes values as a comma separated list.

Best Answer

Using multiple {} makes for a very hard to use interface different from all other latex commands, latex has standard facilities for handling arguments as comma separated lists (\usepackage{array,bm,graphics} for example).

The following produces

argument 24 is: [x]

on the terminal confirming that argument 24 (at least:-) has been captured.

\makeatletter
\newcommand\foo[1]{%
\def\tmplist{#1}%
\@tempcnta=\z@
\@for\tmp:=\tmplist\do{\advance\@tempcnta\@ne
\expandafter\let\csname temp\@roman\@tempcnta\endcsname\tmp
}%
\typeout{argument 24 is: [\tempxxiv]}%
}


\makeatother


\foo{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}

\stop
Related Question