I am a novice in LaTeX and I have one question.

Can someone tell me what if you want more heading's in LaTeX. Like 5 or 10 or even 15. Is there a package for that?

• Could you explain 'more headings'? If you mean more nested levels, there are good reasons why as standard only \chapter, \section, \subsection and \subsubsection are numbered. – Joseph Wright Oct 9 '11 at 8:52
• You mean \section{A section title}? You can add as many of those as you want, no need for a package. If not, can you clarify what you're after. – Torbjørn T. Oct 9 '11 at 8:53
• @B.T.: Please do not ignore the remarks about style lightly. While MS Word will allow you to commit any kind of stylistic crime, having your headings nested so deeply is a sign for an underlying problem. Your document will not be easy to read, or find anything in. Unless you are looking at the type of write-only documentation sadly popular in the IT industry these days... I have written a RPG rulebook 250 pages long, and had no need whatsoever to go beyond "subsubsection". The Intel Architecture Software Manual doesn't go beyond that, at that's a behemoth. – DevSolar Oct 14 '11 at 9:12

This shouldn't be taken too seriously, as deep numbering is not recommended. However, here's how one can have 100 sectional levels (all are modeled after \subsubsection after that level).

\documentclass[a4paper]{report}

\makeatletter
\newcommand\level[1]{%
\ifcase#1\relax\expandafter\chapter\or
\expandafter\section\or
\expandafter\subsection\or
\expandafter\subsubsection\else
\def\next{\@level{#1}}\expandafter\next
\fi}
\newcommand{\@level}[1]{%
\@startsection{level#1}
{#1}
{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}

\newcounter{level4}[subsubsection]
\@namedef{thelevel4}{\thesubsubsection.\arabic{level4}}
\@namedef{level4mark}#1{}
\count@=4
\loop\ifnum\count@<100
\begingroup\edef\x{\endgroup
\noexpand\newcounter{level\number\numexpr\count@+1\relax}[level\number\count@]
\noexpand\@namedef{thelevel\number\numexpr\count@+1\relax}{%
\noexpand\@nameuse{thelevel\number\count@}.\noexpand\arabic{level\number\numexpr\count@+1\relax}}
\noexpand\@namedef{level\number\numexpr\count@+1\relax mark}####1{}}
\x
\repeat
\makeatother
\setcounter{secnumdepth}{100}

\begin{document}

\level{0}{abc}
\level{1}{abc}
\level{2}{abc}
\level{3}{abc}
\level{4}{abc}
\level{5}{abc}
\level{6}{abc}
\level{7}{abc}
\level{8}{abc}
\level{9}{abc}
\level{10}{abc}
\level{11}{abc}
\level{12}{abc}
\end{document}


The commands \level{0}, \level{1}, \level{2}, and \level{3} are synonymous with \chapter, \section, \subsection, and \subsubsection.

\documentclass[a4paper]{report}

\makeatletter
\newcommand\level[1]{%
\ifcase#1\relax\expandafter\chapter\or
\expandafter\section\or
\expandafter\subsection\or
\expandafter\subsubsection\else
\def\next{\@level{#1}}\expandafter\next
\fi}
\newcommand{\@level}[1]{%
\@startsection{level#1}
{#1}
{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}

\newdimen\@leveldim
\newdimen\@dotsdim
{\normalfont\normalsize
\sbox\z@{0}\global\@leveldim=\wd\z@
\sbox\z@{.}\global\@dotsdim=\wd\z@
}

\newcounter{level4}[subsubsection]
\@namedef{thelevel4}{\thesubsubsection.\arabic{level4}}
\@namedef{level4mark}#1{}
\def\l@section{\@dottedtocline{1}{0pt}{\dimexpr\@leveldim*4+\@dotsdim*1+6pt\relax}}
\def\l@subsection{\@dottedtocline{2}{0pt}{\dimexpr\@leveldim*5+\@dotsdim*2+6pt\relax}}
\def\l@subsubsection{\@dottedtocline{3}{0pt}{\dimexpr\@leveldim*6+\@dotsdim*3+6pt\relax}}
\@namedef{l@level4}{\@dottedtocline{4}{0pt}{\dimexpr\@leveldim*7+\@dotsdim*4+6pt\relax}}

\count@=4
\def\@ncp#1{\number\numexpr\count@+#1\relax}
\loop\ifnum\count@<100
\begingroup\edef\x{\endgroup
\noexpand\newcounter{level\@ncp{1}}[level\number\count@]
\noexpand\@namedef{thelevel\@ncp{1}}{%
\noexpand\@nameuse{thelevel\@ncp{0}}.\noexpand\arabic{level\@ncp{1}}}
\noexpand\@namedef{level\@ncp{1}mark}####1{}%
\noexpand\@namedef{l@level\@ncp{1}}%
{\noexpand\@dottedtocline{\@ncp{1}}{0pt}{\the\dimexpr\@leveldim*\@ncp{5}+\@dotsdim*\@ncp{0}\relax}}}%
\x
\repeat
\makeatother
\setcounter{secnumdepth}{100}
\setcounter{tocdepth}{100}
\begin{document}
\tableofcontents

\level{0}{abc}\thispagestyle{empty}
\level{1}{abc}
\level{2}{abc}
\level{3}{abc}
\level{4}{abc}
\level{5}{abc}
\level{6}{abc}
\level{7}{abc}
\level{8}{abc}
\level{9}{abc}
\level{10}{abc}
\level{11}{abc}
\level{12}{abc}
\end{document}


However I can't stand looking at the result.

• Nice that's what i want :) – B. T. Oct 13 '11 at 15:32
• Are those heading included in table of content also? – B. T. Oct 13 '11 at 15:51
• Also headings with \level{3} or more (4,5,6) is written on top of each other in \tableofcontents :( Help please :) – B. T. Oct 13 '11 at 17:02
• @B.T. It's hard to understand the need of 10 numbered levels and harder to think about including them in the table of contents. – egreg Oct 13 '11 at 20:13
• @NNzz And I meant to say it's not good style: a fourth level title would be almost centered. – egreg Oct 8 '14 at 21:22

If you are a novice to LaTeX with demands for complex sectioning, you might want to take a look at ConTeXt. Unless you are using MikTeX or an old TeX Live, it should work out of the box, just run context yourfile.tex or texexec yourfile.tex on the example below:

\setupcolors[state=start]
\usemodule[subsub]
\starttext
\section{first section}
\subsection{a}
\subsubsection{b}
\subsubsubsection{c}
\subsubsubsubsection{d}
\subsubsubsubsubsection{e}
\subsubsubsubsubsubsection{f}
\subsubsubsubsubsubsubsection{g}
\subsubsubsubsubsubsubsubsection{h}
\subsubsubsubsubsubsubsubsubsection{i}
\stoptext


The \usemodule[subsub] defines some additional levels, but you can just as well easily define and configure your own (there is a slight difference between pdfTeX and LuaTeX-based ConTeXt as far as sectioning is concerned, so I didn't provide any more specific example, but I can provide more details if needed). If you want to provide headings different from \section, you can use

\definehead[myniceheading][section]



I found a possible solution - for anyone having the same trouble as I:

http://www-mobile.ecs.soton.ac.uk/scripts/viewvc.cgi/yja02r/thesis/packages/subsections.sty?view=co

http://web.archive.org/web/20100303003122/http://www-mobile.ecs.soton.ac.uk/scripts/viewvc.cgi/yja02r/thesis/packages/subsections.sty?revision=1.1.1.1

new .sty file with possible unlimited number of headings

%% How can I use \subsubsubsection in Latex, so that I can refer to it and also it appears in the table of contents?
% Here is a style file that you will need to use. It has entries to create subsubsubsection and subsubsubsubsection. If you need more then you should add whatever you need by taking the previous level of sub and adding a "sub" everywhere and change the level indicator {5} to {6}.
% I call this file subsections.sty:

% Here is an example file that worked with this style file:
%
% \documentstyle[subsections]{article}
% \setcounter{secnumdepth}{5}
% \setcounter{tocdepth}{5}
% \begin{document}
% \tableofcontents
% \section{section}
% line 1.
% \subsection{subsection}
% line 2.
% \subsubsection{subsub}
% line 3.
% \subsubsubsection{subsubsub}
% line 4.
% \subsubsubsubsection{subsubsubsub}
% line 5.
% \subsubsubsubsection{subsubsubsub}
% line 6.
% \subsubsubsection{subsubsub}
% line 7.
% \subsubsubsubsection{subsubsubsub}
% line 8.
% \subsubsubsubsection{testing}
% line 9.
% \end{document}
%

\newcounter{subsubsubsection}[subsubsection]
\def\subsubsubsectionmark#1{}
\def\thesubsubsubsection {\thesubsubsection
.\arabic{subsubsubsection}}
\def\subsubsubsection{\@startsection
{subsubsubsection}{4}{\z@} {-3.25ex plus -1
ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
% mj02r: original:
%\def\l@subsubsubsection{\@dottedtocline{4}
%     {4.8em}{4.2em}}
% mj02r: for VCE reports:
%\def\l@subsubsubsection{\@dottedtocline{4}
%     {7em}{3.8em}}
% mj02r, 29/12/2004: for thesis:
\def\l@subsubsubsection{\@dottedtocline{4}
{11.1em}{4.6em}}

\newcounter{subsubsubsubsection}[subsubsubsection]
\def\subsubsubsubsectionmark#1{}
\def\thesubsubsubsubsection {\thesubsubsubsection
.\arabic{subsubsubsubsection}}
\def\subsubsubsubsection{\@startsection
{subsubsubsubsection}{5} {\z@} {-3.25ex plus -1
ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
% mj02r: original:
%\def\l@subsubsubsubsection{\@dottedtocline{5}
%     {5.8em}{5.2em}}
% mj02r: for VCE reports:
\def\l@subsubsubsubsection{\@dottedtocline{5}
{10.7em}{4.5em}}


I will try to look at it later.

p.s. I hope it works :)

• For everyone interested, it works :) – B. T. Oct 15 '11 at 11:55
• I get server error when I try to access it. – Nasser Jun 12 '13 at 9:48