%--------------------------------------------
%
% Package pgfplots
%
% Provides a user-friendly interface to create function plots (normal
% plots, semi-logplots and double-logplots).
%
% It is based on Till Tantau's PGF package.
%
% Copyright 2007/2008/2019 by Christian Feuersänger.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see .
%
%--------------------------------------------
% This file provides an interface to the
% pgfmanual.prettyprint.code.tex thing -- it allows to
% *generate pdf crossrefs inside of codeexamples automatically*
% without any user input.
%
% Thus, you write
% \begin{codeexample}[]
% \begin{tikzpicture}[options]
% \end{tikzpicture}
% \end{codeexample}
% and pdf cross references to the definitions of 'tikzpicture'
% and any options will be generated automatically.
%
% Furthermore, pdf cross references will be generated for everything
% within vertical bars, |....|.
%
%
%
%
%
% The only necessary thing is that \pgfmanualpdflabel has been called
% for every (fully qualified) key, control sequence, environment or
% whatever.
\newif\ifpgfmanualpdfwarnings
\pgfmanualpdfwarningstrue
\newif\ifpgfmanualshowlabels
\pgfkeys{%
/codeexample/prettyprint/cs arguments/pgfkeys/.initial=1,
/codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace},
%
/codeexample/prettyprint/autolinks/.style={%
/codeexample/prettyprint/key name/.code={\pgfmanualpdfref{##1}{##1}},
/codeexample/prettyprint/key name with handler/.code 2 args={\pgfmanualpdfref{##1}{##1}/\pgfmanualpdfref{/handlers/##2}{##2}},
/codeexample/prettyprint/key value display only/.code={\pgfmanualprettyprintcode{##1}},
/codeexample/prettyprint/cs/.code={\pgfmanualpdfref{##1}{##1}},
/codeexample/prettyprint/cs with args/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintcode{##2}\pgfmanualclosebrace},
/codeexample/prettyprint/cs arguments/pgfkeys/.initial=1,
/codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace},
/codeexample/prettyprint/cs arguments/begin/.initial=1,
/codeexample/prettyprint/cs/begin/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace},
/codeexample/prettyprint/cs arguments/end/.initial=1,
/codeexample/prettyprint/cs/end/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace},
/codeexample/prettyprint/word/.code={\begingroup\pgfkeyssetvalue{/pdflinks/search key prefixes in}{}\pgfmanualpdfref{##1}{##1}\endgroup},
/codeexample/prettyprint/point/.code={##1},%
/codeexample/prettyprint/point with cs/.code 2 args={(\pgfmanualpdfref{##1}{##1}:##2},%
},%
/codeexample/prettyprint/autolinks,
}%
\pgfkeys{
%
% Enables or disables the parsing of codeexamples.
/pdflinks/codeexample links/.is if=pgfmanualprettyenabled,
/pdflinks/codeexample links/.default=true,
%
% How to render a hyperlink
/pdflinks/render hyperlink/.code={#1},
%
% whenever an unqualified key is found, the following key prefix
% list is tried to find a match.
/pdflinks/search key prefixes in/.initial={/tikz/,/pgf/},
%
% Enables or disables warnings for failed auto links:
/pdflinks/warnings/.is if=pgfmanualpdfwarnings,
/pdflinks/warnings/.default=true,
%
% Shows the autogenerated labels. This is useful to check if the
% 'search key prefixes in' worked as it ought to.
/pdflinks/show labels/.is if=pgfmanualshowlabels,
/pdflinks/show labels/.default=true,
/pdflinks/show labels=false,
% will be invoked with '#1' set to the generated label.
/pdflinks/show labels code/.code={
\hbox to 0pt{%
\vbox to 0pt{\hsize=0pt
\vskip-\baselineskip
\hbox to \hsize{%
\hss
{\footnotesize\ttfamily\textcolor{red}{#1}}%
\hss
}%
\vss
}%
\vbox to 0pt{\hsize=0pt
\vss
\hbox to \hsize{%
\hss
{\footnotesize\ttfamily\textcolor{red}{$\vert$}}%
\hss
}%
}%
\vsize=0pt
}%
},
%
% the link prefix written to the pdf file:
/pdflinks/internal link prefix/.initial=pgf,
}
\begingroup
\catcode`\_=12
\gdef\pgfmanualpdf@underscore{_}%
\catcode`\ =13\relax\gdef\pgfmanualpdf@install@active@space{\def {\space}}%
\endgroup
\gdef\pgfmanualpdf@installreplacements{%
\def\marg##1{{##1}}%
\def\oarg##1{[##1]}%
\def\meta##1{meta(##1)}%
\def\x{x}%
\def\textbackslash{back/}%
\def\\{\textbackslash}%
\def\space{:}%
\edef\ {\space}%
\edef\SPACE{\` \relax}%
\ifnum\the\catcode`\ =13 %
\pgfmanualpdf@install@active@space
\fi
\edef\#{}%
\def\printanat{@}%
\def\protect{}%
\def\textasciicircum{o}%
\def\_{\pgfmanualpdf@underscore}%
\expandafter\edef\pgfmanual@verb@activebar{\pgfmanual@verb@bar}%
}%
% Defines a new pdf cross ref label for use with \pgfmanualpdfref.
%
% Usage:
% \pgfmanualpdflabel{