1. Introduction
In this tutorial, we’ll show how to create a LaTeX document without section numbering.
2. Unnumbered Sections
The LaTeX sectioning commands produce section units that are numbered by default. Each time we use a sectioning command available for our document class, such as \section, \subsection, or \chapter, the corresponding counter increases, and the section heading appears with a number in the resulting file.
However, in some cases, we don’t want numbers attached to section headings as the writing standard we need to follow might require this. For example, poems in poetry collections are usually not numbered.
3. Using Starred Commands
The easiest way to get unnumbered sections is to use starred sectioning commands:
Numbered
Unnumbered
\part
\part*
\chapter
\chapter*
\section
\section*
\subsection
\subsection*
\subsubsection
\subsubsection*
While the non-starred commands number titles and include them in the table of contents (ToC), their starred versions don’t. Additionally, starred commands don’t place headings in the header, so we must also fix that.
4. Including Unnumbered Sections in the Table of Contents
To add a section to the ToC, we use \addcontentsline:
\addcontentsline{toc}{unit}{heading}
where:
- unit determines the section type (section, subsection, subsubsection, chapter, part)
- heading is the unit’s title
- toc means that the section unit will be included in the table of contents (not the list of figures or tables)
However, we’ll have to repeat the title for each section unit, e.g.:
\tableofcontents
\chapter{Introduction}
\lipsum[1-15]
\chapter*{Dumbledore Asked Calmly}
\addcontentsline{toc}{chapter}{Dumbledore Asked Calmly}
\lipsum[1-15]
\chapter*{Didn't He?}
\addcontentsline{toc}{chapter}{Didn't He?}
\lipsum[1-15]
\chapter{Conclusion}
\lipsum[1-15]
The unnumbered chapters won’t affect the numbering of the numbered ones, and ToC will contain both types:
But, because of repetition, if we want to change a title, we’ll have to update it in both places.
4.1. Doing Both Things at Once
To avoid that, we can implement our macro (command) that produces an unnumbered unit and inserts its heading in ToC:
\newcommand{\create}[2]{
\csname#1\endcsname*{#2}
\addcontentsline{toc}{#1}{#2}
}
The \create command takes two arguments:
- the type of the sectioning unit (#1)
- the title (#2)
We convert the type into the corresponding unnumbered command with \csname#1\endcsname*. This way, section becomes \section*, part becomes \part*, etc.
The line \addcontentsline{toc}{#1}{#2} adds the title (#2) to the ToC at the level #1.
So, with \create, we specify each title only once:
\chapter{Introduction}
\lipsum[1-15]
\create{chapter}{Dumbledore Asked Calmly}
\lipsum[1-15]
\create{chapter}{Didn't He?}
\lipsum[1-15]
\chapter{Conclusion}
\lipsum[1-15]
5. Fixing the Header
Chapter and section titles appear in the headers in some document classes, such as book and memoir. Since the starred section units aren’t counted, we won’t see unnumbered titles in headers. Instead, each header will show the previous numbered title.
We can fix this with \markboth and \markright. The \markboth command has two arguments:
\markboth{left_header}{right_header}
Here, left_header defines the header of even-numbered, and right_header specifies the header of odd-numbered pages.
The \markright command is similar. It has one argument, which sets the right header and leaves the left unchanged.
For example, if we want chapters to appear in the left headers and sections in the right ones, we can extend \create to set the headers after \addcontentsline:
\newcommand{\create}[2]{
\csname#1\endcsname*{#2}
\addcontentsline{toc}{#1}{#2}
\ifstrequal{#1}{section}{
\markright{\MakeUppercase{#2}}
}
\ifstrequal{#1}{chapter}{
\markboth{\MakeUppercase{#2}}{}
}
}
We must include the etoolbox package to use the comparison command \ifstrequal. Its first two arguments are the strings to compare: the unit type passed to \create and the string section or chapter. The third argument is the then-branch to execute if the compared strings are equal.
To convert the section and chapter titles to uppercase letters, we use \MakeUppercase, but we can skip this step if our formatting guidelines don’t require capitalization.
6. KOMA-Script
KOMA-Script has sectioning commands that produce unnumbered parts, chapters, and sections and ensure they appear in the ToC. Those are:
- \addpart – for adding an unnumbered part
- \addchap – for adding an unnumbered chapter
- \addsec – for adding an unnumbered section
The titles of chapters and sections added this way appear in the headers without additional work on our side. However, files produced with KOMA-Script don’t look the same as with regular LaTeX by default:
We’ll have to change the file style to get the usual look.
Further, KOMA-Script offers the starred variants \addpart*, \addchap*, and \addsec*. They result in empty headers as opposed to their non-starred counterparts.
7. Conclusion
In this article, we showed how to get unnumbered section units in LaTeX. We can use the starred versions of the usual sectioning commands, but we’ll have to program the addition of those section units to ToC and the setting of the headers. KOMA-script commands do all those things at once.