Re: [NTG-context] [tikz] pgfplotsreplacepdfmark error

2018-08-31 Thread Hans Hagen

On 8/31/2018 11:04 PM, Pierre-Francois Bonnefoi wrote:

Hello,


On 31 Aug 2018, at 22:03, Hans Hagen  wrote:

On 8/31/2018 9:52 PM, Pierre-Francois Bonnefoi wrote:

Hello,
I'm currently working on some graphs with pgfplots and tikz and got this error :

Undefined control sequence
\pgfplotsreplacepdfmark {pgfid7}{pgfid6}
---
This error occurs only in conjunction with :
\tikzstyle{every picture}+=[remember picture]
I use the standalone version of ConTeXt on OS X.
Do you have any idea to get rid of it ?

i dont' even have a clue what a pdf marks does (two decades ago it was 
something in postscript to add pdf related functionality like hyperlinks)

low level pdf jugling is likely to conflict with how context does things

just try this:

\let\pgfplotsreplacepdfmark\gobbletwoarguments



I've tried it and obviously the error is gone, as the possibility to get a 
named coordinate in a pgfplot graph that can be used to put an overlay on the 
graph.

The solution that I've found is to put the definition of the function 
pgfplotsreplacepdfmark in a place where the second pass of the luatex 
interpreter could find it.

I've put these lines, copied from the file 
'/texmf-modules/tex/generic/pgfplots/pgfplots.code.tex'  into the file 
'cont-yes.mkiv' :


that one will be overwritten next update .. better use cont-loc.mkiv in 
texmf-local/tex/context/user/ or so and add


\writestatus{}{pdfmark hack}

and keep an eye on tikz fixes


-
\unprotect
% Replaces the pdfmark for #1 by that of #2.
%
% Note that when this macro is executed (it resides in the .aux file),
% the pdfmark for #2 is typically UNDEFINED.
%
% #1: the pgfpictureid to modify
% #2: the pgfpictureid which contains the correct values
\def\pgfplotsreplacepdfmark#1#2{%
 \pgfsys@getposition{#1}{\pgfplots@loc@TMPa}%
 \ifx\pgfplots@loc@TMPa\relax
 % hm. strange. Perhaps the driver does not support it?
 \else
 % Ok, make a "lazy replace":
 \expandafter\let\expandafter\pgfplots@glob@TMPa\csname 
pgf@sys@pdf@mark@pos@#1\endcsname
 \expandafter\global\expandafter\let\csname 
pgf@sys@pdf@mark@pos@#1@old\endcsname=\pgfplots@loc@TMPa%
 %
 \expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{%
 % this is the lazy replace, assuming knowledge about how
 % pgf calls its internal structures :-/
 %
 % If pgf changes its name, this macro will never be
 % called and we do not hurt someone.
 \pgfsys@getposition{#2}{\pgfplots@loc@TMPa}%
 \ifx\pgfplots@loc@TMPa\relax
 % oh - the picture if for #2 has no remembered name!?
 % Perhaps something failed?
 % try a fall-back. This will most fail (most
 % probably). Issue a warning?
 \csname pgf@sys@pdf@mark@pos@#1@old\endcsname
 \else
 % use #2:
 \pgfplots@loc@TMPa
 \fi
 }%
 \fi
}%

\protect

And now the overlay works as intended : I could draw a graph in a Tikz picture, 
compute some intersections and put an overlay on it from a second Tikz picture.

It seems that the order used by the parser to input files could be patched to 
correct this error.

Thank you very much for your support,
best regards,
Pierre-François.




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] [tikz] pgfplotsreplacepdfmark error

2018-08-31 Thread Pierre-Francois Bonnefoi
Hello,

