In case you both don't wish to use
\edef (which would also totally expand the token list contained in the argument
#1 of the
\topic-macro) and don't wish to integrate the
\stepcounter-directives into the
\topics-macro, you can easily use a combination of
\exchange— the gist is:
\romannumeral is used for "gobbling" tokens that form a number and in return for them delivering character-tokens which form the representation of that number in lowercase roman numerals.
\romannumeral in any case triggers "gobbling" those tokens that form the number. But in case that number does form an integer which is not positive, silently, i.e., without error-message or the like, no tokens at all will be delivered in return.
Besides this when searching for more digits or the terminating space-token of a digit-sequence,
\romannumeral will trigger expansion of expandable tokens. With a digit-sequence, the terminating space-token will be removed silently.
Thus you can (ab?)use
\romannumeral for having (La)TeX doing a lot of expansion-work as long as it is ensured that in the end
\romannumeral will find a non-positive integral number.
In the example below
\romannumeral is used for triggering expansion of
\thetopic three times (because expansion needs to be triggered three times until you get the value of the topic-counter) before exchanging things and triggering expansion of the
In the example below each instance of
\romannumeral will in the end find the digit(-sequence) "0", which is formed by the character-token(-sequence)
0, trailed by a space-token (which terminates that digit-sequence(character-token-sequence) and thus will take these things for the non-positive number 0 and therefore will "gobble" both the character-token "0" which forms the digit(-sequence)/number "0" and the space-token while silently in return for them not delivering any token at all.
\topics\hangindent=0.5cm Topic \#%
Nonetheless the solution provided by Raoul Kessels, where
\stepcounter-directives get integrated into the
\topics-macro is preferable because when you do it in Raoul Kessel's way you can instead also use
\refstepcounter-directives and place referencing-
\labels into the argument of the
\topic-macro for referencing single topics by means of the