I would like to have a hanging indent within the paragraph of an enumerate item. I have the following:
\begin{document}
\begin{enumerate}
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id diam id ante ullamcorper vestibulum eu non nisl. Curabitur interdum laoreet massa, eu eleifend risus placerat nec. Suspendisse potenti.
Mauris nunc risus, congue id sollicitudin id, sagittis quis elit. Proin blandit, orci vitae vehicula faucibus, est leo facilisis ante, quis venenatis mi dolor ut tellus.
\item Integer aliquam mollis lacus, in fermentum tellus pharetra eget. Donec suscipit condimentum tincidunt. Mauris odio felis, ultricies non lobortis non, suscipit in magna.
Nam venenatis dolor turpis. Mauris fermentum, est ac dapibus accumsan, lorem orci vulputate nunc, quis laoreet augue elit pulvinar dui. Curabitur eu enim quis dolor interdum vehicula eget vitae ipsum.
\end{enumerate}
\end{document}
This outputs:
I would like for it to output:
However, \hangindent
does not seem to work within the \item
of an enumerate
environment because \item
uses \parshape
, which overrides \hangindent
.
How can I achieve this?
Best Answer
Your diagnosis is correct:
\parshape
, which is issued by\item
, overrides any\hangindent
setting. You can use theenumitem
package; adjust1em
to what you prefer.I added another
enumerate
environment in order to show that the label placement is the same and a\lipsum
paragraph for showing the global aspect.If you need it in nested lists, I suggest to define a new environment:
This will allow you to use
\begin{enumeratehang}
and will work also nested with otherenumeratehang
(or alsoenumerate
) environments.For nested environments, we have to use the correct left margin; the counter
\@enumdepth
stores the nesting level, so\romannumeral\@enumdepth
will producei
,ii
,iii
, and so on; thus the\csname
construction will give\leftmargini
,\leftmarginii
and so on, which are the length parameters where LaTeX stores the left margin at the various nesting levels. To those we add 1em, consistent with the simple example given at the beginning.