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?
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?
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
\advance\count@\@ne
\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.

In case you want also to arrange for the table of contents, here's a way.
\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
\advance\count@\@ne
\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.
Help please :)
– B. T. Oct 13 '11 at 17:02\z@ in the definition of \@level with #1\dimexpr.3333em\relax; the first three levels won't be affected, but it should suffice to give a flavor. Add some text between the section titles and you'll see what I mean.
– egreg
Oct 08 '14 at 21:30
tocloft package ? Below the subsubsection level, entries are not indented anymore.
–
Dec 23 '14 at 14:08
tocloft; this would require very extensive work. And such a TOC would be almost as long as the document (and pretty uniformative).
– egreg
Dec 23 '14 at 14:45
Undefined control sequence, main.tex, line 1.
– aan
Aug 12 '19 at 17:10
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]
\setuphead[section][color=red,style=\bfc]
\setuphead[subsection][color=blue,style=\bfb]
\setuphead[subsubsection][style=\bfa]
\setuphead[subsubsubsection][style=bold]
\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]
\setuphead[myniceheading][color=darkgreen,style=\bib,alternative=middle,number=no]
\myniceheading{Some heading}
See ConTeXt documentation at Pragma ADE and reference for \setuphead.
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
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 :)
\chapter,\section,\subsectionand\subsubsectionare numbered. – Joseph Wright Oct 09 '11 at 08:52\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 09 '11 at 08:53Heading 1 Heading 1.1 Heading 1.2 Heading 1.2.1 Heading 1.2.2 Heading 1.2.2.1 Heading 1.2.2.2 Heading 1.2.2.1
and they all have to show in TOC:
Heading 1..................1 Heading 1.1................1 Heading 1.2................2 Heading 1.2.1..............2 Heading 1.2.2..............3 Heading 1.2.2.1............3 Heading 1.2.2.2............4 Heading 1.2.2.1...........10
– B. T. Oct 13 '11 at 15:44