Realize More Section Levels in LaTeX article Document Class

May. 19, 2025 • Updated May. 23, 2025

In LaTeX article document class, there are three commands, \section, \subsection, and \subsubsection to create the title of the first-, second-, and third-level section, respectively, and also two commands, \paragraph and \subparagraph, to create a paragraph title and a subparagraph title:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
\documentclass{article}
\usepackage[margin=1in]{geometry}

\usepackage[x11names]{xcolor}
\pagecolor{AntiqueWhite1}

\usepackage{lipsum}
\newcommand{\mylipsum}{\lipsum[1][1-3]}

\begin{document}
\tableofcontents

\section{Section}
\mylipsum

\subsection{Subsection}
\mylipsum

\subsubsection{Subsubsection}
\mylipsum

\paragraph{Paragraph A} \mylipsum
\subparagraph{Paragraph A-1} \mylipsum
\subparagraph{Paragraph A-2} \mylipsum
\mylipsum

\paragraph{Paragraph B} \mylipsum
\subparagraph{Paragraph B-1} \mylipsum
\subparagraph{Paragraph B-2} \mylipsum
\mylipsum

\end{document}

img-1

As can be seen, the TOC can only display the titles of \section, \subsection, and \subsubsection, without including that of \paragraph and \subparagraph. Besides, in the acrticle class there are no more section levels, something like \subsubsubsection or \subsub...subsection.

Therefore, to realize more section levels and make them appear them in the TOC, we can re-define the command \paragraph as the fourth-level section1:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
\documentclass{article}
\usepackage[margin=1in]{geometry}

\usepackage[x11names]{xcolor}
\pagecolor{AntiqueWhite1}

\usepackage{lipsum}
\newcommand{\mylipsum}{\lipsum[1][1-3]}

\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-2.5ex\@plus -1ex \@minus -.25ex}{1.25ex \@plus .25ex}{\normalfont\normalsize\bfseries}}
\makeatother

\setcounter{secnumdepth}{4} % how many sectioning levels to assign numbers to
\setcounter{tocdepth}{4}    % how many sectioning levels to show in ToC

\begin{document}
\tableofcontents

\section{Section}
\mylipsum

\subsection{Subsection}
\mylipsum

\subsubsection{Subsubsection}
\mylipsum

\paragraph{Paragraph A} \mylipsum
\subparagraph{Paragraph A-1} \mylipsum
\subparagraph{Paragraph A-2} \mylipsum
\mylipsum

\paragraph{Paragraph B} \mylipsum
\subparagraph{Paragraph B-1} \mylipsum
\subparagraph{Paragraph B-2} \mylipsum
\mylipsum

\end{document}

img-1

Or, similar to the above method, directly define new commands \subsubsubsection and \subsubsubsubsection2:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
\documentclass{article}
\usepackage[margin=1in]{geometry}

\usepackage[x11names]{xcolor}
\pagecolor{AntiqueWhite1}

\usepackage{lipsum}
\newcommand{\mylipsum}{\lipsum[1][1-3]}

\makeatletter
\newcommand\subsubsubsection{\@startsection{paragraph}{4}{\z@}{-2.5ex\@plus -1ex \@minus -.25ex}{1.25ex \@plus .25ex}{\normalfont\normalsize\bfseries}}
\newcommand\subsubsubsubsection{\@startsection{subparagraph}{5}{\z@}{-2.5ex\@plus -1ex \@minus -.25ex}{1.25ex \@plus .25ex}{\normalfont\normalsize\bfseries}}
\makeatother

\setcounter{secnumdepth}{5} % how many sectioning levels to assign numbers to
\setcounter{tocdepth}{5}    % how many sectioning levels to show in ToC

\begin{document}
\tableofcontents

\section{Section}
\mylipsum

\subsection{Subsection}
\mylipsum

\subsubsection{Subsubsection}
\mylipsum

\subsubsubsection{Paragraph A} \mylipsum
\subsubsubsubsection{Paragraph A-1} \mylipsum
\subsubsubsubsection{Paragraph A-2} \mylipsum
\mylipsum

\subsubsubsection{Paragraph B} \mylipsum
\subsubsubsubsection{Paragraph B-1} \mylipsum
\subsubsubsubsection{Paragraph B-2} \mylipsum
\mylipsum

\end{document}

img-1


References