Go to the first, previous, next, last question, table of contents.

\@ and @ in macro names

A common source of problems in a LaTeX document is the diagnostic about the appearance of the command \@, or about other commands containing the character @. The most common complaint is ``You can't use `\spacefactor' in vertical mode'', but others occur.

Such problems are usually caused by including a LaTeX2e 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 @; this enables it 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 @. Solve this problem by using the correct command to include the file.

But, you will say, ``The LaTeX Companion tells me to use commands containing @!''

Indeed; for example, there's a lengthy section about \@startsection and how to use it to control the appearance of section titles. Page 15 of The Companion explains this; and suggests that you make such changes in the document preamble, between \makeatletter and \makeatother. So the definition of \subsection on page 26 could be:

  \makeatletter
  \renewcommand{\subsection}{\@startsection
    {subsection}%                    % name
    ...
    {\normalfont\normalsize\itshape}}% style
  \makeatother

Go to the first, previous, next, last question, table of contents.