Which commands are there that one can use to define new commands in (La)TeX?

There are: \let, \def, \[re]newcommand[*], \DeclareRobustCommand[*], and ...?

(And I've seen things like \DeclareMathOperator.)

  • 1
    I think there is only \def which defines a new command. \let just assigns a new name. All the others are “only” wrappers around \def, of which there can be arbitrarily many.
    – bodo
    Feb 11, 2013 at 7:36
  • @canaaerus I suspected something like that. But which well-known (or not so well-known) wrappers are there? Feb 11, 2013 at 7:45
  • 1
    @LoverofStructure i think your question is rather vague. Just consider LaTeX2e's \newcounter. It sets up a new counter but also defines a command called \thecounter which prints the counter. So for a complete answer one would have to list a lot of macros.
    – bloodworks
    Feb 11, 2013 at 7:49
  • @bloodworks Thanks for your contribution; \thecounter without any space ... that's weird. If a comprehensive list is long, so be it :-) Feb 11, 2013 at 7:57
  • @LoverofStructure It would be useful to know if you are talking about primitives or higher-level wrappers, and also if you mean just macros or other cases (e.g. do \chardef or \toksdef count?).
    – Joseph Wright
    Feb 11, 2013 at 8:14

1 Answer 1


The LaTeX "official" interface provides





All these commands define one or more commands (some only for internal usage) and provide tests for avoiding clobbering of existing commands. There's also \newfont, but its usage is deprecated.

The kernel has many other command-defining macros:





Of these, only the first one is commonly used in LaTeX programming (it shouldn't be used indiscriminately as a replacement of \newcommand, though). The last is very useful in core LaTeX programming.

Some additional packages provide new functions:

\DeclareMathOperator      (amsmath)
\DeclarePairedDelimiter   (mathtools)

are commonly found, but there are scores of other command-defining functions in the hundreds of packages around.

Another commonly used utility for defining commands is the primitive \let, that "copies" the current meaning of a token into a control sequence, allowing for "redefining a macro in terms of itself". However, for the nonexpert (and also the expert) programmer, the


provided by the letltxmacro package by H. Oberdiek is a recommended replacement.

The etoolbox package provides another set


(look at the documentation for a description).

Eventually, all of these command-defining functions boil down to the primitive commands





but a description of these would require writing a chapter of a book; refer to the TeXbook or to TeX by Topic

  • 1
    as always very nice!
    – bloodworks
    Feb 11, 2013 at 10:18
  • And note that many of these have starred variants. Feb 19, 2013 at 10:00

You must log in to answer this question.

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