[Tex/LaTex] Hanging indent inside list

#enumerateindentationlists

I would like items in a list to have a hanging indent (that is, for all lines after the first to be indented by a space or more), but the traditional \hangindent command doesn't work for this.

\documentclass{article}

\begin{document}
\hangindent=1cm This line of text has a hanging indent that looks fine, as long as it is outside a list environment.
\begin{enumerate}
\item \hangindent=1cm This line is inside a list environment and doesn't have a hanging indent- how can I add one?
\end{enumerate}
\end{document}

enter image description here

How can I add a hanging indent within a list?

Best Answer

You can use the enumitem package:

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}% just to generate text for the example

\begin{document}

\begin{enumerate}[leftmargin=!,labelindent=5pt,itemindent=-15pt]
\item \lipsum[4]
\item \lipsum[4]
\end{enumerate}

\end{document}

enter image description here

Another option, not requiring packages would be to use the TeX primitive \parshape:

\documentclass{article}
\usepackage{lipsum}

\newlength\listindent
\setlength\listindent{20pt}

\begin{document}

\begin{enumerate}
\parshape 2 0cm \linewidth \listindent \dimexpr\linewidth-\listindent\relax
\item \lipsum[4]
\item \lipsum[4]
\end{enumerate}

\end{document}

enter image description here