# Indenting multi-line list items in an enumeration

I have an enumeration environment in my LaTeX document consisting of several numbered steps. Now I need to indent some of these steps. I am using the following command to achieve this indentation for one item:

{\setlength\itemindent{2cm}
\item Some item text...
}


It works for short item texts, but in the case of longer texts that lead to line breaks, the subsequent lines are not indented. See the following LaTeX code for an example:

\begin{enumerate}
\item This is a normal item without any indentation.
{\setlength\itemindent{2cm}
\item This is an indented item with a long text that causes a line break. Unfortunately, the new line is not indented.
}
\item This is a normal item without any indentation.
\end{enumerate}


(Unfortunately I am not allowed to post an image of the output as I'm a new user...)

The first line of the second item is indented by 2cm, but all subsequent lines are not. Can anyone give me a hint on how to get the subsequent lines indented, too?

As ErikYou suggests, one normally would nest an enumerated list within an enumerated list to get this effect. However, in your case, this would in effect start a new list with its own counter. So, I would suggest you use the IndentedEnumerate environment defined below which starts the nested list so that its enumeration continues on from the previous list and yields:

## Notes:

• This is only set up for one level of nesting -- It will need further enhancements if more than one level of nesting if desired.
• If the first item is to be indented, you need to add \item[] before starting the IndentedEnumerate environment.
• If you wish this to work without the enumitem package package, the only tweaks necessary should be to modify how the label is specified for the indented list.
• The showframe package was used just to show the page margins.

## Code:

\documentclass{article}
\usepackage{showframe}
\usepackage{enumitem}

\newcounter{ListStartCount}%
\newenvironment{IndentedEnumerate}[1][]{%
\setcounter{ListStartCount}{\theenumi}%
\stepcounter{ListStartCount}%
\begin{enumerate}[start=\theListStartCount,label={\arabic*.},#1]%
}{%
\setcounter{enumi}{\theListStartCount}%
\end{enumerate}%
}%

\begin{document}
\begin{enumerate}
\item[]
\begin{IndentedEnumerate}
\item This is the frist item with indentation, so need \verb|\item[]| before this.
\end{IndentedEnumerate}
\item This is a normal item without any indentation.
%
\begin{IndentedEnumerate}
\item This is an indented item with a long text that causes a line break. Now, the enumeration is continued and the new line is indented.
\end{IndentedEnumerate}
%
\item This is a normal item without any indentation.
\end{enumerate}
\end{document}

• Works like a charm, thanks! However, there's one special case that doesn't work yet. Sometimes, the indented enumeration has to be the first "item" in the outer enumeration. In that case, the compiler returns an error message stating something's wrong--perhaps a missing item - I guess the outer \theenumi hasn't been initialized. How do I get this case to work? I guess I could just add \setcounter{enumi}{1} to the beginning of each outer enum, but there's probably a nicer way handling this in the environment definition... Jul 3 '12 at 21:12
• @MichaelB: For the first item you need to add \item[]. Have updated the solution to show that. Jul 3 '12 at 21:27
• That did the trick, now everything works as expected, thank you so much! :) Jul 3 '12 at 21:43

enumitem provided the resume. This allows one to terminate a list and restart it with the same counter, perhaps with a different layout configuration. Here's a brief example, duplicating Peter's answer:

\documentclass{article}
\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage{enumitem}% http://ctan.org/pkg/enumitem
\newcommand{\modifyenum}[1]{%
\end{enumerate}
\begin{enumerate}[resume,#1]
}
\begin{document}
\begin{enumerate}[leftmargin=2cm]
\item This is the first item with indentation.
\modifyenum{leftmargin=1cm}
\item This is a normal item with a \verb|1cm| indentation.
\modifyenum{leftmargin=2cm}
\item This is an indented item with a long text that causes a line break. Now, the enumeration is continued and the new line is indented.
\modifyenum{leftmargin=1cm}
\item This is a normal item with a \verb|1cm| indentation.
\modifyenum{resume,leftmargin=*}
\item Here is a normal flush-left item.
\item Here is a normal flush-left item.
\item Here is a normal flush-left item.
\end{enumerate}
\end{document}


The above MWE uses \modifyenum{<new list configuration>} to terminate the existing enumerate list and restart it with any new list preferences using resume.

showframe merely highlights the text block boundary and is not needed otherwise.