14

How many nested subsections can I create using article class in LaTeX? E.g. for first level I use \subsection, for second level I use \subsubsection. My question is how deep can I go?

David Z
  • 12,084
  • 7
  • 48
  • 65
MSB
  • 369
  • 3
  • 4
  • 11

2 Answers2

15

The default article provides the following levels of sectioning

  • \part (level 0)
  • \section (level 1)
  • \subsection (level 2)
  • \subsubsection (level 3)
  • \paragraph (level 4)
  • \subparagraph (level 5)

If you wish to add levels below this, see How to add an extra level of sections with headings below \subsubsection.

Note that more levels are rarely required, since one can always default to lists to provide nested/deeper levels of enumeration.

Werner
  • 603,163
14

By default the article supports only the

  • \part
  • \section
  • \subsection
  • \subsubsection

as well as \paragraph and \subparagraph. It is possible to add additional sections but you should check if it's not easier to switch the class. Here's an example how it may look like (taken from my blog post, uses the KomaScript scrartcl class):

\documentclass{scrartcl}
\setlength{\parindent}{0pt}

\makeatletter
\renewcommand*\l@paragraph{\@dottedtocline{5}{7.0em}{4.1em}}
\renewcommand*\l@subparagraph{\@dottedtocline{6}{10em}{5em}}
\makeatother

\usepackage{titlesec}
\usepackage{titletoc}

\titlecontents{subsubsubsection}[9em]{}{\contentslabel{3.9em}}%
{\hspace*{-1.2em}}{\titlerule*[0.675pc]{.}\contentspage}

\makeatletter
\newcounter{subsubsubsection}[subsubsection]
\setcounter{subsubsubsection}{1}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\renewcommand{\thesubsubsubsection}{\thesubsubsection.\@arabic\c@subsubsubsection}

\titleclass{\subsubsubsection}{straight}[\subsubsection]
\titleformat{\subsubsubsection}{\sf}{\thetitle}{0.9em}{}[]                       
\titlespacing{\subsubsubsection}{0pt}{3.25ex plus 1ex minus 0.2ex}{1.5ex plus 0.2ex}

\renewcommand\paragraph{\@startsection{paragraph}{5}%
    {\z@}%
    {3.25ex \@plus1ex \@minus.2ex}%
    {-1em}%
    {\normalfont\normalsize\bfseries}%
}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}%
    {\parindent}%
    {3.25ex \@plus1ex \@minus .2ex}%
    {-1em}%
    {\normalfont\normalsize\bfseries}%
}
\makeatother

\usepackage{hyperref}
\makeatletter
\newcommand*{\toclevel@subsubsubsection}{4}%
\renewcommand*{\toclevel@paragraph}{5}%
\renewcommand*{\toclevel@subparagraph}{6}%
\makeatother

\begin{document}

\tableofcontents

\section{Hier die Section}
\subsection{Hier die eine Sub-Section}
\subsubsection{Hier die SubSub-Section}
\subsubsubsection{Hier die neue SubSubSub-Section} Hallo Welt
\paragraph{Hier der Paragraph} Hallo Welt
\subparagraph{Hier der Sub-Paragraph} Hallo Welt

\section{Hier die Section}
\subsection{Hier die eine Sub-Section}
\subsubsection{Hier die SubSub-Section}
\subsubsubsection{Hier die neue SubSubSub-Section} Hallo Welt
\paragraph{Hier der Paragraph} Hallo Welt
\subparagraph{Hier der Sub-Paragraph} Hallo Welt
\end{document}

As you see lots of definitions needed to be made and I am not 100\% sure I got them all.

Uwe Ziegenhagen
  • 13,168
  • 5
  • 53
  • 93
  • Remark: I cannot really recommend this as it leaves a few things untouched that should be modified as well. The KOMA classes have better support, in DTK 3/2017 there is a German article on this topic. – Uwe Ziegenhagen Aug 29 '17 at 20:17