2
\begin{enumerate}
\item 1
\item[red] 2
\end{enumerate}

For itemize I could use \item[\textcolor{red}{--}] or something, but for enumerate that does not really work.

I already tried [\textcolor{red}{\arabic{enumi}}] - which oddly started with 1 again [\textcolor{red}{\value{enumi}}] - which resulted in a pdflatex error [\textcolor{red}{\theenumi}] - which printed the (custom) ref= for that entry - and also counted from 1 on

Mico
  • 506,678
weltio
  • 145
  • You can adapt the answers to this question: https://tex.stackexchange.com/q/167454/231952. For example, in the first answer by @egreg, replace the first * with \color{red} (and adjust the open paren) – Ivan Jun 10 '21 at 17:15

1 Answers1

5

The following method works with or without the enumitem package being loaded, and it works for both enumerate and itemize environments.

Observe that the macro \myitem is set up to take one optional argument, and that the default value of the optional argument is red. Thus, \myitem will create an item number that's red, while \myitem[blue] will create an item number that's -- you guessed right -- blue.

enter image description here

\documentclass{article}
\usepackage{xcolor}
\newcommand\myitem[1][red]{\color{#1}\item\color{black}}

\begin{document} \begin{enumerate} \item A \myitem B \myitem[blue] C \item D \end{enumerate} \end{document}

Mico
  • 506,678
  • 1
    thanks, I also came up that idea. Is there a latexway to define a makro or so? like "\reditem" "\blueitem" or even better: \myitem[red] – weltio Jun 11 '21 at 17:22
  • @weltio - I'll edit my answer to show how to set up a macro called \myitem that takes an optional argument, with the default value of the optional argument being red. – Mico Jun 11 '21 at 17:40
  • 1
    @Mico Do you think that this question is it a duplicate of this? https://tex.stackexchange.com/questions/155968/make-enumerate-numbering-different-colours – Sebastiano Jun 11 '21 at 20:02
  • 1
    @Sebastiano - I don't think so. The earlier question required an automatic cycling thru a list of colors; this one does not. – Mico Jun 11 '21 at 20:10
  • @Mico Surely is my low level for English language. Very often I find that I don't understand what the user is asking for. – Sebastiano Jun 11 '21 at 21:02