This is an example of the functionality of a macro, that should the following: iterate over a spaced string and print the first letter of each part.
\newcommand\text{\StrSubstitute{a b c}{ }{,}}
\foreach \i in \text{
\StrLeft{\i}{1} ,
}
But apparently, I cannot use \StrLeft
or any other when the iteration is over something I have done over a StrSubstitute. Why is that?
Error messages:
! Paragraph ended before \reserved@a was complete.<to be read again>\par }
! Paragraph ended before \reserved@a was complete.<to be read again>\par }
! Missing control sequence inserted.<inserted text>\inaccessible }
The following do work though:
\newcommand\text{\StrSubstitute{a b c}{ }{,}}
\foreach \i in \text{
\i
}
\newcommand\text{a,b,c}
\foreach \i in \text{
\StrLeft{\i}{1} ,
}
\text
is nota,b,c
, but the set of instructions necessary to producea,b,c
.