ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Latest betas break tikz matrix
@ 2011-02-23  1:39 Mathieu Boespflug
  2011-02-23  2:10 ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Boespflug @ 2011-02-23  1:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

This code used to compile in versions of context prior to January,
though I can't quite pin down the versions.

\usemodule[t-tikz]
\usetikzlibrary{matrix}

\starttext
\tikzstyle{description}=[fill=white,inner sep=2pt]
\starttikzpicture
    \matrix(m)[matrix of math nodes,
      row sep=3em, column sep=3em,
      text height=1.5ex, text depth=0.25ex]
           {x&y\\
             z&u\\};
    \path[->]
      (m-1-1) edge node[description] {$*$} (m-1-2)
              edge node[description] {$*$} (m-2-1)
      (m-1-2) edge[dashed] node[description] {$*$} (m-2-2)
      (m-2-1) edge[dashed] node[description] {$*$} (m-2-2);
\stoptikzpicture
\stoptext

(compilation error at the bottom of this email)

I thought at first that this was a luatex problem, but I've ruled that
out with the following plain tex file, which compiles just fine in
plain luatex and in plain pdftex:

\input tikz.tex
\usetikzlibrary{matrix}

\tikzstyle{description}=[fill=white,inner sep=2pt]
\tikzpicture
    \matrix(m)[matrix of math nodes,
      row sep=3em, column sep=3em,
      text height=1.5ex, text depth=0.25ex]
           {x&y\\
             z&u\\};
    \path[->]
      (m-1-1) edge node[description] {$*$} (m-1-2)
              edge node[description] {$*$} (m-2-1)
      (m-1-2) edge[dashed] node[description] {$*$} (m-2-2)
      (m-2-1) edge[dashed] node[description] {$*$} (m-2-2);
\endtikzpicture
\end


I have no idea what the error is telling me and what could be causing
it. Any ideas?

Many thanks,

Mathieu

Compile log:

! Only one # is allowed per tab.

system          > tex > error on line 10 in file testcontext.tex: Only one # is
 allowed per tab ...

 1     \usemodule[t-tikz]
 2     \usetikzlibrary{matrix}
 3
 4     \starttext
 5     \tikzstyle{description}=[fill=white,inner sep=2pt]
 6     \starttikzpicture
 7         \matrix(m)[matrix of math nodes,
 8           row sep=3em, column sep=3em,
 9           text height=1.5ex, text depth=0.25ex]
10 >>             {x&y\\
11                  z&u\\};
12         \path[->]
13           (m-1-1) edge node[description] {$*$} (m-1-2)
14                   edge node[description] {$*$} (m-2-1)
15           (m-1-2) edge[dashed] node[description] {$*$} (m-2-2)
16           (m-2-1) edge[dashed] node[description] {$*$} (m-2-2);
17     \stoptikzpicture
18     \stoptext
19


\pgf@matrix@cont ...ell ##\pgf@matrix@endcell }&##
                                                  \pgf@matrix@padding &&\pgf...
