From: Marius <mariausol@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: ConText, TikZ and definecolor: undefined control sequence
Date: Wed, 27 Oct 2010 20:18:09 +0300 [thread overview]
Message-ID: <AANLkTimpyWE5O-cOKH_eyKFjZ_VXUhg9TFmn7+qYGh_B@mail.gmail.com> (raw)
In-Reply-To: <AANLkTin1=3g39vtnycgJ04Q9JvT9-=0Nkv8XwNz=PLwm@mail.gmail.com>
Hello,
I had the same problem, so I desided to define colors by hand.
\definecolor [lightgray] [h=D3D3D3]
\usemodule[tikz]
\unprotect
\pgfutil@definecolor{black}{gray}{0}
\pgfutil@definecolor{gray}{gray}{0.5}
\pgfutil@definecolor{lightgray}{gray}{0.9}
\pgfutil@definecolor{white}{gray}{1}
\protect
If you want to fix script, you need to change line:
local cv = colors.value(attributes)
into
local cv = attributes.colors.values
Just guess, untested.
Regards,
Marius
On 27 October 2010 15:49, Cedric Mauclair <cedric.mauclair@gmail.com> wrote:
> Hi,
>
> Same problem here with the latest TikZ 2.10.
>
> Regards.
>
> -- Cédric
>
>
>
> On Tue, Oct 26, 2010 at 12:20, Michael Murphy <michael.murphy@uni-ulm.de> wrote:
>> Hi,
>>
>> I've been trying to get colors to work in TikZ, and found a nice fix by
>> Aditya here:
>>
>> http://archive.contextgarden.net/message/20100120.220124.f2d3f8bc.en.html
>>
>> The problem is that the lua script doesn't work: I get a problem with
>> 'colors'.
>>
>> LuaTeX error <main ctx instance>:13: attempt to index global 'colors' (a
>> nil value)
>> stack traceback:
>> <main ctx instance>:13: in function 'registercolor'
>> <main ctx instance>:1: in main chunk.
>>
>> The input file from Aditya (called colorfix.tex) is
>>
>> \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
>>
>> and my test file is
>>
>> \usemodule[tikz]
>> \input colorfix
>>
>> \definecolor[mycolor][r=1,g=0,b=1]
>>
>> \starttext
>> \starttikzpicture
>> \fill[mycolor] (0,0) circle (1);
>> \stoptikzpicture
>> \stoptext
>>
>> I'm running the latest beta.
>>
>> ___________________________________________________________________________________
>> 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 : http://foundry.supelec.fr/projects/contextrev/
>> wiki : http://contextgarden.net
>> ___________________________________________________________________________________
>>
> ___________________________________________________________________________________
> 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 : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2010-10-27 17:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-26 10:20 Michael Murphy
2010-10-27 12:49 ` Cedric Mauclair
2010-10-27 17:18 ` Marius [this message]
2010-10-27 20:08 ` Michael Murphy
2010-10-28 7:54 ` Cedric Mauclair
2010-10-28 8:24 ` Cedric Mauclair
2010-10-28 11:47 ` Hans Hagen
2010-10-28 11:46 ` Hans Hagen
2010-10-28 12:14 ` Cedric Mauclair
2010-10-28 9:44 ` Marius
2010-11-11 11:07 ` Tikz figures not centred Michael Murphy
2010-11-11 11:14 ` Vedran Miletić
2010-11-11 16:18 ` Michael Murphy
2010-11-11 19:34 ` Aditya Mahajan
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=AANLkTimpyWE5O-cOKH_eyKFjZ_VXUhg9TFmn7+qYGh_B@mail.gmail.com \
--to=mariausol@gmail.com \
--cc=ntg-context@ntg.nl \
/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).