tags:

views:

808

answers:

5

I want to produce output something like this:

1. List item

2. Another list item

Paragraph of comments on list items 1 and 2.

3. Further item

4. Final item

I'm sure I've seen a nice way to interrupt and resume lists in this way (without explicitly setting some counter), but I can't reproduce it.

A: 

You can use newcounter and usecounter to get around this -- here's an example.

Mark Rushakoff
He asked for a way that does not include "explicitly setting some counter".
spatz
This doesn't use an **explicit** count -- he doesn't have to explicitly start at 3 after he breaks the list at 2 items.
Mark Rushakoff
+1  A: 
\documentclass{article}

\begin{document}

\begin{enumerate}
\item first;

\item second;
\end{enumerate}

This is a paragraph.


\begin{enumerate}
  \setcounter{enumi}{2}
\item third;

\item and so on...
\end{enumerate}
\end{document}

edit: as pointed out by Dervin Thunk, I hardcoded 2 here.

so, here's a solution that seems to work:

\documentclass{article}

\newcounter{tempcounter}

\begin{document}

\begin{enumerate}
\item first;

\item second;
  \setcounter{tempcounter}{\value{enumi}}
\end{enumerate}

This is a paragraph.


\begin{enumerate}
  \setcounter{enumi}{\value{tempcounter}}
\item third;

\item and so on...
\end{enumerate}
\end{document}
giorgian
Problem with this is that you're hardcoding the values... what happens if you add a 3rd item in he first enumerate? You wil have to change all other hardcaded vals... my 2 cents
Dervin Thunk
A: 

You use a special paralist package, which you declare in the document heading (under your documentclass declaration): \usepackage{paralist}. Then, within your paragraph, you enclose your inline list in \begin{inparaenum}...\end{inparaenum} source: http://happymutant.com/latex/

CommuSoft
Sorry, went a little bit too fast over the question, this isn't the answer
CommuSoft
+8  A: 

The TeX FAQ lists several ways of doing this. Read here for full details.

I've successfully used the mdwlist package (which is part of mdwtools) in my own documents. For example:

\documentclass{article}
\usepackage{mdwlist}

\begin{document}

\begin{enumerate}
\item List item
\item Another list item
\suspend{enumerate}

Paragraph of comments on list items 1 and 2.

\resume{enumerate}
\item Further item
\item Final item
\end{enumerate}

\end{document}

Thanks to Dervin Thunk for providing the FAQ link.

ChrisN
+1 since this is the only answer that answers the actual question (how to interrupt and resume lists without explicitly setting some counter).
las3rjock
@Dervin Thunk - I was going to remove my answer because the page you linked to described this and the other possibilities. I'll happily do this if you undelete. I didn't click to read the link - sorry.
ChrisN
Hi, Chris. No, your answer is more to the point. It should stay. But thanks for offer, I appreciate.
Dervin Thunk
And by the way, if you say you didn't read it, then that's enough for me.
Dervin Thunk
nice... i had no idea about this package :P
Mica
@Dervin Thunk: Please undelete your answer anyway. I found that link extremely helpful, and I think it contained the best answer to the question (I like the `enumitem` package way of interrupting a list a bit better than the `mdwlist` approach).
Anton Geraschenko
+3  A: 

I like enumitem for this sort of thing:

\documentclass{article}
\usepackage{enumitem}
\begin{document}

\begin{enumerate}
  \item List item
  \item Another list item
\end{enumerate}

Paragraph of comments on list items 1 and 2.

\begin{enumerate}[resume]
  \item Further item
  \item Final item
\end{enumerate}

\end{document}
Will Robertson