From: Aditya Mahajan <adityam@umich.edu>
To: Ben <stonemonkey@gmx.de>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>,
pgf Mailing-List <pgf-users@lists.sourceforge.net>
Subject: Re: ConText and definecolor: undefined control sequence
Date: Wed, 20 Jan 2010 17:01:24 -0500 (EST) [thread overview]
Message-ID: <alpine.LNX.2.01.1001201652300.31265@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <20100112150255.GA8216@shahin.dnsalias.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1890 bytes --]
On Tue, 12 Jan 2010, Ben wrote:
> Dear List,
> using the pgf build from 20100103 and texlive2009 from the Debian unstable
> I've just tried to do the following:
>
> \enableregime[utf]
> \usemodule[tikz]
>
> \starttext
>
> \startTEXpage
> \pgfutil@definecolor{magenta}{rgb}{1,0,1}
>
> \starttikzpicture
> \draw (0,0) -- (1,1);
> \stoptikzpicture
> \stopTEXpage
>
> \stoptext
>
> I always get
>
> ! Undefined control sequence.
> l.21 \pgfutil
> @definecolor{magenta}{rgb}{1,0,1}
> ?
> ! Emergency stop.
> l.21 \pgfutil
> @definecolor{magenta}{rgb}{1,0,1}
> End of file on the terminal!
You need to add \unprotect and \protect
\unprotect
\pgfutil@definecolor{...}
\protect
They are similar to \makeatletter and \makeatother in LaTeX.
The correct way is to ConTeXt's color mechanism to define colors. For
example,
\usemodule[tikz]
\definecolor[mycolor][r=1,g=0,b=1]
\starttext
\starttikzpicture
\node[text=mycolor] {Test} ;
\stoptikzpicture
\stoptext
This works with MkII but gives an error with MkIV.
! Undefined control sequence.
\pgfutil@registercolor ...ef \pgf@temp {\PDFcolor
{#1}}\edef \pgf@marshal
{\...
\pgfutil@colorlet ...x \pgfutil@registercolor {#2}
\fi \edef \pgf@marshal
{\n...
\tikz@next ...futil@colorlet {.}{\tikz@textcolor }
\fi \pgfsetcolor
{.}\setbo...
l.7 \node[text=mycolor] {
Test}
That is because MkII and MkIV have a different color model,
and tikz does not support the MkIV model yet.
I am attaching a fix for that. I do not know what is the best way to
incorporate it into tikz (perhaps a pgfutils-mkiv.tex file). For the
moment, you can just input it after loading tikz.
Aditya
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-tex; name=pgf-colorfix.tex, Size: 1183 bytes --]
\startluacode
pgfutil = pgfutil or { }
local texsprint, format = tex.sprint, string.format
local prtcatcodes = tex.prtcatcodes
function pgfutil.unsupported_color(name)
texsprint(prtcatcodes,format("\\PackageError{pgf}{color %s has unsupported model}{}", name))
texsprint(prtcatcodes,format("\\pgfutil@definecolor{%s}{gray}{0}", name))
end
function pgfutil.registercolor(name, attributes)
print(name, attributes)
local cv = colors.value(attributes)
if cv then
local model = cv[1]
if model == 1 then
print("model=1")
texsprint(prtcatcodes,format("\\pgfutil@definecolor{%s}{gray}{%1.3f}", name, cv[2]))
elseif model == 3 then
print("model=2")
texsprint(prtcatcodes,format("\\pgfutil@definecolor{%s}{rgb}{%1.3f,%1.3f,%1.3f}", name, cv[3], cv[4], cv[5]))
else
print("no model")
pgfutil.unsupported_color(name)
end
else
print("no color")
pgfutil.unsupported_color(name)
end
end
\stopluacode
\unprotect
\def\pgfutil@registercolor#1%
{\ctxlua{pgfutil.registercolor("#1",\thecolorattribute {#1})}}
\protect
[-- Attachment #3: Type: text/plain, Size: 420 bytes --]
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
[-- Attachment #4: Type: text/plain, Size: 158 bytes --]
_______________________________________________
pgf-users mailing list
pgf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgf-users
parent reply other threads:[~2010-01-20 22:01 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20100112150255.GA8216@shahin.dnsalias.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.01.1001201652300.31265@ybpnyubfg.ybpnyqbznva \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
--cc=pgf-users@lists.sourceforge.net \
--cc=stonemonkey@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).