[NTG-context] [tikz] pgfplotsreplacepdfmark error

Pierre-Francois Bonnefoi bonnefoi at unilim.fr
Fri Aug 31 23:04:16 CEST 2018


Hello,

> On 31 Aug 2018, at 22:03, Hans Hagen <j.hagen at xs4all.nl> 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 at getposition{#1}{\pgfplots at loc@TMPa}%
    \ifx\pgfplots at loc@TMPa\relax
        % hm. strange. Perhaps the driver does not support it?
    \else
        % Ok, make a "lazy replace":
        \expandafter\let\expandafter\pgfplots at glob@TMPa\csname pgf at sys@pdf at mark@pos@#1\endcsname
        \expandafter\global\expandafter\let\csname pgf at sys@pdf at mark@pos@#1 at old\endcsname=\pgfplots at loc@TMPa%
        %
        \expandafter\gdef\csname pgf at sys@pdf at 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 at getposition{#2}{\pgfplots at loc@TMPa}%
            \ifx\pgfplots at 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 at sys@pdf at mark@pos@#1 at old\endcsname
            \else
                % use #2:
                \pgfplots at 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 : bonnefoi at 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.



More information about the ntg-context mailing list