> On 31 Aug 2018, at 22:03, Hans Hagen  wrote:
> 
> On 8/31/2018 9:52 PM, Pierre-Francois Bonnefoi wrote:
>> Hello,
>> I'm currently working on some graphs with pgfplots and tikz and got this 
>> error :
>> 
>> Undefined control sequence
>> \pgfplotsreplacepdfmark {pgfid7}{pgfid6}
>> ---
>> This error occurs only in conjunction with :
>> \tikzstyle{every picture}+=[remember picture]
>> I use the standalone version of ConTeXt on OS X.
>> Do you have any idea to get rid of it ?
> i dont' even have a clue what a pdf marks does (two decades ago it was 
> something in postscript to add pdf related functionality like hyperlinks)
> 
> low level pdf jugling is likely to conflict with how context does things
> 
> just try this:
> 
> \let\pgfplotsreplacepdfmark\gobbletwoarguments
> 
> 
I've tried it and obviously the error is gone, as the possibility to get a 
named coordinate in a pgfplot graph that can be used to put an overlay on the 
graph.

The solution that I've found is to put the definition of the function 
pgfplotsreplacepdfmark in a place where the second pass of the luatex 
interpreter could find it.

I've put these lines, copied from the file 
'/texmf-modules/tex/generic/pgfplots/pgfplots.code.tex'  into the file 
'cont-yes.mkiv' :
-
\unprotect
% Replaces the pdfmark for #1 by that of #2.
%
% Note that when this macro is executed (it resides in the .aux file),
% the pdfmark for #2 is typically UNDEFINED.
%
% #1: the pgfpictureid to modify
% #2: the pgfpictureid which contains the correct values
\def\pgfplotsreplacepdfmark#1#2{%
\pgfsys@getposition{#1}{\pgfplots@loc@TMPa}%
\ifx\pgfplots@loc@TMPa\relax
% hm. strange. Perhaps the driver does not support it?
\else
% Ok, make a "lazy replace":
\expandafter\let\expandafter\pgfplots@glob@TMPa\csname 
pgf@sys@pdf@mark@pos@#1\endcsname
\expandafter\global\expandafter\let\csname 
pgf@sys@pdf@mark@pos@#1@old\endcsname=\pgfplots@loc@TMPa%
%
\expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{%
% this is the lazy replace, assuming knowledge about how
% pgf calls its internal structures :-/
%
% If pgf changes its name, this macro will never be
% called and we do not hurt someone.
\pgfsys@getposition{#2}{\pgfplots@loc@TMPa}%
\ifx\pgfplots@loc@TMPa\relax
% oh - the picture if for #2 has no remembered name!?
% Perhaps something failed?
% try a fall-back. This will most fail (most
% probably). Issue a warning?
\csname pgf@sys@pdf@mark@pos@#1@old\endcsname
\else
% use #2:
\pgfplots@loc@TMPa
\fi
}%
\fi
}%

\protect 

And now the overlay works as intended : I could draw a graph in a Tikz picture, 
compute some intersections and put an overlay on it from a second Tikz picture.

It seems that the order used by the parser to input files could be patched to 
correct this error.

Thank you very much for your support,
best regards,
Pierre-François.

-- 
Bonnefoi Pierre-Francois|  E-mail : bonne...@unilim.fr 
http://p-fb.net/
Universite de Limoges, Laboratoire XLIM |   Tel : 06 28 18 03 38
123 av Albert Thomas|  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE| The Avengers.

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] [tikz] pgfplotsreplacepdfmark error

2018-08-31 Thread Hans Hagen

On 8/31/2018 9:52 PM, Pierre-Francois Bonnefoi wrote:

Hello,

I'm currently working on some graphs with pgfplots and tikz and got this error :

Undefined control sequence
\pgfplotsreplacepdfmark {pgfid7}{pgfid6}
---

This error occurs only in conjunction with :
\tikzstyle{every picture}+=[remember picture]


I use the standalone version of ConTeXt on OS X.

Do you have any idea to get rid of it ?
i dont' even have a clue what a pdf marks does (two decades ago it was 
something in postscript to add pdf related functionality like hyperlinks)


low level pdf jugling is likely to conflict with how context does things

just try this:

\let\pgfplotsreplacepdfmark\gobbletwoarguments

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___