[NTG-context] ConText, TikZ and definecolor: undefined control sequence

Cedric Mauclair cedric.mauclair at gmail.com
Wed Oct 27 14:49:21 CEST 2010


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 at 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 at 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 at definecolor{%s}{gray}{%
> 1.3f}", name, cv[2]))
>      elseif model == 3 then
>        print("model=2")
>        texsprint(prtcatcodes,format("\\pgfutil at 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 at 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 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