Proper document structure is fundamental to creating organized, professional LaTeX documents. Whether you're writing research papers, technical reports, books, or resumes, LaTeX's hierarchical sectioning commands and automatic table of contents generation ensure consistent formatting and easy navigation.

This comprehensive guide covers LaTeX's complete document structuring system: section commands from chapters down to subparagraphs, automatic numbering, table of contents generation, lists of figures and tables, customization with the titlesec package, hyperlinked navigation, and best practices for resumes and CVs.

Document Hierarchy

LaTeX provides seven hierarchical levels for organizing document content. The available levels depend on your document class.

Complete Hierarchy

Level Command Available In
-1 \part book, report
0 \chapter book, report
1 \section All classes
2 \subsection All classes
3 \subsubsection All classes
4 \paragraph All classes
5 \subparagraph All classes

Document Class Differences

% article class (no chapters)
\documentclass{article}
\section{Introduction}
\subsection{Background}

% book/report class (with chapters)
\documentclass{book}
\chapter{Getting Started}
\section{Installation}
\subsection{Requirements}

% letter class (no sections)
\documentclass{letter}

Typical Usage Patterns

% Research paper (article)
\section{Introduction}
\section{Literature Review}
\subsection{Previous Work}
\section{Methodology}

% Book
\part{Foundations}
\chapter{Introduction}
\section{Overview}
\subsection{Key Concepts}

% Thesis (report)
\chapter{Introduction}
\section{Background}
\subsection{Related Work}

Basic Section Commands

Section commands create headings with automatic numbering, formatting, and table of contents entries.

Section Syntax

% Basic section
\section{Section Title}

% Optional short title for TOC
\section[Short Title]{Full Section Title}

% Unnumbered section
\section*{Unnumbered Section}

% Complete example
\section{Introduction}
This is the introduction content.

\subsection{Background}
Background information here.

\subsubsection{Historical Context}
Details about history.

Article Document Example

\documentclass{article}
\title{Research Paper Title}
\author{Author Name}
\date{\today}

\begin{document}

\maketitle

\section{Introduction}
Introduction text here.

\section{Methods}
\subsection{Data Collection}
How data was collected.

\subsection{Analysis}
How data was analyzed.

\section{Results}
\subsection{Findings}
What we found.

\section{Discussion}
Discussion of results.

\section{Conclusion}
Summary and conclusions.

\end{document}

All Section Levels

\section{Level 1: Section}
\subsection{Level 2: Subsection}
\subsubsection{Level 3: Subsubsection}
\paragraph{Level 4: Paragraph} Text continues immediately.
\subparagraph{Level 5: Subparagraph} Text continues.

Note: \paragraph and \subparagraph are run-in headings (text continues on same line).

Short Titles for TOC

% Long title in document, short in TOC
\section[Short]{Very Long Section Title That Would Clutter TOC}

% Useful for:
\section[Introduction]{Introduction to Advanced Topics in Machine Learning}

Automatic Numbering

LaTeX automatically numbers sections hierarchically. You can control numbering depth and format.

Unnumbered Sections

% Add asterisk for unnumbered sections
\section*{Abstract}
\section*{Acknowledgments}
\section*{References}

% Still numbered
\section{Introduction}

Controlling Numbering Depth

% Set which levels get numbered (default: 2 for article, 3 for book)
\setcounter{secnumdepth}{3}  % Number down to subsubsection

% Values:
% -1: part        (book only)
%  0: chapter     (book/report)
%  1: section
%  2: subsection
%  3: subsubsection
%  4: paragraph
%  5: subparagraph

% No numbering at all
\setcounter{secnumdepth}{-1}

Customizing Number Format

% Change section numbering style
\renewcommand{\thesection}{\Roman{section}}  % I, II, III
\renewcommand{\thesection}{\Alph{section}}   % A, B, C
\renewcommand{\thesection}{\arabic{section}} % 1, 2, 3 (default)

% Subsection format
\renewcommand{\thesubsection}{\thesection.\alph{subsection}}  % 1.a, 1.b

Manual Numbering

% Set section counter manually
\setcounter{section}{5}  % Next section will be 6

% Add to counter
\addtocounter{section}{2}  % Skip ahead by 2

% Reset subsection counter
\setcounter{subsection}{0}

Appendices

% Switch to appendix numbering
\appendix

\section{Supplementary Data}  % Becomes Appendix A
\section{Additional Proofs}  % Becomes Appendix B

% Or with explicit command
\begin{appendices}
  \section{First Appendix}
  \section{Second Appendix}
\end{appendices}

Table of Contents

LaTeX automatically generates a table of contents from section commands with the \tableofcontents command.

Basic Table of Contents

\documentclass{article}

\begin{document}

\tableofcontents  % Generates TOC
\newpage          % Start content on new page

\section{Introduction}
Content here.

