I want to create an automatic itemize environment where the item's color font is alternating.

Suposing the following list:

   \item A
   \item B
   \item C
   \item D
   \item E

I want a code to A, C, and E have color #1 and B and D, color #2.

Yes, I know I can create an alternative \item command (\coloreditem or something such that), but I am asking for an automated way. So, if I insert on the fly a new item between other two items of that list, I do not need to (manually) change the color scheme of every item after the new one.


Like this?





enter image description here

  • Good choice of colors :) – Marijn Mar 16 '18 at 15:50
  • @Marijn you too :) – Skillmon Mar 16 '18 at 15:51
  • 2
    I did not know the duckuments package. Funnier than lipsum ;) – Fabiano Fagundes Mar 16 '18 at 16:24
  • @FabianoFagundes no wonder you didn't know, I pushed it to CTAN only a few days ago :) – Skillmon Mar 16 '18 at 16:25
  • This is ducking clever! – FeRD Mar 17 '18 at 8:26

You can add a custom macro before each \item with the xpatch package. In the example below the \choosecolor macro is defined which alternates the color using a toggle.



\item first item
\item second item
\item third item
Text after itemize


enter image description here

  • So, in your example, how I am sure that every new itemize list starts with tcolor=true? I think the tcolor toggle does not reset automatically after each itemize list. EDIT: Nevermind, I just tested and works very fine, reseting the toggle. Thanks :) – Fabiano Fagundes Mar 16 '18 at 16:37
  • In my nature I always thank from the heart those who help with the heart Sebastiano. – Sebastiano Sep 7 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.