\chapter is the top numbered division in long-document classes (report and book), while \section is the top division in article and serves as the subchapter level inside report and book. Standard classes provide up to seven heading levels from \part down to \subparagraph; there is no \subsubsubsection command—use \paragraph instead.
Chapter vs. section and all seven heading levels
Using\chapter in \documentclass{article} fails with ! Undefined control sequence. because article.cls does not define chapters. There is also no \subchapter command: divide a \chapter with \section, then \subsection, and so on.
Sectioning commands are not environments, so there is no
\end{section} or \end{subsection}. A subsection ends automatically when the next heading at the same or a higher level begins, or at \end{document}.
hierarchy.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
Using \paragraph as a “subsubsubsection” (secnumdepth and tocdepth)
\paragraph{Title} is a sectioning command (level 4), not a paragraph break—blank lines create ordinary paragraphs. By default, \paragraph and \subparagraph are run-in headings, unnumbered, and excluded from the table of contents.
Two counters control numbering and table-of-contents inclusion:
secnumdepth: highest heading level that receives a number. Defaults to3inarticle(through\subsubsection) and2inreportandbook(through\subsection, so\subsubsectionis unnumbered by default inreportandbook).tocdepth: deepest heading level listed by\tableofcontents. Defaults to3inarticleand2inreportandbook.
\paragraph (as 1.1.1.1) and include it in \tableofcontents, set both counters to 4 in the preamble (use 5 to include \subparagraph as well):
subsubsubsection-depth.tex
Unnumbered headings and short titles
Every standard sectioning command accepts two modifiers:- Starred form (
\chapter*,\section*,\subsection*): prints the heading without a number, omits it from\tableofcontents, and does not update running page headers. To include a starred heading in the table of contents, add\addcontentsline{toc}{section}{Title}right after it (orchapterfor\chapter*). Whenhyperrefis loaded, place\phantomsectionbefore\addcontentslineso the link jumps to the heading; see Table of contents and Hyperlinks. - Optional short title (
\section[Short title]{Full title}): prints the full title in the document body while placing the short title in\tableofcontentsand running headers.
unnumbered-and-short-titles.tex
Section symbol (§) and custom heading styles
To print the section sign (§) in body text, write \S (or \S\S for §§, such as \S~3.2), which is built into base LaTeX with no extra package required. To customize heading fonts, spacing, or convert \paragraph from a run-in heading into a display heading, use the titlesec package.
Try it in the editor
To experiment with chapters,secnumdepth, and tocdepth on TeX Live 2026 (full distribution), start from the Book template in LaTeX Cloud Studio and replace main.tex with the complete example.
