Edit Note: I am trying to research "switches" (like \chapter), which led to this question. It might be helpful to tag this "switches".

I have seen a lot of documentation that appears to be using the @ symbol in a way that appears to separate a control sequence from a variable:

\@ptsize This control sequence is used to store the second digit of the pointsize we are typesetting in. So, normally, it’s value is one of 0, 1 or 2.

1 (*article|report|book)

2 \newcommand\@ptsize{}

From: CTAN documentation on the "Book" class., also in Memoir, etc.

However in other documentation sources, there doesn't seem to be a need for the @ symbol at all: LaTeX \if condition.

What is this symbol for, and more importantly: how should it actually be used?

  • What I know is that commands with this symbol @ can not be defined or modified in preamble of documents (except if you make use of some tricks). So if some command is too important that shouldn't be changed without caution, they use @ in its name, so no chance to destroy it. – Sigur Feb 23 '19 at 0:43
  • It is like the underscore _ in other programming languages. In TeX _ stands for very important things so @ is chosen to play the role. – Symbol 1 Feb 23 '19 at 0:57
  • 1
    @elikakohen That is answered in the TeXbook on page 344: “At this point plain.tex completes its initialization of category codes by setting \catcode`\@=11, thereby making the character @ behave temporarily like a letter. The command \catcode`\@=12 will appear later, hence at-sign characters will act just like ordinary punctuation marks when TeX is running. The idea is to make it easy for plain TeX to have private control sequences that cannot be redefined by ordinary users; all such control sequences will have at least one @ in their names.” – Henri Menke Feb 23 '19 at 1:03
  • @elikakohen This is by the way also explained in the answer of the duplicate. – Henri Menke Feb 23 '19 at 1:04
  • @elikakohen Yes, you can use any character and set its catcode to 11. ConTeXt does that for !, ?, _ and expl3 does it for _ and :. The official reference for such questions is, as mentioned in my previous comment, the TeXbook. – Henri Menke Feb 23 '19 at 1:30