next up previous contents index
Next: Changing the Chapter Headings Up: Changing the Document Style Previous: Modifying Object Specific Text   Contents   Index

Changing the Section Headings

It is possible to customise the way your section, subsection etc headings appear by redefining the corresponding commands \section, \subsection etc using the command:

\@startsection{<type>}{<level>}{<indent>}{<beforeskip>}{<afterskip>}{<style>}

The six arguments are as follows:

<type>
The sectioning type. This should be one of: section, subsection, subsubsection, paragraph or subparagraph. (Note no backslash.)

<level>
This is the sectioning level as indicated in Table 4.2.

<indent>
This should be a length, specifying the indentation from the left margin.

<beforeskip>
The absolute value of the <beforeskip> specifies how much vertical distance to leave before the heading. If <beforeskip> is negative, the first paragraph following the section heading will not be indented.

<afterskip>
The absolute value of the <afterskip> specifies how much vertical distance to leave after the heading. If <afterskip> is negative, the text following the sectioning command will appear on the same level as the section heading.

<style>
The <style> are the declarations required to set the style of the heading (e.g. \itshape for an italic heading.) Note that the last command in <style> may be a command which takes a single argument, but all the others must be declarations.

(Remember that \paragraph and \subparagraph produce sub-sub-sub-sections and sub-sub-sub-sub-sections, respectively, though most class files suppress their numbering and give them a negative <afterskip>.[How to create a \subsubsubsection])


Table 4.2: Section Levels
part -1
chapter 0
section 1
subsection 2
subsubsection 3
paragraph 4
subparagraph 5

As an example, suppose you want to change the section headings so that they appear in a large italic font, you could do something like:

\renewcommand{\section}{\@startsection
{section}%                   % the name
{1}%                         % the level
{0mm}%                       % the indent
{-\baselineskip}%            % the before skip
{0.5\baselineskip}%          % the after skip
{\normalfont\large\itshape}} % the style
As mentioned above, the final command within the <style> argument may be a command which takes an argument, so you could also do something like:
\renewcommand{\section}{\@startsection
{section}%                   % the name
{1}%                         % the level
{0mm}%                       % the indent
{-\baselineskip}%            % the before skip
{0.5\baselineskip}%          % the after skip
{\normalfont\large\MakeUppercase}} % the style
which would convert the section heading to uppercase. See A Guide to LaTeX [2] for further information.

There is a counter called secnumdepth that controls what level the sections have numbers. The levels correspond to those shown in Table 4.2. By default this value is 2, so only parts, chapters, sections and subsections have associated numbers. You can use \setcounter to change the value of secnumdepth. So, for example, if you want the \paragraph command to produce a number, do

\settocounter{secnumdepth}{4}


next up previous contents index
Next: Changing the Chapter Headings Up: Changing the Document Style Previous: Modifying Object Specific Text   Contents   Index
Nicola L. C. Talbot. School of Computing Sciences. University of East Anglia. Last Modified: 2007-11-06