There are some related questions:
Iterate over space-separated list
How to repeat over all characters in a string?
But every post I found asked for something specific and it was really hard to understand which is the part actually needed for applying a certain operation on all characters/words. Let's say we have a \newcommand\command1[1]{do something}
and we want to apply this on every character and \newcommand\command2[1]{do something}
which we want to apply on every word. How would we go about it?
Best Answer
Use
expl3
: both commands have a second argument that's a template for what to do with the characters or the words.In the last case, we need
##1
for the nested call.