Does the @ mean anything specific? For example, is it substituted? Does it split the command into parts, like \s@foo could internally mean "foo of type s"? Is the purpose of the @ only to make internal commands break when used outside a class definition or a package? If so, how is that a Good Thing?


Others have mentioned the protection against user definition / redefinition. Another aspect is that command names like \foo may only contain letters, so \mymacro is a valid command, \my!macro is not. So the normal user cannot redefine these commands, as \newcommand{\my!macro}{....} will throw an error. You can redefine the category code of e.g. ! to behave as a letter, so that \my!macro is considered as a valid command name (control word in TeX speak). This is what \makeatletter does for @, \makeatother changes the @ back to a symbol (category code 'other').

|improve this answer|||||

When Knuth originally published the language he used the @ to mark commands that a user should not normally use. This was in order to avoid overriding kernel commands by redefining them. Remember that a macro defined using \def will overwrite an earlier command with the same name. Lamport followed suit with LaTeX a few years later as well as countless other package writers. The @ can only be used in a command in a document only if you use \makeatletter so that it can change its \catcode.

For me it served also another purpose as a marker to split long commands, for example it is more readable to read \make@page@wider than \makepagewider.

|improve this answer|||||

No, it does not mean anything specific; it is simply used to "namespace" code that shouldn't appear in a regular document. You can use almost any analphabetic symbol you like; ConTeXt also allows ? and !, while LaTeX3/expl3 uses _ and : instead.

While there are few conventions on how to use @ in LaTeX package code, for expl3 we recommend the syntax

\<module>_<function name>:<argument spec>


\<l/g/c>_<module>_<variable name>_<datatype>

for functions (macros that take arguments) and variables, respectively. For variables, the prefixes are l for ‘local’, g for ‘global’, and c for ‘constant’.

|improve this answer|||||

Some TeX internal commands have @ in them, too. IMO the idea is not so much to break when used "externally" as to keep the space of regularly available control sequences free for users.

Some of the original authors used @ in place of vowels, but more often nowadays people seem to use it as a word separator much like _ is used in Perl, C, PHP, Python, etc.

|improve this answer|||||
  • 9
    Using @ for vowel sounds can get very tiresome: some of the LaTeX2e kernel has runs of internal functions with more and more @ symbols in them, making them more-or-less unreadable! – Joseph Wright Nov 30 '10 at 17:17
  • 1
    @Joseph Wright: indeed. Viz. \z@ and \m@ne – Matthew Leingang Nov 30 '10 at 19:03
  • 2
    @JOseph Wright: in particular when you run out of \v@w@ls@iv. – Ulrich Schwarz Nov 30 '10 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.