# Color "item #"

Jerry Seibert jerry at seibercom.net
Wed Dec 22 13:21:28 CET 2021

On Tue, 21 Dec 2021 22:54:14 +0000, David Carlisle stated:
>
>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
>>
>\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

Thanks David, I had not considered that approach before. While I have
your attention, I do have one other quick question. I have used the
"soul" package to create text background colors. I can use the
"\hl{text}" command inside an enumerate listing; however, it can only
be used AFTER an "\item" command, ie

\begin{enumerate}
\item \hl{This is text with a yellow background}
\end{enumerate}

If I try to place the "\hl" command before the "\item" an error
message is issued.

Again, I can do it in MS Word, so I figure that there has to be a
relatively easy way to do it in LaTeX also. I am just not finding it.

--
Thanks!

Jerry