Welcome to the UK List of
TeX Frequently Asked Questions
on the Web

Searching

The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:
Google

\@ and @ in macro names

Macro names containing @ are internal to LaTeX, and without special treatment just don’t work in ordinary use. A nice example of the problems caused is discussed in \@ in vertical mode”.

The problems users see are caused by copying bits of a class (.cls file) or package (.sty file) into a document, or by including a class or package file into a LaTeX document by some means other than \documentclass or \usepackage. LaTeX defines internal commands whose names contain the character @ to avoid clashes between its internal names and names that we would normally use in our documents. In order that these commands may work at all, \documentclass and \usepackage play around with the meaning of @.

If you’ve included a file some other way (for example, using \input), you can probably solve the problem by using the correct command.

If you’re using a fragment of a package or class, you may well feel confused: books such as the first edition of the The LaTeX Companion are full of fragments of packages as examples for you to employ. The second edition of the Companion makes clearer how you should use these fragments, and in addition, the code of all the examples is now available on CTAN. To see the technique in practice, look at the example below, from file 2-2-7.ltx in the Companion examples directory:

\makeatletter
\renewcommand\subsection{\@startsection
  {subsection}{2}{0mm}%name, level, indent
  {-\baselineskip}%             beforeskip
  {0.5\baselineskip}%            afterskip
  {\normalfont\normalsize\itshape}}% style
\makeatother

(That example appears on page 29 of The LaTeX Companion, second edition.)

The alternative is to treat all these fragments as a package proper, bundling them up into a .sty file and including them with \usepackage; this way you hide your LaTeX internal code somewhere that LaTeX internal code is expected, which often looks ‘tidier’.

Examples from the Companion
info/examples/tlc2 (or browse the directory)

This answer last edited: 2011-06-01


Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=atsigns

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.27, released on 2013-06-07.