引数と ifnum のカウンタ

引数と ifnum のカウンタ

なぜこれがifnum常に真なのでしょうか?\@tempcntbは 5 ですが、代わりに最後の引数を印刷するべきではないでしょうか\tmp? また、何がそうなのかわかりませんm@ne。これは確かにカウンターを 1 進めないからです (ネストされた 's の外側から内側に向​​かっています\tmp)

\documentclass{article}
\usepackage{color}

\makeatletter
\newcommand\metafunc[1]{{
\count@\z@
Number of arguments: \the\@tempcntb \par
\@tempcnta\z@\relax
\@tempcntb=\count@
\@for\tmp:=#1\do{\advance\count@\@ne}
\ifnum\@tempcnta=\@tempcntb
    \@for\tmp:=#1\do{%
    \advance\@tempcnta\@ne
    \textcolor[RGB]{\the\numexpr255*\@tempcnta/(\count@)\relax,
                 0,
                 \the\numexpr255-(255*\@tempcnta/(\count@))\relax}%
                {\tmp(}}\relax
    \@tempcnta\count@ 
    \@for\tmp:=#1\do{%
    \textcolor[RGB]{\the\numexpr255*\@tempcnta/(\count@)\relax,
                 0,
                 \the\numexpr255-(255*\@tempcnta/(\count@))\relax}%
                {)}\relax
    \advance\@tempcnta\m@ne
}
\else
\@for\tmp:=#1\do{\tmp}
\fi
}}
\makeatother


\begin{document}

\metafunc{Banana,Stool,Another banana,chair,peanut}

\end{document}

関連情報