# Question about enumitem, suspend/resume enumeration, last item of list, nested list

How do I suspend / resume an item of a list, multiple levels, if it is the last item of the list?

\documentclass{article}

\usepackage{enumitem}

\begin{document}
\begin{enumerate}
\item first level
\begin{enumerate}
\item second level
\begin{enumerate}
\item third level
\begin{enumerate}
\item fourth level

Text outside of enumerate
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document}


Specifically, how do I move "Text outside of enumerate" outside one level (equal to the third level), outside two levels (equal to the second level), outside three levels (equal to the first level)?

I am unable to simply enclose "Text outside of enumerate" inside a \end{enumerate} and \begin{enumerate}[resume] because there are issues with starting an enumerate environment and then immediately ending it without any items.

I have also investigated the usage of \item[]. If I try using it at the end of the list, it appears a blank vertical line is produced, similar to \phantom but with a vertical blank line.

-
I should have included some more description in my question. There are two points I should make: first, the item to be outside of the numeration may not be the last item in the list. If it is not, then 1 level of suspension can be done by using \end{enumerate}, \begin{enumerate}[resume]. Second, the enumeration levels may change from time to time. Therefore, it may not be known whether to manually change the indentation one 'level' to the left, two 'levels', and so on. Note that it appears the answer I accepted may not work under the second situation. –  jrand Sep 5 '12 at 6:26

I am not sure if this is what you want:

\documentclass{article}

\usepackage{enumitem}

\begin{document}

\begin{enumerate}
\item first level
\begin{enumerate}
\item second level
\begin{enumerate}
\item third level

\begin{enumerate}
\item fourth level

\hspace*{\dimexpr-\leftmargini+\labelsep-\labelwidth\relax}
Text outside of enumerate

\hspace*{\dimexpr-\leftmargini-\leftmarginii+\labelsep-\labelwidth\relax}
Text outside of enumerate

\hspace*{\dimexpr-\leftmargini-\leftmarginii-\leftmarginiii+\labelsep-\labelwidth\relax}
Text outside of enumerate
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}

\end{document}


-
Yes, the output is visually exactly what I was trying to produce. The context for my question was I had code sample from listings, and I wanted to squeeze as much code as possible without too many linebreaks (I'm in a multi-column environment). –  jrand Sep 4 '12 at 23:08

Perhaps I am misunderstanding the requirements, but can't you just move the text outside of the enumerate environment:

## Notes:

• I added \setlist[enumerate]{align=left} to make it clearer that the text is aligned with the label.

## Code:

\documentclass{article}

\usepackage{enumitem}
\setlist[enumerate]{align=left}%

\begin{document}
\begin{enumerate}
\item first level
\begin{enumerate}
\item second level
\begin{enumerate}
\item third level
\begin{enumerate}
\item fourth level
\end{enumerate}
Text outside of enumerate
\end{enumerate}
Text outside of enumerate
\end{enumerate}
Text outside of enumerate
\end{enumerate}
\end{document}

-

your question is difficult to understand. if you like to the sentence in your example out of enumeration, than just put this sentence after enumeration.

in case, that this sentence is somewhere middle of enumeration in like to have, that after it enumeration continue to with enumeration, then for such a task is useful package mdwlist:

\documentclass{article}
\usepackage{mdwlist}

\begin{document}
\begin{enumerate}
\item first item
\item second item
\item third item
\suspend{enumerate}
Text outside of enumerate
\resume{enumerate}
\item fourth item
\item fifth item
\end{enumerate}
\end{enumerate}
\end{document}


on above principle you can suspend enumerate list inside of an enumeration.

-