LaTeX中\newcommand, \renewcommand, \providecommand的用法

LaTeX中\newcommand, \renewcommand, \providecommand的用法

\newcommand defines a new command, and makes an error if it is already defined.

\renewcommand redefines a predefined command, and makes an error if it is not yet defined.

\providecommand defines a new command if it isn't already defined,  or does nothing if it exists.

If you want to define a command whether it is new or predefined, you can use \def or

  • \providecommand \foo{}
  • \renewcommand \foo{…}

猜你喜欢

转载自blog.csdn.net/FJDJFKDJFKDJFKD/article/details/87162271