[XeTeX] Problems with xcolor and fontspec

Zdenek Wagner zdenek.wagner at gmail.com
Tue Oct 4 02:11:28 CEST 2011


2011/10/3 Tobias Schoel <liesdiedatei at googlemail.com>:
> Try using tikz/pgf.
>
AFAIK tikz does not have its own color commands but uses xcolor, so
the problem would be exactly the same. And it would be a "shutting
ants by a cannon" solution to load such a huge package in order to
define a dozen macros.

> Am 03.10.2011 16:52, schrieb Stephen Moye:
>>
>> Xecolor provides none of the facilities that I need, most importantly,
>> access to the HSB color model. It is in no way a replacement for xcolor, but
>> simply provides a range of colors made accessible through fontspec's
>> \addfonfeature command.
>>
>> Sounded promising on the face of it. Thanks for the suggestion.
>>
>> Stephen
>>
>>
>>
>> On Oct 3, 2011, at 10:29 AM, Herbert Schulz wrote:
>>
>>>
>>> On Oct 3, 2011, at 8:57 AM, Stephen Moye wrote:
>>>
>>>> The following minimum example shows the problem: I would like to
>>>> generate some text in random colors and specify the opacity. In the example
>>>> file below, either I get black text with opacity of 50%, or random colors at
>>>> 100% opacity, or one random color for all the text at 50% opacity. Can I
>>>> have my cake and eat it too? That is, can I have random colors *and* control
>>>> over the opacity?
>>>>
>>>> I'm using MacTeX 2011.
>>>>
>>>> Thanks for any insights.
>>>>
>>>> Stephen Moye
>>>>
>>>> %%=====8><-----%%
>>>>
>>>> % !TEX TS-program = XeLaTeX-xdv2pdf
>>>>
>>>> \documentclass{article}
>>>>
>>>> \input random
>>>> \usepackage{xcolor}
>>>> \usepackage{fontspec}
>>>>
>>>> \setmainfont{Helvetica}
>>>>
>>>> \newlength{\huedim}
>>>>
>>>> \newcommand{\randcolor}{%
>>>>        \setrandim\huedim{0.0pt}{1.0pt}%
>>>>        \definecolor{mycolor}{hsb}{\pointless\huedim,1.0,1.0}%
>>>>        \color{mycolor}
>>>> }
>>>>
>>>> \newcommand{\testit}[3]{%
>>>>        %%% Uncomment *one* of the following \put commands to see the
>>>> difference:
>>>>        %
>>>>        %%% This returns only gray:
>>>>
>>>>  %\put(#1,#2){\randcolor\addfontfeature{Opacity=0.5}\color{mycolor}#3}
>>>>        %
>>>>        %%% This returns only the color first defined:
>>>>
>>>>  %\put(#1,#2){\randcolor\addfontfeature{Color=mycolor,Opacity=0.5}\color{mycolor}#3}
>>>>        %
>>>>        %%% This works as it should, but the opacity is 100%
>>>>        %\put(#1,#2){\randcolor\color{mycolor}#3}
>>>> }
>>>>
>>>> \begin{document}
>>>>
>>>> \begin{picture}(100,100)
>>>> \testit{20}{100}{X}
>>>> \testit{30}{90}{y}
>>>> \testit{40}{80}{z}
>>>> \end{picture}
>>>>
>>>> \end{document}
>>>
>>>
>>> Howdy,
>>>
>>> Don't know if this will help but try using the xecolor package. Note that
>>> it's commands have a different name than the xcolor package though.
>>>
>>> Good Luck,
>>>
>>> Herb Schulz
>>> (herbs at wideopenwest dot com)
>>>
>>>
>>>
>>>
>>>
>>>
>>> --------------------------------------------------
>>> Subscriptions, Archive, and List information, etc.:
>>>  http://tug.org/mailman/listinfo/xetex
>>
>>
>>
>> --------------------------------------------------
>> Subscriptions, Archive, and List information, etc.:
>>   http://tug.org/mailman/listinfo/xetex
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>  http://tug.org/mailman/listinfo/xetex
>



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the XeTeX mailing list