[NTG-context] Different colors in LaTeX and ConTeXt

Henri Menke henrimenke at gmail.com
Tue Jul 12 21:39:52 CEST 2016


Dear Aditya and Hans,

I'm not so sure about it being a bug in pgfplots.  I played a little and
encountered the following.

> \usemodule[tikz]
> \starttext
> 
> % Original gray
> \blackrule[color=gray,width=1cm,height=1pt]
> 
> \starttikzpicture
>   \draw[gray,line width=1pt] (0,0) -- (1,0);
> \stoptikzpicture
> 
> % New colors
> \definecolor[gray][s=0.5]
> \unprotect
> \pgfutil at definecolor{tikzgray}{gray}{0.5}
> \protect
> 
> % Now ConTeXt's gray = tikzgray
> \blackrule[color=gray,width=1cm,height=1pt]
> 
> \starttikzpicture
>   \draw[tikzgray,line width=1pt] (0,0) -- (1,0);
> \stoptikzpicture
> 
> % Inside TikZ gray is still off
> \starttikzpicture
>   \draw[gray,line width=1pt] (0,0) -- (1,0);
> \stoptikzpicture
> 
> \stoptext

Cheers,
Henri

On 07/12/2016 08:23 PM, Aditya Mahajan wrote:
> On Tue, 12 Jul 2016, Hans Hagen wrote:
> 
>> On 7/12/2016 5:07 PM, Aditya Mahajan wrote:
>>> On Tue, 12 Jul 2016, Hans Hagen wrote:
>>>
>>>> On 7/12/2016 3:44 PM, Henri Menke wrote:
>>>>> Dear Hans,
>>>>>
>>>>> thanks for your reply.  Indeed there are color definitions in
>>>>> `pgfutil-context.def`.  However, they are commented out with the 
>> message
>>>>>
>>>>>> % no need for x colors (users can load it if needed)
>>>>>> ...
>>>>>> %\pgfutil at definecolor{gray}{gray}{0.5}
>>>>>
>>>>> If I add
>>>>>
>>>>>> \csname pgfutil at definecolor\endcsname{gray}{gray}{0.5}
>>>>>
>>>>> to my document the gray shows up fine.  So that's for sure a feasible
>>>>> workaround.
>>>>>
>>>>> Can you comment on the phrase »no need for x colors (users can load it
>>>>> if needed)«?  I'm not quite sure what it means and it suggests that
>>>>> there exists a proper solution to my color problem.
>>>>
>>>> normally you want the same colors in tikz images as in context so then
>>>> defining them in tikz is creating incompatibilities (your case is the
>>>> reverse and a-typical)
>>>
>>> However, without such redefinitions, tikz does not understand ConTeXt
>>> colors. I use a similar workaround in my documents as well.
>>
>> I have no clue what you mean.
>>
>> \definecolor[red][g=1]
>>
>> \startTEXpage
>>     \starttikzpicture
>>        \fill[red] (0,0) circle (1cm);
>>     \stoptikzpicture
>> \stopTEXpage
>>
>> works ok here and gives green. So, one can collect a list of colors
>> defined in tikz in a colo-imp-tikz.mkiv and load that one if needed.
> 
> I guess it is a bug with pgfplots rather than tikz (which also means
> that it may be easier to pursuade pgfplot maintainers to use low level
> tikz interface, since tikz is already playing nice with context).
> 
> \usemodule[tikz,pgfplots]
> \definecolor[red][g=1]
> 
> \startmode[bug]
> \unprotect
> \pgfutil at definecolor{red}   {rgb} {0,1,0}
> \protect
> \stopmode
> 
> \starttext
> \startTEXpage
>      \starttikzpicture
>        \startaxis
>          \addplot[color=red] coordinates { (0,0) (1,1) };
>        \stopaxis
>      \stoptikzpicture
> \stopTEXpage
> \stoptext
> 
> Aditya
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 



More information about the ntg-context mailing list