Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the numberings of nested lists in an Enumerate environment, in LaTeX

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?

like image 218
Andreas Grech Avatar asked Jan 12 '10 00:01

Andreas Grech


People also ask

How do I change enumerate in LaTeX?

If you like to change the appearance of the enumerator, the simplest way to change is to use the enumerate-package, giving you the possibility to optionally choose an enumerator. \begin {enumerate}[I] %for capital roman numbers. \begin {enumerate}[(a)] %for small alpha-characters within brackets.

How do I continue numbering in enumerate LaTeX?

The environment where this happens is called cenumerate-- as in, continuing to enumerate. To employ this environment at any level k in i, ii, iii or iv, just employ the command \renewcommand{outlinek}{cenumerate} before the start of your outline. Be warned, this will even continue to count across outlines!

How do I skip enumerate numbers in LaTeX?

You can also use \addtocounter{enumi}{2} (for example, in your particular case) to skip 2 items.

What is the difference between enumerate environment and itemize environment in LaTeX?

Using lists in LaTeX is pretty straightforward and doesn't require you do add any additional packages. For unordered lists, LaTeX provides the itemize environment and for ordered lists there is the enumerate environment. The elements within both environments have to be declared beginning with the \item command.


2 Answers

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 :-)

like image 195
Norman Ramsey Avatar answered Sep 30 '22 06:09

Norman Ramsey


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.

like image 23
Charles Stewart Avatar answered Sep 30 '22 06:09

Charles Stewart