1

Are there any conventions concerning the naming of "dummy" commands that are used in a restricted scope for specific purposes?

For example, I am checking if slashes (/) are contained inside a string parameter passed on from a user input file. My first instinct was to assign a new command \slash with the result but it is obviously already defined.

I could go with the usual foo, bar, baz, etc. but, again, \bar already exists.

What are the bests practices for doing so and avoid overriding existing commands?

  • 2
    \FlorianTheEmperorHelperCommand will definitely be free to use. – Johannes_B Apr 5 '17 at 11:11
  • 1
    \makeatletter \newcommand\ifslashinside[3]{..} \newcommand\florian@checkslash@i[..]{..} \newcommand\florian@checkslash@ii[..]{..} \makeatother or something like that? The “user interface” should not have @ in its name, in this case since you are checking, you can put an “if” at the beginning the name to be more clear; after that, all the internals could use a prefix, or @ to separate parts of the name, or a mix or both. – Manuel Apr 5 '17 at 11:38
  • 1
    @Johannes_B Actually, I use \FlorianTheEmperorHelperCommand in my code! – Andrew Apr 5 '17 at 11:50
  • 3
    Please note that inside groups you could redefine macros without damage to outside – user31729 Apr 5 '17 at 11:50
  • 2
    It should be noted that you cannot include numbers in a command name unless you use \csname ... \endcsname. Also, \c@... is used for counters, \l@... is used for the TOC (e.g. \l@chapter), \ps@... is used for pagestyles, and there may be other such conventions. – John Kormylo Apr 5 '17 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.