Color "item #"

David Carlisle d.p.carlisle at gmail.com
Tue Dec 21 23:54:14 CET 2021


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

\begin{document}
\colorlet{labelcolor}{black}
\begin{enumerate}[label=\textcolor{labelcolor}{(\arabic*) }]
\item aaa
\colorlet{labelcolor}{red}\item bbb
\colorlet{labelcolor}{green}\item ccc
\end{enumerate}
\end{document}

David


On Tue, 21 Dec 2021 at 22:44, Jerry Seibert <jerry at seibercom.net> wrote:

> On Tue, 21 Dec 2021 21:39:12 +0000, David Carlisle stated:
>
> >On Tue, 21 Dec 2021 at 20:56, Jerry Seibert <jerry at seibercom.net>
> >wrote:
> >
> >> I am using the "enumitem" package to create lists used in reports I
> >> generate. My supervisor wants me to have the item number or letter
> >> in a different color from the item's text. For instance, in the
> >> following example, the "(1)" would be in blue and the text in black.
> >>
> >>         (1) This is item one.
> >>
> >> I cannot find a way to accomplish this easily. Is there something I
> >> am missing here or is it just not feasible? My supervisor is
> >> insisting on it because he can do exactly that in MS Word.
>
> >\documentclass{article}
> >\usepackage{enumitem,xcolor}
> >
> >\begin{document}
> >
> >\begin{enumerate}[label=\textcolor{blue}{(\arabic*) }]
> >\item aaa
> >\item bbb
> >\item ccc
> >\end{enumerate}
> >\end{document}
> >
> >David
>
> Dave, that works if I want to change every item in the list to the same
> color. I was looking for a method to change different items to
> different colors in the same list. I have seen examples of how to do it
> with itemized lists, but not numbered or lettered lists.
>
> --
> Jerry
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20211221/3d6b88e7/attachment.html>


More information about the texhax mailing list.