Your support for our advertisers helps cover the cost of hosting, research, and maintenance of this document

Formatting Information — An introduction to typesetting with LATEX

Chapter 2: Basic structures

Section 2.6: Sections

In this section…

  1. Section numbering

LATEX provides seven levels of division or sectioning for you to use in structuring your text. They are all optional: it is perfectly possible to write a document consisting solely of paragraphs of unstructured text. But even novels are normally divided into chapters, although short stories are often made up just of paragraphs.

Table 2.1: LATEX’s sectioning commands

−1Part\partNot in letters
0Chapter\chapterBooks, reports
1Section\sectionNot in letters
2Subsection\subsectionNot in letters
3Subsubsection\subsubsectionNot in letters
4Titled paragraph\paragraphNot in letters
5Titled subparagraph\subparagraphNot in letters

Chapters are only available in the book and report document classes, because they don’t have any meaning in articles and letters. Parts are also undefined in letters.

In each case the title of the part, chapter, section, etc goes in curly braces after the command. LATEX automatically calculates the correct numbering and prints the title in bold. You can turn section numbering off at a specific depth: details in § 2.6.1.

There are packages to let you control the typeface, style, spacing, and appearance of section headings: it’s much easier to use them than to try and reprogram the headings manually. Two of the most popular are section and sectsty.

\section{New recruitment policies}
\subsection{Effect on staff turnover}
\chapter{Business plan 2010--2020}

Headings also get put automatically into the Table of Contents, if you specify one (it’s optional). But if you make manual styling changes to your heading, for example a very long title, or some special line-breaks or unusual font-play, this would appear in the Table of Contents as well, which you almost certainly don’t want. LATEX allows you to give an optional extra version of the heading text which only gets used in the Table of Contents and any running heads, if they are in effect (see § 6.1.2). This alternative heading goes in [square brackets] before the curly braces:

\section[Effect on staff turnover]{An analysis of the 
effects of the revised corporate recruitment policies 
on staff turnover at divisional headquarters}

Exercise 5: Start your document text

  1. Add a \chapter command after your Abstract or Summary, giving the title of your first chapter.

  2. If you’re planning ahead, add a few more \chapter commands for subsequent chapters. Leave a few blank lines between them to make it easier to add paragraphs of text later.

  3. Typeset the document.

2.6.1 Section numbering

All document divisions get numbered automatically. Parts get Roman numerals (Part I, Part II, etc); chapters and sections get decimal numbering like this document, and Appendixes (which are just a special case of chapters, and share the same structure) are lettered (A, B, C, etc). You can easily change this default if you want some special scheme.

You can change the depth to which section numbering occurs, so you can turn it off selectively. In this document the depth is set to 3, using the depth column in Table 2.1. If you only want parts, chapters, and sections numbered, not subsections, subsubsections, or lower levels, you can change the value of the secnumdepth counter using the the \setcounter command, giving the depth value from Table 2.1:


Notice that the \setcounter command, like \renewcommand which we saw earlier, has two arguments: the name of the counter you want to set, and the number you want to set it to.

A related counter is tocdepth, which specifies what depth to take the Table of Contents to. It can be reset independently, in exactly the same way as secnumdepth. The setting for this document is 2.


To get a one-time (special case) unnumbered section heading which does not go into the Table of Contents, follow the command name with an asterisk before the opening curly brace:

\subsection*{Shopping List}

All the divisional commands from \part* to \subparagraph* have this ‘starred’ version which can be used in isolated circumstances for an unnumbered heading when the setting of secnumdepth would normally mean it would be numbered.

  1. It is arguable that chapters also have no place in reports, either, as these are conventionally divided into sections as the top-level division. LATEX, however, assumes your reports have chapters, but this is only the default, and can be changed very simply (see § 7.6).