Re: [NTG-context] colors in pgf within context
Hello, Another problem with PGF+ConTeXt is the handling of cmyk colors: \usemodule[tikz] \setupcolors[state=start] \definecolor[my_yellow][c=0,m=0.3,y=0.94,k=0] \starttext \startcolor[my_yellow] Yellow text. \stopcolor \starttikzpicture \fill[my_yellow] (0,0) circle(1); \stoptikzpicture \stoptext CMYK colors work in ConTeXt but do not get passed correctly to PGF/TikZ. A work-around is to transform to rgb : \definecolor[my_yellow][r=0.98,g=0.698,b=0.09] % 250,178,23 #FAB217 This seems to be a documented bug; Perhaps it will be fixed someday... Alan On Tuesday 19 February 2008 04:47:35 Aditya Mahajan wrote: On Mon, 18 Feb 2008, Jesse Alama wrote: Hi Aditya, Thanks for the help -- I think I now see why there is such trouble with colors in pgf and context. It looks like one can systematically transform LaTeX-like PGF examples of \color into ConTeXt examples. The reason why this came up is that I'm trying to go through Till Tantau's Example for Karl's Students tutorial in the PGF/TikZ manual. Has anyone managed to ConTeXt-ify that example? I did that some time back while testing tikz. I will send that file as a reply to this email, since I am not sure if it will go through the mailing list because of its size. The example features some \definecolor's which I just did away with (sadly) by simply substituting their defining values for their occurences. (This is unfortunate, but perhaps necessary until some other mechanism is produced.) The problem is that the text box to the right of the picture is supposed to be colored, and with rounded corners. But the box is missing. Look at p. 20 of The TikZ manual make a lot of uses of the xcolor syntax (e.g. \color{red!20}). There is no equivalent ConTeXt syntax. You need to define a color, say lightred, as follows \definecolor[lightred][r=0.2] For tikz key-value options, pgf works behind the scene to define appropriate colors, so xcolor syntax works for them. So \fill[fillcolor=red!20] will work as expected. However, when using \color inside any box, you need to follow ConTeXt syntax. So \color[red!20] will not work, you need to define a context color and then use that. Hope that this clarifies some things. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ -- Alan Braslau CEA DSM-IRAMIS-SPEC CNRS URA 2464 Orme des Merisiers 91191 Gif-sur-Yvette cedex FRANCE tel: +33 1 69 08 73 15 fax: +33 1 69 08 87 86 mailto:[EMAIL PROTECTED] http://www-dna2006.cea.fr/ .''`. : :' : `. `'` `- ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] colors in pgf within context
Jesse Alama wrote: Hi Aditya, Thanks for the help -- I think I now see why there is such trouble with colors in pgf and context. It looks like one can systematically transform LaTeX-like PGF examples of \color into ConTeXt examples. keep in mind that color handles sveral grouping cases: {\somecolor whatever} \color[somecolor]{whatever} all use the same underlying mechanissm (and sometimes aftergroup to revert to the outer color; this may interfere when grouping is kind of unpredictable in case of doubt: \color[name]{..} works best (explicit braces) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] colors in pgf within context
Aditya Mahajan [EMAIL PROTECTED] writes: The example features some \definecolor's which I just did away with (sadly) by simply substituting their defining values for their occurences. (This is unfortunate, but perhaps necessary until some other mechanism is produced.) The problem is that the text box to the right of the picture is supposed to be colored, and with rounded corners. But the box is missing. Look at p. 20 of The TikZ manual make a lot of uses of the xcolor syntax (e.g. \color{red!20}). There is no equivalent ConTeXt syntax. You need to define a color, say lightred, as follows \definecolor[lightred][r=0.2] For tikz key-value options, pgf works behind the scene to define appropriate colors, so xcolor syntax works for them. So \fill[fillcolor=red!20] will work as expected. However, when using \color inside any box, you need to follow ConTeXt syntax. So \color[red!20] will not work, you need to define a context color and then use that. I'm still not able to get fillcolor to work with the information box: \starttikzpicture[scale=4,information text/.style={fill=red}] \draw[xshift=1.85cm] node[right,text width=6cm,information text] { The \color[green]{angle $\alpha$} is $30^\circ$ in the example ($\pi/6$ in radians). The \color[red]{sine of $\alpha$}, which is the height of the red line, is \startformula \color[red]{\sin \alpha} = 1/2. \stopformula By the Theorem of Pythagoras ... }; Is ConTeXt correctly parsing the key information tex/.style? Jesse -- Jesse Alama ([EMAIL PROTECTED]) ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] colors in pgf within context
Hi Aditya, Thanks for the help -- I think I now see why there is such trouble with colors in pgf and context. It looks like one can systematically transform LaTeX-like PGF examples of \color into ConTeXt examples. The reason why this came up is that I'm trying to go through Till Tantau's Example for Karl's Students tutorial in the PGF/TikZ manual. Has anyone managed to ConTeXt-ify that example? The closest that I've come is \usemodule[tikz] \setupcolors[state=start] \starttext \starttikzpicture [scale=3, line cap=thin, %Styles axes/.style=, important line/.style={very thick}, information text/.style={rounded corners,fill=red!10,inner sep=1ex}] % Local definitions \def\costhirty{0.8660256} % The graphic \draw[help lines,step=0.5cm] (-1.4,-1.4) grid (1.4,1.4); \draw (0,0) circle (1cm); \startscope[axes] \draw[-] (-1.5,0) -- (1.5,0) node[right] {$x$} coordinate(x axis); \draw[-] (0,-1.5) -- (0,1.5) node[above] {$y$} coordinate(y axis); \foreach \x/\xtext in {-1, -.5/-\frac{1}{2}, 1} \draw[xshift=\x cm] (0pt,1pt) -- (0pt,-1pt) node[below,fill=white] {$\xtext$}; \foreach \y/\ytext in {-1, -.5/-\frac{1}{2}, .5/\frac{1}{2}, 1} \draw[yshift=\y cm] (1pt,0pt) -- (-1pt,0pt) node[left,fill=white] {$\ytext$}; \stopscope \filldraw[fill=green!20,draw=green!50!black] (0,0) -- (3mm,0pt) arc(0:30:3mm); \draw (15:2mm) node[green!50!black] {$\alpha$}; \draw[important line,red] (30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} (30:1cm |- x axis); \draw[important line,orange!80!black] (1,0) -- node[right=1pt,fill=white] { $\displaystyle \tan \alpha \color[black]{=} \frac{\color[red]{\sin \alpha}}{\color[blue]{\cos \alpha}}$} (intersection of 0,0--30:1cm and 1,0--1,1) coordinate (t); \draw (0,0) -- (t); \draw[xshift=1.85cm] node[right,text width=6cm,information text] { The \color[green!50!black]{angle $\alpha$} is $30^\circ$ in the example ($\pi/6$ in radians). The \color[red]{sine of $\alpha$}, which is the height of the red line, is \startformula \color[red]{\sin \alpha} = 1/2. \stopformula By the Theorem of Pythagoras ... }; \stoptikzpicture \stoptext The example features some \definecolor's which I just did away with (sadly) by simply substituting their defining values for their occurences. (This is unfortunate, but perhaps necessary until some other mechanism is produced.) The problem is that the text box to the right of the picture is supposed to be colored, and with rounded corners. But the box is missing. Look at p. 20 of http://altermundus.com/downloads/pgfmanual_cvs.pdf to see what I mean. Also, the phrase angle $\alpha$ is supposed to be in a kind of green, but that's not working either. What might be happening? Thanks, Jesse Aditya Mahajan [EMAIL PROTECTED] writes: I am CCing to the context list also. On Mon, 18 Feb 2008, Jesse Alama wrote: Hi Aditya, I recently came across a thread on the PGF users mailing list in which you mention some problems with ConTeXt, PGF and colors. For example: http://article.gmane.org/gmane.comp.tex.pgf.user/38 Have these issues beein resolved for your? I just downloaded PFG 1.18 from the modules part of the contextgarden, installed it, and, when trying to compile the following example PGF code \starttikzpicture[scale=3] \clip (-2,-0.2) rectangle (2,0.8); \draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4); \filldraw[fill=green!20,draw=green!50!black] (0,0) -- (3mm,0mm) arc (0:30:3mm) -- cycle; \draw[-] (-1.5,0) -- (1.5,0) coordinate (x axis); \draw[-] (0,-1.5) -- (0,1.5) coordinate (y axis); \draw (0,0) circle (1cm); \draw[very thick,red] (30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} (30:1cm |- x axis); \draw[very thick,blue] (30:1cm |- x axis) -- node[below=2pt,fill=white] {$\cos \alpha$} (0,0); \draw[very thick,orange] (1,0) -- node [right=1pt,fill=white] {$\displaystyle \tan \alpha \color{black}= \frac{{\color[red]\sin \alpha}}{{\color[blue]\cos \alpha}}$} (intersection of 0,0--30:1cm and 1,0--1,1) coordinate (t); \draw (0,0) -- (t); \foreach \x/\xtext in {-1, -0.5/-\frac{1}{2}, 1} \draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north,fill=white] {$\xtext$}; \foreach \y/\ytext in {-1, -0.5/-\frac{1}{2}, 0.5/\frac{1}{2}, 1} \draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east,fill=white] {$\ytext$}; \stoptikzpicture (which is taken from the PGF manual), I get ! Use of \color doesn't match its definition. [EMAIL PROTECTED] ...{$\displaystyle \tan \alpha \color { black}= \frac {{\color {re... [EMAIL PROTECTED]@[EMAIL PROTECTED] ...mmand [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]@[EMAIL PROTECTED]@... [EMAIL PROTECTED]@[EMAIL PROTECTED] [EMAIL PROTECTED]@onpath