l.10            {
                 x&y\\
?
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
  2011-02-23  1:39 Latest betas break tikz matrix Mathieu Boespflug
@ 2011-02-23  2:10 ` Aditya Mahajan
       [not found]   ` <AANLkTim5kURLU-pKFBtzGsnP9C0bJy4W9T50JZTKrXL0@mail.gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2011-02-23  2:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 22 Feb 2011, Mathieu Boespflug wrote:

> Hi all,
>
> This code used to compile in versions of context prior to January,
> though I can't quite pin down the versions.
>
> [snip]
>
> I have no idea what the error is telling me and what could be causing
> it. Any ideas?

Could be due to the change in catcode of &. Try adding \donknuthmode.

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
       [not found]   ` <AANLkTim5kURLU-pKFBtzGsnP9C0bJy4W9T50JZTKrXL0@mail.gmail.com>
@ 2011-02-23 16:38     ` Mathieu Boespflug
  2011-02-23 22:39       ` Mathieu Boespflug
  2011-02-25 21:05       ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Mathieu Boespflug @ 2011-02-23 16:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Aditya,

> Could be due to the change in catcode of &. Try adding \donknuthmode.

It doesn't make any difference if I put the \donknuthmode just before
\starttikzpicture. But If I put it before the \usemodule[tikz], then I
get another error:

Package pgfbasematrix: Error! Single ampersand used with wrong catcode.
! Missing number, treated as zero.

system          > tex > error on line 12 in file testcontext.tex:
Missing number, treated as zero ...

 2     \usemodule[tikz]
 3     \usetikzlibrary{matrix}
 4
 5     \starttext
 6     \tikzstyle{description}=[fill=white,inner sep=2pt]
 7     \starttikzpicture
 8         \matrix(m)[matrix of math nodes,
 9           row sep=3em, column sep=3em,
10           text height=1.5ex, text depth=0.25ex]
11                {x&y\\
12 >>               z&u};
13         \path[->]
14           (m-1-1) edge node[description] {$*$} (m-1-2)
15                   edge node[description] {$*$} (m-2-1)
16           (m-1-2) edge[dashed] node[description] {$*$} (m-2-2)
17           (m-2-1) edge[dashed] node[description] {$*$} (m-2-2);
18     \stoptikzpicture
19     \nonknuthmode
20     \stoptext
21

<to be read again>
                  \pgf@matrix@column@sep@2
\pgf@matrix@endcell ...ixcurrentcolumn \endcsname
                                                 \relax \advance \pgf@picmi...
<template> \pgf@matrix@endcell
                              }\endtemplate
\pgf@matrix@no@eom@found ->\cr
                              \noalign {\vskip \pgf@y \ifpgf@matrix@fixed \...
<to be read again>
                  z
l.12              z
                  &u};
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
  2011-02-23 16:38     ` Mathieu Boespflug
@ 2011-02-23 22:39       ` Mathieu Boespflug
  2011-09-11 14:38         ` Philipp A.
  2011-02-25 21:05       ` Hans Hagen
  1 sibling, 1 reply; 9+ messages in thread
From: Mathieu Boespflug @ 2011-02-23 22:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

just as a followup and for the mailing list archives, the solution is
to use both Aditya's suggestion to turn on \donknuthmode, as well
replacing the & signs with their interpretations, namely
\pgfmatrixnextcell. Thank you Aditya for the suggestion.

Regards,

Mathieu

On Wed, Feb 23, 2011 at 11:38 AM, Mathieu Boespflug <0xbadcode@gmail.com> wrote:
> Hi Aditya,
>
>> Could be due to the change in catcode of &. Try adding \donknuthmode.
>
> It doesn't make any difference if I put the \donknuthmode just before
> \starttikzpicture. But If I put it before the \usemodule[tikz], then I
> get another error:
>
> Package pgfbasematrix: Error! Single ampersand used with wrong catcode.
> ! Missing number, treated as zero.
>
> system          > tex > error on line 12 in file testcontext.tex:
> Missing number, treated as zero ...
>
>  2     \usemodule[tikz]
>  3     \usetikzlibrary{matrix}
>  4
>  5     \starttext
>  6     \tikzstyle{description}=[fill=white,inner sep=2pt]
>  7     \starttikzpicture
>  8         \matrix(m)[matrix of math nodes,
>  9           row sep=3em, column sep=3em,
> 10           text height=1.5ex, text depth=0.25ex]
> 11                {x&y\\
> 12 >>               z&u};
> 13         \path[->]
> 14           (m-1-1) edge node[description] {$*$} (m-1-2)
> 15                   edge node[description] {$*$} (m-2-1)
> 16           (m-1-2) edge[dashed] node[description] {$*$} (m-2-2)
> 17           (m-2-1) edge[dashed] node[description] {$*$} (m-2-2);
> 18     \stoptikzpicture
> 19     \nonknuthmode
> 20     \stoptext
> 21
>
> <to be read again>
>                  \pgf@matrix@column@sep@2
> \pgf@matrix@endcell ...ixcurrentcolumn \endcsname
>                                                 \relax \advance \pgf@picmi...
> <template> \pgf@matrix@endcell
>                              }\endtemplate
> \pgf@matrix@no@eom@found ->\cr
>                              \noalign {\vskip \pgf@y \ifpgf@matrix@fixed \...
> <to be read again>
>                  z
> l.12              z
>                  &u};
>
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
  2011-02-23 16:38     ` Mathieu Boespflug
  2011-02-23 22:39       ` Mathieu Boespflug
@ 2011-02-25 21:05       ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2011-02-25 21:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 23-2-2011 5:38, Mathieu Boespflug wrote:
> Hi Aditya,
>
>> Could be due to the change in catcode of&. Try adding \donknuthmode.
>
> It doesn't make any difference if I put the \donknuthmode just before
> \starttikzpicture. But If I put it before the \usemodule[tikz], then I
> get another error:
>
> Package pgfbasematrix: Error! Single ampersand used with wrong catcode.
> ! Missing number, treated as zero.

that's a strange error ... if pgf knows that the catcode is 'wrong' it 
could deal with it i guess

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
  2011-02-23 22:39       ` Mathieu Boespflug
@ 2011-09-11 14:38         ` Philipp A.
  2011-09-12  2:58           ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Philipp A. @ 2011-09-11 14:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 769 bytes --]

2011/2/23 Mathieu Boespflug <0xbadcode@gmail.com>

> Hi all,
>
> just as a followup and for the mailing list archives, the solution is
> to use both Aditya's suggestion to turn on \donknuthmode, as well
> replacing the & signs with their interpretations, namely
> \pgfmatrixnextcell. Thank you Aditya for the suggestion.
>
> Regards,
>
> Mathieu


umm, i can’t seem to get it to work. i use the mkiv minimals…

no combination of \donknuthmode, \nonknuthmode, \pgfmatrixnextcell and
“replace ampersand=foo”, that i tried, seems to work.

can anyone give me a minimal example of a working tikz matrix in a context
document? (preferrably something that prevents me from littering everything
with “\pgfmatrixnextcell”)

thanks,
philipp

[-- Attachment #1.2: Type: text/html, Size: 1070 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
  2011-09-11 14:38         ` Philipp A.
@ 2011-09-12  2:58           ` Aditya Mahajan
  2011-09-12  3:39             ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2011-09-12  2:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1754 bytes --]

On Sun, 11 Sep 2011, Philipp A. wrote:

> 2011/2/23 Mathieu Boespflug <0xbadcode@gmail.com>
>
>> Hi all,
>>
>> just as a followup and for the mailing list archives, the solution is
>> to use both Aditya's suggestion to turn on \donknuthmode, as well
>> replacing the & signs with their interpretations, namely
>> \pgfmatrixnextcell. Thank you Aditya for the suggestion.
>>
>> Regards,
>>
>> Mathieu
>
>
> umm, i can’t seem to get it to work. i use the mkiv minimals…
>
> no combination of \donknuthmode, \nonknuthmode, \pgfmatrixnextcell and
> “replace ampersand=foo”, that i tried, seems to work.
>
> can anyone give me a minimal example of a working tikz matrix in a context
> document? (preferrably something that prevents me from littering everything
> with “\pgfmatrixnextcell”)

One way around this is to re-read part of tikz module code under the right 
catcode regime (ideally this should be done by t-tikz). I still cannot get 
& to work, but using \& is a reasonable shortcut.

Here is a working example:

\usemodule[t-tikz]
\usetikzlibrary{matrix}

\unprotect
\ReadFile{pgfmodulematrix.code.tex}
\protect

\starttext
\tikzstyle{description}=[fill=white,inner sep=2pt]
\starttikzpicture
     \matrix(m)[matrix of math nodes,
       row sep=3em, column sep=3em,
       ampersand replacement=\&,%% AM: Added this.
       text height=1.5ex, text depth=0.25ex]
            {x \& y\\
             z \& u\\};
     \path[->]
       (m-1-1) edge node[description] {$*$} (m-1-2)
               edge node[description] {$*$} (m-2-1)
       (m-1-2) edge[dashed] node[description] {$*$} (m-2-2)
       (m-2-1) edge[dashed] node[description] {$*$} (m-2-2);
\stoptikzpicture
\stoptext

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
  2011-09-12  2:58           ` Aditya Mahajan
@ 2011-09-12  3:39             ` Aditya Mahajan
  2011-09-12  9:16               ` Philipp A.
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2011-09-12  3:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1682 bytes --]

