Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Your diagnosis is correct: \parshape, which is issued by \item, overrides any \hangindent setting. You can use the enumitem package; adjust 1em to what you prefer.

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}

\begin{document}

\lipsum*[2]
\begin{enumerate}[
  leftmargin=\dimexpr\leftmargini+1em\relax,
  labelindent=-1em,
  listparindent=-1em,
  itemindent=-1em
]
\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}

\begin{enumerate}
\item Test
\end{enumerate}

\end{document}

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.

enter image description here

If you need it in nested lists, I suggest to define a new environment:

\makeatletter
\newenvironment{enumeratehang}
  {\enumerate[
    leftmargin=\dimexpr\csname leftmargin\romannumeral\@enumdepth\endcsname+1em\relax,
    labelindent=-1em,
    listparindent=-1em,
    itemindent=-1em
   ]}
  {\endenumerate}
\makeatother

This will allow you to use \begin{enumeratehang} and will work also nested with other enumeratehang (or also enumerate) environments.

For nested environments, we have to use the correct left margin; the counter \@enumdepth stores the nesting level, so \romannumeral\@enumdepth will produce i, 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.

share|improve this answer
    
If I put \newenvironment{enumeratehang}{\begin{enumerate}[leftmargin=\dimexpr\leftmargin‌​i+1em\relax,labelindent=-1em,listparindent=-1em,itemindent=-1em]}{\end{enumerate}‌​}, then \begin{enumeratehang} \item \begin{enumeratehang} \item Test1 \item Test2 \end{enumeratehang} \end{enumeratehang} does not work (Test2 is indented too much). –  cubetwo1729 Dec 15 '12 at 18:28
    
This is good only at first nesting level. I'll try a workaround for nested lists. –  egreg Dec 15 '12 at 18:39
    
@egreg Why is this command needed? \dimexpr\csname leftmargin\romannumeral\the\@enumdepth\endcsname+1em\relax –  NVaughan Dec 18 '12 at 15:43
2  
@NVaughan It expands to the correct length, depending on the nesting depth: \leftmargini+1em for first level, \leftmarginii+1em for second level, and so on. I'll add something to my answer. –  egreg Dec 18 '12 at 17:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.