1

My structure begin on section (this is a monograph with documentclass article), so I don't use \chapter.

I have one section with I need expand to 'level 6' (as a precaution, expand to 'level 10').

Example:

1.

1.1.

1.1.1.

1.1.1.1.

1.1.1.1.1.

...

1.1.1.1.1.1.1.1.1.1.

How can I do that without change too much the structure?

P.S: I try this (great) suggestion (More section headings?), but he needed chapter to begin.

  • 1
    Welcome to TeX.SX! Some unsolicited advice: consider restructuring your document instead of adding this many extra sectional units. Numbering this deep will be confusing for readers and rarely adds value. – Paul Gessler Mar 04 '15 at 15:57
  • 1
    The linked post uses level 0 for chapter. Just don't use level 0. – Werner Mar 04 '15 at 15:57
  • That's too many sections! With the standard article class you get six: part, section, subsection, subsubsection, paragraph, and subparagraph – Thruston Mar 04 '15 at 15:58
  • What makes you think that the code in the linked answer needs chapters? – egreg Mar 04 '15 at 18:47
  • I tried my code (in the second part of the answer), changing report into article and removing the \level{0} line. It worked well, even for the table of contents. As such, I'll vote for closing as duplicate – egreg Mar 04 '15 at 18:54
  • I will try again with change 'article' into 'report' and repeat the same suggestion of egreg. Werner: when I use the suggestion of egreg the first time (yes, I try many times), the structure on \taleofcontent without \chapter begin with 0. Example: 0.1, 0.2, 0.2.1, ... – Leonardo Alves Almeida Mar 06 '15 at 14:21
  • I type the sequence wrong. I swap 'report' into 'article'. That's work now!! THANK YOU!!!! :D :D :D – Leonardo Alves Almeida Mar 06 '15 at 16:40
  • I needed these "deeper section" because I want make a document about software. – Leonardo Alves Almeida Mar 06 '15 at 16:41

1 Answers1

3

egreg's code does not need \chapter here using article instead of report just don't use level 0:

\documentclass[a4paper]{article}

\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}
David Carlisle
  • 757,742