Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Why do LaTeX internal commands have an @ in them?

What does the @ symbol mean in LaTeX? I'm looking at the source of apa.cls, and there's a declaration:

\newsavebox\gr@box

and later on

\sbox\gr@box{\includegraphics[width=\linewidth]{#2}}.

It seems like @ isn't acting as a normal character, but I can't figure out exactly what it's doing, and couldn't find anything after bit of googling (how I would love a Google regex feature!) Thanks.

EDIT: Thanks for the help; of the links I looked through I found http://www.tug.org/pipermail/tugindia/2002-January/000178.html to be very helpful and concise. To summarize, the @ character is not normally allowed in the names of macros, so as a hack for scoping, LaTeX packages declare it internally to be a valid name character and use it for their macros. You can use \makeatletter in a document to access these macros, but you obviously must be very careful since you have can now overwrite essential LaTeX kernel macros; use \makeatother to revert.

share|improve this question

migrated from stackoverflow.com Oct 17 '11 at 2:45

This question came from our site for professional and enthusiast programmers.

marked as duplicate by topskip, N.N., egreg, lockstep, diabonas Oct 17 '11 at 15:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
See also stackoverflow.com/questions/2296772/… –  Josh Lee Mar 23 '10 at 9:01
    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  N.N. Oct 17 '11 at 13:48
add comment

3 Answers

up vote 36 down vote accepted

Every char has the category code from 0 upto 15.

  • 0 - Escape character; this signals the start of a control sequence. backslash \ (code 92) is a default escape character.
  • 1 - Beginning of group; such a character causes TeX to enter a new level of grouping. The open brace { is a beginningof-group character.
  • 2 - End of group; TeX closes the current level of grouping. TeX has the closing brace } as end-of-group character.
  • 3 - Math shift; TeX uses the dollar sign $ for this.
  • 4 - Alignment tab; TeX uses the ampersand &.
  • 5 - End of line; a character that TeX considers to signal the end of an input line.
  • 6 - Parameter character; this indicates parameters for macros. In TeX this is the hash sign #.
  • 7 - Superscript; Default superscript is the circumflex ^.
  • 8 - Subscript; Default superscript is underscore _.
  • 9 - Ignored; characters of this category are removed from the input.
  • 10 - Space; space characters receive special treatment. TeX assigns this category to the ASCII space character, code 32 and tab character (code 9).
  • 11 - Letter; in TeX only the characters a..z, A..Z are in this category. Often, macro packages make some ‘secret’ character (for instance @) into a letter, see below.
  • 12 - Other; TeX puts everything that is not in the other categories into this category. Thus it includes, for instance, digits, punctuation and @.
  • 13 - Active; active characters function as a TeX command, without being preceded by an escape character. The tie character ~ has such category.
  • 14 - Comment character; Default comment character is %.
  • 15 - Invalid character; this category is for characters that should not appear in the input. TeX causes an error in the case of such chars.

Any macro can only consist of letters (code 11). The @ symbol has category code 12 and can not be included in the macro name. But you can change the category of any symbol

\catcode`\@ = 11 % Macro \makeatletter does the same

Now you can use @ as letter in your macro names. All LaTeX packages change catcode of the @ to 11 and return it at the end.

\catcode`\@ = 12 % Macro \makeatother does the same

Note you can change catcode any charachter, not only @. For example, if you want to use [, ] as open and close group symbols write

\catcode`\[ = 1
\catcode`\] = 2
share|improve this answer
    
perfect thanks! –  secondbanana Mar 25 '10 at 8:37
add comment

Answered here.

The LaTeX commands are built using commands with the @ sign. In order to prevent these commands from being modified, @ is usually redefined to be a special symbol. Occasionally, if you know what you're doing, you can "make at letter" (\makeatletter) to do some fine tuning, and then you would "make at other" (\makeatother) again when you're finished.

share|improve this answer
add comment

@ character in a macro name simply marks the macro as internal to the package, see http://www.tex.ac.uk/cgi-bin/texfaq2html?label=atsigns

share|improve this answer
add comment