Typically, documents possess a “logical structure” characterized by divisions into chapters, sections, sub-sections, sub-sub-sections, paragraphs, etc., to structure and arrange their content. LaTeX facilitates the establishment of such a document structure and offers flexibility in customizing sectioning and numbering. The specific commands for organizing a document depend on the chosen document class.
Hierarchical levels defining sections
In LaTeX, you can arrange, number, and index chapters and sections within your document. The number of hierarchical levels defining sections varies based on the chosen document class.
Hierarchical levels for defining sections in the “book/report” document class
\chapter{}
\section{}
\subsection{}
\subsubsection{}
\paragraph{}
\subparagraph{}
\chapter{}
is the top-level document command in the book
or report
document classes.
Hierarchical levels for defining sections in the “article” document class
\section{}
\subsection{}
\subsubsection{}
\paragraph{}
\subparagraph{}
\section{}
is the top-level document command in the article
document class.
Note: The sectional unit commands mentioned earlier operate hierarchically, emphasizing the importance of proper nesting to maintain a structured and organized document. It means that \subsection{}
command must come after \section{}
command, \subparagraph{}
command come after
and so on.\paragraph{}
Numbering System of Sections in Different Document Classes
In book
or report
document class, LaTeX assigns three-tier serial numbers to \chapters{}
\section{}
, and \subsection{}
commands. It is noted that \subsubsection{}
, \paragraph{}
, and \subparagraph{}
commands are not numbered even if they are used.
- Each chapter is identified by a whole number, with the label word ‘Chapter‘ preceding it and its heading following it.
- A chapter can consist of sections identified by numbers such as 1.1, 1.2, etc. In this format, the second number after the first decimal point represents the serial number of the section, and the first number indicates the serial number of the chapter to which the section belongs.
- Subsections within sections are assigned a third level of serial numbers, such as 1.1.1, 1.1.2, etc. In this format, the third number after the second decimal point represents the serial number of the subsection, the second number indicates the serial number of the section to which the subsection belongs, and the first number indicates the serial number of the chapter to which the section belongs.
In article
document classes, LaTeX assigns three-tier serial numbers to \section{}
, \subsection{}
, and \subsubsection{}
commands. It is noted that \paragraph{}
and \subparagraph{}
commands are not numbered even if they are used.
The numbering of the sections in the article
document class can be described similarly to the book
/report
document class.
Note: If you don’t want to show the number of any section in your document, you can use the following commands.
\chapter*{}
\section*{}
\subsection*{}
\subsubsection*{}
When you use any of the above commands, then numbering will be disabled due to its starred (*) form.
Example
The following example shows the use of \section{}
, \subsection{}
, \subsubsection{}
, \paragraph{}
, and subparagraph{}
commands.
\documentclass{article}
\begin{document}
\section{Introduction}
This is the introduction section of your document. You can start by providing some background information about your topic.
\subsection{Background}
% \subsection creates a subsection within the current section.
\section{Methodology}
% Creating a new section for the methodology of your study or project.
\subsection{Data Collection}
% Subsection for a specific part of the methodology.
Explain how you collected data for your study.
\subsubsection{Types of Data Collection}
% Subsection for a specific part of the data collection.
\subsection{Data Analysis}
% Another subsection for a different aspect of the methodology.
Describe the methods used for analyzing the collected data.
\subsubsection{Types of Data Analysis}
% Subsection for a specific part of the data analysis.
\paragraph{Descriptive analysis:}
This explains the descriptive analysis.
\subparagraph{Advantages and Limitations:}
This explains the descriptive analysis.
\end{document}
Output