9

The solution to A five level deep list implemented an enumerated list that extended to 9 levels of nesting. However, references to nested labels do not list the extended nesting position. I have included an example below. Is this implementable? The difference between references to myEnumerate and enumerate labels.

\documentclass{article}
\usepackage{enumitem}
\setlistdepth{9}

\newlist{myEnumerate}{enumerate}{9}
\setlist[myEnumerate,1]{label=(\arabic*)}
\setlist[myEnumerate,2]{label=(\Roman*)}
\setlist[myEnumerate,3]{label=(\Alph*)}
\setlist[myEnumerate,4]{label=(\roman*)}
\setlist[myEnumerate,5]{label=(\alph*)}
\setlist[myEnumerate,6]{label=(\arabic*)}
\setlist[myEnumerate,7]{label=(\Roman*)}
\setlist[myEnumerate,8]{label=(\Alph*)}
\setlist[myEnumerate,9]{label=(\roman*)}

\begin{document}
\begin{myEnumerate}
\item 1st level
    \begin{myEnumerate}
    \item 2nd level
        \begin{myEnumerate}
        \item 3rd level
            \begin{myEnumerate}
            \item 4th level
                \begin{myEnumerate}
                \item 5th level
                    \begin{myEnumerate}
                    \item 6th level
                        \begin{myEnumerate}
                        \item 7th level
                            \begin{myEnumerate}
                            \item 8th level
                                \begin{myEnumerate}
                                    \item \label{9th level}9th level
                                \end{myEnumerate}
                            \end{myEnumerate}
                        \end{myEnumerate}
                    \end{myEnumerate}
                \end{myEnumerate}
            \end{myEnumerate}
        \end{myEnumerate}
    \end{myEnumerate}
\end{myEnumerate}
9th level is nested at position \ref{9th level}.

\begin{enumerate}
\item Level 1
    \begin{enumerate}
    \item Level 2
        \begin{enumerate}
        \item Level 3
            \begin{enumerate}
            \item\label{level 4} Level 4
            \end{enumerate}
        \end{enumerate}
    \end{enumerate}
\end{enumerate}
Level 4 is nested at \ref{level 4}.

\end{document}
11

You can use the ref key:

\documentclass{article}
\usepackage{enumitem}
\usepackage{pgffor}
\setlistdepth{9}

\newlist{myEnumerate}{enumerate}{9}
\setlist[myEnumerate,1]{label=(\arabic*)}
\setlist[myEnumerate,2]{label=(\Roman*),
  ref=\themyEnumeratei(\Roman*)}
\setlist[myEnumerate,3]{label=(\Alph*),
  ref=\themyEnumerateii(\Alph*)}
\setlist[myEnumerate,4]{label=(\roman*),
  ref=\themyEnumerateiii(\roman*)}
\setlist[myEnumerate,5]{label=(\alph*),
  ref=\themyEnumerateiv(\alph*)}
\setlist[myEnumerate,6]{label=(\arabic*),
  ref=\themyEnumeratev(\arabic*)}
\setlist[myEnumerate,7]{label=(\Roman*),
  ref=\themyEnumeratevi(\Roman*)}
\setlist[myEnumerate,8]{label=(\Alph*),
  ref=\themyEnumeratevii(\Alph*)}
\setlist[myEnumerate,9]{label=(\roman*),
  ref=\themyEnumerateviii(\roman*)}

\begin{document}

\noindent\foreach \level in {1,...,9}
  {Level number \level\ is nested at position \ref{\level level}\par\noindent}

\begin{myEnumerate}
\item 1st level\label{1level}
    \begin{myEnumerate}
    \item 2nd level\label{2level}
        \begin{myEnumerate}
        \item 3rd level\label{3level}
            \begin{myEnumerate}
            \item 4th level\label{4level}
                \begin{myEnumerate}
                \item 5th level\label{5level}
                    \begin{myEnumerate}
                    \item 6th level\label{6level}
                        \begin{myEnumerate}
                        \item 7th level\label{7level}
                            \begin{myEnumerate}
                            \item 8th level\label{8level}
                                \begin{myEnumerate}
                                    \item \label{9level}9th level
                                \end{myEnumerate}
                            \end{myEnumerate}
                        \end{myEnumerate}
                    \end{myEnumerate}
                \end{myEnumerate}
            \end{myEnumerate}
        \end{myEnumerate}
    \end{myEnumerate}
\end{myEnumerate}
9th level is nested at position \ref{9level}.

\begin{enumerate}
\item Level 1
    \begin{enumerate}
    \item Level 2
        \begin{enumerate}
        \item Level 3
            \begin{enumerate}
            \item\label{level 4} Level 4
            \end{enumerate}
        \end{enumerate}
    \end{enumerate}
\end{enumerate}
Level 4 is nested at \ref{level 4}.

\end{document}

enter image description here

However, this can be really confusing. Are you sure you want strings that long for cross-referencing?

1
  • Wonderful. Thank you. To answer your question, normally no - but sometimes it is the easiest and most intuitive route!
    – beethree
    Aug 6 '13 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.