On Sun, 11 Sep 2011, Aditya Mahajan wrote:

> On Sun, 11 Sep 2011, Philipp A. wrote:
>
>> 2011/2/23 Mathieu Boespflug <0xbadcode@gmail.com>
>> 
>>> Hi all,
>>> 
>>> just as a followup and for the mailing list archives, the solution is
>>> to use both Aditya's suggestion to turn on \donknuthmode, as well
>>> replacing the & signs with their interpretations, namely
>>> \pgfmatrixnextcell. Thank you Aditya for the suggestion.
>>> 
>>> Regards,
>>> 
>>> Mathieu
>> 
>> 
>> umm, i can’t seem to get it to work. i use the mkiv minimals…
>> 
>> no combination of \donknuthmode, \nonknuthmode, \pgfmatrixnextcell and
>> “replace ampersand=foo”, that i tried, seems to work.
>> 
>> can anyone give me a minimal example of a working tikz matrix in a context
>> document? (preferrably something that prevents me from littering everything
>> with “\pgfmatrixnextcell”)
>
> One way around this is to re-read part of tikz module code under the right 
> catcode regime (ideally this should be done by t-tikz). I still cannot get & 
> to work, but using \& is a reasonable shortcut.
>
> Here is a working example:
>
> \usemodule[t-tikz]
> \usetikzlibrary{matrix}
>
> \unprotect
> \ReadFile{pgfmodulematrix.code.tex}
> \protect

