Don’t use short cut macros

Today I took over a client’s project containing lots of definitions like

etc. Don’t do this! It’s absolutely awful to maintain and in some month when you get back on your document you’ll probably have forgotten what all those shortcuts mean. On a first sight they save some time while typing but that is actually a task for autocompletion and a proper editor. Furthermore things probably get complicated if you redefine (\renewcommand) macros that are already defined without knowing what you do and which other packages rely on the original definition …

It gets even worse if you share your documents with someone else and force them to learn you abbreviations, while e.g. \beta is perfectly clear for everyone. Not to think about a case where two authors use different definitions/abbreviations like

Thus: Don’t use shortcuts instead of the original macros and use “speaking” (meaningful) names for your macros.

Post updated according to Clemens’ and Moss’ comments.

10 thoughts

  1. Any discussion about good editors with good autocompletion (with good something \morei and good something \moreii and \so \on)?

    1. You’re right … in the original file the author used \renewcommand. Probably without knowing what \c was supposed to do and that it could be a problem to change its meaning …

  2. It get’s even worse

    Ouch! No apostrophe in “gets”, please.

    For your example code, “\newcommand{\c}{…}” will raise an error anyway, because “\c” is predefined in plain TeX and LaTeX.

    1. “\newcommand{\c}{…}” will raise an error anyway, because “\c” is predefined in plain TeX

      But in the case of plain TeX the cause of the error will be that \newcommand is not defined :p

  3. A good solution for the kind of user you’re describing, is to define a macro:
    \newcommand{\MathCharacterGreekBeta}{\beta}

    and then to enable your lazy typing habits with:

    \let\b\MathCharacterGreekBeta

    1. and then to enable your lazy typing habits with:
      \let\b\MathCharacterGreekBeta

      This is bad advice: \b is (\c, \d, \k) an existing accent command. Redefining those kind of commands can give rather unexpected errors. Run this with pdflatex for example:

Leave a Reply

Your email address will not be published.