I want to let the users of a package define the name of command into which some unique content will be stuffed, so that they can then recall that content using the command name that they prefer. Is it a better practice to make them provide me a string, from which I create the command and stuff the content (as in \tokify in my MWE) or is it preferable to let them tell me the actual (as yet undefined) command name and merely have me stuff the content (as in \populate in my MWE)?

The MWE is simple enough that you might say "just let them create the \def", but for the actual application, it will save them more keystrokes to let me create the content of the command.

  \expandafter\def\csname#1\endcsname{Content: #1}%
  \expandafter\def\csname\thestring\endcsname{Content: \thestring}%




enter image description here

1 Answer 1


I would use whichever you think more natural but use the same form for declaration and use.

So LaTeX counters use a name form


but LaTeX lengths use a command form:


There isn't really any logical reason why these are different but at least they are individually consistent.

Similarly of course commands which use the command form


and environments which use a name


So I would not have




is OK.

But in that case I would not use \csname#1\endcsname use \csname my-#1\endcsname or some such to avoid accidentally clashing with stuff (cf counters which use c@...)

  • I infer an emphatic "use the same form for declaration and use." I'm offline for a few days but I'll check back Monday to see if other considerations arise, and make an upvote next week. Cheers. Commented Apr 19, 2013 at 15:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .