Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-13 Thread Jörg Weger
After putting the definition you proposed last in front of my minimal 
example in mkiv beta 2015.02.03 it worked once and then not any more. I 
also tried to remove all auxiliary files after a new pass.


But today I installed beta 2015.03.10 (complete fresh install as I keep 
the older version in a renamed folder) and now the MWE with your extra 
code renders repeatedly correct.


So this seems to be a workaround until you rewrite “write” as you said.

I will experiment further with tikz’ ‘remember’ picture mode.


Greetings Jörg

 START MWE %

%D %%% Hans’ redefinition of write function: %%%

\def\syst_write#1#2%
  {\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}}

\unexpanded\def\writeviatex#1#2%
  {\ifx\normalwrite\relax\else
 \normalwrite#1{#2}%
   \fi}

%%

\usemodule[tikz]

\usetikzlibrary[shapes.misc,arrows]

\starttext

\tikz[baseline,remember picture] \node[rounded 
rectangle,draw,anchor=text] (n1) {this};

belongs to
\tikz[baseline,remember picture] \node[rounded 
rectangle,draw,anchor=text] (n2) {that};


\starttikzpicture
[remember picture,overlay]
\draw[-] (n1.north) to [bend left] (n2.north);
\stoptikzpicture

\stoptext

 STOP MWE %%



On 08.03.2015 23:17, Hans Hagen wrote:

On 3/8/2015 7:07 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 18:39 schrieb Hans Hagen pra...@wxs.nl:

On 3/8/2015 1:04 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 12:55 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl:

On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl
mailto:pra...@wxs.nl:

this should help:

\unexpanded\def\writeviatex#1#2%
{\ifx\normalwrite\relax\else
  % the \detokenize makes sure we don't expand \noexpanded macros
   \normalwrite#1{\detokenize{#2}}%
\fi}

(in future version i might replace write completely)


Only partially because the saved positions from \pdfsavepos are
wrong.


in what sense wrong?


Content of the external file from MkIV (the entries on the first
page show 0
and the values on page 2 and 3 are always the same):

1:0:0
2:0:0
3:4661756:45255023
4:4661756:45255023
5:4661756:45255023
6:4661756:45255023

Content of the external file from MkII (different values for the first
and second position on each page):

1:6526435:46204089
2:4661756:45256000
3:6526435:46204089
4:4661756:45256000
5:6526435:46204089
6:4661756:45256000


ypositions can differ a bit because we use different fonts and so
does the interlinespace


But the values for both positions should be different which isn’t the
case for MkIV
and the first page saves 0 for the x and y positions.


It's a side effect of expansion at the wrong time (where such primitives
can return wrong values but at least they return something) but
something like this works:

\def\syst_write#1#2%
   {\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}}

\unexpanded\def\writeviatex#1#2%
   {\ifx\normalwrite\relax\else
  \normalwrite#1{#2}%
\fi}





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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-13 Thread Wolfgang Schuster

 Am 13.03.2015 um 14:17 schrieb Jörg Weger joerg73@googlemail.com:
 
 After putting the definition you proposed last in front of my minimal example 
 in mkiv beta 2015.02.03 it worked once and then not any more. I also tried to 
 remove all auxiliary files after a new pass.
 
 But today I installed beta 2015.03.10 (complete fresh install as I keep the 
 older version in a renamed folder) and now the MWE with your extra code 
 renders repeatedly correct.
 
 So this seems to be a workaround until you rewrite “write” as you said.
 
 I will experiment further with tikz’ ‘remember’ picture mode.

1. The current beta has a fix for the \write command and you don’t need Hans 
patch.

2. Commands with a _ in the name, e.g. \syst_write can only be used when you 
place them
   in a group which starts with \unprotect and ends with \protect.

Wolfgang
___
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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Hans Hagen

On 3/8/2015 1:04 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 12:55 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl:

On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl
mailto:pra...@wxs.nl:

this should help:

\unexpanded\def\writeviatex#1#2%
{\ifx\normalwrite\relax\else
  % the \detokenize makes sure we don't expand \noexpanded macros
   \normalwrite#1{\detokenize{#2}}%
 \fi}

(in future version i might replace write completely)


Only partially because the saved positions from \pdfsavepos are wrong.


in what sense wrong?


Content of the external file from MkIV (the entries on the first page show 0
and the values on page 2 and 3 are always the same):

1:0:0
2:0:0
3:4661756:45255023
4:4661756:45255023
5:4661756:45255023
6:4661756:45255023

Content of the external file from MkII (different values for the first
and second position on each page):

1:6526435:46204089
2:4661756:45256000
3:6526435:46204089
4:4661756:45256000
5:6526435:46204089
6:4661756:45256000


ypositions can differ a bit because we use different fonts and so does 
the interlinespace


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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Hans Hagen

