# More layers of sectioning in article class

I'm using LaTeX for a university assignment and my professor has some strange formatting rules:

There are 7 layers of sectioning, which all have to appear in the table of contents. This is more then I can archive with \section, \subsection, \subsubsection, \paragraph and \subparagraph. Is there a way to define new commands to add new sectioning layers?

The counting of the sections is also quite unusal:

A. I. 1. a) aa) (1) (a)

So, it's capital letters, roman numbers, numbers, letters, double letters, numbers in brackets and letters in brackets.

Can anybody help me out on this?

-
Are you sure this isn't a joke? Did the professor also send you to get a long stand? –  Ian Thompson Apr 21 '14 at 14:40
The titlesec package allows for creating new levels of sectioning. However, note that with chapter and \part (forcertain classes), it makes in all 7 levels. maybe he wants you to use them all? Looks like an April fool. –  Bernard Apr 21 '14 at 14:52
if i remember correctly, amsart has a \part, and i'm pretty sure it goes down through \subsubparagraph (one level lower than article). so that is actually 7 levels, although i've never seen them all used. this isn't for a law class, is it? –  barbara beeton Apr 21 '14 at 15:27
Yes, its for a law class. I found this, but i still need 2 more levels of sectioning. –  Small Zane Apr 21 '14 at 15:44
jura might be of interest, especially if you are in Germany. I can't read the documentation to confirm but the section numbering looks similar. –  cfr Apr 21 '14 at 15:54

One option using the titlesec package to define two new units; the alphalph package was used to provide the counter with double alphabetic characters.

The two new units are \myunit and \mysubunit, with levels 6 and 7, respectively; I also added support for bookmarks for the new units. Of course, change the settings for the headings and for eventual ToC entries according to your needs:

\documentclass{article}
\usepackage{alphalph}
\usepackage{titlesec}
\usepackage{hyperref}

% declaration of the class for the new units
\titleclass{\myunit}{straight}[\subparagraph]
\titleclass{\mysubunit}{straight}[\myunit]

% counters for the new units
\newcounter{myunit}
\newcounter{mysubunit}

% all units numbered and in ToC
\setcounter{secnumdepth}{7}
\setcounter{tocdepth}{7}

% modification of heading format for section, subsection, subsubsection
% to add the period after the counter
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection.}
{1em}
{}
\titleformat{\subsection}
{\normalfont\large\bfseries}
{\thesubsection.}
{1em}
{}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}
{\thesubsubsection.}
{1em}
{}
% heading format for the new units
\titleformat{\myunit}[runin]
{\normalsize\bfseries}
{\themyunit}
{1em}
{}
\titleformat{\mysubunit}[runin]
{\normalsize\bfseries}
{\themysubunit}
{1em}
{}
% spacing for the headings of subparagraph and the new units
\titlespacing*{\subparagraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titlespacing*{\myunit}
{0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titlespacing*{\mysubunit}
{0pt}{3.25ex plus 1ex minus .2ex}{1em}

% redefinitions for the counter representation for all units
\renewcommand\thesection{\Alph{section}}
\renewcommand\thesubsection{\Roman{subsection}}
\renewcommand\thesubsubsection{\arabic{subsubsection}}
\renewcommand\theparagraph{\alph{paragraph})}
\renewcommand\thesubparagraph{\alphalph{\value{subparagraph}})}
\renewcommand\themyunit{(\arabic{myunit})}
\renewcommand\themysubunit{(\alph{subsubsection})}

\makeatletter
% bookmark support for new units
\def\toclevel@myunit{6}
\def\toclevel@mysubunit{7}

% ToC entries format
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{1.5em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{3em}{1.5em}}
\renewcommand*\l@paragraph{\@dottedtocline{4}{4.5em}{1.5em}}
\renewcommand*\l@subparagraph{\@dottedtocline{5}{6em}{2em}}
\newcommand*\l@myunit{\@dottedtocline{5}{8em}{1.5em}}
\newcommand*\l@mysubunit{\@dottedtocline{5}{9.5em}{1.5em}}
\makeatother

\begin{document}

\tableofcontents
\section{Test section}
Test text
\subsection{Test subsection}
Test text
\subsubsection{Test subsubsection}
Test text
\paragraph{Test paragraph}
Test text
\setcounter{subparagraph}{26}
\subparagraph{Test subparagraph}
Test text
\myunit{Test new unit}
Test text
\mysubunit{Test new subunit}
Test text

\end{document}


An image of the output showing all units in the ToC:

An image showing the bookmarks panel:

-