# Automated format in a nested enumerate environment

I have to do a small document, in which I intend to use Tufte-handout rather than article or Scrartcl classes and compile it with XeLaTeX with a typography I intend to use.

However I have a difficulty with the format, I have to use the enumerate environment nested in three levels with the following characteristics:

1. The item marker appears in color (red), for this I think I can load the xcolor package before \documentclass to \PassOptionToPackage or something like that. But I don't know how to define it automatically for each item.
2. The method of numbering the list, I need to appear as:

1

1.1

1.1.1

and not:

1.
(a)
i.


as default.

Finally I think this is the most difficult (or I don't know how to achieve it) and it's the format of each level of nesting:

• 1st level item: in roman letter (default value)
• 2nd level item: in small caps (and sometimes in small italic caps). The font I chose can achieve it without problems.
• 3rd level item: in italics but without using \emph{} I've already used and I don't think it's the best choice.

Any idea how to do this? I can do it manually but as it is a fairly long list because it would prefer to automate in the preamble.

## Update

Well, after the suggestion of use enumitem I triead with good results. The suggestion is in the code below as a MWE, it is:

\PassOptionsToPackage{usenames,dvipsnames,table}{xcolor}
\documentclass[]{tufte-handout}
%\usepackage[spanish]{babel}
\usepackage{enumitem}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont{Warnock Pro}
\renewcommand{\theenumii}{\arabic{enumii}}
\renewcommand{\labelenumii}{\theenumii.}
\renewcommand{\theenumii}{\arabic{enumii}}
\renewcommand{\labelenumii}{\theenumi . \theenumii.}
\renewcommand{\theenumiii}{\arabic{enumiii}}
\renewcommand{\labelenumiii}{
\theenumi . \theenumii . \theenumiii.}
\begin{document}
\begin{enumerate}
\item[\textcolor{red}{1}] This is a first level item
\begin{enumerate}
\item \textsc{This is a second level item}
\begin{enumerate}
\item \textit{This is a third level item}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document}


It works, now I need to add color to the label of the first level, and automate the format of the content as I described before.

• I think package enumitem comes to help here. But do you really want the same thing once with a period (1.1) and a level higher up with out a period (1)? Apr 10, 2015 at 18:46
• Well, the period is a kind of marker of level. I don't need a final period in any level, so in this case will be: 1 and later 1.1 and the deepest level 1.1.1 Apr 10, 2015 at 20:11
• I don't understand what the level of nesting is. That is not the same as the levels of the enumerate environment, which are nested. So what is that for?
– cfr
Apr 10, 2015 at 22:27
• Are we talking about the number format or the format of contents?
– user11232
Apr 10, 2015 at 23:34
• That code doesn't make use of enumitem at all, by the way. You might as well not load it if you do it that way.
– cfr
Apr 11, 2015 at 2:30

enumitem offers specialised ways to customise lists which was why it was recommended in this case. If you look at the documentation, you'll appreciate that the point is to abstract away from the need to use the lower level LaTeX list configuration macros.

The following example shows one way. I very much doubt I have Warnock Pro so I created a MWE sans the fancy font stuff. Hence, this example uses the default Computer Modern.

\PassOptionsToPackage{usenames,dvipsnames,table}{xcolor}
\documentclass{tufte-handout}
\usepackage{enumitem}
\setlist[enumerate]{label*=.\arabic*, after=\normalfont}
\setlist[enumerate,1]{label=\arabic*, font=\normalfont\color{red}}
\setlist[enumerate,2]{before=\normalfont\scshape}
\setlist[enumerate,3]{font=\normalfont\upshape, before=\normalfont\itshape}
\begin{document}
\begin{enumerate}
\item This is a first level item
\begin{enumerate}
\item This is a second level item
\begin{enumerate}
\item This is a third level item
\end{enumerate}
\end{enumerate}
\end{enumerate}
abc
\end{document}


• Great!!! That's exactly what I need. Very nice example. Bow I need to automate also the format of each item according to its level within. Apr 11, 2015 at 6:32
• @Aradnix I have no idea what you mean. This formats the content of each item according to level as specified in your question. I'm not sure what the further formatting you want consists of.
– cfr
Apr 11, 2015 at 14:49
• @Aradnix Yes. enumitem is great!
– cfr
Apr 12, 2015 at 12:14
• @Aradnix You could try adding \upshape to the font= for that level, which affects only the label.
– cfr
Apr 12, 2015 at 19:31
• @Aradnix font= not label=.
– cfr
Apr 13, 2015 at 15:50