Latest news 2024-07-03: Ebook sale (1st – 31st July 2024): short story cybercrime fiction Unsocial Media free; short story cybercrime fiction Smile for the Camera free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

# Exercise 20: Extending the Maximum enumerate Depth (Solution)

This is a solution to Exercise 20.
\documentclass[numbers=endperiod]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% Extended enumerate:

\newcounter{enumv}[enumiv]
\newcounter{enumvi}[enumv]
\newcommand*{\labelenumv}{\theenumv.}
\newcommand*{\labelenumvi}{\theenumvi.}

% Make the left margins a bit bigger for levels 5 and 6
\setlength{\leftmarginv}{15pt}
\setlength{\leftmarginvi}{15pt}

\makeatletter

\renewcommand*{\p@enumi}{}
\renewcommand*{\p@enumii}{}
\renewcommand*{\p@enumiii}{}
\renewcommand*{\p@enumiv}{}
\renewcommand*{\p@enumv}{}
\renewcommand*{\p@enumvi}{}

\renewcommand*{\enumerate}{%
\ifnum \@enumdepth > 5\relax
\@toodeep
\else
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
\expandafter\list\csname label\@enumctr\endcsname{%
\usecounter\@enumctr
\def\makelabel##1{\hss\llap{##1}}%
}%
\fi
}

\makeatother

% Modify item label formats
\renewcommand*{\labelenumi}{\theenumi.}
\renewcommand*{\labelenumii}{\theenumii.}
\renewcommand*{\labelenumiii}{\theenumiii.}
\renewcommand*{\labelenumiv}{\theenumiv.}

% Modify the way the item counters are displayed:

\renewcommand*{\theenumi}{\thesection.\arabic{enumi}}
\renewcommand*{\theenumii}{\theenumi.\arabic{enumii}}%
\renewcommand*{\theenumiii}{\theenumii.\arabic{enumiii}}%
\renewcommand*{\theenumiv}{\theenumiii.\arabic{enumiv}}%

% And for the new extended counters:
\renewcommand*{\theenumv}{\theenumiv.\arabic{enumv}}%
\renewcommand*{\theenumvi}{\theenumv.\arabic{enumvi}}%

\begin{document}

\begin{enumerate}
\item This website is run by the Secret Lab of Experimental Stuff
(We'', Our''). We operate from the University of Somewhere.
\end{enumerate}

\section{Our Products}

\begin{enumerate}

\item You may only purchase our products if you are at least 18
years old.
\end{enumerate}

\section{Refunds}

\begin{enumerate}
\item You are entitled to a refund unless:
\begin{enumerate}
\item you have eaten the mind-controlling cookies;
\item you have thrown the exploding chocolates;
\item you have used the ray gun as:
\begin{enumerate}
\item a table chock;
\item a weapon unless:
\begin{enumerate}
\item
\label{permit}you have a ray gun permit;
\item you are an extraterrestrial and:
\begin{enumerate}
\item are not a resident of the planet Earth;
\item have a licence under Galactic Treaty 1024, unless:
\begin{enumerate}
\item you come under Article~24, or
\item you live on Saturn.
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}

Cross-reference item~\ref{permit}.

\end{document}