\section{Methods}
More content.

\end{document}

Important: Compile twice—first run collects section info, second run generates TOC.

Controlling TOC Depth

% Set which levels appear in TOC (default: 2 for article, 3 for book)
\setcounter{tocdepth}{3}

% Values same as secnumdepth:
% -1: part
%  0: chapter
%  1: section
%  2: subsection
%  3: subsubsection

% Example: Only sections and subsections in TOC
\setcounter{tocdepth}{2}

Adding Unnumbered Sections to TOC

% Unnumbered section not in TOC
\section*{Abstract}

% Unnumbered but added to TOC
\section*{Acknowledgments}
\addcontentsline{toc}{section}{Acknowledgments}

% Simpler with package
\usepackage{tocbibind}  % Automatically adds bibliography, index

TOC Title Customization

% Change "Contents" title
\renewcommand{\contentsname}{Table of Contents}

% Or in different language
\renewcommand{\contentsname}{Innehåll}  % Swedish

Multiple TOCs

\usepackage{minitoc}

% Enable mini-TOCs per chapter
\dominitoc

\chapter{First Chapter}
\minitoc  % Chapter-specific TOC

Lists of Figures & Tables

Similar to table of contents, LaTeX can automatically generate lists of figures and tables.

List of Figures

% Generate list of figures
\listoffigures

% Changes appear with all \caption commands
\begin{figure}
  \includegraphics{image.png}
  \caption{This appears in list of figures}
  \label{fig:example}
\end{figure}

List of Tables

% Generate list of tables
\listoftables

% Captured from table captions
\begin{table}
  \begin{tabular}{cc}
    A & B \\
    C & D
  \end{tabular}
  \caption{This appears in list of tables}
  \label{tab:example}
\end{table}

Complete Front Matter Example

\documentclass{report}

\begin{document}

% Title page
\maketitle

% Front matter
\tableofcontents
\listoffigures
\listoftables

% Main content
\chapter{Introduction}
...

\end{document}

Short Captions for Lists

% Long caption in document, short in list
\caption[Short caption]{Very long detailed caption that would clutter the list of figures}

% Example
\caption[Neural network architecture]{Detailed neural network architecture showing all 12 layers with activation functions and dropout rates}

Customizing List Titles

% Change default titles
\renewcommand{\listfigurename}{List of Figures}
\renewcommand{\listtablename}{List of Tables}

Customization with titlesec

The titlesec package provides extensive control over section heading appearance.

Loading titlesec

\usepackage{titlesec}

Basic Formatting

% Change section format
\titleformat{\section}
  {\normalfont\Large\bfseries}  % Format
  {\thesection}                  % Label
  {1em}                          % Separation
  {}                             % Before-code

% Example: centered, large, bold sections
\titleformat{\section}
  {\centering\Large\bfseries}
  {\thesection}
  {1em}
  {}

Colored Section Headings

\usepackage{xcolor}
\usepackage{titlesec}

% Blue section headings
\titleformat{\section}
  {\color{blue}\normalfont\Large\bfseries}
  {\thesection}
  {1em}
  {}

% Different colors for different levels
\titleformat{\section}
  {\color{blue}\Large\bfseries}
  {\thesection}{1em}{}
\titleformat{\subsection}
  {\color{cyan}\large\bfseries}
  {\thesubsection}{1em}{}

Custom Section Styles

% Underlined sections
\titleformat{\section}
  {\normalfont\Large\bfseries}
  {\thesection}
  {1em}
  {}
  [\titlerule]  % Horizontal line after

% Boxed sections
\titleformat{\section}
  {\normalfont\Large\bfseries}
  {\thesection}
  {1em}
  {\fbox}

Spacing Control

% Adjust spacing before and after sections
\titlespacing{\section}
  {0pt}      % Left margin
  {12pt}     % Space before
  {6pt}      % Space after

% Compact sections (resume-style)
\titlespacing{\section}
  {0pt}{8pt}{4pt}
\titlespacing{\subsection}
  {0pt}{6pt}{3pt}

Resume Section Formatting

\usepackage{titlesec}
\usepackage{xcolor}

% Define color
\definecolor{primary}{HTML}{2C3E50}

% Custom section format for resume
\titleformat{\section}
  {\color{primary}\Large\bfseries}
  {}
  {0em}
  {}
  [\color{primary}\titlerule]

% Reduce spacing
\titlespacing{\section}
  {0pt}{10pt}{5pt}

Sections for Resumes

Resume sections require different formatting than academic documents—minimal spacing, clear hierarchy, professional appearance.

Basic Resume Structure

\documentclass{article}
\usepackage[margin=0.75in]{geometry}
\pagestyle{empty}

\begin{document}

% Header (name and contact)
{\Huge\bfseries John Doe}

\section*{Experience}
\textbf{Senior Developer} | Company Name \hfill 2020--Present

