[tex-live] Using counters in command name

Manuel Pégourié-Gonnard mpg at elzevir.fr
Wed Sep 10 23:24:46 CEST 2008

Gergő Balogh a écrit :
> I have the following problem: I wish to create a command
> (\addTask{taskname}), what create a command with a name what consist of two
> part.

Hmm, I doubt this is the appropriate list for that. You should rather
ask on the texhax mailing list of the comp.text.tex newsgroup.

> Of course, the counter called taskcounter have a value(0), but the command
> named \task0 has not created.

The point is, if you want to create command whose name contains non only
letters, you have to use \csname. But then you need to use \expandafter
to get the name formed before \newcommand starts. For example:

\expandafter\newcommand\csname task\arabic{taskcounter}\endcsname{%
% definition

Again, this is not the appropriate place for this so if you need further
explanation, please ask them in texhac or compt.text.tex.


More information about the tex-live mailing list