I try to understand how work the macro named \separator
in MWE
.
\documentclass[]{article}
\def\separator#1\separator#2{%
\unexpanded{#1}%
\ifx*#2%
\else
, \expandafter\separator\expandafter#2%
\fi
}%
\def\stcs{\separator One\separator Two\separator three}
\tracingmacros 1
\begin{document}
\stcs\separator*
\end{document}
Trace of \separator
is following:
\stcs ->\separator One\separator Two\separator three
\separator #1\separator #2->\unexpanded {#1}\ifx *#2\else , \expandafter \separator \expandafter #2\fi
#1<-One
#2<-T
\separator #1\separator #2->\unexpanded {#1}\ifx *#2\else , \expandafter \separator \expandafter #2\fi
#1<-Two
#2<-t
\separator #1\separator #2->\unexpanded {#1}\ifx *#2\else , \expandafter \separator \expandafter #2\fi
#1<-three
#2<-*
What have I see.
At the first stage:
First: \separator
gets a #1
as 'One' -this is normal for me.
Second: \separator
gets a #2
only 'T' but not 'Two'. Why?
At the second stage:
First: \separator
gets a #1
as 'Two'. Why not 'T', as one can see from the first stage? And what had become of this 'T'? It lost?
\LaTeX
pdf output is normal "One, Two, three".
Thus, what is happen with #2
?