# Define a colour enumeration

The following code is very interesting as it adds an asterisk beside an enumeration.

\documentclass{article}
\usepackage{enumitem}
%%%%%%%%%%%%%%%%%%%%%%%%
%% CODE thanks to egreg
%%%%%%%%%%%%%%%%%%%%%%%
\setlist[enumerate]{before=\setupmodenumerate}

\newif\ifmoditem
\newcommand{\setupmodenumerate}{%
\global\moditemfalse
\let\origmakelabel\makelabel
\def\moditem##1{\global\moditemtrue\def\mesymbol{##1}\item}%
\def\makelabel##1{%
\origmakelabel{\ifmoditem\llap{\mesymbol\enspace}\fi##1}%
\global\moditemfalse}%
}

\begin{document}
\begin{enumerate}
\moditem{*} test
\end{enumerate}
\end{document}


This yields:

My question is:

"How can I create a similar modded item, say \citem, that colours the enumeration?"

A similar code or using the idea as above would be great. Note that the colouring (what the user wishes to be) must be to selective items and not the entire set of enumeration.

UPDATE: So looking at the links above I thought I had the solution as the code;

\newcommand{\myitem}{\refstepcounter{enumi}\item[\color{red}{\theenumi.}]}


sheds some light, but it does not respect enumeration within enumeration. Hmmmmmm???

This is given by

\begin{enumerate}
\myitem
\moditem{*} test
\myitem
\myitem Test test test
\begin{enumerate}
\item
\item
\item
\myitem
\end{enumerate}
\end{enumerate}

-
That's actually quite hard as (unlike the asterisk) you need to locate the end of the item which isn't so easy with the standard latex list markup. You could look at the solutions for tex.stackexchange.com/questions/70436/… and use colour rather than parenthesis, although an alternative to locating the end would be to use \color every item, setting to black in the default case. –  David Carlisle Sep 27 '12 at 15:59
and David Carlisle's link also points to tex.stackexchange.com/questions/52715/… –  cmhughes Sep 27 '12 at 16:00

Just change the macros to use color:

\documentclass{article}
\usepackage{enumitem,color}

\setlist[enumerate]{before=\setupmodenumerate}

\newif\ifcitem
\newcommand{\setupmodenumerate}{%
\global\citemfalse
\let\origmakelabel\makelabel
\def\citem##1{\global\citemtrue\def\cecolor{##1}\item}%
\def\makelabel##1{%
\origmakelabel{\ifcitem\color{\cecolor}\fi##1}%
\global\citemfalse}%
}

\begin{document}
\begin{enumerate}
\item
\citem{red} test
\item
\item Test test test
\begin{enumerate}
\item
\citem{green}
\item
\item
\end{enumerate}
\end{enumerate}
\end{document}


-
Yes, I figured it out after playing around with your code. Just couldn't post an answer. –  azetina Sep 27 '12 at 19:27