Next: , Previous: , Up: Definitions   [Contents][Index]

12.3 \makeatletter & \makeatother


  ... definition of commands with @ in their name ..

Use this pair when you redefine LaTeX commands that are named with an at-sign character ‘@’. The \makeatletter declaration makes the at-sign character have the category code of a letter, code 11. The \makeatother declaration sets the category code of the at-sign to code 12, its default value.

As TeX reads characters, it assigns each one a category code, or catcode. For instance, it assigns the backslash character ‘\’ the catcode 0. Command names consist of a category 0 character, ordinarily backslash, followed by letters, category 11 characters (except that a command name can also consist of a category 0 character followed by a single non-letter symbol).

LaTeX’s source code has the convention that some commands use @ in their name. These commands are mainly intended for package or class writers. The convention prevents authors who are just using a package or class from accidentally replacing such a command with one of their own, because by default the at-sign has catcode 12.

Use the pair \makeatletter and \makeatother inside a .tex file, typically in the preamble, when you are defining or redefining commands named with @, by having them surround your definition. Don’t use these inside .sty or .cls files since the \usepackage and \documentclass commands already arrange that the at-sign has the character code of a letter, catcode 11.

For a comprehensive list of macros with an at-sign in their names see

In this example the class file has a command \thesis@universityname that the user wants to change. These three lines should go in the preamble, before the \begin{document}.

\renewcommand{\thesis@universityname}{Saint Michael's College}

Unofficial LaTeX2e reference manual