6.8 \@startsection: Typesetting sectional unit headings

Synopsis:

\@startsection{name}{level}{indent}{beforeskip}{afterskip}{style}

Used to help redefine the behavior of common sectioning commands, namely \section, \subsection, and subsubsection.

First, there is an alternative to using this rather low-level \@startsection command: the titlesec package makes manipulation of sectioning easier. Further, while most requirements for sectioning commands can be satisfied with \@startsection, some cannot. For instance, in the standard LaTeX book and report classes the commands \chapter and \report are not constructed using this. To make such a command you might look into LaTeX’s \secdef command (not yet described in this manual, sorry).

The \@startsection macro takes many arguments; each is explained in the next section.

\@startsection{name}
  {level}
  {indent}
  {beforeskip}
  {afterskip}
  {style}*[toctitle]{title}

Because of the @ in the name, it must be used in a package or class file, or the document preamble. If used in the preamble, it must go between a \makeatletter command and a \makeatother (see \makeatletter & \makeatother).

\@startsection is typically used in redefining \section or other such command, like this:

\makeatletter % needed if in preamble
\renewcommand{\section}{\@startsection{name}
  {level}
  {indent}
  {beforeskip}
  {afterskip}
  {style}
}
\makeatother % if in preamble

Some practical examples are shown below.

When used this way, \section retains its standard calling form of \section*[toctitle] {title} (in which, as a reminder, the star * and bracketed argument are optional). See Sectioning. This implies that when you write a command like \renewcommand{\section}{...}, the \@startsection{...} must come last in the definition.


Unofficial LaTeX2e reference manual