# Macro to take {032911} and return 03 29 11

It's in the title -- I am looking for a macro to insert spaces. I would like to call \mycmd{032911} to get 03 29 11.

-

\def\mycmd#1{\dostartmycmd#1\dostopmycmd}

What is the role of \dostopmycmd here? In my (admittedly limited) testing I get the same results with and without it. Would you care to explain this more? –  cefstat Mar 29 '11 at 7:38
@cefstat: The end-marker makes TeX read everything up to it. If the user gives more than six digits all of them would be read as part of #6. Without the end-marker all further content would not be read, which doesn't matter in your case, but might cause wrong results in other cases, e.g. when you also want to change the font for the numbers. –  Martin Scharrer Mar 29 '11 at 12:31
+1. In this specific case, as long no access to the single digits is required, it could also be written as \def\dostartmycmd#1#2#3#4#5\dostopmycmd {#1#2\space #3#4\space #5}, which might be slightly more efficient. –  Martin Scharrer Mar 29 '11 at 12:31