A slightly more robust solution is to load the attached module instead of 
t-tikz. (It also patches \usetikzlibrary). However, I cannot figure out 
what is the expected catcode of & inside a tikz \matrix. So, you will 
still need to use amserand replacement=\&.

Note that this sets the catcode of ! to other (as expected by tikz). In 
the past, circuittikz has some troubles with the catcode of !.

Aditya

[-- Attachment #2: Type: APPLICATION/x-tex, Size: 1469 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Latest betas break tikz matrix
  2011-09-12  3:39             ` Aditya Mahajan
@ 2011-09-12  9:16               ` Philipp A.
  0 siblings, 0 replies; 9+ messages in thread
From: Philipp A. @ 2011-09-12  9:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 659 bytes --]

Thank you both!

We should get the TikZ devs to accept patches already. does anyone know
anyone who has CVS access?

Apart from Aditya’s hack, I’d also like to see Joseph Wright’s
hack<http://tex.stackexchange.com/questions/27952/cmyk-context-colors-in-tikz/27955#27955>for
ConTeXt’s CMYK colors in TikZ. Maybe we should create a module from
user-created TikZ hacks that make it work better with ConTeXt, and link to
it on ConTeXtgarden?

PS: Aditya, does your module provide everything you’d expect? like
\tikzstyle, \usetikzlibrary[something], \tikz\node{};, …? I don’t exactly
know the inner workings of plain TeX…

philipp

[-- Attachment #1.2: Type: text/html, Size: 688 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-09-12  9:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-23  1:39 Latest betas break tikz matrix Mathieu Boespflug
2011-02-23  2:10 ` Aditya Mahajan
     [not found]   ` <AANLkTim5kURLU-pKFBtzGsnP9C0bJy4W9T50JZTKrXL0@mail.gmail.com>
2011-02-23 16:38     ` Mathieu Boespflug
2011-02-23 22:39       ` Mathieu Boespflug
2011-09-11 14:38         ` Philipp A.
2011-09-12  2:58           ` Aditya Mahajan
2011-09-12  3:39             ` Aditya Mahajan
2011-09-12  9:16               ` Philipp A.
2011-02-25 21:05       ` Hans Hagen

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).