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'm using the enumerate environment to make a numbered list. I want to write a paragraph that serves as information for the next items. I want to remove the indent on this paragraph of text, so that it is indented just as much as the numbers in the list. How do I do this?

This is in essence what I've done. I've tried using \noindent, but without success.

\documentclass{book}

\begin{document}
\section*{Exercises}

Here are some exercises.

\begin{enumerate}
    \item This is the first exercise.
    \item This is the second exercise.

    Here is some information to answer the questions below. This paragraph
    should be indented just as much as the numbers in the list are.

    \item This is the third exercise.
    \item This is the fourth exercise.
\end{enumerate}
\end{document}

The output is:

enter image description here

share|improve this question
2  
possible duplicate of Resuming a list –  mvkorpel Jul 3 at 12:14
2  
In my opinion, it is not a duplicate, because of the condition "This paragraph should be indented just as much as the numbers in the list are.". –  T. Verron Jul 3 at 12:57
    
@T.Verron I agree. I was too hasty. –  mvkorpel Jul 3 at 13:05
2  
Thanks for the link, @mvkorpel. It partly solved my problem. However, as @T.Verron pointed out, I want the paragraph of text to be aligned with the numbers, not the section heading. I just used \hspace to shift it to the right place, but I'd really like to know of a better way. –  vedadh Jul 3 at 13:07
    
Good question. Upvoted. –  mvkorpel Jul 3 at 14:40

1 Answer 1

up vote 5 down vote accepted

Here is a solution that uses the enumitem package: it has resume optional parameter and a series notion for enumerate environments. So I define a quest series, and an inform series, that are formatted so that the inform series leftmargin is exactly where labels of the quest series begin.

The information could be made of several paragraphs. I don't know if you want those after the first one to be indented. In my code they are; if you do not want this indentation, just remove listparindent=\parindent.

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{enumitem}

\begin{document}
\section*{Exercises}

Here are some exercises. Here are some exercises. Here are some exercises. Here are some exercises. Here are some exercises.

\begin{enumerate}[labelindent =\parindent, align = left, labelwidth =1em, leftmargin =! , labelsep =0.2 em, series = quest]
    \item This is the first exercise. Quite a very very long exercise, with many questions and many more subquestions.
    \item This is the second exercise.
\end{enumerate}

\begin{enumerate}[series = inform, leftmargin =\parindent, labelwidth =0pt, listparindent = \parindent]
\item[] Here is some information to answer the questions below. This paragraph
    is indented just as much as the numbers in the list are.

    Here is another information to answer the questions below. This paragraph is indented just as much as the numbers in the list are.
\end{enumerate}

\begin{enumerate}[resume* = quest]%
    \item This is the third exercise.
    \item This is the fourth exercise.
\end{enumerate}

\begin{enumerate}[resume*= inform]
\item[] Here is some more information to answer further questions below. This paragraph
    is indented just as much as the numbers in the list are.
\end{enumerate}

\end{document} 

enter image description here

share|improve this answer
    
Great solution, thank you. This solved my problem. If you don't mind telling me; what does the asterisk in resume* do? I tried removing it and noticed the number labels after the paragraph are no longer aligned with the ones before the paragraph, but I don't understand why. –  vedadh Jul 3 at 15:51
    
It uses the previous enumerate parameters (in the same series), while without a star it only uses the same counter and the default parameters. All this is explained in §§ 3.4, 3.5 of the documentation. –  Bernard Jul 3 at 16:08
    
I'm sorry about the nitpicking. One thing I noticed is that the indentation of the numbered items in these lists are different from what I have in other similar chapters, because here we explicitly set labelindent=\parindent,instead of leaving it at the default value. Is there any way to let the indentation of quest stay on the default value, and assign this value to leftmargin in inform? That way the indentation across chapters would be consistent. –  vedadh Jul 3 at 16:34
    
I'll try to think it over, but I see a problem: my solution is rather simple, mainly because I set align=left for the quest series. But the default is align=right, and the "real" labels may have varying width, so that they only end at a fixed place. It's quite visible with roman enumerations. –  Bernard Jul 3 at 16:52

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.