[texhax] Makros in \color

Heiko Oberdiek heiko.oberdiek at googlemail.com
Thu Jun 17 00:04:56 CEST 2010


On Wed, Jun 16, 2010 at 08:59:16PM +0200, Arno Trautmann wrote:

> I want to abuse the \color makro a bit in the following way:
> 
> \color[RGB]{0 0 \themycount}
> 
> So the color will change as the counters change. This works. Trying it
> with 2 counters:
> 
> \color[RGB]{0 \themycount \themycount},
> 
> I get errors from the \color-parser, I think:
> 
> ! Argument of \c at lor@@RGB has an extra }.

The space between \themycount and \themycount is ignored, because
it ends the reading of the macro \themycount.

Best is to use the correct syntax that is compatible with the color
package:

\color[RGB]{0,\themycount,\themycount}

Yours sincerely
  Heiko Oberdiek

PS: If a command need explicit space tokens in the argument,
then this can be achieved by:

\begingroup
  \def\x#1{\endgroup
    \color[RGB]{0 \themycount#1\themycount}%
  }%
\x{ }


More information about the texhax mailing list