views:

472

answers:

3

I want to produce the following in LaTeX:

1. Item
    2. Item
    3a. Item
    3b. Item
    4. Item
5. Item

Basically I have already tried using nested enumerate environments, but I have a problem with implementing the different numberings.

How can I do the above in LaTeX?

+1  A: 
\renewcommand{\labelenumi}{\Roman{enumi}.}
\renewcommand{\labelenumii}{\Roman{enumi}. \alph{enumii}}

\noindent Here's my list:

\begin{enumerate}
\item Item 1.
\begin{enumerate}
\item List 2, Item 1
\item List 2, Item 2
\end{enumerate}
\item Item 2.
\item Item 3.
\end{enumerate}

Then change the \Roman in the renewcommand to whatever you want it to be: \alph or \arabic

Mica
+1: It doesn't really answer the question -there should be a second env that reuses the first counter, and the innermost env should be indented as this second env, but I based my code on it, so it was useful to me.
Charles Stewart
+3  A: 

The purpose of the {enumerate} environment is to number things algorithmically. If you really want the numbers to appear as shown in your question, I can't identify what algorithm you want to be used. For the example you show, I think the easiest method is just to program the labels yourself instead of trying to program LaTeX to do it. I would just do it this way:

\begin{itemize}
\item[1.]  Item
   \begin{itemize}
    \item[2.  ] Item
    \item[3a. ] Item
    \item[3b. ] Item
    \item[4.  ] Item
   \end{itemize}
\item [5. ] Item
\end{itemize}

With LaTeX, the quickest path to a solution often involves brute force :-)

Norman Ramsey
Lightweight :->
Charles Stewart
+1  A: 

Quick and dirty:

\documentclass{article}
\begin{document}

\renewcommand{\labelenumii}{\addtocounter{enumi}{1}\arabic{enumi}}
%% Second list uses first counter

\def\startenumtuple{\setcounter{enumii}{1}\addtocounter{enumi}{1}
  \renewcommand{\labelenumii}{\arabic{enumi}.\alph{enumii}}}
\def\endenumtuple{
  \renewcommand{\labelenumii}{\addtocounter{enumi}{1}\arabic{enumi}}}

\noindent Here's my list:

\begin{enumerate}
\item Item
\begin{enumerate}
\item Item
\startenumtuple
\item Item
\item Item
\endenumtuple
\item Item
\item Item
\end{enumerate}
\item Item
\end{enumerate}
\end{document}

(Mica's version was used in the first iteration of this code)

The right way involves defining environments based on enumerate that do the right thing with the counters: the above code would need tweaking to get it to work right if you wanted to change the nesting of the list environments.

Charles Stewart