Sections, subsections and chapters in LaTeX

\section{Title} starts a numbered section, and \subsection and \subsubsection the levels below it. \chapter exists only in the classes report and book and their KOMA-Script counterparts.

The levels in an article

LaTeX numbers the headings and sets their font and spacing. \paragraph and \subparagraph are two more levels; in article they have no number and the text continues on the line of the heading.

\section{Introduction}
Text of the section.

\subsection{Background}
Text of the subsection.

\subsubsection{Earlier work}
Text of the subsubsection.

\paragraph{Remark}
The text continues on the same line as the heading.
Result
The compiled example

Open in the editor

Chapters and parts

In report and book, \chapter is the level above \section and starts a new page. \part groups several chapters and does not reset the chapter number.

Complete document:

\documentclass{report}
\begin{document}
\part{Basics}
\chapter{Introduction}
\section{Motivation}
Text of the section.
\end{document}
Result
Page 1 of the compiled examplePage 1
Page 2 of the compiled examplePage 2

Open in the editor

A short title for the table of contents

The optional argument is the version of the title that goes into the table of contents and the page header.

\section[Results]{Results of the second series of measurements}
Text of the section.
Result
The compiled example

Open in the editor

Which levels get a number

The counter secnumdepth holds the lowest level that is numbered: 0 for chapters, 1 for sections, 2 for subsections, 3 for subsubsections, 4 for paragraphs. The default is 3 in article and 2 in report and book.

This goes into the preamble.

\setcounter{secnumdepth}{1}

Open in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages