Translate numbers from 0 to 9 into color names

Added by Paco Riviere over 3 years ago

I try to write an exercise about resistor color code with random values. I would like to translate numbers from 0 to 9 into color names and vice versa, with LaTeX. I've checked the FP guide but I can't figure it out. Is there any way to convert with LaTeX something like:
black 0
brown 1
red 2
...


Replies (2)

RE: Translate numbers from 0 to 9 into color names - Added by Frédéric Bréal over 3 years ago

You should better ask https://latex.org/forum/index.php or https://tex.stackexchange.com/ (forums relating to latex code )

I think FP compare only numbers.

Is there any way to convert with LaTeX something like

May be using those packages : ifthen, xcolor

RE: Translate numbers from 0 to 9 into color names - Added by Paco Riviere over 3 years ago

Nice, I had seen xcolor but not ifthenelse!

(1-2/2)