On 3/8/2015 7:07 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 18:39 schrieb Hans Hagen pra...@wxs.nl:

On 3/8/2015 1:04 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 12:55 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl:

On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl
mailto:pra...@wxs.nl:

this should help:

\unexpanded\def\writeviatex#1#2%
{\ifx\normalwrite\relax\else
  % the \detokenize makes sure we don't expand \noexpanded macros
   \normalwrite#1{\detokenize{#2}}%
\fi}

(in future version i might replace write completely)


Only partially because the saved positions from \pdfsavepos are wrong.


in what sense wrong?


Content of the external file from MkIV (the entries on the first page show 0
and the values on page 2 and 3 are always the same):

1:0:0
2:0:0
3:4661756:45255023
4:4661756:45255023
5:4661756:45255023
6:4661756:45255023

Content of the external file from MkII (different values for the first
and second position on each page):

1:6526435:46204089
2:4661756:45256000
3:6526435:46204089
4:4661756:45256000
5:6526435:46204089
6:4661756:45256000


ypositions can differ a bit because we use different fonts and so does the 
interlinespace


But the values for both positions should be different which isn’t the case for 
MkIV
and the first page saves 0 for the x and y positions.


hm, after some playing with it i think that is a luatex bug (it expands 
the positions in a tex.write which is wrong


so we need to revert to this:

\def\syst_write_execute#1%
  {\ctxcommand{execute(\!!bs#1\!!es)}}

\unexpanded\def\write#1#%
  {\ifnum#1=18
 \expandafter\syst_write_execute
   \else
 \normalwrite#1%
   \fi}

(context itself doesn't suffer from this as it does things differently; 
maybe i should make an api and then nil \pdf*pos)


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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Wolfgang Schuster

 Am 08.03.2015 um 18:39 schrieb Hans Hagen pra...@wxs.nl:
 
 On 3/8/2015 1:04 PM, Wolfgang Schuster wrote:
 
 Am 08.03.2015 um 12:55 schrieb Hans Hagen pra...@wxs.nl
 mailto:pra...@wxs.nl:
 
 On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:
 
 Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl
 mailto:pra...@wxs.nl
 mailto:pra...@wxs.nl:
 
 this should help:
 
 \unexpanded\def\writeviatex#1#2%
 {\ifx\normalwrite\relax\else
  % the \detokenize makes sure we don't expand \noexpanded macros
   \normalwrite#1{\detokenize{#2}}%
 \fi}
 
 (in future version i might replace write completely)
 
 Only partially because the saved positions from \pdfsavepos are wrong.
 
 in what sense wrong?
 
 Content of the external file from MkIV (the entries on the first page show 0
 and the values on page 2 and 3 are always the same):
 
 1:0:0
 2:0:0
 3:4661756:45255023
 4:4661756:45255023
 5:4661756:45255023
 6:4661756:45255023
 
 Content of the external file from MkII (different values for the first
 and second position on each page):
 
 1:6526435:46204089
 2:4661756:45256000
 3:6526435:46204089
 4:4661756:45256000
 5:6526435:46204089
 6:4661756:45256000
 
 ypositions can differ a bit because we use different fonts and so does the 
 interlinespace

But the values for both positions should be different which isn’t the case for 
MkIV
and the first page saves 0 for the x and y positions.

Wolfgang
___
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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Hans Hagen

On 3/7/2015 7:22 PM, Wolfgang Schuster wrote:



Am 07.03.2015 um 18:30 schrieb Jörg Weger joerg73@googlemail.com:


Is that really an mkiv issue? If I understood well tikz has its own way
of keeping track of positions independent of context.


Normally yes.

But there is TikZ’ “remember picture” mode. You can produce several independent 
TikZ pictures on a ConTeXt/LaTeX/plain text page. TikZ tells ConTeXt (or LaTeX 
or plain TeX) to give back the coordinates of those pictures on the page after 
the page has been typeset. TikZ can then draw interconnections between those 
images which are rendered in an extra run.


Tikz uses the pdftex commands \pdfsavepos, \pdflastxpos and \pdflastypos to 
save the position
of the graphics on the page. ConTeXt isn’t involved in this process which 
provides its own
interface for this mechanism but Tikz doesn’t use it.


In my example the rounded rectangles with the words inside are TikZ images 
which are put inline into the ConteXt text by the command

\tikz[baseline] \node[form of node, draw, anchor=text] {text content}

When I use

\tikz[baseline, remember picture] …

instead I activate the mode explained above and the arrows can be drawn 
according to the “remembered” coordinates after ConTeXt’s first typesetting run.

According to Wolfgang Schuster in the first reply in this thread when using 
ConTeXt mkiv – other than mkii – file the coordinates given back after the 
first typesetting run look strange in TikZ’ auxiliary so there seems to be a 
mistake somnewhere between ConTeXt and TikZ in this regard.


The problem is the \write command which differs in MkII and MkIV and Tikz
way to prevent the expansion of a command which is written to the auxiliary 
file.


The following example demonstrates the difference between MkII and MkIV.

In MkII the \noexpand prevents the expansion of \dummytext when writes
content is written to the external file but in MkIV \write is redefined and this
doesn’t work anymore.

 begin example
\newwrite\testwrite

\starttext

\immediate\openout\testwrite=\jobname-dummytext.tmp

\def\dummytext{First sample text.}

\immediate\write\testwrite{\noexpand\dummytext}

\def\dummytext{Second sample text.}

\immediate\write\testwrite{\noexpand\dummytext}

\immediate\closeout\testwrite

\stoptext
 end example


this should help:

\unexpanded\def\writeviatex#1#2%
  {\ifx\normalwrite\relax\else
% the \detokenize makes sure we don't expand \noexpanded macros
 \normalwrite#1{\detokenize{#2}}%
   \fi}

(in future version i might replace write completely)

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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Hans Hagen

On 3/8/2015 7:07 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 18:39 schrieb Hans Hagen pra...@wxs.nl:

On 3/8/2015 1:04 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 12:55 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl:

On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl
mailto:pra...@wxs.nl:

this should help:

\unexpanded\def\writeviatex#1#2%
{\ifx\normalwrite\relax\else
  % the \detokenize makes sure we don't expand \noexpanded macros
   \normalwrite#1{\detokenize{#2}}%
\fi}

(in future version i might replace write completely)


Only partially because the saved positions from \pdfsavepos are wrong.


in what sense wrong?


Content of the external file from MkIV (the entries on the first page show 0
and the values on page 2 and 3 are always the same):

1:0:0
2:0:0
3:4661756:45255023
4:4661756:45255023
5:4661756:45255023
6:4661756:45255023

Content of the external file from MkII (different values for the first
and second position on each page):

1:6526435:46204089
2:4661756:45256000
3:6526435:46204089
4:4661756:45256000
5:6526435:46204089
6:4661756:45256000


ypositions can differ a bit because we use different fonts and so does the 
interlinespace


But the values for both positions should be different which isn’t the case for 
MkIV
and the first page saves 0 for the x and y positions.


It's a side effect of expansion at the wrong time (where such primitives 
can return wrong values but at least they return something) but 
something like this works:


\def\syst_write#1#2%
  {\ctxcommand{write(\number#1,\!!bs\normalunexpanded{#2}\!!es)}}

\unexpanded\def\writeviatex#1#2%
  {\ifx\normalwrite\relax\else
 \normalwrite#1{#2}%
   \fi}




--

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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Wolfgang Schuster

 Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl:
 
 this should help:
 
 \unexpanded\def\writeviatex#1#2%
  {\ifx\normalwrite\relax\else
% the \detokenize makes sure we don't expand \noexpanded macros
 \normalwrite#1{\detokenize{#2}}%
   \fi}
 
 (in future version i might replace write completely)

Only partially because the saved positions from \pdfsavepos are wrong.

 begin example
\newwrite\testwrite

\immediate\openout\testwrite=\jobname-testwrite.tmp

\parindent=1cm

\starttext

  \indent\pdfsavepos\write\testwrite{1:\number\pdflastxpos:\number\pdflastypos}

\noindent\pdfsavepos\write\testwrite{2:\number\pdflastxpos:\number\pdflastypos}

\page

  \indent\pdfsavepos\write\testwrite{3:\number\pdflastxpos:\number\pdflastypos}

\noindent\pdfsavepos\write\testwrite{4:\number\pdflastxpos:\number\pdflastypos}

\page

  \indent\pdfsavepos\write\testwrite{5:\number\pdflastxpos:\number\pdflastypos}

\noindent\pdfsavepos\write\testwrite{6:\number\pdflastxpos:\number\pdflastypos}

\stoptext
 end example

Wolfgang___
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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Hans Hagen

On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:



Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl
mailto:pra...@wxs.nl:

this should help:

\unexpanded\def\writeviatex#1#2%
 {\ifx\normalwrite\relax\else
   % the \detokenize makes sure we don't expand \noexpanded macros
\normalwrite#1{\detokenize{#2}}%
  \fi}

(in future version i might replace write completely)


Only partially because the saved positions from \pdfsavepos are wrong.


in what sense wrong?



 begin example
\newwrite\testwrite

\immediate\openout\testwrite=\jobname-testwrite.tmp

\parindent=1cm

\starttext


\indent\pdfsavepos\write\testwrite{1:\number\pdflastxpos:\number\pdflastypos}

\noindent\pdfsavepos\write\testwrite{2:\number\pdflastxpos:\number\pdflastypos}

\page


\indent\pdfsavepos\write\testwrite{3:\number\pdflastxpos:\number\pdflastypos}

\noindent\pdfsavepos\write\testwrite{4:\number\pdflastxpos:\number\pdflastypos}

\page


\indent\pdfsavepos\write\testwrite{5:\number\pdflastxpos:\number\pdflastypos}

\noindent\pdfsavepos\write\testwrite{6:\number\pdflastxpos:\number\pdflastypos}

\stoptext
 end example

Wolfgang


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




--

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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-08 Thread Wolfgang Schuster

 Am 08.03.2015 um 12:55 schrieb Hans Hagen pra...@wxs.nl:
 
 On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:
 
 Am 08.03.2015 um 11:11 schrieb Hans Hagen pra...@wxs.nl 
 mailto:pra...@wxs.nl
 mailto:pra...@wxs.nl mailto:pra...@wxs.nl:
 
 this should help:
 
 \unexpanded\def\writeviatex#1#2%
 {\ifx\normalwrite\relax\else
   % the \detokenize makes sure we don't expand \noexpanded macros
\normalwrite#1{\detokenize{#2}}%
  \fi}
 
 (in future version i might replace write completely)
 
 Only partially because the saved positions from \pdfsavepos are wrong.
 
 in what sense wrong?

Content of the external file from MkIV (the entries on the first page show 0
and the values on page 2 and 3 are always the same):

1:0:0
2:0:0
3:4661756:45255023
4:4661756:45255023
5:4661756:45255023
6:4661756:45255023

Content of the external file from MkII (different values for the first
and second position on each page):

1:6526435:46204089
2:4661756:45256000
3:6526435:46204089
4:4661756:45256000
5:6526435:46204089
6:4661756:45256000

Wolfgang___
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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-07 Thread Hans Hagen

On 3/7/2015 1:08 PM, Jörg Weger wrote:


Metapost’s learnig curve seems to be a lot steeper to me. It is really a
pity that ConTeXt mkiv does not save the node coordinates correctly as
Wolfgang found out.


Is that really an mkiv issue? If I understood well tikz has its own way 
of keeping track of positions independent of context.


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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-07 Thread Jörg Weger

 Is that really an mkiv issue? If I understood well tikz has its own way
 of keeping track of positions independent of context.

Normally yes.

But there is TikZ’ “remember picture” mode. You can produce several 
independent TikZ pictures on a ConTeXt/LaTeX/plain text page. TikZ tells 
ConTeXt (or LaTeX or plain TeX) to give back the coordinates of those 
pictures on the page after the page has been typeset. TikZ can then draw 
interconnections between those images which are rendered in an extra run.


In my example the rounded rectangles with the words inside are TikZ 
images which are put inline into the ConteXt text by the command


\tikz[baseline] \node[form of node, draw, anchor=text] {text content}

When I use

\tikz[baseline, remember picture] …

instead I activate the mode explained above and the arrows can be drawn 
according to the “remembered” coordinates after ConTeXt’s first 
typesetting run.


According to Wolfgang Schuster in the first reply in this thread when 
using ConTeXt mkiv – other than mkii – file the coordinates given back 
after the first typesetting run look strange in TikZ’ auxiliary so there 
seems to be a mistake somnewhere between ConTeXt and TikZ in this regard.



Greetings Jörg


On 07.03.2015 15:52, Hans Hagen wrote:

On 3/7/2015 1:08 PM, Jörg Weger wrote:


Metapost’s learnig curve seems to be a lot steeper to me. It is really a
pity that ConTeXt mkiv does not save the node coordinates correctly as
Wolfgang found out.


Is that really an mkiv issue? If I understood well tikz has its own way
of keeping track of positions independent of context.

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
___

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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-07 Thread Wolfgang Schuster

 Am 07.03.2015 um 18:30 schrieb Jörg Weger joerg73@googlemail.com:
 
  Is that really an mkiv issue? If I understood well tikz has its own way
  of keeping track of positions independent of context.
 
 Normally yes.
 
 But there is TikZ’ “remember picture” mode. You can produce several 
 independent TikZ pictures on a ConTeXt/LaTeX/plain text page. TikZ tells 
 ConTeXt (or LaTeX or plain TeX) to give back the coordinates of those 
 pictures on the page after the page has been typeset. TikZ can then draw 
 interconnections between those images which are rendered in an extra run.

Tikz uses the pdftex commands \pdfsavepos, \pdflastxpos and \pdflastypos to 
save the position
of the graphics on the page. ConTeXt isn’t involved in this process which 
provides its own
interface for this mechanism but Tikz doesn’t use it.

 In my example the rounded rectangles with the words inside are TikZ images 
 which are put inline into the ConteXt text by the command
 
 \tikz[baseline] \node[form of node, draw, anchor=text] {text content}
 
 When I use
 
 \tikz[baseline, remember picture] …
 
 instead I activate the mode explained above and the arrows can be drawn 
 according to the “remembered” coordinates after ConTeXt’s first typesetting 
 run.
 
 According to Wolfgang Schuster in the first reply in this thread when using 
 ConTeXt mkiv – other than mkii – file the coordinates given back after the 
 first typesetting run look strange in TikZ’ auxiliary so there seems to be a 
 mistake somnewhere between ConTeXt and TikZ in this regard.

The problem is the \write command which differs in MkII and MkIV and Tikz
way to prevent the expansion of a command which is written to the auxiliary 
file.


The following example demonstrates the difference between MkII and MkIV.

In MkII the \noexpand prevents the expansion of \dummytext when writes
content is written to the external file but in MkIV \write is redefined and this
doesn’t work anymore.

 begin example
\newwrite\testwrite

\starttext

\immediate\openout\testwrite=\jobname-dummytext.tmp

\def\dummytext{First sample text.}

\immediate\write\testwrite{\noexpand\dummytext}

\def\dummytext{Second sample text.}

\immediate\write\testwrite{\noexpand\dummytext}

\immediate\closeout\testwrite

\stoptext
 end example

Wolfgang
___
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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-07 Thread Jörg Weger
Thank you very much Hans and Aditya for your efforts and sorry for only 
replying now — momentarily I am writing a paper (of course typeset with 
ConTeXt :-) ) that has to get finished.


For now I have dropped the idea of using that certain type of 
illustration in the paper as your METAPOST examples are working, but I 
had forgotten to say that I need effectively two arrows from one part of 
a sentence two two others (I am trying to illustrate a linguistic 
ambiguity problem) and I did not manage to get that working starting 
from your examples. Then I need a shape other than a tight frame to 
surround the words, TikZ’ rounded rectangles were too nice for that. In 
the moment I don’t have the time to dive deeper into METAPOST which 
seems to be a mighty beast from what I see in the Metafun manual, but in 
future I shurely will.


The nice thing about TikZ are that you can use the self explaining 
commands rather intuitively (at least having some experience in Lilypond 
and now ConTeXt), that there are many different building blocks 
predefined that you can use and that there are hundreds of examples in 
the internet that you can use as starting point. So I managed to get 
some things working after a self-tought one day crash course – 
Metapost’s learnig curve seems to be a lot steeper to me. It is really a 
pity that ConTeXt mkiv does not save the node coordinates correctly as 
Wolfgang found out.


Greetings Jörg

On 03.03.2015 20:28, Aditya Mahajan wrote:

On Tue, 3 Mar 2015, Hans Hagen wrote:


On 3/3/2015 6:12 PM, Aditya Mahajan wrote:

2. The metafun alternative is a bit inconvenient. Suppose you want to
draw a bunch of such graphics (words connected by arrows). Then, you
will need to ensure that node names are unique. (Is there a way to get
around that?)


\newcounter\connectedwordcounter

\starttexdefinition unexpanded fromword [#1]#2
\expandafter\pushmacro\csname cwc#1\endcsname % nesting hack
\doglobal\increment\connectedwordcounter
\setxvalue{cwc#1}{\connectedwordcounter}%
\startpositionoverlay{highlightoverlay}
\setMPpositiongraphic
  {\getvalue{cwc#1}f}
  {highlightgraphic}
  {from=\getvalue{cwc#1}f,to=\getvalue{cwc#1}t}
\stoppositionoverlay
\hpos{\getvalue{cwc#1}f}{#2}%
\stoptexdefinition

\starttexdefinition unexpanded toword [#1]#2
\hpos{\getvalue{cwc#1}t}{#2}
\expandafter\popmacro\csname cwc#1\endcsname % nesting hack
\stoptexdefinition


Thanks.

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
___

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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-03 Thread Ulrike Fischer
Am Tue, 3 Mar 2015 08:54:00 +0100 schrieb Wolfgang Schuster:

I wanted to try the example in my context standalone installation
and got an undefined command error on the \usetikzlibrary.
After a bit digging I could repair this with first-install.bat
--modules=t-tikz which seems to get me the newest tikz.

But during this digging I saw

-- that tikz is not mentioned on the module list:
http://modules.contextgarden.net/

-- Following the link to the module
(http://modules.contextgarden.net/TikZ) from
http://wiki.contextgarden.net/TikZ gives an internal error message

-- the installation advices on contextgarden doesn't explain what to
do if you want to update modules too. I'm always using (on windows)
first-setup.bat --keep as explained here
http://wiki.contextgarden.net/ConTeXt_Standalone#Updating_2. But
this doesn't seem to update the modules. Is first-setup.bat --all
better if one simply wants the newest complete standalone?


-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-03 Thread Mojca Miklavec
On Tue, Mar 3, 2015 at 2:27 PM, Ulrike Fischer  wrote:

 I'm always using (on windows)
 first-setup.bat --keep

 I would advise you against using the --keep option unless there are
 some other/strong reasons to do so.

 Then the instructions here are quite misleading:
 http://wiki.contextgarden.net/ConTeXt_Standalone#Updating_2

Thank you. Removed. I need to review the page. There are some weird
statements there.

If you are familiar with rsync: all that --keep does is omit the
--delete flag in rsync modules. It's not exactly the same, but it is
roughly equally evil as setting the TeX Live's option to keep the
removed modules installed. Except that here it would accumulate all
the files that ever existed in ConTeXt since the first day when the
user first installed the distribution. When, say, fonts in TeX Live
move around, users would end up with duplicate files at two locations.

 I'm not a regularly context user, I maintain the installation mostly
 for tests and want an up-to-date, complete (with all modules)
 installation and was looking for a command that compares to tlmgr
 update --all from texlive.

 Did I got it right now that I should do first-setup.bat and that
 first-setup.bat --keep doesn't update the modules?

No, --keep isn't related to updating modules at all. The flag would
help you keep things that you install in your tree from your own
sources (something that doesn't come from the distribution). But it
would also keep all other outdated files. It's waay better to keep
your own files elsewhere. (Even if simply under texmf-local that's
created for you. But not in texmf-modules to texmf-context or
alike.)

Mojca
___
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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-03 Thread Mojca Miklavec
On Tue, Mar 3, 2015 at 1:38 PM, Ulrike Fischer wrote:

 I wanted to try the example in my context standalone installation
 and got an undefined command error on the \usetikzlibrary.
 After a bit digging I could repair this with first-install.bat
 --modules=t-tikz which seems to get me the newest tikz.

 But during this digging I saw

 -- that tikz is not mentioned on the module list:
 http://modules.contextgarden.net/

That site is used for uploading modules by authors. I never thought
about users trying to learn about existence of modules via that site.

 -- Following the link to the module
 (http://modules.contextgarden.net/TikZ) from
 http://wiki.contextgarden.net/TikZ gives an internal error message

I removed the link.

 -- the installation advices on contextgarden doesn't explain what to
 do if you want to update modules too.

Do you want to say that the module gets removed next time when you run
first-setup.bat? If that is the case, it should be fixed. Updating
works for me and also keeps the modules up to date.

 I'm always using (on windows)
 first-setup.bat --keep

I would advise you against using the --keep option unless there are
some other/strong reasons to do so. But you shouldn't need keep just
for the sake of a potential bug.

I would need to check again what exactly --all does. But --modules=all
should install all modules and --modules=t-tikz should be sufficient
to keep that module. However I don't know what happens if you use
--modules=t-somethingelse next time. Maybe that removes the modules
that you installed previously as it expects the complete list of
modules. I need to check.

Mojca
___
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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-03 Thread Ulrike Fischer
Am Tue, 3 Mar 2015 14:11:56 +0100 schrieb Mojca Miklavec:

 -- the installation advices on contextgarden doesn't explain what to
 do if you want to update modules too.

 Do you want to say that the module gets removed next time when you run
 first-setup.bat? If that is the case, it should be fixed. Updating
 works for me and also keeps the modules up to date.

I have no idea ;-). 

 
 I'm always using (on windows)
 first-setup.bat --keep
 
 I would advise you against using the --keep option unless there are
 some other/strong reasons to do so. 

Then the instructions here are quite misleading:
http://wiki.contextgarden.net/ConTeXt_Standalone#Updating_2

I'm not a regularly context user, I maintain the installation mostly
for tests and want an up-to-date, complete (with all modules)
installation and was looking for a command that compares to tlmgr
update --all from texlive.  

Did I got it right now that I should do first-setup.bat and that
first-setup.bat --keep doesn't update the modules?

-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/

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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-03 Thread Aditya Mahajan

On Tue, 3 Mar 2015, Jörg Weger wrote:

In the minimal working example below inside of a text two words should 
be printed inside of rounded TikZ rectangles and should be connected by 
an TikZ arrow pointing from the first word to the other.


TikZ offers the remember picture/overlay option for that.

I have seen a solution similar to what I want to achieve in the METAFUN 
manual but I don’t have a clue how to get that METAPOST alternative working.


Here is how to get the metafun alternative working.

1. I don't understand why I need to manually input the mp-abck file; that 
should be input automatically.


2. The metafun alternative is a bit inconvenient. Suppose you want to draw 
a bunch of such graphics (words connected by arrows). Then, you will need 
to ensure that node names are unique. (Is there a way to get around that?)


3. I did not bother to set the style of the boxes and arrows. So it looks 
a bit dry.


\startMPdefinitions
  % I don't know why this does not get loaded automatically.
  input mp-abck.mpiv;
\stopMPdefinitions

\defineoverlay[highlight] [\positionoverlay{highlightoverlay}]

\startpositionoverlay{highlightoverlay}
  \setMPpositiongraphic{n1}{highlightgraphic}{from=n1,to=n2}
\stoppositionoverlay

\startMPpositiongraphic{highlightgraphic}
  save n; path n[];

  initialize_box(\MPpos{\MPvar{from}}); n[1] := pxy;
  initialize_box(\MPpos{\MPvar{to}});   n[2] := pxy;

  draw n[1];
  draw n[2];

  drawarrow (center n[1]){dir 45} .. {dir -45}(center n[2])
   cutbefore n[1]
   cutafter  n[2];

  anchor_box(\MPanchor{\MPvar{from}});
\stopMPpositiongraphic

\setuppapersize[A6]

\setupbackgrounds[page][background=highlight]

\starttext
\hpos{n1}{this} belongs to \hpos{n2}{that}
\stoptext

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
___

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-03 Thread Hans Hagen

On 3/3/2015 6:12 PM, Aditya Mahajan wrote:

On Tue, 3 Mar 2015, Jörg Weger wrote:


In the minimal working example below inside of a text two words should
be printed inside of rounded TikZ rectangles and should be connected
by an TikZ arrow pointing from the first word to the other.

TikZ offers the remember picture/overlay option for that.

I have seen a solution similar to what I want to achieve in the
METAFUN manual but I don’t have a clue how to get that METAPOST
alternative working.


Here is how to get the metafun alternative working.

1. I don't understand why I need to manually input the mp-abck file;
that should be input automatically.

2. The metafun alternative is a bit inconvenient. Suppose you want to
draw a bunch of such graphics (words connected by arrows). Then, you
will need to ensure that node names are unique. (Is there a way to get
around that?)

3. I did not bother to set the style of the boxes and arrows. So it
looks a bit dry.

\startMPdefinitions
   % I don't know why this does not get loaded automatically.
   input mp-abck.mpiv;
\stopMPdefinitions

\defineoverlay[highlight] [\positionoverlay{highlightoverlay}]

\startpositionoverlay{highlightoverlay}
   \setMPpositiongraphic{n1}{highlightgraphic}{from=n1,to=n2}
\stoppositionoverlay

\startMPpositiongraphic{highlightgraphic}
   save n; path n[];

   initialize_box(\MPpos{\MPvar{from}}); n[1] := pxy;
   initialize_box(\MPpos{\MPvar{to}});   n[2] := pxy;

   draw n[1];
   draw n[2];

   drawarrow (center n[1]){dir 45} .. {dir -45}(center n[2])
cutbefore n[1]
cutafter  n[2];

   anchor_box(\MPanchor{\MPvar{from}});
\stopMPpositiongraphic

\setuppapersize[A6]

\setupbackgrounds[page][background=highlight]

\starttext
\hpos{n1}{this} belongs to \hpos{n2}{that}
\stoptext


\startMPdefinitions
% I don't know why this does not get loaded automatically. Answer: 
seldom needed.

input mp-abck.mpiv;
\stopMPdefinitions

\defineoverlay[highlight] [\positionoverlay{highlightoverlay}]

\startMPpositiongraphic{highlightgraphic}
save n; path n[];

initialize_box(\MPpos{\MPvar{from}}); n[1] := pxy;
initialize_box(\MPpos{\MPvar{to}});   n[2] := pxy;

draw n[1];
draw n[2];

if ypart center n[1]  ypart center n[2] :
drawarrow (center n[1]){dir 225} ... {dir -225}(center n[2])
cutbefore n[1]
cutafter  n[2] ;
else :
drawarrow (center n[1]){dir 45} ... {dir -45}(center n[2])
cutbefore n[1]
cutafter  n[2] ;
fi ;

anchor_box(\MPanchor{\MPvar{from}});
\stopMPpositiongraphic

\newcounter\connectedwordcounter

\starttexdefinition unexpanded fromword [#1]#2
\expandafter\pushmacro\csname cwc#1\endcsname % nesting hack
\doglobal\increment\connectedwordcounter
\setxvalue{cwc#1}{\connectedwordcounter}%
\startpositionoverlay{highlightoverlay}
\setMPpositiongraphic
  {\getvalue{cwc#1}f}
  {highlightgraphic}
  {from=\getvalue{cwc#1}f,to=\getvalue{cwc#1}t}
\stoppositionoverlay
\hpos{\getvalue{cwc#1}f}{#2}%
\stoptexdefinition

\starttexdefinition unexpanded toword [#1]#2
\hpos{\getvalue{cwc#1}t}{#2}
\expandafter\popmacro\csname cwc#1\endcsname % nesting hack
\stoptexdefinition

\setuppapersize[A6]

\setupbackgrounds[page][background=highlight]

\starttext
\fromword[foo]{this} belongs to \toword[foo]{that}
\fromword[bar]{this} belongs to \toword[bar]{that}
\fromword[foo]{this} belongs to \toword[foo]{that}
\fromword[bar]{this} belongs \fromword[bar]{this} belongs to 
\toword[bar]{that} to \toword[bar]{that}

\stoptext

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

Re: [NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-03 Thread Aditya Mahajan

On Tue, 3 Mar 2015, Hans Hagen wrote:


On 3/3/2015 6:12 PM, Aditya Mahajan wrote:

2. The metafun alternative is a bit inconvenient. Suppose you want to
draw a bunch of such graphics (words connected by arrows). Then, you
will need to ensure that node names are unique. (Is there a way to get
around that?)


\newcounter\connectedwordcounter

\starttexdefinition unexpanded fromword [#1]#2
\expandafter\pushmacro\csname cwc#1\endcsname % nesting hack
\doglobal\increment\connectedwordcounter
\setxvalue{cwc#1}{\connectedwordcounter}%
\startpositionoverlay{highlightoverlay}
\setMPpositiongraphic
  {\getvalue{cwc#1}f}
  {highlightgraphic}
  {from=\getvalue{cwc#1}f,to=\getvalue{cwc#1}t}
\stoppositionoverlay
\hpos{\getvalue{cwc#1}f}{#2}%
\stoptexdefinition

\starttexdefinition unexpanded toword [#1]#2
\hpos{\getvalue{cwc#1}t}{#2}
\expandafter\popmacro\csname cwc#1\endcsname % nesting hack
\stoptexdefinition


Thanks.

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
___

[NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-02 Thread Jörg Weger

In the minimal working example below inside of a text two words should
be printed inside of rounded TikZ rectangles and should be connected by
an TikZ arrow pointing from the first word to the other.

TikZ offers the remember picture/overlay option for that.

The MWE works in MkII (command “texexec”) which I am not using, but not
in the latest MkIV (command “context”).

The problem might be that according to the PGF/TikZ manual “You need to
use a driver that supports picture remembering and you need to run TEX
twice” (16.13.1 Referencing a Node in a Different Picture).

So my questions are:

1.) Does LuaTeX support TikZ picture remembering?

2.) If so, how can I get ConTeXt MkIV to “run TeX twice”?

3.) If all of the above worked, would that work also if the inline TikZ
pictures to be remembered are on another file referenced via \input?

I have seen a solution similar to what I want to achieve in the METAFUN
manual but I don’t have a clue how to get that METAPOST alternative working.


Greetings Jörg


 START MWE %

\usemodule[tikz]

\usetikzlibrary[shapes.misc,arrows]

\starttext

\tikz[baseline,remember picture] \node[rounded
rectangle,draw,anchor=text] (n1) {this};
belongs to
\tikz[baseline,remember picture] \node[rounded
rectangle,draw,anchor=text] (n2) {that};

\starttikzpicture
[remember picture,overlay]
\draw[-] (n1.north) to [bend left] (n2.north);
\stoptikzpicture

\stoptext

 STOP MWE %%


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

[NTG-context] Problem with MkIV and TikZ picture remembering

2015-03-02 Thread Jörg Weger
In the minimal working example below inside of a text two words should 
be printed inside of rounded TikZ rectangles and should be connected by 
an TikZ arrow pointing from the first word to the other.


TikZ offers the remember picture/overlay option for that.

The MWE works in MkII (command “texexec”) which I am not using, but not 
in the latest MkIV (command “context”).


The problem might be that according to the PGF/TikZ manual “You need to 
use a driver that supports picture remembering and you need to run TEX 
twice” (16.13.1 Referencing a Node in a Different Picture).


So my questions are:

1.) Does LuaTeX support TikZ picture remembering?

2.) If so, how can I get ConTeXt MkIV to “run TeX twice”?

3.) If all of the above worked, would that work also if the inline TikZ 
pictures to be remembered are on another file referenced via \input?


I have seen a solution similar to what I want to achieve in the METAFUN 
manual but I don’t have a clue how to get that METAPOST alternative working.



Greetings Jörg


 START MWE %

\usemodule[tikz]

\usetikzlibrary[shapes.misc,arrows]

\starttext

\tikz[baseline,remember picture] \node[rounded 
rectangle,draw,anchor=text] (n1) {this};

belongs to
\tikz[baseline,remember picture] \node[rounded 
rectangle,draw,anchor=text] (n2) {that};


\starttikzpicture
[remember picture,overlay]
\draw[-] (n1.north) to [bend left] (n2.north);
\stoptikzpicture

\stoptext

 STOP MWE %%
___
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
___