[pstricks] pstricks and color

Uwe Kern u.kern at web.de
Wed Dec 21 10:45:22 CET 2005


Hendri Adriaens <spotje at gmail.com> schrieb am 17.12.05 15:26:28:
> 
> But \newrgbcolor and friends have
> been mapped to \definecolor{rgb} in pstricks.sty a long time ago,
> right?

There are important differences.

This mapping is done in pstricks.sty such that \newrgbcolor{foo}{...}
1) invokes \xglobal\definecolor{foo}{rgb}{...}, thus defining each color globally;
2) additionally performs \gdef\foo{\color{foo}}.

This means, each \new*color command will define two commands, one of which
offering not much additional value (only calling \color), but with the side effect of
possibly overwriting existing macros that have no connection with color.

For example, the following color definitions will give very nice error messages
and/or infinite loops:
\newrgbcolor{def}{.75 .5 .25}
\newrgbcolor{box}{.75 .5 .25}
Well, this may be softened by additional checks, but name conflicts are still present.

Furthermore, usage of additional predefined colors like `dvipsnames'
requires explicit \color commands anyway.

Thus, I appeal to pstricks.sty users to generally prefer the variant
\definecolor{def}{rgb}{.75,.5,.25}
etc. which avoids the above-mentioned problems.
In order to define globally available color names inside groups, simply say
\xglobal\definecolor{def}{rgb}{.75,.5,.25}

And for those who don't have a comma on their keyboard,
there is an additional input syntax, starting with xcolor v2.09
(which will be available today or tomorrow):
\definecolor{def}{rgb}{.75 .5 .25}

For color application, (x)color provide a variety of user-level
commands like \color, \textcolor, \colorbox.
Thus, it is unclear to me why we need an additional \gdef\foo{\color{foo}}
in general (not talking about special abbreviations under certain
circumstances).

I would very much appreciate if LaTeX users could develop towards
a common language for color definitions inside and outside
the great pstricks package(s).

Uwe

______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193




More information about the PSTricks mailing list