# Create \ref for nested enumitem \item without nesting in the output

Sorry the question is a bit awkward.

Basically I have nested \begin{enumerate} lists. I'd like something to appear like this:

1 Foo
1.1 Bar
1.1.1 Baz


But when I use this code:

\begin{enumerate}
\item Foo
\begin{enumerate}
\item Bar
\begin{enumerate}
\item Baz
\label{test}
\end{enumerate}
\end{enumerate}
\end{enumerate}


It appears like this:

1 Foo
1.1 Bar
1.1.1 Baz


When the nesting gets heavy, it ends up looking a lot uglier ("see subsection 3(d)iC"). Is there a way to just list the final nesting level? I've tried to simplify my code to make it a bit easier to read. Hopefully it doesn't confuse the issue.

• So you wish to keep the numbering of the enumerate, but only remove the hierarchy in the reference. Correct? May 3 '13 at 21:26
• Welcome to TeX.sx!
– mafp
May 3 '13 at 21:30
• May 3 '13 at 21:46

enumitem provides separate label and ref components to its lists. So, you could have a different representation of your reference to an item than the label that is set for that item. Here's an example:

\documentclass{article}
\usepackage{enumitem}% http://ctan.org/pkg/enumitem
\begin{document}
\begin{enumerate}[label=\arabic*]
\item Foo
\begin{enumerate}[label*=(\alph*)]
\item Bar
\begin{enumerate}[label*=\roman*,ref=\roman*]
\item Baz
\label{test}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document}


Although I've defined the list construction together with its usage, this can be performed globally. See section 5 Global settings (p 9) of the enumitem documentation.

This also interfaces seamlessly with hyperref.

• This appears to be what I'm looking for. I can get the specific labels to work as you showed in this example, but I can't seem to get the global settings working? For instance: \documentclass{article} \usepackage{enumitem} \setlist[enumerate]{label=\Roman} \begin{document} \begin{enumerate} \item Foo \item Bar \end{enumerate} \end{document} May 6 '13 at 15:22
• That shows a list with Arabic numerals instead of Roman numerals as I'd expect. May 6 '13 at 15:22
• I'm using version 2.2 of the enumitem package. Maybe that's the problem? That's what came with TeX Live for my Ubuntu distribution, but from the documentation it appears to be very old compared to the latest version. May 6 '13 at 15:29
• @aardvarkk: The distribution on Ubuntu is notoriously out-of-date and yes, I would think that the outdated version of the package is the problem (it should be 3.5.2). See How do I update my TeX distribution? and maybe Where do I place my own .sty files, to make them available to all my .tex files? (in a pinch). May 6 '13 at 15:34
• @aardvarkk Wow I was getting the same error. Google sent me to your comment. Thanks for replying with your solution! I have no idea how I missed that.
– Paul
Aug 26 '17 at 2:19

Please always post complete documents not just fragments. You can redefine the prefix used at each level of list to be empty.

\documentclass{article}
\makeatletter
\renewcommand\p@enumi{}
\renewcommand\p@enumii{}
\renewcommand\p@enumiii{}
\renewcommand\p@enumiv{}
\makeatother
\begin{document}

\begin{enumerate}
\item Foo
\begin{enumerate}
\item Bar