1

I don't know the right terminology, but what I am looking for is this: say I write

\begin{enumerate}[(1)]
\setcounter{enumi}{-1}
\item blabla
\item $x - 3 = 0 \iff x = 3$
\item The End.
\end{enumerate}

The output would be like

(1) blabla

(2) $x - 3 = 0 \iff x = 3$

(3) The End

Is there a way to have ONLY the numbers indicators coloured (I call them indicators because if I start nesting the enumerates, they change with letters, then with $i$ and so on...)?

Something like

\color{red}{(1)} blabla

\color{red}{(2)} $x - 3 = 0 \iff x = 3$

\color{red}{(3)} The End

Thank you! (Seems like here colors don't work, but you perhaps understand what I wish for).

ADD

I tried to use this code

\usepackage{enumitem, xcolor}
\setlist[enumerate]{label=\color{red}\arabic*.}
\setlist[itemize]{label=\color{blue}\textbullet}

\begin{document}
\section*{enumerate}
\begin{enumerate}
\item test
\item test
\end{enumerate}

\section*{itemize}
\begin{itemize}
\item test
\item test
\end{itemize}

\end{document}

From this question: Enumitem: global color modification of (possibly nested) list labels

But it doesn't work.

ADD 2

The problems lie in the contrast between

\usepackage{enumerate}
\usepackage{enumitem}

With the first one it's all ok, I can use

\begin{enumerate}[(1)]

and other "styles" (like using [a] or [i]), but this turns into errors if I switch to ENUMITEM.

On the contrary, with ENUMITEM I can have the labels coloured but I cannot have the styles of the labels.

Yet the part

\setlist[enumerate]{label=\color{red}\arabic*.}
\setlist[itemize]{label=\color{blue}\textbullet}

returns error if I use ENUMERATE.

3
  • Please add a documentclass to your code. Some classes have build in mechanism to colour the itemize item. Oct 2 at 20:46
  • Don't load enumitem and enumerate simultaneously.
    – Mico
    Oct 3 at 0:53
  • @Mico Yes that I got myself too. The problem has anyway been solved, thanks.
    – Henry
    Oct 3 at 18:36

1 Answer 1

2

Something like this?

\documentclass{article}
\usepackage[shortlabels]{enumitem}
\usepackage{xcolor}
\setlist[enumerate]{label=\textcolor{red}{(\arabic*)}}
\setlist[itemize]{label=\textcolor{blue}{\textbullet}}

\begin{document}

\section*{enumerate}
\begin{enumerate}
\item test
\item test
\end{enumerate}

Changing the label with \texttt{enumitem}'s syntax:
\begin{enumerate}[label=\textcolor{green}{\alph*}]
\item test
\item test
\end{enumerate}

Changing the label with \texttt{enumerate}'s syntax:
\begin{enumerate}[\color{purple}(a)]
\item test
\item test
\end{enumerate}

\section*{itemize}
\begin{itemize}
\item test
\item test
\end{itemize}

\end{document}
5
  • Soo, this works, so thank you! But the problems remain if I wish to use, for example, \begin{enumerate}[a] it returns an error
    – Henry
    Oct 2 at 20:11
  • 1
    @Henry Yes, this will fail because you're trying to use the syntax from the package enumerate with enumitem. In general, enumitem has the option shortlabels to make it accept enumerate's syntax, but unfortunately I don't think it would be possible to use this short syntax while still changing the color. If you want to change the appearance of the counter, you'd have to use enumitem's syntax. I can add another example if that's helpful.
    – Vincent
    Oct 2 at 20:18
  • Some examples with the shotlabels option would be amazing, thank you! And thank you again for the detailed explanation!
    – Henry
    Oct 2 at 20:30
  • 1
    @Henry I added two more examples to show how to change labels: one with enumitem's syntax and one with enumerate's (which is what enumitem's shortlabels option is for). And in fact I was mistaken, it does work to change the color with enumerate's syntax.
    – Vincent
    Oct 2 at 20:39
  • Wonderful!! Thank you so much!!
    – Henry
    Oct 2 at 21:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .