# What's the function of the @ symbol? [duplicate]

I'm sure that this is TeX basics and I'm just being a fool, but I can't figure out for what/how the @ symbol is used. All I can tell is that to make sure it works you have to put it between \makeatletter...\makeatother. But I have no idea what it actually does. Thanks!

• Nothing special at all. It works just like any letter for a command name, but its usage usually denotes internal (non user-level) macros. \makeatletter and \makeatother just activate/deactivate the possibility to use @ in command names – Phelype Oleinik May 14 at 15:18
• It is mostly to prevent accidental use of names by users, such as \@tempdima (instead of \dimen0). – John Kormylo May 14 at 16:07
• Please have a look at What do \makeatletter and \makeatother do? – campa May 14 at 16:08
• it's just a letter \makeatletter is "make at letter" so after that command @ works the same way as a or z . – David Carlisle May 14 at 17:03

It is conventional in TeX and LaTeX to include @ in private command names that shouldn't be used in documents. Normally a command name consists of either a single non-letter or one or more letters, e.g., \# or \sigma. Inside of class and package files, however, @ is treated as a letter so a command like \@startsection will be available to a class programmer while keeping it (mostly) inaccessible to document writers. On rare occasions, a document writer may need to access these private commands, so the commands \makeatletter and \makeatother are available to turn on and off access to the private commands.
Newer LaTeX code uses the expl3 syntax which allows commands to have _ and : in the names and has conventions around naming that I won't get into here. Access to this naming convention is controlled using \ExplSyntaxOn and \ExplSyntaxOff. Even in class and package files, this has to be turned on/off manually since it has other repercussions that may not be desired in most code (most notably all spaces are ignored).
The last naming convention is one that's inconsistently applied, but is to use CamelCase in command names for commands that are made available to document writers but that have some programming-level significance. The \ExplSyntaxOn/\ExplSyntaxOff commands are examples of this. Arguably, it should also be \MakeAtLetter and \MakeAtOther but those commands precede the adoption of the CamelCase convention.
• OpTeX uses another naming convention: the _ is set as letter and can be used in control sequences every time. We need not to switch on/off to access such names. And the names \_foo are reserved for primitives and internal OpTeX sequences. The meaning of \_foo is doubled as \foo too (\_hbox is the same as \hbox), so users can access these meanings by normal way: use \hbox. Or they can re-define them without any catastrophic scenario inside the OpTeX macros because these macros are using only \_foo sequences. – wipet May 14 at 18:40
• @generallyconfuzzled Just to clarify, "to treat @ as a letter" means to make the catcode of @=11, whereas "to treat @ as other" means to make the catcode of @=12. The catcode of a character (which can be changed on the fly) is how TeX decides the function of various characters. See en.wikibooks.org/wiki/TeX/catcode – Steven B. Segletes May 17 at 10:58