\section*{Education}
\textbf{BS Computer Science} | University Name \hfill 2016--2020

\section*{Skills}
Python, JavaScript, React, Node.js

\end{document}

Custom Resume Section Command

\usepackage{xcolor}

% Define color
\definecolor{primary}{HTML}{2C3E50}

% Custom section command
\newcommand{\cvsection}[1]{%
  \vspace{10pt}
  {\color{primary}\Large\bfseries #1}
  \vspace{2pt}
  {\color{primary}\hrule height 1pt}
  \vspace{5pt}
}

% Usage
\cvsection{Professional Experience}
\cvsection{Education}
\cvsection{Technical Skills}

Two-Column Resume Sections

\usepackage{paracol}

\begin{paracol}{2}

% Left column (narrow)
\section*{Skills}
Python \\
JavaScript \\
SQL

\switchcolumn

% Right column (wide)
\section*{Experience}
\textbf{Developer} \\
Company Name

\end{paracol}

Minimal Spacing Resume

\documentclass[10pt]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{titlesec}

% Remove section numbering
\setcounter{secnumdepth}{0}

% Compact section formatting
\titleformat{\section}
  {\large\bfseries}
  {}
  {0em}
  {}
  [\vspace{-10pt}\hrule\vspace{2pt}]

\titlespacing{\section}
  {0pt}{8pt}{3pt}

% Remove paragraph indentation
\setlength{\parindent}{0pt}

Skills Section with Categories

\section*{Technical Skills}

\textbf{Languages:} Python, JavaScript, Java, C++ \\
\textbf{Frameworks:} React, Django, Spring Boot \\
\textbf{Databases:} PostgreSQL, MongoDB, Redis \\
\textbf{Tools:} Git, Docker, Kubernetes, AWS

Advanced Techniques

Mini Table of Contents

\usepackage{minitoc}

\dominitoc  % Enable mini-TOCs
\tableofcontents

\chapter{First Chapter}
\minitoc  % Local TOC for this chapter
\section{Section One}
\section{Section Two}

Custom List of Items

% Create custom list (like LOF/LOT)
\usepackage{tocloft}

% Define new list
\newlistof{algorithm}{loa}{List of Algorithms}

% Add entries
\refstepcounter{algorithm}
\addcontentsline{loa}{algorithm}{Algorithm Name}

% Generate list
\listofalgorithms

Conditional Sections

% Include sections conditionally
\newif\ifdetailed
\detailedtrue  % or \detailedfalse

\ifdetailed
  \section{Detailed Analysis}
  Content for detailed version.
\fi

Section Breaks

% Decorative section break
\newcommand{\sectionbreak}{%
  \vspace{10pt}
  \noindent\makebox[\linewidth]{\rule{0.5\paperwidth}{0.4pt}}
  \vspace{10pt}
}

\section{First Section}
Content.
\sectionbreak
\section{Second Section}

Numbered Paragraphs

% Make paragraph numbered like section
\setcounter{secnumdepth}{4}

\paragraph{First Point}
This paragraph is numbered.

\paragraph{Second Point}
This one too.

Running Headers with Sections

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhead[L]{\leftmark}  % Chapter/section name
\fancyhead[R]{\thepage}

% Left mark shows chapter, right mark shows section
\fancyhead[L]{\rightmark}

Troubleshooting

TOC Not Updating

Problem: Changes to sections don't appear in table of contents.

Solution: Compile twice (or delete .aux files):

% First compile: collects section information
% Second compile: generates TOC with collected info

% Or delete auxiliary files
rm document.aux document.toc

Chapter Not Defined

Problem: ! Undefined control sequence. \chapter

Solution: Chapters only exist in book/report classes:

% Wrong (article doesn't have chapters)
\documentclass{article}
\chapter{Introduction}  % Error!

% Correct
\documentclass{book}
\chapter{Introduction}  % OK

% Or use section in article
\documentclass{article}
\section{Introduction}  % OK

Section Numbers Wrong

Problem: Numbering restarts or skips numbers.

Solution: Check for manual counter changes:

% If you manually set counters, numbering can be affected
\setcounter{section}{0}  % Resets to 0

% Use \refstepcounter for proper references
\refstepcounter{section}

TOC Too Deep or Too Shallow

Problem: TOC shows too many or too few levels.

Solution: Adjust tocdepth:

% Show more levels
\setcounter{tocdepth}{3}  % Include subsubsections

% Show fewer levels
\setcounter{tocdepth}{1}  % Only sections

Sections Have No Numbers

Problem: All sections appear without numbers.

Solutions:

% Check if secnumdepth is too low
\setcounter{secnumdepth}{3}  % Number down to subsubsection

% Check if using starred versions
\section{Title}   % Numbered
\section*{Title}  % Unnumbered

Hyperref Conflicts

Problem: Errors when loading hyperref with other packages.

Solution: Load hyperref last:

% Load other packages first
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{titlesec}

% Load hyperref last
\usepackage{hyperref}

Frequently Asked Questions

How do I create sections in LaTeX?

Use sectioning commands like \section, \subsection, etc.:

\documentclass{article}

\begin{document}

\section{Introduction}
Introduction text here.

\subsection{Background}
Background information.

\section{Methods}
Methods description.

\end{document}

LaTeX automatically numbers sections and includes them in the table of contents.

How do I create a table of contents?

Use the \tableofcontents command:

\documentclass{article}

\begin{document}

\tableofcontents  % Generates TOC
\newpage

\section{Introduction}
\section{Methods}
\section{Results}

\end{document}

Important: Compile twice—first run collects section info, second generates TOC.

How do I create unnumbered sections?

Add an asterisk (*) to the section command:

% Unnumbered section
\section*{Abstract}
\section*{Acknowledgments}

% Regular numbered section
\section{Introduction}

Unnumbered sections don't appear in the table of contents by default. To add them:

\section*{Abstract}
\addcontentsline{toc}{section}{Abstract}

What's the difference between \section and \subsection?

Hierarchy levels:

  • \section: Top-level heading (1, 2, 3...)
  • \subsection: Second-level (1.1, 1.2, 2.1...)
  • \subsubsection: Third-level (1.1.1, 1.1.2...)
\section{Main Topic}
  \subsection{Subtopic}
    \subsubsection{Detailed Point}

Subsections are nested under sections in both numbering and TOC.

How do I change section numbering style?

Redefine \thesection command:

% Roman numerals (I, II, III)
\renewcommand{\thesection}{\Roman{section}}

% Letters (A, B, C)
\renewcommand{\thesection}{\Alph{section}}

% Standard numbers (default)
\renewcommand{\thesection}{\arabic{section}}

% Custom format
\renewcommand{\thesection}{Chapter \arabic{section}}

How do I control how deep the table of contents goes?

Use \setcounter{tocdepth}{n}:

% Show only sections (depth 1)
\setcounter{tocdepth}{1}

% Show sections and subsections (depth 2, default)
\setcounter{tocdepth}{2}

% Show down to subsubsections (depth 3)
\setcounter{tocdepth}{3}

% Values:
% -1: part
%  0: chapter
%  1: section
%  2: subsection
%  3: subsubsection

How do I customize section heading appearance?

Use the titlesec package:

\usepackage{titlesec}
\usepackage{xcolor}

% Custom section format
\titleformat{\section}
  {\color{blue}\Large\bfseries}  % Format
  {\thesection}                   % Label
  {1em}                           % Separation
  {}                              % Before-code
  [\titlerule]                    % After-code (underline)

% Adjust spacing
\titlespacing{\section}
  {0pt}   % Left
  {12pt}  % Before
  {6pt}   % After

How do I create a list of figures or tables?

Use \listoffigures and \listoftables:

\documentclass{article}

\begin{document}

\tableofcontents
\listoffigures
\listoftables

\section{Results}

\begin{figure}
  \caption{My figure}  % Appears in list of figures
\end{figure}

\begin{table}
  \caption{My table}  % Appears in list of tables
\end{table}

\end{document}

How do I add hyperlinks to sections?

Use the hyperref package:

\usepackage[colorlinks=true,linkcolor=blue]{hyperref}

% TOC entries become clickable automatically
\tableofcontents

% Create links manually
\section{Introduction}
\label{sec:intro}

% Link to it
See Section~\ref{sec:intro}.

% External URLs
\href{https://example.com}{Click here}
\url{https://example.com}

Do resumes need sections with numbers?

No. Resumes should use unnumbered sections:

% Unnumbered sections (recommended for resumes)
\section*{Experience}
\section*{Education}
\section*{Skills}

% Or disable numbering globally
\setcounter{secnumdepth}{0}

\section{Experience}  % Won't be numbered
\section{Education}

Resume sections are for organization, not sequential reading like academic papers.

Conclusion

LaTeX's hierarchical document structure—from \part and \chapter down to \paragraph and \subparagraph—provides comprehensive organization for any document type. The automatic numbering, table of contents generation with \tableofcontents, and lists of figures/tables create professional navigation with minimal effort.

For academic papers and technical reports, use numbered sections with full hierarchy and generated TOCs. For resumes and CVs, use unnumbered sections (\section*) with custom formatting via the titlesec package to create clean, professional layouts. The hyperref package adds modern navigation with clickable links in PDFs.

Key takeaways: LaTeX automatically handles numbering and TOC generation (compile twice for TOCs to update), customize appearance with titlesec, use unnumbered sections for resumes, and add hyperref for clickable navigation. With proper document structure, your LaTeX documents become well-organized, professionally formatted, and easy to navigate.