인수 카운터 및 ifnum

인수 카운터 및 ifnum

왜 이것이 ifnum항상 사실입니까? 5입니다. 대신 마지막 인수를 \@tempcntb인쇄하면 안 되나요 ? 또한 이것이 확실히 카운터를 1만큼 전진시키지 않기 때문에 \tmp무엇을 하는지 이해가 안 됩니다 (중첩된 's의 외부에서 내부로 이동합니다).m@ne\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}

관련 정보