Translate numbers from 0 to 9 into color names

Added by Paco Riviere 10 months 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 GĂ©rard Carpeaux 10 months 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 10 months ago

Nice, I had seen xcolor but not ifthenelse!

(1-2/2)