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

Jörg Weger joerg73.muc at googlemail.com
Fri Mar 13 14:17:24 CET 2015


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 <pragma at wxs.nl>:
>>>
>>> On 3/8/2015 1:04 PM, Wolfgang Schuster wrote:
>>>>
>>>>> Am 08.03.2015 um 12:55 schrieb Hans Hagen <pragma at wxs.nl
>>>>> <mailto:pragma at wxs.nl>>:
>>>>>
>>>>> On 3/8/2015 12:26 PM, Wolfgang Schuster wrote:
>>>>>>
>>>>>>> Am 08.03.2015 um 11:11 schrieb Hans Hagen <pragma at wxs.nl
>>>>>>> <mailto:pragma at wxs.nl>
>>>>>>> <mailto:pragma at 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}
>
>
>
>


More information about the ntg-context mailing list