diff options
Diffstat (limited to 'graphics/pgf/base/tex/latex')
42 files changed, 6829 insertions, 0 deletions
diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgf.sty b/graphics/pgf/base/tex/latex/basiclayer/pgf.sty new file mode 100644 index 0000000000..0474adfc31 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgf.sty @@ -0,0 +1,39 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgf.sty} + +\def\pgf@draft{} +\DeclareOption{draft}{\def\pgf@draft{\pgf@draftmodetrue}} + +% the following obsolete stuff is loaded by default: +\def\pgf@obsolete{\RequirePackage{pgfcomp-version-0-65,pgfcomp-version-1-18}} + +\DeclareOption{version=0.65}{} % obsolete stuff is loaded +\DeclareOption{version=0.96}{\def\pgf@obsolete{\RequirePackage{pgfcomp-version-1-18}}} % less obsolete stuff is loaded +\DeclareOption{version=1.18}{\def\pgf@obsolete{\RequirePackage{pgfcomp-version-1-18}}} % less obsolete stuff is loaded +\DeclareOption{version=latest}{\def\pgf@obsolete{}} % no obsolete stuff is loaded + +\ProcessOptions + +\RequirePackage{pgfcore} + +\usepgfmodule{shapes,plot} + +%\RequirePackage{pgfbasesnakes} +%\RequirePackage{pgfbasedecorations} +%\RequirePackage{pgfbasematrix} + +\pgf@obsolete +\pgf@draft + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfbaseimage.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfbaseimage.sty new file mode 100644 index 0000000000..7920e4daa9 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfbaseimage.sty @@ -0,0 +1,15 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfbaselayers.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfbaselayers.sty new file mode 100644 index 0000000000..7920e4daa9 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfbaselayers.sty @@ -0,0 +1,15 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfbasematrix.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfbasematrix.sty new file mode 100644 index 0000000000..01715384c1 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfbasematrix.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{matrix} instead} + +\usepgfmodule{matrix} + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfbasepatterns.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfbasepatterns.sty new file mode 100644 index 0000000000..7920e4daa9 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfbasepatterns.sty @@ -0,0 +1,15 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete and no longer needed} + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfbaseplot.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfbaseplot.sty new file mode 100644 index 0000000000..1db7f610e1 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfbaseplot.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{plot} instead} + +\usepgfmodule{plot} + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfbaseshapes.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfbaseshapes.sty new file mode 100644 index 0000000000..b91b44df18 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfbaseshapes.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{shapes} instead} + +\usepgfmodule{shapes} + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfbasesnakes.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfbasesnakes.sty new file mode 100644 index 0000000000..82fcb1f0a2 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfbasesnakes.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgfcore} + +\PackageWarning{pgf}{This package is obsolete. Use \string\usepgfmodule{decorations} instead} + +\usepgfmodule{decorations} + +\endinput diff --git a/graphics/pgf/base/tex/latex/basiclayer/pgfcore.sty b/graphics/pgf/base/tex/latex/basiclayer/pgfcore.sty new file mode 100644 index 0000000000..02c5e696e0 --- /dev/null +++ b/graphics/pgf/base/tex/latex/basiclayer/pgfcore.sty @@ -0,0 +1,17 @@ +% Copyright 2019 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{graphicx} +\RequirePackage{pgfsys} +\RequirePackage{keyval} +\RequirePackage{xcolor} + +\input{pgfcore.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgfarrows.sty b/graphics/pgf/base/tex/latex/compatibility/pgfarrows.sty new file mode 100644 index 0000000000..d619cfd7df --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgfarrows.sty @@ -0,0 +1,19 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgfarrows.sty} + +\RequirePackage{pgf} + +\PackageWarning{pgfarrows}{This package is obsolete. pgf.sty will load + arrow management automatically} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgfautomata.sty b/graphics/pgf/base/tex/latex/compatibility/pgfautomata.sty new file mode 100644 index 0000000000..a5ccb62fae --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgfautomata.sty @@ -0,0 +1,315 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgfautomata.sty} + + +\RequirePackage{pgf} + +\PackageWarning{pgfautomata}{This package is obsolete.} + +\ProcessOptions + +% +% Package for drawing finite automata. +% + + +\newdimen\pgf@stateradius +\newdimen\pgf@mooreradius +\newdimen\pgf@doublethickness +\newdimen\pgf@statebackoff + + + + +% Automaton environment - setup of certain drawing parameters like arrows. +% +% Example: +% +% \begin{pgfpicture}{-2cm}{-2cm}{2cm}{2cm}% +% \begin{pgfautomaton} +% \pgfstaterejecting{q1}{\pgforigin}{$q_1$} +% \pgfstateaccepting{q2}{\pgfstaterelative[east]{q1}{1cm}}{$q_2$} +% \pgfstateaccepting{q3}{\pgfstaterelative[east]{q2}{1cm}}{$q_3$} +% +% \pgfstateconnect{q1}{q2}[.5]{$0$} +% \pgfstateconnect{q2}{q3}[.5]{$1$} +% \pgfstateloop{q1}{90}{$1$} +% \pgfstateloop{q2}{90}{$1$} +% \end{pgfautomaton} +% \end{pgfpicture} + +\def\pgfautomaton{\begin{pgfscope}% + \pgfsetendarrow{\pgfarrowto}% + \pgfnodesetsepend{4pt}\ignorespaces} +\def\endpgfautomaton{\end{pgfscope}} + + + +% Set the outer state radius to #1. +% +% #1 = new state radius. +% +% Example: +% +% \pgfsetstateradius{10pt} + +\def\pgfsetstateradius#1{\setlength\pgf@stateradius{#1}\ignorespaces} + +\pgfsetstateradius{1em} + + + +% Set the state radius for Moore states to #1. +% +% #1 = new state radius. +% +% Example: +% +% \pgfsetstatemooreradius{10pt} + +\def\pgfsetstatemooreradius#1{\setlength\pgf@mooreradius{#1}\ignorespaces} + +\pgfsetstatemooreradius{2em} + + + +% Set the distance between the outer and the inner circle in an +% accepting state. +% +% #1 = new distance radius. +% +% Example: +% +% \pgfsetstatecircledistance{1.2pt} + +\def\pgfsetstatecircledistance#1{\setlength\pgf@doublethickness{#1}\ignorespaces} + +\pgfsetstatecircledistance{1.6pt} + + + +% Set the distance between a connecting line and a label to #1. +% +% #1 = new distance +% +% Example: +% +% \pgfsetstatelabeldistance{4pt} + +\def\pgfsetstatelabeldistance#1{\setlength\pgf@statebackoff{#1}\ignorespaces} + +\pgfsetstatelabeldistance{4pt} + + +% Draws an accepting state #1 with name #3 at position #2. +% +% #1 = a name +% #2 = a point +% #3 = a text +% +% Example: +% +% \pgfstateaccepting{q1}{\pgfxy(1,1)}{$q_1$} + +\def\pgfstateaccepting#1#2#3{% + \pgfnodecircle{#1}[stroke]{#2}{\pgf@stateradius}% + \pgfputat{#2}{\pgfbox[center,center]{#3}}% + {% + \pgf@xa=\pgf@stateradius% + \advance\pgf@xa by-\pgf@doublethickness% + \pgfcircle[stroke]{#2}{\pgf@xa}}\ignorespaces} + + +% Draws a rejecting state #1 with name #3 at position #2. +% +% #1 = a name +% #2 = a point +% #3 = a text +% +% Example: +% +% \pgfstaterejecting{q2}{\pgfstatedirection[n]{q1}}{$q_2$} + +\def\pgfstaterejecting#1#2#3{% + \pgfnodecircle{#1}[stroke]{#2}{\pgf@stateradius}% + \pgfputat{#2}{\pgfbox[center,center]{#3}}\ignorespaces} + + +% Draws a Moore state #1 with name #3 and output #4 at position #2. +% +% #1 = a name +% #2 = a point +% #3 = a text +% #4 = an output text +% +% Example: +% +% \pgfstatemoore{q}{\pgfxy(1,1)}{$q_1$}{$0,1$} + +\def\pgfstatemoore#1#2#3#4{% + \pgfnodecircle{#1}[stroke]{#2}{\pgf@mooreradius}% + \begin{pgftranslate}{#2}% + \begin{pgfscope}% + \pgfsetdash{{2pt}{1pt}}{0pt}% + \pgfmoveto{\pgfpoint{-\pgf@mooreradius}{0cm}}% + \pgflineto{\pgfpoint{\pgf@mooreradius}{0cm}}% + \pgfqstroke% + \end{pgfscope}% + \pgfputat{\pgfpoint{0cm}{0.4\pgf@mooreradius}}{\pgfbox[center,base]{#3}}% + \pgfputat{\pgfpoint{0cm}{-0.2\pgf@mooreradius}}{\pgfbox[center,top]{#4}}% + \end{pgftranslate}\ignorespaces} + + + + +% Connect states #1 and #2 and draw #4 above label, #3-th part of the +% way from #1 to #2. +% +% #1 = a start state +% #2 = an end state +% #3 = a fraction of the distance between the two +% #4 = a label +% +% Example: +% +% \pgfstateconnect{q1}{q2}[.5]{$0$} + +\def\pgfstateconnect#1#2[#3]#4{% + \pgfnodeconnline{#1}{#2}% + \pgfnodelabel{#1}{#2}[#3][\pgf@statebackoff]% + {\pgfbox[center,bottom]{#4}}\ignorespaces} + + + +% Connect states #1 and #2 and draw #4 above label, #3-th part of the +% way from #1 to #2. +% +% #1 = a start state +% #2 = an end state +% #3 = a fraction of the distance between the two +% #4 = a label +% +% Example: +% +% \pgfstateconnectrotated{q1}{q2}[.5]{$0$} + +\def\pgfstateconnectrotated#1#2[#3]#4{% + \pgfnodeconnline{#1}{#2}% + \pgfnodelabelrotated{#1}{#2}[#3][\pgf@statebackoff]% + {\pgfbox[center,bottom]{#4}}\ignorespaces} + + + +% Connect state #1 with itself with label #3 and a loop going in +% direction #2. +% +% #1 = a state +% #2 = an angle +% #3 = a label +% +% Example: +% +% \pgfstateloop{q1}{90}{$0$} + +\def\pgfstateloop#1#2#3{% + \c@pgf@counta=#2\relax% + \c@pgf@countb=#2\relax% + \advance\c@pgf@counta by15\relax% + \advance\c@pgf@countb by-15\relax% + \pgfnodeconncurve{#1}{#1}{\the\c@pgf@counta}{\the\c@pgf@countb}{2\pgf@stateradius}{2\pgf@stateradius}% + \pgfputat{\pgfnodeborder{#1}{#2}{2.25\pgf@stateradius}}{\pgfbox[center,center]{#3}}\ignorespaces} + + + +% Connect states #1 and #2 and draw #4 above label, #3-th part of the +% way from #1 to #2. +% +% #1 = a start state +% #2 = an end state +% #3 = a start angle +% #4 = an end angle +% +% Example: +% +% \pgfstatecurve{q1}{q2}{10}{-10} + +\def\pgfstatecurve#1#2#3#4{% + \pgfnodeconncurve{#1}{#2}{#3}{#4}{2\pgf@stateradius}{2\pgf@stateradius}\ignorespaces} + + + +% Give a position relative to some state. +% +% #1 = a direction +% #2 = a state +% #3 = a distance +% +% Example: +% +% \pgfstaterelative[east]{q2}{1cm} + +\def\pgfstaterelative{\pgfnoderelative} + + + +% Draw an initial state by drawing an inleading line. +% +% #1 = a state +% #2 = a direction leading into the state (n,s,e,w) +% #3 = a label (for example ``start'') +% +% Example: +% +% \pgfstateinitial{q1}[w]{start} + +\def\pgfstateinitial#1[#2]#3{{% + \pgfmoveto{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{-2pt}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + \pgflineto{\pgfnodeborder{#1}{\pgfdirection{#2}}{\pgf@nodesepend}}% + \pgfstroke% + \edef\temp{[\csname pgf@statepos\pgfdirection{#2}\endcsname]}% + \pgfputat{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{0pt}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + {\expandafter\pgfbox\temp{#3}}}\ignorespaces} + +\expandafter\def\csname pgf@statepos0\endcsname{left,center} +\expandafter\def\csname pgf@statepos90\endcsname{center,bottom} +\expandafter\def\csname pgf@statepos180\endcsname{right,center} +\expandafter\def\csname pgf@statepos270\endcsname{center,top} + + + +% Draw an final state by drawing an outleading line. +% +% #1 = a state +% #2 = a direction leading out of the state (valid directions are +% n,s,e,w) +% #3 = a label (for example ``exit'') +% +% Example: +% +% \pgfstatefinal{q1}[right]{accept} + +\def\pgfstatefinal#1[#2]#3{{% + \pgfmoveto{\pgfnodeborder{#1}{\pgfdirection{#2}}{\pgf@nodesepstart}}% + \pgflineto{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{-\pgf@nodesepend}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + \pgfstroke% + \edef\tempb{[\csname pgf@statepos\pgfdirection{#2}\endcsname]}% + \pgfputat{\pgfrelative{\pgfnodeborder{#1}{\pgfdirection{#2}}{0pt}}% + {\pgfpolar{\pgfdirection{#2}}{1.5\pgf@stateradius}}}% + {\expandafter\pgfbox\tempb{#3}}}\ignorespaces} + + + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgfcomp-version-0-65.sty b/graphics/pgf/base/tex/latex/compatibility/pgfcomp-version-0-65.sty new file mode 100644 index 0000000000..8bb5ab447d --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgfcomp-version-0-65.sty @@ -0,0 +1,719 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgfcomp-version-0-65.sty} + +\def\pgfdirection#1{\csname pgf@direction#1\endcsname} + +\def\pgf@directionn{90} +\def\pgf@directionnorth{90} +\def\pgf@directionabove{90} +\def\pgf@directions{270} +\def\pgf@directionsouth{270} +\def\pgf@directionbelow{270} +\def\pgf@directionw{180} +\def\pgf@directionwest{180} +\def\pgf@directionleft{180} +\def\pgf@directione{0} +\def\pgf@directioneast{0} +\def\pgf@directionright{0} +\def\pgf@directionne{45} +\def\pgf@directionse{315} +\def\pgf@directionnw{135} +\def\pgf@directionsw{-135} + + +\def\pgfpictureboxed#1#2#3#4{% + \pgfpicture{#1}{#2}{#3}{#4}% + \pgfmoveto{\pgfpoint{#1}{#2}}% + \pgflineto{\pgfpoint{#1}{#4}}% + \pgflineto{\pgfpoint{#3}{#4}}% + \pgflineto{\pgfpoint{#3}{#2}}% + \pgfclosestroke\ignorespaces} +\def\endpgfpictureboxed{\endpgfpicture} + +\def\pgfxyline(#1,#2)(#3,#4){% + \pgfmoveto{\pgfxy(#1,#2)}% + \pgflineto{\pgfxy(#3,#4)}% + \pgfstroke} + +\def\pgfxycurve(#1,#2)(#3,#4)(#5,#6)(#7,#8){% + \pgfmoveto{\pgfxy(#1,#2)}% + \pgfbezier{\pgfxy(#3,#4)}{\pgfxy(#5,#6)}{\pgfxy(#7,#8)}% + \pgfstroke} + +\def\pgfline#1#2{% + \pgfmoveto{#1}% + \pgflineto{#2}% + \pgfstroke} + +\let\pgflineto=\pgfpathlineto +\let\pgfmoveto=\pgfpathmoveto +\let\pgfcurveto=\pgfpathcurveto +\let\pgfbezier=\pgfpathcurveto +\let\pgfarc=\pgfpatharc + +\def\pgfzerocircle#1{\pgfcircle{\pgforigin}{#1}} +\def\pgfzeroellipse#1#2{\pgfellipse{\pgforigin}{#1}{#2}} +\def\pgfeofill{{\pgfseteorule\pgfsys@flushpath\pgfsys@fill}\pgf@resetpathsizes\ignorespaces} +\def\pgfeofillstroke{{\pgfseteorule\pgfsys@flushpath\pgfsys@fillstroke}\pgf@resetpathsizes\ignorespaces} +\def\pgf@perform@eofill{\pgfeofill} +\def\pgf@perform@eofillstroke{\pgfeofillstroke} +\let\pgfdiff=\pgfpointdiff +\let\pgfrelative=\pgfpointadd +\let\pgfpartway=\pgfpointlineattime +\let\pgfbackoff=\pgfpointlineatdistance +\def\pgflabel#1#2#3#4{% + % First, calculate base point + \pgfpointlineattime{#1}{#2}{#3}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@process{#2}% + \pgf@xa=\pgf@x% xb/yb = start point + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \pgf@process{\pgfpointnormalised{}}% x/y = normalised vector + \setlength\pgf@ya{#4}% + \pgf@xa=-\pgf@ya\relax% + \pgf@xa=\pgf@sys@tonumber{\pgf@y}\pgf@xa% + \pgf@ya=\pgf@sys@tonumber{\pgf@x}\pgf@ya% + \pgf@x=\pgf@xb\relax% + \pgf@y=\pgf@yb\relax% + \advance\pgf@x by\pgf@xa\relax% + \advance\pgf@y by\pgf@ya\relax% + \ignorespaces} +\let\pgfnormalise=\pgfpointnormalised +\let\pgfpolar=\pgfpointpolar +\let\pgforigin=\pgfpointorigin +\let\pgfclosepath=\pgfpathclose + +\def\pgfxy(#1,#2){\pgfpointxy{#1}{#2}} +\def\pgfxyz(#1,#2,#3){\pgfpointxyz{#1}{#2}{#3}} +\newcommand\pgfgrid[3][]{\pgfpathgrid[#1]{#2}{#3}\pgfqstroke} +\newcommand\pgfellipse[4][]{% + \pgfpathellipse{#2}{#3}{#4}% + \csname pgf@perform@#1\endcsname\ignorespaces +} +\newcommand\pgfcircle[3][]{\pgfellipse[#1]{#2}{\pgfpoint{#3}{0pt}}{\pgfpoint{0pt}{#3}}} +\newcommand\pgfrect[3][]{% + \pgfpathrectangle{#2}{#3}% + \csname pgf@perform@#1\endcsname% +} +\def\pgf@perform@stroke{\pgfqstroke} +\def\pgf@perform@fill{\pgffill} +\def\pgf@perform@fillstroke{\pgffillstroke} +\def\pgf@perform@clip{\pgfclip} + +\def\pgfsincos#1{% + \pgfmathparse{#1}% + \pgfmathcos@{#1}\pgf@y\pgfmathresult pt% + \pgfmathsin@{#1}\pgf@x\pgfmathresult pt% +} + +\let\pgfdegree=\pgfsincos + +\newenvironment{pgfmagnify}[2]{\pgflowlevelscope{\pgftransformcm{#1}{0}{0}{#2}{\pgfpointorigin}}}{\endpgflowlevelscope} +\newenvironment{pgftranslate}[1]{\pgflowlevelscope{\pgftransformshift{#1}}}{\endpgflowlevelscope} +\newcommand{\pgftranslateto}[1]{\pgflowlevel{\pgftransformshift{#1}}} +\newenvironment{pgfrotateby}[1]{% + \pgf@process{#1}% + \pgf@xa=-\pgf@x% + \edef\pgf@temp{\noexpand\pgflowlevelscope{\noexpand\pgftransformcm{\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@xa}}{\pgf@sys@tonumber{\pgf@y}}{\noexpand\pgfpointorigin}}}% + \pgf@temp} +{\endpgflowlevelscope} + +\long\def\pgfputat#1#2{\begin{pgftranslate}{#1}#2\end{pgftranslate}} +\def\pgfputlabelrotated#1#2#3#4#5{% + \pgflabel{#1}{#2}{#3}{#4}% + \pgfputat{}{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% xb/yb = start point + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \advance\pgf@x by-\pgf@xa% + \advance\pgf@y by-\pgf@ya% + \pgfnormalise{}% x/y = normalised vector + \pgf@ya=-\pgf@y% + \pgfsys@transformcm{\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}{\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{0pt}{0pt}% + #5}% + \ignorespaces} +\def\pgfqcurveto#1#2#3#4#5#6{\pgfpathqcurveto{#1bp}{#2bp}{#3bp}{#4bp}{#5bp}{#6bp}} +\let\pgfqbezier=\pgfqcurveto +\def\pgfqlineto#1#2{\pgfpathqlineto{#1bp}{#2bp}} +\def\pgfqmoveto#1#2{\pgfpathqmoveto{#1bp}{#2bp}} +\let\pgfqstroke=\pgfusepathqstroke + +\def\pgfstroke{\pgfusepath{stroke}} +\def\pgfclip{\pgfusepath{clip}} +\def\pgffill{\pgfusepath{fill}} +\def\pgfclosestroke{\pgfpathclose\pgfusepath{stroke}} +\def\pgffillstroke{\pgfusepath{fill,stroke}} +\def\pgfstrokeclip{\pgfusepath{clip,stroke}} +\def\pgffillclip{\pgfusepath{clip,stroke}} +\def\pgfclosestrokeclip{\pgfpathclose\pgfusepath{stroke,clip}} +\def\pgffillstrokeclip{\pgfusepath{stroke,fill,clip}} +\def\pgfclearendarrow{\pgfsetendarrow{}} +\def\pgfclearstartarrow{\pgfsetstartarrow{}} + +\def\pgfputarrow#1#2#3{\pgflowlevelobj{\pgftransformarrow{#1}{#2}}{\pgfsys@setdash{}{0pt}#3}} + +\def\pgfsetstartarrow#1{\def\pgf@startarrow{#1}\def\pgf@shorten@start{\pgf@x=0.0pt}} +\def\pgfsetendarrow#1{\def\pgf@endarrow{#1}\def\pgf@shorten@end{\pgf@x=0.0pt}} + +\def\pgfdefarrow#1#2#3#4{% + \pgfdefobject{pgf@#1}{#2}{#3}{\pgfsys@setlinewidth{1bp}#4}% + \expandafter\gdef\csname#1\endcsname{% + \pgf@x=\pgflinewidth% + \pgf@y=\pgflinewidth% + \pgfuseobjectmagnify{pgf@#1}\ignorespaces}} +\def\pgfdefarrowabs#1#2#3#4{% + \pgfdefobject{pgf@#1}{#2}{#3}{\pgfarrowlinewidthscale{1}#4}% + \expandafter\gdef\csname#1\endcsname{% + \pgfuseobject{pgf@#1}\ignorespaces} + } +\def\pgfarrowlinewidthscale#1{\pgfsys@setlinewidth{#1bp}\ignorespaces} +\pgfdefarrow{pgfarrowsingle}{\pgfpoint{-7pt}{-5pt}}{\pgfpoint{3pt}{5pt}}{% + \pgfqmoveto{2}{0} + \pgfqlineto{-6}{4} + \pgfqlineto{-3}{0} + \pgfqlineto{-6}{-4} + \pgfusepathqfill} +\def\pgfarrowswap#1{\pgflowlevelobj{\pgftransformxscale{-1}}{#1}} +\def\pgfarrowcombine#1#2{% + #1% + \pgflowlevelobj{\pgftransformshift{\pgfpoint{-7\pgflinewidth}{0pt}}}{#2}} +\def\pgfarrowcombineloose#1#2{#1\pgflowlevelobj{\pgftransformshift{\pgfpoint{-14\pgflinewidth}{0pt}}}{#2}} +\def\pgfarrowdouble#1{\pgfarrowcombine{#1}{#1}} +\def\pgfarrowtriple#1{% + #1% + \pgflowlevelobj{\pgftransformshift{\pgfpoint{-7\pgflinewidth}{0pt}}}{#1}% + \pgflowlevelobj{\pgftransformshift{\pgfpoint{-14\pgflinewidth}{0pt}}}{#1}} +\pgfdefarrow{pgfarrowto}{\pgfpoint{-4pt}{-5pt}}{\pgfpoint{2pt}{5pt}}{% + \pgfarrowlinewidthscale{0.8} + \pgfsetdash{}{0pt} + \pgfsetroundcap + \pgfsetroundjoin + \pgfqmoveto{-3}{4} + \pgfqcurveto{-2.75}{2.5}{0}{0.25}{0.75}{0} + \pgfqcurveto{0}{-0.25}{-2.75}{-2.5}{-3}{-4} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowbar}{\pgfpoint{-1pt}{-6pt}}{\pgfpoint{1pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{0}{-5} + \pgfqlineto{0}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowsquare}{\pgfpoint{-4pt}{-6pt}}{\pgfpoint{1pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{-3}{-5} + \pgfqlineto{0}{-5} + \pgfqlineto{0}{5} + \pgfqlineto{-3}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowround}{\pgfpoint{-3pt}{-6pt}}{\pgfpoint{2pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{-2}{-5} + \pgfqcurveto{1}{-3}{1}{3}{-2}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowpointed}{\pgfpoint{-6pt}{-6pt}}{\pgfpoint{2pt}{6pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{-4.5}{-5} + \pgfqlineto{0.5}{0} + \pgfqlineto{-4.5}{5} + \pgfusepathqstroke} +\pgfdefarrow{pgfarrowdot}{\pgfpoint{-7pt}{-4pt}}{\pgfpoint{2pt}{4pt}}{% + \pgfsys@transformshift{-2.5bp}{0bp}% + \pgfsetdash{}{0pt} + \pgfpathqcircle{3bp} + \pgfusepathqfillstroke} +\pgfdefarrow{pgfarrowdiamond}{\pgfpoint{-12pt}{-4pt}}{\pgfpoint{2pt}{4pt}}{% + \pgfsetdash{}{0pt} + \pgfqmoveto{1}{0} + \pgfqlineto{-5}{3} + \pgfqlineto{-11}{0} + \pgfqlineto{-5}{-3} + \pgfpathclose + \pgfusepathqfillstroke} +\def\pgfarrowcircle#1{% + \pgfsetdash{}{0pt} + \setlength\pgf@xa{#1}% + \pgf@xb=\pgf@xa% + \advance\pgf@xa by-0.5\pgflinewidth + \begin{pgflowlevelscope}{\pgftransformshift{\pgfpoint{-\pgf@xa}{0pt}}}% + \pgfpathqcircle{\pgf@sys@tonumber{\pgf@xb}bp} + \pgfusepathqfillstroke + \end{pgflowlevelscope}} +\def\pgfarrowtriangle#1{% + \pgfsetdash{}{0pt} + \begin{pgfscope}% + \setlength\pgf@xa{#1}% + \pgf@ya=0.577\pgf@xa% + \advance\pgf@xb by-\pgflinewidth% + \pgfpathmoveto{\pgfpoint{-\pgf@xa}{-\pgf@ya}}% + \pgfpathlineto{\pgfpoint{\pgflinewidth}{0pt}}% + \pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@ya}}% + \pgfpathclose% + \pgfusepathqfillstroke% + \end{pgfscope}} +\def\pgfarrowlargepointed#1{% + \pgfsetdash{}{0pt} + \begin{pgfscope}% + \setlength\pgf@xa{#1}% + \pgfpathmoveto{\pgfpoint{-\pgf@xa}{-\pgf@xa}} + \pgfpathlineto{\pgfpointorigin} + \pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@xa}} + \pgfusepathqstroke + \end{pgfscope}} + +\newcommand\pgfcorner[3][sw]{% + \pgf@process{#2}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#3}% + \ifdim\pgf@xa<\pgf@x% + \pgf@xb=\pgf@x% + \pgf@x=\pgf@xa% + \pgf@xa=\pgf@xb% + \fi% + \ifdim\pgf@ya<\pgf@y% + \pgf@yb=\pgf@y% + \pgf@y=\pgf@ya% + \pgf@ya=\pgf@yb% + \fi% + \csname pgf@corner@#1\endcsname\relax% +} +\def\pgf@corner@se{\pgf@x=\pgf@xa} +\def\pgf@corner@ne{\pgf@x=\pgf@xa\pgf@y=\pgf@ya} +\def\pgf@corner@nw{\pgf@y=\pgf@ya} +\def\pgf@corner@sw{} +\def\pgf@corner@s{\pgf@x=.5\pgf@x\advance\pgf@x by.5\pgf@xa} +\def\pgf@corner@n{\pgf@x=.5\pgf@x\advance\pgf@x by.5\pgf@xa\pgf@y=\pgf@ya} +\def\pgf@corner@w{\pgf@y=.5\pgf@y\advance\pgf@y by.5\pgf@ya} +\def\pgf@corner@e{\pgf@y=.5\pgf@y\advance\pgf@y by.5\pgf@ya\pgf@x=\pgf@xa} + +% Defines a circle node of name #1 at position #3 of radius #4. +% +% #1 = a name +% #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw +% nothing) +% #3 = a point +% #4 = a radius +% +% Example: +% +% \pgfnodecircle{mynode}[stroke]{\pgfxy(1,1)}{2cm} + +\def\pgfnodecircle#1[#2]#3#4{% + \pgf@process{#3}% + \expandafter\def\csname pgfno@#1\endcsname{\pgf@backoffcircle{#4}}% + \expandafter\def\csname pgfnob@#1\endcsname{\pgf@anglecircle{#4}}% + \expandafter\edef\csname pgfnom@#1\endcsname{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@x}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@y}pt}% + \expandafter\ifx\csname pgf@@#2\endcsname\pgf@@virtual% + \else% + \pgfcircle[#2]{\csname pgfnom@#1\endcsname}{#4}% + \fi\ignorespaces} + +\def\pgf@@virtual{} + + +% Defines a rectangular node of name #1 with center at position #3 and +% width/height vector #4 +% +% #1 = a name +% #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw +% nothing) +% #3 = a center +% #4 = width/height vector +% +% Example: +% +% \pgfnoderect{mynode}[stroke]{\pgfxy(1,1)}{\pgfxy(2,2)} + +\def\pgfnoderect#1[#2]#3#4{% + \pgf@process{#3}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#4}% + \pgf@x=.5\pgf@x% + \pgf@y=.5\pgf@y% + \expandafter\edef\csname pgfno@#1\endcsname{\noexpand\pgf@backoffrect% + {\pgf@sys@tonumber{\pgf@x}pt}{\pgf@sys@tonumber{\pgf@y}pt}}% + \expandafter\edef\csname pgfnob@#1\endcsname{\noexpand\pgf@anglerect% + {\pgf@sys@tonumber{\pgf@x}pt}{\pgf@sys@tonumber{\pgf@y}pt}}% + \expandafter\edef\csname + pgfnom@#1\endcsname{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@xa}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@ya}pt}% + \expandafter\ifx\csname pgf@@#2\endcsname\pgf@@virtual% + \else% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + \edef\pgf@temp{\noexpand\pgf@x=\pgf@sys@tonumber{\pgf@xa}pt\noexpand\pgf@y=\pgf@sys@tonumber{\pgf@ya}pt}% + \pgfrect[#2]{\pgf@temp}{#4}% + \fi\ignorespaces} + + +% Defines a rectangular node of name #1 with center at position #3 +% contaning a box #4 +% +% #1 = a name +% #2 = ``stroke'' or ``fill'' or ``fillstroke'' or ``virtual'' (= draw +% nothing) +% #3 = a center +% #4 = TeX text that will be boxed +% #5 = a horizontal border offset +% #6 = a vertical border offset +% +% Example: +% +% \pgfnodebox{mynode}[stroke]{\pgfxy(1,1)}{start}{2pt}{2pt} + +\def\pgfnodebox#1[#2]#3#4#5#6{% + \pgf@makehbox{#4}% + \pgf@x=\wd\pgf@hbox% + \pgf@y=\ht\pgf@hbox% + \advance\pgf@y by \dp\pgf@hbox% + \addtolength\pgf@x{#5}% + \addtolength\pgf@x{#5}% + \addtolength\pgf@y{#6}% + \addtolength\pgf@y{#6}% + \edef\pgf@boxsize{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \csname pgf@haligncompcenter\endcsname% + \csname pgf@valigncompcenter\endcsname% + \wd\pgf@hbox=0pt% + \pgfputat{#3}{% + \pgfsys@hbox\pgf@hbox}% + \pgfnoderect{#1}[#2]{#3}{\pgf@boxsize}\ignorespaces} + + + + +% Retrieves the center of #1. +% +% #1 = a node name +% +% Example: +% +% \pgfpathmoveto{\pgfnodecenter{mynode}} + +\def\pgfnodecenter#1{% + \expandafter\ifx\csname pgfnom@#1\endcsname\relax% + \GenericError{\space\space\space\@spaces\@spaces\@spaces}% + {PGF Error: Node "#1" undefined.}{}{\@ehc}% + \pgfpoint{0pt}{0pt}% + \else\csname pgfnom@#1\endcsname\fi\ignorespaces} + + + +% Returns a position relative to the center of #1. +% +% #1 = a node name +% #2 = a direction (see \pgfdirection) +% #3 = a distance +% +% Example: +% +% \pgfpathmoveto{\pgfnoderelative{mynode}[north]{1cm}} + +\def\pgfnoderelative#1[#2]#3{% + \pgfrelative{\pgfnodecenter{#1}}{\pgfpolar{\pgfdirection{#2}}{#3}}\ignorespaces} + + + +% Retrieves a border point of #1 at angle #2 and distance #3 from +% border. +% +% #1 = a node name +% #2 = an angle +% #3 = a distance from the border +% +% Example: +% +% \pgfpathmoveto{\pgfnodeborder{first}{30}{0pt}} +% \pgfpathlineto{\pgfnodeborder{second}{180}{2pt}} +% \pgfstroke + +\def\pgfnodeborder#1#2#3{% + \csname pgfnob@#1\endcsname{#3}{#2}{\pgfnodecenter{#1}}\ignorespaces} + + + +% Gives the beginning of a connection of #2 and #3, taking a +% separation distance of #1 into account. +% +% #1 = a separation distance +% #2 = a node name +% #3 = a second node name +% +% Example: +% +% \pgfpathmoveto{\pgfnodeconnstart{first}{second}} +% \pgfpathlineto{\pgfnodeconnstart{second}{first}} + +\def\pgfnodeconnstart[#1]#2#3{% + \csname pgfno@#2\endcsname[#1]{\pgfnodecenter{#2}}{\pgfnodecenter{#3}}% + \ignorespaces} + + + +\newdimen\pgf@nodesepstart +\newdimen\pgf@nodesepend + +% Sets the node separation for starts of lines. +% +% #1 = a distance +% +% Example: +% +% \pgfnodesetsepstart{2pt} + +\def\pgfnodesetsepstart#1{\setlength\pgf@nodesepstart{#1}\ignorespaces} + +\pgfnodesetsepstart{0pt} + + +% Sets the node separation for end of lines. +% +% #1 = a distance +% +% Example: +% +% \pgfnodesetsepend{2pt} + +\def\pgfnodesetsepend#1{\setlength\pgf@nodesepend{#1}\ignorespaces} + +\pgfnodesetsepend{0pt} + + + + +% Draws a line from #1 to #2. +% +% #1 = a node name +% #2 = a second node name +% +% Example: +% +% \pgfnodeconnline{first}{second} + +\def\pgfnodeconnline#1#2{% + \pgfpathmoveto{\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}% + \pgfpathlineto{\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}% + \pgfstroke% + \ignorespaces} + + + +% Draws a curve from #1 to #2. The starting angle at #1 is #3 and the +% length to the first support point is #5. The starting angle at #2 +% is #4 and the length to the second support point is #6. +% +% #1 = a node name +% #2 = a second node name +% #3 = angle at first node +% #4 = angle at second node +% #5 = distance to support point at first node +% #6 = distance to support point at second node +% +% Example: +% +% \pgfnodeconncurve{first}{second}{10}{-10}{1cm}{1cm} + +\def\pgfnodeconncurve#1#2#3#4#5#6{% + \pgfpathmoveto{\pgfnodeborder{#1}{#3}{\pgf@nodesepstart}}% + \pgfpathcurveto{\pgfnodeborder{#1}{#3}{#5}}{\pgfnodeborder{#2}{#4}{#6}}% + {\pgfnodeborder{#2}{#4}{\pgf@nodesepend}}% + \pgfstroke\ignorespaces} + + + + +% Put a label on a line from #1 to #2. +% +% #1 = a node name +% #2 = a second node name +% #3 = fraction of way from #1 to #2 +% #4 = vertical offset +% #5 = label +% +% Example: +% +% \pgfnodelabel{first}{second}[.5][2pt]{\pgfbox[center,base]{owns}} + +\def\pgfnodelabel#1#2[#3][#4]#5{% + \pgfputat{\pgflabel% + {#3}% + {\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}% + {\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}% + {#4}}% + {#5}\ignorespaces} + + +% Put a rotated label on a line from #1 to #2. +% +% #1 = a node name +% #2 = a second node name +% #3 = fraction of way from #1 to #2 +% #4 = vertical offset +% #5 = label +% +% Example: +% +% \pgfnodelabelrotated{first}{second}[.5][2pt]{\pgfbox[center,base]{owns}} + +\def\pgfnodelabelrotated#1#2[#3][#4]#5{% + \pgfputlabelrotated% + {#3}% + {\pgfnodeconnstart[\pgf@nodesepstart]{#1}{#2}}% + {\pgfnodeconnstart[\pgf@nodesepend]{#2}{#1}}% + {#4}% + {#5}\ignorespaces} + + + +% Internals + +\def\pgf@backoffcircle#1[#2]#3#4{% + % Calculate backoff for a circle of radius + % #1 and offset separation #2. #3 is the center of the circle, #4 + % is the target point. + \setlength\pgf@x{#1}% + \addtolength\pgf@x{#2}% + \edef\pgf@temp{{\pgf@sys@tonumber{\pgf@x}pt}}% + \expandafter\pgfbackoff\pgf@temp{#3}{#4}\ignorespaces} + +\def\pgf@mult#1#2#3{#1=#2#3} + +\def\pgf@anglecircle#1#2#3#4{% + % Calculate border point. #1 is radius, #2 is additional backoff, #3 + % is an angle, #4 is the center of the circle. + \pgfsincos{#3}% + \setlength\pgf@xa{#1}% + \addtolength\pgf@xa{#2}% + \pgf@ya=\pgf@xa\relax% + \pgf@mult{\pgf@xa}{\pgf@sys@tonumber{\pgf@x}}{\pgf@xa}% + \pgf@mult{\pgf@ya}{\pgf@sys@tonumber{\pgf@y}}{\pgf@ya}% + \pgf@process{#4}% + \advance\pgf@y by\pgf@xa\relax% + \advance\pgf@x by\pgf@ya\ignorespaces} + +\def\pgf@backoffrect#1#2[#3]#4#5{% + % Calculate backoff for a rect with half width #1, + % half height #2, offset separation #3. #4 is the center of the rect, #5 + % is the target point. + \pgfdiff{#4}{#5}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \setlength\pgf@xb{#1}% + \setlength\pgf@yb{#2}% + \addtolength\pgf@xb{#3}% + \addtolength\pgf@yb{#3}% + \ifnum\pgf@xa<0\relax% move into first quadrant + \pgf@x=-\pgf@x% + \fi% + \ifnum\pgf@ya<0\relax% + \pgf@y=-\pgf@y% + \fi% + \c@pgf@counta=\pgf@x% + \c@pgf@countb=\pgf@y% + \divide\c@pgf@counta by 256\relax% + \divide\c@pgf@countb by 256\relax% + \ifnum\c@pgf@countb<\c@pgf@counta% + \ifnum\c@pgf@counta<1\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@y=16\pgf@y% + \divide\pgf@y by \c@pgf@counta% + \pgf@y=16\pgf@y% + \pgf@mult{\pgf@y}{\pgf@sys@tonumber{\pgf@xb}}{\pgf@y}% + \ifnum\pgf@y<\pgf@yb% + \pgf@x=\pgf@xb% + \else% rats, calculate intersection on upper side + \ifnum\c@pgf@countb<1\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@x=16\pgf@x% + \divide\pgf@x by \c@pgf@countb% + \pgf@x=16\pgf@x% + \pgf@mult{\pgf@x}{\pgf@sys@tonumber{\pgf@yb}}{\pgf@x}% + \pgf@y=\pgf@yb% + \fi% + \fi% + \fi% + \else% + \ifnum\c@pgf@countb<1\relax% + \pgf@x=\pgf@xb\relax% + \pgf@y=0pt\relax% + \else% + \pgf@x=16\pgf@x% + \divide\pgf@x by \c@pgf@countb% + \pgf@x=16\pgf@x% + \pgf@mult{\pgf@x}{\pgf@sys@tonumber{\pgf@yb}}{\pgf@x}% + \ifnum\pgf@x<\pgf@xb% + \pgf@y=\pgf@yb% + \else% + \ifnum\c@pgf@counta<1\relax% + \pgf@y=\pgf@yb\relax% + \pgf@x=0pt\relax% + \else% + \pgf@y=16\pgf@y% + \divide\pgf@y by \c@pgf@counta% + \pgf@y=16\pgf@y% + \pgf@mult{\pgf@y}{\pgf@sys@tonumber{\pgf@xb}}{\pgf@y}% + \pgf@x=\pgf@xb% + \fi% + \fi% + \fi% + \fi% + \ifnum\pgf@xa<0\relax\pgf@x=-\pgf@x\fi% + \ifnum\pgf@ya<0\relax\pgf@y=-\pgf@y\fi% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{#4}% + \advance\pgf@x by\pgf@xa% + \advance\pgf@y by\pgf@ya\ignorespaces} + +\def\pgf@anglerect#1#2#3#4#5{% + % Calculate border point. #1/#2 is half width/height, #3 is additional backoff, #4 + % is an angle, #5 is the center of the rect. + \pgfsincos{#4}% + \pgf@xa=100\pgf@x% + \pgf@ya=100\pgf@y% + \pgf@process{#5}% + \advance\pgf@x by\pgf@ya% + \advance\pgf@y by\pgf@xa% + \edef\pgf@temp{{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}}% + \expandafter\pgf@caller\pgf@temp{#1}{#2}{#3}{#5}\ignorespaces} + +\def\pgf@caller#1#2#3#4#5{\pgf@backoffrect{#2}{#3}[#4]{#5}{#1}} + +\long\def\pgfbox[#1,#2]#3{% + \pgf@makehbox{#3}% + \csname pgf@haligncomp#1\endcsname% + \csname pgf@valigncomp#2\endcsname% + \wd\pgf@hbox=0pt% + \ht\pgf@hbox=0pt% + \dp\pgf@hbox=0pt% + \pgfqbox{\pgf@hbox}% + \ignorespaces} + +\def\pgf@haligncompleft{}% do nothing +\def\pgf@haligncompcenter{\setbox\pgf@hbox=\hbox{\hskip-.5\wd\pgf@hbox\box\pgf@hbox}} +\def\pgf@haligncompright{\setbox\pgf@hbox=\hbox{\hskip-\wd\pgf@hbox\box\pgf@hbox}} +\def\pgf@valigncompbase{}% do nothing +\def\pgf@valigncompbottom{\setbox\pgf@hbox=\hbox{\raise\dp\pgf@hbox\box\pgf@hbox}} +\def\pgf@valigncompcenter{% + \setbox\pgf@hbox=\hbox{\raise.5\dp\pgf@hbox\hbox{\lower.5\ht\pgf@hbox\box\pgf@hbox}}}% +\def\pgf@valigncomptop{\setbox\pgf@hbox=\hbox{\lower\ht\pgf@hbox\box\pgf@hbox}} + + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgfcomp-version-1-18.sty b/graphics/pgf/base/tex/latex/compatibility/pgfcomp-version-1-18.sty new file mode 100644 index 0000000000..573d45d9b4 --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgfcomp-version-1-18.sty @@ -0,0 +1,29 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgfcomp-version-1-18.sty} + +\def\pgfsetshapeinnerxsep#1{\pgfset{inner xsep=#1}} +\def\pgfsetshapeinnerysep#1{\pgfset{inner ysep=#1}} +\def\pgfsetshapeouterxsep#1{\pgfset{outer xsep=#1}} +\def\pgfsetshapeouterysep#1{\pgfset{outer ysep=#1}} +\def\pgfsetshapeminwidth#1{\pgfset{minimum width=#1}} +\def\pgfsetshapeminheight#1{\pgfset{minimum height=#1}} + +\def\pgfshapeinnerxsep{\pgfkeysvalueof{/pgf/inner xsep}} +\def\pgfshapeinnerysep{\pgfkeysvalueof{/pgf/inner ysep}} +\def\pgfshapeouterxsep{\pgfkeysvalueof{/pgf/outer xsep}} +\def\pgfshapeouterysep{\pgfkeysvalueof{/pgf/outer ysep}} +\def\pgfshapeminwidth{\pgfkeysvalueof{/pgf/minimum width}} +\def\pgfshapeminheight{\pgfkeysvalueof{/pgf/minimum height}} + + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgfheaps.sty b/graphics/pgf/base/tex/latex/compatibility/pgfheaps.sty new file mode 100644 index 0000000000..6228c961ce --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgfheaps.sty @@ -0,0 +1,107 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgfheaps.sty} + +\RequirePackage{pgf} + +\PackageWarning{pgfheaps}{This package is obsolete.} + +\ProcessOptions + +% +% Package for drawing heap diagrams. +% + +\newdimen\pgf@heapx +\newdimen\pgf@heapy + + + + +% Construct the path of a heap. +% +% #1 = Position of heap label. +% #2 = Position of left base +% #3 = Position of right base +% +% Example: +% +% \pgfheappath{\pgfxy(1,0)}{\pgfxy(-1,0)}{\pgfxy(1,0)} +% \pgffill + +\def\pgfheappath#1#2#3{% + \pgfdiff{#2}{#3}% + \pgf@heapx=-.25\pgf@x% + \pgf@heapy=-.25\pgf@y% + \pgfmoveto{#2}% + \pgfbezier% + {\pgfpartway{0.5}{#2}{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}}% + {\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}% + {#1}% + \pgf@heapx=-\pgf@heapx% + \pgf@heapy=-\pgf@heapy% + \pgfbezier% + {\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}% + {\pgfpartway{0.5}{#3}{\pgfrelative{#1}{\pgfpoint{\pgf@heapx}{\pgf@heapy}}}}% + {#3}% + \ignorespaces} + + +% Draw a heap label. +% +% #1 = Position of heap label. +% #2 = Label text. +% +% Example: +% +% \pgfheaplabel{\pgfxy(1,0)}{Class P} + +\def\pgfheaplabel#1#2{% + \setbox\pgf@hbox=\hbox{\pgfinterruptpicture#2\endpgfinterruptpicture}% + \pgf@heapy=\ht\pgf@hbox% + \pgfputat{\pgfrelative{#1}{\pgfpoint{0pt}{-2\pgf@heapy}}}{\pgfbox[center,base]{#2}}% + \ignorespaces} + + +% Draw a labeled heap. +% +% #1 = Position of heap label. +% #2 = Position of left base +% #3 = Position of right base +% #4 = Label text. +% +% Example: +% +% \pgfheaplabeled{\pgfxy(1,0)}{\pgfxy(-1,0)}{\pgfxy(1,0)}{Class P} + +\def\pgfheaplabeled#1#2#3#4{% + \pgfheaplabel{#1}{#4}% + \pgfheappath{#1}{#2}{#3}% + \pgfstroke% + \ignorespaces} + + + +% Draw a labeled heap. +% +% #1 = Height of the label +% #2 = Left and right extension of the base. +% #3 = Label text. +% +% Example: +% +% \pgfheaplabeledcentered{1cm}{1cm}{Class P} + +\def\pgfheaplabeledcentered#1#2#3{% + \pgfheaplabeled{\pgfpoint{0pt}{#1}}{\pgfpoint{-#2}{0pt}}{\pgfpoint{#2}{0pt}}{#3}\ignorespaces} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibraryarrows.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibraryarrows.sty new file mode 100644 index 0000000000..253ed35a84 --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibraryarrows.sty @@ -0,0 +1,16 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{arrows} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryarrows.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibraryautomata.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibraryautomata.sty new file mode 100644 index 0000000000..1ea9902cc4 --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibraryautomata.sty @@ -0,0 +1,16 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{automata} instead} + +\RequirePackage{pgfcore} + +\input{pgflibrarytikzautomata.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibraryplothandlers.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibraryplothandlers.sty new file mode 100644 index 0000000000..536003568b --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibraryplothandlers.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{plothandlers} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryplothandlers.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibraryplotmarks.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibraryplotmarks.sty new file mode 100644 index 0000000000..af70c2d7d6 --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibraryplotmarks.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{plotmarks} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryplotmarks.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibraryshapes.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibraryshapes.sty new file mode 100644 index 0000000000..96d64709a0 --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibraryshapes.sty @@ -0,0 +1,18 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{shapes} instead} + +\RequirePackage{pgfcore} + +\input{pgflibraryshapes.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibrarysnakes.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibrarysnakes.sty new file mode 100644 index 0000000000..d0ee7fa924 --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibrarysnakes.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{snakes} instead} + +\RequirePackage{pgfcore} + +\input{pgflibrarysnakes.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibrarytikzbackgrounds.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibrarytikzbackgrounds.sty new file mode 100644 index 0000000000..94a1c0f5cf --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibrarytikzbackgrounds.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{backgrounds} instead} + +\RequirePackage{tikz} + +\input{pgflibrarytikzbackgrounds.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgflibrarytikztrees.sty b/graphics/pgf/base/tex/latex/compatibility/pgflibrarytikztrees.sty new file mode 100644 index 0000000000..676b28d47d --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgflibrarytikztrees.sty @@ -0,0 +1,17 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\PackageWarning{pgf}{This package is obsolete. Use \noexpand\usetikzlibrary{trees} instead} + +\RequirePackage{tikz} + +\input{tikzlibrarytrees.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgfnodes.sty b/graphics/pgf/base/tex/latex/compatibility/pgfnodes.sty new file mode 100644 index 0000000000..c58f3bc2b7 --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgfnodes.sty @@ -0,0 +1,19 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgfnodes.sty} + +\RequirePackage{pgf} + +\PackageWarning{pgfnodes}{This package is obsolete. pgf.sty will load + node management automatically} + +\endinput diff --git a/graphics/pgf/base/tex/latex/compatibility/pgfshade.sty b/graphics/pgf/base/tex/latex/compatibility/pgfshade.sty new file mode 100644 index 0000000000..2b3283010c --- /dev/null +++ b/graphics/pgf/base/tex/latex/compatibility/pgfshade.sty @@ -0,0 +1,19 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\ProvidesPackageRCS{pgfshade.sty} + +\RequirePackage{pgf} + +\PackageWarning{pgfshade}{This package is obsolete. pgf.sty will load + shade management automatically} + +\endinput diff --git a/graphics/pgf/base/tex/latex/doc/pgfmanual-en-macros.tex b/graphics/pgf/base/tex/latex/doc/pgfmanual-en-macros.tex new file mode 100644 index 0000000000..68ecfffc44 --- /dev/null +++ b/graphics/pgf/base/tex/latex/doc/pgfmanual-en-macros.tex @@ -0,0 +1,1932 @@ +% Copyright 2019 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Free Documentation License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +% $Header$ + + +\newcount\pgfmanualtargetcount + +\colorlet{examplefill}{yellow!80!black} +\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8} +\definecolor{codebackground}{rgb}{0.9,0.9,1} +\definecolor{animationgraphicbackground}{rgb}{0.96,0.96,0.8} + +\newenvironment{pgfmanualentry}{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}}{\endlist} +\newcounter{pgfmanualentry} +\newcommand\pgfmanualentryheadline[1]{% + \itemsep=0pt\parskip=0pt{\raggedright\item\refstepcounter{pgfmanualentry}\strut{#1}\par}\topsep=0pt} +\newcommand\pgfmanualbody{\parskip3pt} + +\let\origtexttt=\texttt +\def\texttt#1{{\def\textunderscore{\char`\_}\def\textbraceleft{\char`\{}\def\textbraceright{\char`\}}\origtexttt{#1}}} +\def\exclamationmarktext{!} +\def\atmarktext{@} + +{ + \catcode`\|=12 + \gdef\pgfmanualnormalbar{|} + \catcode`\|=13 + \AtBeginDocument{\gdef|{\ifmmode\pgfmanualnormalbar\else\expandafter\verb\expandafter|\fi}} +} + + + +\newenvironment{pgflayout}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \texttt{\string\pgfpagesuselayout\char`\{\declare{#1}\char`\}}\oarg{options}% + } + \index{#1@\protect\texttt{#1} layout}% + \index{Page layouts!#1@\protect\texttt{#1}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\newenvironment{sysanimateattribute}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \texttt{\string\pgfsysanimate\char`\{\declare{#1}\char`\}}% + } + \index{#1@\protect\texttt{#1} system layer animation attribute}% + \index{Animation attributes (system layer)!#1@\protect\texttt{#1}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\newenvironment{animateattribute}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \texttt{\string\pgfanimateattribute\char`\{\declare{#1}\char`\}\marg{options}}% + } + \index{#1@\protect\texttt{#1} basic layer animation attribute}% + \index{Animation attributes (basic layer)!#1@\protect\texttt{#1}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\newenvironment{tikzanimateattribute}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \foreach \attr in{#1} {\expandafter\pgfmanualpdflabel\expandafter{\attr}{}}% + \textbf{Animation attribute} \foreach \attr[count=\i] + in{#1}{{\ifnum\i>1 \textbf,\fi} \texttt{:\declare{\attr}}}% + } + \foreach\attr in{#1}{% + \edef\indexcall{% + \noexpand\index{\attr@\noexpand\protect\noexpand\texttt{\attr} animation attribute}% + \noexpand\index{Animation attributes!\attr@\noexpand\protect\noexpand\texttt{\attr}}% + }% + \indexcall% + }% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\newenvironment{command}[1]{ + \begin{pgfmanualentry} + \extractcommand#1\@@ + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\makeatletter + +\def\includeluadocumentationof#1{ + \directlua{require 'pgf.manual.DocumentParser'} + \directlua{pgf.manual.DocumentParser.include '#1'} +} + +\newenvironment{luageneric}[4]{ + \pgfmanualentry + \pgfmanualentryheadline{#4 \texttt{#1\declare{#2}}#3} + \index{#2@\protect\texttt{#2} (Lua)}% + \def\temp{#1} + \ifx\temp\pgfutil@empty\else + \index{#1@\protect\texttt{#1}!#2@\protect\texttt{#2} (Lua)}% + \fi + \pgfmanualbody +}{\endpgfmanualentry} + +\newenvironment{luatable}[3]{ + \medskip + \luageneric{#1}{#2}{ (declared in \texttt{#3})}{\textbf{Lua table}} +}{\endluageneric} + +\newenvironment{luafield}[1]{ + \pgfmanualentry + \pgfmanualentryheadline{Field \texttt{\declare{#1}}} + \pgfmanualbody +}{\endpgfmanualentry} + + +\newenvironment{lualibrary}[1]{ + \pgfmanualentry + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Graph Drawing Library} \texttt{\declare{#1}}% + } + \index{#1@\protect\texttt{#1} graph drawing library}% + \index{Libraries!#1@\protect\texttt{#1}}% + \index{Graph drawing libraries!#1@\protect\texttt{#1}}% + \vskip.25em + {\ttfamily\char`\\usegdlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}\\ + {\ttfamily\char`\\usegdlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}\smallskip\par + \pgfmanualbody +}{\endpgfmanualentry} + +\newenvironment{luadeclare}[4]{ + \pgfmanualentry + \def\manual@temp@default{#3}% + \def\manual@temp@initial{#4}% + \def\manual@temp@{#3#4}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily/graph + drawing/\declare{#1}\opt{=}}\opt{#2}\hfill% + \ifx\manual@temp@\pgfutil@empty\else% + (\ifx\manual@temp@default\pgfutil@empty\else% + default {\ttfamily #3}\ifx\manual@temp@initial\pgfutil@empty\else, \fi% + \fi% + \ifx\manual@temp@initial\pgfutil@empty\else% + initially {\ttfamily #4}% + \fi% + )\fi% + }% + \index{#1@\protect\texttt{#1} key}% + \pgfmanualbody + \gdef\myname{#1}% +% \keyalias{tikz} +% \keyalias{tikz/graphs} +}{\endpgfmanualentry} + +\newenvironment{luadeclarestyle}[4]{ + \pgfmanualentry + \def\manual@temp@para{#2}% + \def\manual@temp@default{#3}% + \def\manual@temp@initial{#4}% + \def\manual@temp@{#3#4}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily/graph drawing/\declare{#1}}\ifx\manual@temp@para\pgfutil@empty\else\opt{\texttt=}\opt{#2}\fi\hfill% + (style\ifx\manual@temp@\pgfutil@empty\else, % + \ifx\manual@temp@default\pgfutil@empty\else% + default {\ttfamily #3}\ifx\manual@temp@initial\pgfutil@empty\else, \fi% + \fi% + \ifx\manual@temp@initial\pgfutil@empty\else% + initially {\ttfamily #4}% + \fi% + \fi)% + }% + \index{#1@\protect\texttt{#1} key}% + \pgfmanualbody% + \gdef\myname{#1}% +% \keyalias{tikz} +% \keyalias{tikz/graphs} +}{\endpgfmanualentry} + +\newenvironment{luanamespace}[2]{ + \luageneric{#1}{#2}{}{\textbf{Lua namespace}} +}{\endluageneric} + +\newenvironment{luafiledescription}[1]{}{} + +\newenvironment{luacommand}[4]{ + \hypertarget{pgf/lua/#1}{\luageneric{#2}{#3}{\texttt{(#4)}}{\texttt{function}}} +}{\endluageneric} + +\newenvironment{luaparameters}{\par\emph{Parameters:}% + \parametercount=0\relax% + \let\item=\parameteritem% + \let\list=\restorelist% +} +{\par +} + +\newenvironment{luareturns}{\par\emph{Returns:}% + \parametercount=0\relax% + \let\item=\parameteritem% + \let\list=\restorelist% +} +{\par +} + +\newcount\parametercount + +\newenvironment{parameterdescription}{\unskip% + \parametercount=0\relax% + \let\item=\parameteritem% + \let\list=\restorelist% +} +{\par +} +\let\saveditemcommand=\item +\let\savedlistcommand=\list +\def\denselist#1#2{\savedlistcommand{#1}{#2}\parskip0pt\itemsep0pt} +\def\restorelist{\let\item=\saveditemcommand\denselist} +\def\parameteritem{\pgfutil@ifnextchar[\parameteritem@{}}%} +\def\parameteritem@[#1]{\advance\parametercount by1\relax\hskip0.15em plus 1em\emph{\the\parametercount.}\kern1ex\def\test{#1}\ifx\test\pgfutil@empty\else#1\kern.5em\fi} + +\newenvironment{commandlist}[1]{% + \begin{pgfmanualentry} + \foreach \xx in {#1} {% + \expandafter\extractcommand\xx\@@ + }% + \pgfmanualbody +}{% + \end{pgfmanualentry} +}% + +% \begin{internallist}[register]{\pgf@xa} +% \end{internallist} +% +% \begin{internallist}[register]{\pgf@xa,\pgf@xb} +% \end{internallist} +\newenvironment{internallist}[2][register]{% + \begin{pgfmanualentry} + \foreach \xx in {#2} {% + \expandafter\extractinternalcommand\expandafter{\xx}{#1}% + }% + \pgfmanualbody +}{% + \end{pgfmanualentry} +}% +\def\extractinternalcommand#1#2{% + \removeats{#1}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{\textbackslash\strippedat}{}% + Internal #2 \declare{\texttt{\string#1}}}% + \index{Internals!\strippedat @\protect\myprintocmmand{\strippedat}}% + \index{\strippedat @\protect\myprintocmmand{\strippedat}}% +} + +%% MW: START MATH MACROS +\def\mvar#1{{\ifmmode\textrm{\textit{#1}}\else\rmfamily\textit{#1}\fi}} + +\makeatletter + +\def\extractmathfunctionname#1{\extractmathfunctionname@#1(,)\tmpa\tmpb} +\def\extractmathfunctionname@#1(#2)#3\tmpb{\def\mathname{#1}} + +\makeatother + +\newenvironment{math-function}[1]{ + \def\mathdefaultname{#1} + \extractmathfunctionname{#1} + \edef\mathurl{{math:\mathname}}\expandafter\hypertarget\expandafter{\mathurl}{}% + \begin{pgfmanualentry} + \pgfmanualentryheadline{\texttt{#1}}% + \index{\mathname @\protect\texttt{\mathname} math function}% + \index{Math functions!\mathname @\protect\texttt{\mathname}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\pgfmanualemptytext{} +\def\pgfmanualvbarvbar{\char`\|\char`\|} + +\newenvironment{math-operator}[4][]{% + \begin{pgfmanualentry} + \csname math#3operator\endcsname{#2}{#4} + \def\mathtest{#4}% + \ifx\mathtest\pgfmanualemptytext% + \def\mathtype{(#3 operator)} + \else% + \def\mathtype{(#3 operator; uses the \texttt{#4} function)} + \fi% + \pgfmanualentryheadline{\mathexample\hfill\mathtype}% + \def\mathtest{#1}% + \ifx\mathtest\pgfmanualemptytext% + \index{#2@\protect\texttt{#2} #3 math operator}% + \index{Math operators!#2@\protect\texttt{#2}}% + \fi% + \pgfmanualbody +} +{\end{pgfmanualentry}} + +\newenvironment{math-operators}[5][]{% + \begin{pgfmanualentry} + \csname math#4operator\endcsname{#2}{#3} + \def\mathtest{#5}% + \ifx\mathtest\pgfmanualemptytext% + \def\mathtype{(#4 operators)} + \else% + \def\mathtype{(#4 operators; use the \texttt{#5} function)} + \fi% + \pgfmanualentryheadline{\mathexample\hfill\mathtype}% + \def\mathtest{#1}% + \ifx\mathtest\pgfmanualemptytext% + \index{#2#3@\protect\texttt{#2\protect\ #3} #4 math operators}% + \index{Math operators!#2#3@\protect\texttt{#2\protect\ #3}}% + \fi% + \pgfmanualbody +} +{\end{pgfmanualentry}} + +\def\mathinfixoperator#1#2{% + \def\mathoperator{\texttt{#1}}% + \def\mathexample{\mvar{x}\space\texttt{#1}\space\mvar{y}}% +} + +\def\mathprefixoperator#1#2{% + \def\mathoperator{\texttt{#1}}% + \def\mathexample{\texttt{#1}\mvar{x}}% +} + +\def\mathpostfixoperator#1#2{% + \def\mathoperator{\texttt{#1}} + \def\mathexample{\mvar{x}\texttt{#1}}% +} + +\def\mathgroupoperator#1#2{% + \def\mathoperator{\texttt{#1\ #2}}% + \def\mathexample{\texttt{#1}\mvar{x}\texttt{#2}}% +} + +\expandafter\let\csname matharray accessoperator\endcsname=\mathgroupoperator +\expandafter\let\csname matharrayoperator\endcsname=\mathgroupoperator + +\def\mathconditionaloperator#1#2{% + \def\mathoperator{#1\space#2} + \def\mathexample{\mvar{x}\ \texttt{#1}\ \mvar{y}\ {\texttt{#2}}\ \mvar{z}} +} + +\newcommand\mathcommand[1][\mathdefaultname]{% + \expandafter\makemathcommand#1(\empty)\stop% + \expandafter\extractcommand\mathcommandname\@@% + \medskip +} +\makeatletter + +\def\makemathcommand#1(#2)#3\stop{% + \expandafter\def\expandafter\mathcommandname\expandafter{\csname pgfmath#1\endcsname}% + \ifx#2\empty% + \else% + \@makemathcommand#2,\stop, + \fi} +\def\@makemathcommand#1,{% + \ifx#1\stop% + \else% + \expandafter\def\expandafter\mathcommandname\expandafter{\mathcommandname{\ttfamily\char`\{#1\char`\}}}% + \expandafter\@makemathcommand% + \fi} +\makeatother + +\def\calcname{\textsc{calc}} + +\newenvironment{math-keyword}[1]{ + \extracttikzmathkeyword#1@ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\texttt{\color{red}\mathname}\mathrest}% + \index{\mathname @\protect\texttt{\mathname} tikz math function}% + \index{TikZ math functions!\mathname @\protect\texttt{\mathname}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\extracttikzmathkeyword#1#2@{% + \def\mathname{#1}% + \def\mathrest{#2}% +} + +%% MW: END MATH MACROS + + +\def\extractcommand#1#2\@@{% + \removeats{#1}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{\textbackslash\strippedat}{}% + \declare{\expandafter\texttt\expandafter{\string#1}}#2% + }% + \index{\strippedat @\protect\myprintocmmand{\strippedat}} +} + +\def\luaextractcommand#1#2\relax{% + \declare{\texttt{\string#1}}#2\par% +% \removeats{#1}% + % \index{\strippedat @\protect\myprintocmmand{\strippedat}} + % \pgfmanualpdflabel{\textbackslash\strippedat}{}% +} + + +% \begin{environment}{{name}\marg{arguments}} +\renewenvironment{environment}[1]{ + \begin{pgfmanualentry} + \extractenvironement#1\@@ + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\extractenvironement#1#2\@@{% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily\char`\\begin\char`\{\declare{#1}\char`\}}#2% + }% + \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}% + \pgfmanualentryheadline{{\ttfamily\char`\\end\char`\{\declare{#1}\char`\}}}% + \index{#1@\protect\texttt{#1} environment}% + \index{Environments!#1@\protect\texttt{#1}} +} + + +\newenvironment{plainenvironment}[1]{ + \begin{pgfmanualentry} + \extractplainenvironement#1\@@ + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\extractplainenvironement#1#2\@@{% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\#1}}#2}% + \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\end#1}}}% + \index{#1@\protect\texttt{#1} environment}% + \index{Environments!#1@\protect\texttt{#1}}% +} + + +\newenvironment{contextenvironment}[1]{ + \begin{pgfmanualentry} + \extractcontextenvironement#1\@@ + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\extractcontextenvironement#1#2\@@{% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\start#1}}#2}% + \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}% + \pgfmanualentryheadline{{\ttfamily\declare{\char`\\stop#1}}}% + \index{#1@\protect\texttt{#1} environment}% + \index{Environments!#1@\protect\texttt{#1}}} + + +\newenvironment{shape}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Shape} {\ttfamily\declare{#1}}% + }% + \index{#1@\protect\texttt{#1} shape}% + \index{Shapes!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{pictype}[2]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Pic type} {\ttfamily\declare{#1}#2}% + }% + \index{#1@\protect\texttt{#1} pic type}% + \index{Pic Types!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{shading}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Shading} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} shading}% + \index{Shadings!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\newenvironment{graph}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Graph} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} graph}% + \index{Graphs!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{gdalgorithm}[2]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Layout} {\ttfamily/graph drawing/\declare{#1}\opt{=}}\opt{\meta{options}}}% + \index{#1@\protect\texttt{#1} layout}% + \index{Layouts!#1@\protect\texttt{#1}}% + \foreach \algo in {#2} + {\edef\marshal{\noexpand\index{#2@\noexpand\protect\noexpand\texttt{#2} algorithm}}\marshal}% + \index{Graph drawing layouts!#1@\protect\texttt{#1}} + \item{\small alias {\ttfamily/tikz/#1}}\par + \item{\small alias {\ttfamily/tikz/graphs/#1}}\par + \item{\small Employs {\ttfamily algorithm=#2}}\par + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{dataformat}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Format} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} format}% + \index{Formats!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{stylesheet}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Style sheet} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} style sheet}% + \index{Style sheets!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{handler}[1]{ + \begin{pgfmanualentry} + \extracthandler#1\@nil% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\gobble#1{} +\def\extracthandler#1#2\@nil{% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{/handlers/#1}{}% + \textbf{Key handler} \meta{key}{\ttfamily/\declare{#1}}#2}% + \index{\gobble#1@\protect\texttt{#1} handler}% + \index{Key handlers!#1@\protect\texttt{#1}} +} + + +\makeatletter + + +\newenvironment{stylekey}[1]{ + \begin{pgfmanualentry} + \def\extrakeytext{style, } + \extractkey#1\@nil% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\choicesep{$\vert$}% +\def\choicearg#1{\texttt{#1}} + +\newif\iffirstchoice + +% \mchoice{choice1,choice2,choice3} +\newcommand\mchoice[1]{% + \begingroup + \firstchoicetrue + \foreach \mchoice@ in {#1} {% + \iffirstchoice + \global\firstchoicefalse + \else + \choicesep + \fi + \choicearg{\mchoice@}% + }% + \endgroup +}% + +% \begin{key}{/path/x=value} +% \begin{key}{/path/x=value (initially XXX)} +% \begin{key}{/path/x=value (default XXX)} +\newenvironment{key}[1]{ + \begin{pgfmanualentry} + \def\extrakeytext{} + %\def\altpath{\emph{\color{gray}or}}% + \extractkey#1\@nil% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +% \insertpathifneeded{a key}{/pgf} -> assign mykey={/pgf/a key} +% \insertpathifneeded{/tikz/a key}{/pgf} -> assign mykey={/tikz/a key} +% +% #1: the key +% #2: a default path (or empty) +\def\insertpathifneeded#1#2{% + \def\insertpathifneeded@@{#2}% + \ifx\insertpathifneeded@@\empty + \def\mykey{#1}% + \else + \insertpathifneeded@#2\@nil + \ifpgfutil@in@ + \def\mykey{#2/#1}% + \else + \def\mykey{#1}% + \fi + \fi +}% +\def\insertpathifneeded@#1#2\@nil{% + \def\insertpathifneeded@@{#1}% + \def\insertpathifneeded@@@{/}% + \ifx\insertpathifneeded@@\insertpathifneeded@@@ + \pgfutil@in@true + \else + \pgfutil@in@false + \fi +}% + +% \begin{keylist}[default path] +% {/path/option 1=value,/path/option 2=value2} +% \end{keylist} +\newenvironment{keylist}[2][]{% + \begin{pgfmanualentry} + \def\extrakeytext{}% + \foreach \xx in {#2} {% + \expandafter\insertpathifneeded\expandafter{\xx}{#1}% + \expandafter\extractkey\mykey\@nil% + }% + \pgfmanualbody +}{% + \end{pgfmanualentry} +}% + +\def\extractkey#1\@nil{% + \pgfutil@in@={#1}% + \ifpgfutil@in@% + \extractkeyequal#1\@nil + \else% + \pgfutil@in@{(initial}{#1}% + \ifpgfutil@in@% + \extractequalinitial#1\@nil% + \else + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}}\hfill(\extrakeytext no value)}% + \fi + \fi% +} + +\def\extractkeyequal#1=#2\@nil{% + \pgfutil@in@{(default}{#2}% + \ifpgfutil@in@% + \extractdefault{#1}#2\@nil% + \else% + \pgfutil@in@{(initial}{#2}% + \ifpgfutil@in@% + \extractinitial{#1}#2\@nil% + \else + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}% + \fi% + \fi% +} + +\def\extractdefault#1#2(default #3)\@nil{% + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill (\extrakeytext default {\ttfamily#3})}% +} + +\def\extractinitial#1#2(initially #3)\@nil{% + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}% +} + +\def\extractequalinitial#1 (initially #2)\@nil{% + \pgfmanualentryheadline{% + \def\mykey{#1}% + \def\mypath{}% + \gdef\myname{}% + \firsttimetrue% + \pgfmanualdecomposecount=0\relax% + \decompose#1/\nil% + {\ttfamily\declare{#1}}\hfill (\extrakeytext initially {\ttfamily#2})}% +} + +% Introduces a key alias '/#1/<name of current key>' +% to be used inside of \begin{key} ... \end{key} +\def\keyalias#1{\vspace{-3pt}\item{\small alias {\ttfamily/#1/\myname}}\vspace{-2pt}\par + \pgfmanualpdflabel{/#1/\myname}{}% +} + +\newif\iffirsttime +\newcount\pgfmanualdecomposecount + +\makeatother + +\def\decompose/#1/#2\nil{% + \def\test{#2}% + \ifx\test\empty% + % aha. + \index{#1@\protect\texttt{#1} key}% + \index{\mypath#1@\protect\texttt{#1}}% + \gdef\myname{#1}% + \pgfmanualpdflabel{#1}{} + \else% + \advance\pgfmanualdecomposecount by1\relax% + \ifnum\pgfmanualdecomposecount>2\relax% + \decomposetoodeep#1/#2\nil% + \else% + \iffirsttime% + \begingroup% + % also make a pdf link anchor with full key path. + \def\hyperlabelwithoutslash##1/\nil{% + \pgfmanualpdflabel{##1}{}% + }% + \hyperlabelwithoutslash/#1/#2\nil% + \endgroup% + \def\mypath{#1@\protect\texttt{/#1/}!}% + \firsttimefalse% + \else% + \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}% + \fi% + \def\firsttime{}% + \decompose/#2\nil% + \fi% + \fi% +} + +\def\decomposetoodeep#1/#2/\nil{% + % avoid too-deep nesting in index + \index{#1/#2@\protect\texttt{#1/#2} key}% + \index{\mypath#1/#2@\protect\texttt{#1/#2}}% + \decomposefindlast/#1/#2/\nil% +} +\makeatletter +\def\decomposefindlast/#1/#2\nil{% + \def\test{#2}% + \ifx\test\pgfutil@empty% + \gdef\myname{#1}% + \else% + \decomposefindlast/#2\nil% + \fi% +} +\makeatother +\def\indexkey#1{% + \def\mypath{}% + \decompose#1/\nil% +} + +\newenvironment{predefinedmethod}[1]{ + \begin{pgfmanualentry} + \extractpredefinedmethod#1\@nil + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\def\extractpredefinedmethod#1(#2)\@nil{% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + Method \declare{\ttfamily #1}\texttt(#2\texttt) \hfill(predefined for all classes)} + \index{#1@\protect\texttt{#1} method}% + \index{Methods!#1@\protect\texttt{#1}} +} + + +\newenvironment{ooclass}[1]{ + \begin{pgfmanualentry} + \def\currentclass{#1} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Class} \declare{\texttt{#1}}} + \index{#1@\protect\texttt{#1} class}% + \index{Class #1@Class \protect\texttt{#1}}% + \index{Classes!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{method}[1]{ + \begin{pgfmanualentry} + \extractmethod#1\@nil + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\def\extractmethod#1(#2)\@nil{% + \def\test{#1} + \ifx\test\currentclass + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + Constructor \declare{\ttfamily #1}\texttt(#2\texttt)} + \else + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + Method \declare{\ttfamily #1}\texttt(#2\texttt)} + \fi + \index{#1@\protect\texttt{#1} method}% + \index{Methods!#1@\protect\texttt{#1}} + \index{Class \currentclass!#1@\protect\texttt{#1}}% +} + +\newenvironment{classattribute}[1]{ + \begin{pgfmanualentry} + \extractattribute#1\@nil + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\def\extractattribute#1=#2;\@nil{% + \def\test{#2}% + \ifx\test\@empty + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + Private attribute \declare{\ttfamily #1} \hfill (initially empty)} + \else + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + Private attribute \declare{\ttfamily #1} \hfill (initially {\ttfamily #2})} + \fi + \index{#1@\protect\texttt{#1} attribute}% + \index{Attributes!#1@\protect\texttt{#1}} + \index{Class \currentclass!#1@\protect\texttt{#1}}% +} + + + +\newenvironment{predefinednode}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Predefined node} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} node}% + \index{Predefined node!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{coordinatesystem}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{Coordinate system} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} coordinate system}% + \index{Coordinate systems!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{snake}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Snake} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} snake}% + \index{Snakes!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{decoration}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Decoration} {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} decoration}% + \index{Decorations!#1@\protect\texttt{#1}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\def\pgfmanualbar{\char`\|} +\makeatletter +\newenvironment{pathoperation}[3][]{ + \begin{pgfmanualentry} + \def\pgfmanualtest{#1}% + \pgfmanualentryheadline{% + \ifx\pgfmanualtest\@empty% + \pgfmanualpdflabel{#2}{}% + \fi% + \textcolor{gray}{{\ttfamily\char`\\path}\ + \ \dots} + \declare{\texttt{\noligs{#2}}}#3\ \textcolor{gray}{\dots\texttt{;}}}% + \ifx\pgfmanualtest\@empty% + \index{#2@\protect\texttt{#2} path operation}% + \index{Path operations!#2@\protect\texttt{#2}}% + \fi% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\newenvironment{datavisualizationoperation}[3][]{ + \begin{pgfmanualentry} + \def\pgfmanualtest{#1}% + \pgfmanualentryheadline{% + \ifx\pgfmanualtest\@empty% + \pgfmanualpdflabel{#2}{}% + \fi% + \textcolor{gray}{{\ttfamily\char`\\datavisualization}\ + \ \dots} + \declare{\texttt{\noligs{#2}}}#3\ \textcolor{gray}{\dots\texttt{;}}}% + \ifx\pgfmanualtest\@empty% + \index{#2@\protect\texttt{#2} (data visualization)}% + \index{Data visualization!#2@\protect\texttt{#2}}% + \fi% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\makeatother + +\def\doublebs{\texttt{\char`\\\char`\\}} + + +\newenvironment{package}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily\char`\\usepackage\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX}} + \index{#1@\protect\texttt{#1} package}% + \index{Packages and files!#1@\protect\texttt{#1}}% + \pgfmanualentryheadline{{\ttfamily\char`\\input \declare{#1}.tex\space\space\space \char`\%\space\space plain \TeX}} + \pgfmanualentryheadline{{\ttfamily\char`\\usemodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\newenvironment{pgfmodule}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + {\ttfamily\char`\\usepgfmodule\char`\{\declare{#1}\char`\}\space\space\space + \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}} + \index{#1@\protect\texttt{#1} module}% + \index{Modules!#1@\protect\texttt{#1}}% + \pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}} + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{pgflibrary}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{\tikzname\ Library} \texttt{\declare{#1}}} + \index{#1@\protect\texttt{#1} library}% + \index{Libraries!#1@\protect\texttt{#1}}% + \vskip.25em% + {{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space + \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}\\ + {{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}\\ + {{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space + \char`\%\space\space \LaTeX\space and plain \TeX\space when using \tikzname}}\\ + {{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space + \char`\%\space\space Con\TeX t\space when using \tikzname}}\\[.5em] + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{purepgflibrary}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{{\small PGF} Library} \texttt{\declare{#1}}} + \index{#1@\protect\texttt{#1} library}% + \index{Libraries!#1@\protect\texttt{#1}}% + \vskip.25em% + {{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space + \char`\%\space\space \LaTeX\space and plain \TeX}}\\ + {{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}}\\[.5em] + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{tikzlibrary}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{\tikzname\ Library} \texttt{\declare{#1}}} + \index{#1@\protect\texttt{#1} library}% + \index{Libraries!#1@\protect\texttt{#1}}% + \vskip.25em% + {{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}\\ + {{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}\\[.5em] + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\newenvironment{pgfkeyslibrary}[1]{% + \begin{pgfmanualentry}% + \pgfmanualentryheadline{% + \pgfmanualpdflabel{#1}{}% + \textbf{pgfkeys Library} \texttt{\declare{#1}}}% + \index{#1@\protect\texttt{#1} pgfkeys library}% + \index{pgfkeys Libraries!#1@\protect\texttt{#1}}% + \vskip.25em + {{\ttfamily\char`\\usepgfkeyslibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}\\ + {{\ttfamily\char`\\usepgfkeyslibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}\\[.5em]% + \pgfmanualbody +}% +{% + \end{pgfmanualentry}% +} + + +\newenvironment{filedescription}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{File {\ttfamily\declare{#1}}}% + \index{#1@\protect\texttt{#1} file}% + \index{Packages and files!#1@\protect\texttt{#1}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + +\newenvironment{packageoption}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{{\ttfamily\char`\\usepackage[\declare{#1}]\char`\{pgf\char`\}}} + \index{#1@\protect\texttt{#1} package option}% + \index{Package options for \textsc{pgf}!#1@\protect\texttt{#1}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + + + +\newcommand\opt[1]{{\color{black!50!green}#1}} +\newcommand\ooarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}} + +\def\opt{\afterassignment\pgfmanualopt\let\next=} +\def\pgfmanualopt{\ifx\next\bgroup\bgroup\color{black!50!green}\else{\color{black!50!green}\next}\fi} + + + +\def\beamer{\textsc{beamer}} +\def\pdf{\textsc{pdf}} +\def\eps{\texttt{eps}} +\def\pgfname{\textsc{pgf}} +\def\tikzname{Ti\emph{k}Z} +\def\pstricks{\textsc{pstricks}} +\def\prosper{\textsc{prosper}} +\def\seminar{\textsc{seminar}} +\def\texpower{\textsc{texpower}} +\def\foils{\textsc{foils}} + +{ + \makeatletter + \global\let\myempty=\@empty + \global\let\mygobble=\@gobble + \catcode`\@=12 + \gdef\getridofats#1@#2\relax{% + \def\getridtest{#2}% + \ifx\getridtest\myempty% + \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1} + \else% + \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1\protect\printanat} + \getridofats#2\relax% + \fi% + } + + \gdef\removeats#1{% + \let\strippedat\myempty% + \edef\strippedtext{\stripcommand#1}% + \expandafter\getridofats\strippedtext @\relax% + } + + \gdef\stripcommand#1{\expandafter\mygobble\string#1} +} + +\def\printanat{\char`\@} + +\def\declare{\afterassignment\pgfmanualdeclare\let\next=} +\def\pgfmanualdeclare{\ifx\next\bgroup\bgroup\color{red!75!black}\else{\color{red!75!black}\next}\fi} + + +\let\textoken=\command +\let\endtextoken=\endcommand + +\def\myprintocmmand#1{\texttt{\char`\\#1}} + +\def\example{\par\smallskip\noindent\textit{Example: }} +\def\themeauthor{\par\smallskip\noindent\textit{Theme author: }} + + +\def\indexoption#1{% + \index{#1@\protect\texttt{#1} option}% + \index{Graphic options and styles!#1@\protect\texttt{#1}}% +} + +\def\itemcalendaroption#1{\item \declare{\texttt{#1}}% + \index{#1@\protect\texttt{#1} date test}% + \index{Date tests!#1@\protect\texttt{#1}}% +} + + + +\def\class#1{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}% +\extractclass#1@\par\topsep=0pt} +\def\endclass{\endlist} +\def\extractclass#1#2@{% +\item{{{\ttfamily\char`\\documentclass}#2{\ttfamily\char`\{\declare{#1}\char`\}}}}% + \index{#1@\protect\texttt{#1} class}% + \index{Classes!#1@\protect\texttt{#1}}} + +\def\partname{Part} + +\makeatletter +\def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index} + This index only contains automatically generated entries. A good + index should also contain carefully selected keywords. This index is + not a good index. + \bigskip +} +\c@IndexColumns=2 + \def\theindex{\@restonecoltrue + \columnseprule \z@ \columnsep 29\p@ + \twocolumn[\index@prologue]% + \parindent -30pt + \columnsep 15pt + \parskip 0pt plus 1pt + \leftskip 30pt + \rightskip 0pt plus 2cm + \small + \def\@idxitem{\par}% + \let\item\@idxitem \ignorespaces} + \def\endtheindex{\onecolumn} +\def\noindexing{\let\index=\@gobble} + + +\newenvironment{arrowtipsimple}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \def\currentarrowtype{#1} + \pgfmanualbody} +{ + \end{pgfmanualentry} +} + +\newenvironment{arrowtip}[4]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \pgfmanualbody + \def\currentarrowtype{#1} + \begin{minipage}[t]{10.25cm} + #2 + \end{minipage}\hskip5mm\begin{minipage}[t]{4.75cm} + \leavevmode\vskip-2em + \tikz{ + \draw [black!50,line width=5mm,-{#1[#3,color=black]}] (-4,0) -- (0,0); + \foreach \action in {#4} + { \expandafter\processaction\action\relax } + } + \end{minipage}\par\smallskip + } +{ + \end{pgfmanualentry} +} + +\newenvironment{arrowcap}[5]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Arrow Tip Kind} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \pgfmanualbody + \def\currentarrowtype{#1} + \begin{minipage}[t]{10.25cm} + #2 + \end{minipage}\hskip5mm\begin{minipage}[t]{4.75cm} + \leavevmode\vskip-2em + \tikz{ + \path [tips, line width=10mm,-{#1[#3,color=black]}] (-4,0) -- (0,0); + \draw [line width=10mm,black!50] (-3,0) -- (#5,0); + \foreach \action in {#4} + { \expandafter\processaction\action\relax } + } + \end{minipage}\par\smallskip + } +{ + \end{pgfmanualentry} +} + +\newenvironment{pattern}[1]{ + \begin{pgfmanualentry} + \pgfmanualentryheadline{\textbf{Pattern} {\ttfamily#1}} + \index{#1@\protect\texttt{#1} pattern}% + \index{Patterns!#1@\protect\texttt{#1}}% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} + +\def\processaction#1=#2\relax{ + \expandafter\let\expandafter\pgf@temp\csname manual@action@#1\endcsname + \ifx\pgf@temp\relax\else + \pgf@temp#2/0/\relax + \fi +} +\def\manual@action@length#1/#2/#3\relax{% + \draw [red,|<->|,semithick,xshift=#2] ([yshift=4pt]current bounding + box.north -| -#1,0) coordinate (last length) -- node + [above=-2pt] {|length|} ++(#1,0); +} +\def\manual@action@width#1/#2/#3\relax{% + \draw [overlay, red,|<->|,semithick] (.5,-#1/2) -- node [below,sloped] {|width|} (.5,#1/2); +} +\def\manual@action@inset#1/#2/#3\relax{% + \draw [red,|<->|,semithick,xshift=#2] ([yshift=-4pt]current bounding + box.south -| last length) -- node [below] {|inset|} ++(#1,0); +} + +\newenvironment{arrowexamples} +{\begin{tabbing} + \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= + \hbox to 1.9cm{\emph{0.4pt}\hfil} \= \hbox to 2cm{\emph{0.8pt}\hfil} \= \emph{1.6pt} \\ + } +{\end{tabbing}\vskip-1em} + +\newenvironment{arrowcapexamples} +{\begin{tabbing} + \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= + \hbox to 1.9cm{\emph{1ex}\hfil} \= \hbox to 2cm{\emph{1em}\hfil} \\ + } +{\end{tabbing}\vskip-1em} + +\def\arrowcapexample#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowcapexample@\currentarrowtype[{#2}]\else\arrowcapexample@#1[{#2}]\fi} +\def\arrowcapexample@#1[#2]{% + {\sfcode`\.1000\small\texttt{#1[#2]}} \> + \kern-.5ex\tikz [baseline,>={#1[#2]}] \draw [line + width=1ex,->] (0,.5ex) -- (2em,.5ex); \> + \kern-.5em\tikz [baseline,>={#1[#2]}] \draw [line + width=1em,->] (0,.5ex) -- (2em,.5ex); \\ +} + +\def\arrowexample#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowexample@\currentarrowtype[{#2}]\else\arrowexample@#1[{#2}]\fi} +\def\arrowexample@#1[#2]{% + {\sfcode`\.1000\small\texttt{#1[#2]}} \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=0.4pt,->] (0,.5ex) -- (2em,.5ex); thin \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=0.8pt,->] (0,.5ex) -- (2em,.5ex); \textbf{thick} \> + \tikz [baseline,>={#1[#2]}] \draw [line + width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\ +} +\def\arrowexampledup[#1]{\arrowexample[{#1] \currentarrowtype[}]} +\def\arrowexampledupdot[#1]{\arrowexample[{#1] . \currentarrowtype[}]} + +\def\arrowexampledouble#1[#2]{\def\temp{#1}\ifx\temp\pgfutil@empty\arrowexampledouble@\currentarrowtype[{#2}]\else\arrowexampledouble@#1[{#2}]\fi} +\def\arrowexampledouble@#1[#2]{% + {\sfcode`\.1000\small\texttt{#1[#2]} on double line} \> + \tikz [baseline,>={#1[#2]}] + \draw [double equal sign distance,line width=0.4pt,->] (0,.5ex) -- (2em,.5ex); thin \> + \tikz [baseline,>={#1[#2]}] + \draw [double equal sign distance,line width=0.8pt,->] (0,.5ex) -- (2em,.5ex); \textbf{thick} \> + \tikz [baseline,>={#1[#2]}] + \draw [double equal sign distance, line width=1.6pt,->] (0,.5ex) -- (3em,.5ex); \\ +} + + + +\newcommand\symarrow[1]{% + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \texttt{#1}& yields thick + \begin{tikzpicture}[arrows={#1-#1},thick,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} and thin + \begin{tikzpicture}[arrows={#1-#1},thin,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} +} +\newcommand\symarrowdouble[1]{% + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \texttt{#1}& yields thick + \begin{tikzpicture}[arrows={#1-#1},thick,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} + and thin + \begin{tikzpicture}[arrows={#1-#1},thin,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture}, double + \begin{tikzpicture}[arrows={#1-#1},thick,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} and + \begin{tikzpicture}[arrows={#1-#1},thin,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} +} + +\newcommand\sarrow[2]{% + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \index{#2@\protect\texttt{#2} arrow tip}% + \index{Arrow tips!#2@\protect\texttt{#2}}% + \texttt{#1-#2}& yields thick + \begin{tikzpicture}[arrows={#1-#2},thick,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} and thin + \begin{tikzpicture}[arrows={#1-#2},thin,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} +} + +\newcommand\sarrowdouble[2]{% + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \index{#2@\protect\texttt{#2} arrow tip}% + \index{Arrow tips!#2@\protect\texttt{#2}}% + \texttt{#1-#2}& yields thick + \begin{tikzpicture}[arrows={#1-#2},thick,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} and thin + \begin{tikzpicture}[arrows={#1-#2},thin,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture}, double + \begin{tikzpicture}[arrows={#1-#2},thick,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} and + \begin{tikzpicture}[arrows={#1-#2},thin,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); + \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); + \end{tikzpicture} +} + +\newcommand\carrow[1]{% + \index{#1@\protect\texttt{#1} arrow tip}% + \index{Arrow tips!#1@\protect\texttt{#1}}% + \texttt{#1}& yields for line width 1ex + \begin{tikzpicture}[arrows={#1-#1},line width=1ex,baseline] + \useasboundingbox (-1mm,-0.5ex) rectangle (1.6cm,2ex); + \fill [black!15] (1.5cm,-.5ex) rectangle (1.6cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; + \draw (0pt,.5ex) -- (1.5cm,.5ex); + \end{tikzpicture} +} +\def\myvbar{\char`\|} +\newcommand\plotmarkentry[1]{% + \index{#1@\protect\texttt{#1} plot mark}% + \index{Plot marks!#1@\protect\texttt{#1}} + \texttt{\char`\\pgfuseplotmark\char`\{\declare{\noligs{#1}}\char`\}} & + \tikz\draw[color=black!25] plot[mark=#1,mark options={fill=examplefill,draw=black}] coordinates{(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\ +} +\newcommand\plotmarkentrytikz[1]{% + \index{#1@\protect\texttt{#1} plot mark}% + \index{Plot marks!#1@\protect\texttt{#1}} + \texttt{mark=\declare{\noligs{#1}}} & \tikz\draw[color=black!25] + plot[mark=#1,mark options={fill=examplefill,draw=black}] + coordinates {(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\ +} + + + +\ifx\scantokens\@undefined + \PackageError{pgfmanual-macros}{You need to use extended latex + (elatex) or (pdfelatex) to process this document}{} +\fi + +\begingroup +\catcode`|=0 +\catcode`[= 1 +\catcode`]=2 +\catcode`\{=12 +\catcode `\}=12 +\catcode`\\=12 |gdef|find@example#1\end{codeexample}[|endofcodeexample[#1]] +|endgroup + +% define \returntospace. +% +% It should define NEWLINE as {}, spaces and tabs as \space. +\begingroup +\catcode`\^=7 +\catcode`\^^M=13 +\catcode`\^^I=13 +\catcode`\ =13% +\gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^I=13\def^^I{\space}} +\gdef\showreturn{\show^^M} +\endgroup + +\begingroup +\catcode`\%=13 +\catcode`\^^M=13 +\gdef\commenthandler{\catcode`\%=13\def%{\@gobble@till@return}} +\gdef\@gobble@till@return#1^^M{} +\gdef\@gobble@till@return@ignore#1^^M{\ignorespaces} +\gdef\typesetcomment{\catcode`\%=13\def%{\@typeset@till@return}} +\gdef\@typeset@till@return#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}}\par} +\endgroup + +% Define tab-implementation functions +% \codeexample@tabinit@replacementchars@ +% and +% \codeexample@tabinit@catcode@ +% +% They should ONLY be used in case that tab replacement is active. +% +% This here is merely a preparation step. +% +% Idea: +% \codeexample@tabinit@catcode@ will make TAB active +% and +% \codeexample@tabinit@replacementchars@ will insert as many spaces as +% /codeexample/tabsize contains. +{ +\catcode`\^^I=13 +% ATTENTION: do NOT use tabs in these definitions!! +\gdef\codeexample@tabinit@replacementchars@{% + \begingroup + \count0=\pgfkeysvalueof{/codeexample/tabsize}\relax + \toks0={}% + \loop + \ifnum\count0>0 + \advance\count0 by-1 + \toks0=\expandafter{\the\toks0\ }% + \repeat + \xdef\codeexample@tabinit@replacementchars@@{\the\toks0}% + \endgroup + \let^^I=\codeexample@tabinit@replacementchars@@ +}% +\gdef\codeexample@tabinit@catcode@{\catcode`\^^I=13}% +}% + +% Called after any options have been set. It assigns +% \codeexample@tabinit@catcode +% and +% \codeexample@tabinit@replacementchars +% which are used inside of +%\begin{codeexample} +% ... +%\end{codeexample} +% +% \codeexample@tabinit@catcode is either \relax or it makes tab +% active. +% +% \codeexample@tabinit@replacementchars is either \relax or it inserts +% a proper replacement sequence for tabs (as many spaces as +% configured) +\def\codeexample@tabinit{% + \ifnum\pgfkeysvalueof{/codeexample/tabsize}=0\relax + \let\codeexample@tabinit@replacementchars=\relax + \let\codeexample@tabinit@catcode=\relax + \else + \let\codeexample@tabinit@catcode=\codeexample@tabinit@catcode@ + \let\codeexample@tabinit@replacementchars=\codeexample@tabinit@replacementchars@ + \fi +} + +\newif\ifpgfmanualtikzsyntaxhilighting + +\pgfqkeys{/codeexample}{% + width/.code= {\setlength\codeexamplewidth{#1}}, + graphic/.code= {\colorlet{graphicbackground}{#1}}, + code/.code= {\colorlet{codebackground}{#1}}, + execute code/.is if=code@execute, + hidden/.is if=code@hidden, + code only/.code= {\code@executefalse}, + setup code/.code= {\pgfmanual@setup@codetrue\code@executefalse}, + multipage/.code= {\code@executefalse\pgfmanual@multipage@codetrue}, + pre/.store in=\code@pre, + post/.store in=\code@post, + % #1 is the *complete* environment contents as it shall be + % typeset. In particular, the catcodes are NOT the normal ones. + typeset listing/.code= {#1}, + render instead/.store in=\code@render, + vbox/.code= {\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}}, + ignorespaces/.code= {\let\@gobble@till@return=\@gobble@till@return@ignore}, + leave comments/.code= {\def\code@catcode@hook{\catcode`\%=12}\let\commenthandler=\relax\let\typesetcomment=\relax}, + tabsize/.initial=0,% FIXME : this here is merely used for indentation. It is just a TAB REPLACEMENT. + every codeexample/.style={width=4cm+7pt, tikz syntax=true}, + from file/.code={\codeexamplefromfiletrue\def\codeexamplesource{#1}}, + tikz syntax/.is if=pgfmanualtikzsyntaxhilighting, + animation list/.store in=\code@animation@list, + animation pre/.store in=\code@animation@pre, + animation post/.store in=\code@animation@post, + animation scale/.store in=\pgfmanualanimscale, + animation bb/.style={ + animation pre={ + \tikzset{ + every picture/.style={ + execute at begin picture={ + \useasboundingbox[clip] #1;} + } + } + } + }, + preamble/.store in=\code@preamble, +} + +\def\pgfmanualanimscale{.5} + +\newread\examplesource + + +% Opening, reading and closing the results file + +\def\opensource#1{ + \immediate\openin\examplesource=#1 +} +\def\do@codeexamplefromfile{% + \immediate\openin\examplesource\expandafter{\codeexamplesource}% + \def\examplelines{}% + \readexamplelines + \closein\examplesource + \expandafter\endofcodeexample\expandafter{\examplelines}% +} + +\def\readexamplelines{ + \ifeof\examplesource% + \else + \immediate\read\examplesource to \exampleline + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\examplelines\expandafter\expandafter\expandafter{\expandafter\examplelines\exampleline} + \expandafter\readexamplelines% + \fi +} + +\let\code@animation@pre\pgfutil@empty +\let\code@animation@post\pgfutil@empty +\let\code@animation@list\pgfutil@empty + +\let\code@pre\pgfutil@empty +\let\code@post\pgfutil@empty +\let\code@render\pgfutil@empty +\let\code@preamble\pgfutil@empty +\def\code@catcode@hook{} + +\newif\ifpgfmanual@multipage@code +\newif\ifpgfmanual@setup@code +\newif\ifcodeexamplefromfile +\newdimen\codeexamplewidth +\newif\ifcode@execute +\newif\ifcode@hidden +\newbox\codeexamplebox +\def\codeexample[#1]{% + \global\let\pgfmanual@do@this\relax% + \aftergroup\pgfmanual@do@this% + \begingroup% + \code@executetrue + \pgfqkeys{/codeexample}{every codeexample,#1}% + \pgfmanualswitchoncolors% + \ifcodeexamplefromfile\begingroup\fi + \codeexample@tabinit% assigns \codeexample@tabinit@[catcode,replacementchars] + \parindent0pt + \begingroup% + \par% this \par is not inside \ifcode@hidden because we want to switch to vmode + \ifcode@hidden\else + \medskip% + \fi + \let\do\@makeother% + \dospecials% + \obeylines% + \@vobeyspaces% + \catcode`\%=13% + \catcode`\^^M=13% + \code@catcode@hook% + \codeexample@tabinit@catcode + \relax% + \ifcodeexamplefromfile% + \expandafter\do@codeexamplefromfile% + \else% + \expandafter\find@example% + \fi} +\def\endofcodeexample#1{% + \endgroup% + \ifpgfmanual@setup@code% + \gdef\pgfmanual@do@this{% + {% + \returntospace% + \commenthandler% + % ensures the active ^^M is protected thus won't be expanded in the + % following \xdef\code@temp{#1} + \obeylines% + \xdef\code@temp{#1}% removes returns and comments + }% + \edef\pgfmanualmcatcode{\the\catcode`\^^M}% + \catcode`\^^M=9\relax% + \expandafter\scantokens\expandafter{\code@temp}% + \catcode`\^^M=\pgfmanualmcatcode% + }% + \fi% + \ifcode@hidden\else + \ifcode@execute% + \setbox\codeexamplebox=\hbox{% + \ifx\code@render\pgfutil@empty% + {% + {% + \returntospace% + \commenthandler% + % ensures the active ^^M is protected thus won't be expanded in the + % following \xdef\code@temp{#1} + \obeylines% + \xdef\code@temp{#1}% removes returns and comments + }% + \catcode`\^^M=9% + \colorbox{graphicbackground}{\color{black}\ignorespaces% + \code@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@post\ignorespaces}% + }% + \else% + \global\let\code@temp\code@render% + \colorbox{graphicbackground}{\color{black}\ignorespaces% + \code@render}% + \fi% + }% + \ifx\code@animation@list\pgfutil@empty% + \else% + \setbox\codeexampleboxanim=\vbox{% + \rightskip0pt\leftskip0pt plus1filll% + \ifdim\wd\codeexamplebox>\codeexamplewidth% + \else% + \hsize\codeexamplewidth% + \advance\hsize by2cm% + \fi% + \leavevmode\catcode`\^^M=9% + \foreach \pgfmanualtime/\pgfmanualtimehow in\code@animation@list{% + \setbox\codeexampleboxanim=\hbox{\colorbox{animationgraphicbackground}{% + \tikzset{make snapshot of=\pgfmanualtime}% + \scalebox{\pgfmanualanimscale}{\color{black}\ignorespaces% + \code@animation@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@animation@post\ignorespaces}% + }}% + \space\raise4pt\hbox to0pt{\vrule width0pt height1em\hbox + to\wd\codeexampleboxanim{\hfil\scriptsize$t{=}\pgfmanualtimehow \mathrm s$\hfil}\hss}% + \lower\ht\codeexampleboxanim\box\codeexampleboxanim\hfil\penalty0\hskip0ptplus-1fil% + }% + }% + \setbox\codeexampleboxanim=\hbox{\hbox{}\hskip-2cm\box\codeexampleboxanim}% + \fi% + \ifdim\wd\codeexamplebox>\codeexamplewidth% + \def\code@start{\par}% + \def\code@flushstart{}\def\code@flushend{}% + \def\code@mid{\parskip2pt\par\noindent}% + \def\code@width{\linewidth-6pt}% + \def\code@end{}% + \else% + \def\code@start{% + \linewidth=\textwidth% + \parshape \@ne 0pt \linewidth + \leavevmode% + \hbox\bgroup}% + \def\code@flushstart{\hfill}% + \def\code@flushend{\hbox{}}% + \def\code@mid{\hskip6pt}% + \def\code@width{\linewidth-12pt-\codeexamplewidth}% + \def\code@end{\egroup}% + \fi% + \code@start% + \noindent% + \begin{minipage}[t]{\codeexamplewidth}\raggedright + \hrule width0pt% + \footnotesize\vskip-1em% + \code@flushstart\box\codeexamplebox\code@flushend% + \vskip0pt% + \leavevmode% + \box\codeexampleboxanim% + \vskip-1ex + \leavevmode% + \end{minipage}% + \else% + \def\code@mid{\par} + \def\code@width{\linewidth-6pt} + \def\code@end{} + \fi% + \code@mid% + \ifpgfmanual@multipage@code% + {% + \pgfkeysvalueof{/codeexample/prettyprint/base color}% + \pgfmanualdolisting{#1}% + }% + \else% + \colorbox{codebackground}{% + \pgfkeysvalueof{/codeexample/prettyprint/base color}% + \begin{minipage}[t]{\code@width}% + \pgfmanualdolisting{#1}% + \end{minipage}}% + \fi% + \code@end% + \par% + \medskip + \fi + \endcodeexample\endgroup% +} + +\def\endcodeexample{\endgroup} +\newbox\codeexampleboxanim + +\def\pgfmanualdolisting#1{% + {% + \let\do\@makeother + \dospecials + \frenchspacing\@vobeyspaces + \normalfont\ttfamily\footnotesize + \typesetcomment% + \codeexample@tabinit@replacementchars + \@tempswafalse + \def\par{% + \if@tempswa + \leavevmode \null \@@par\penalty\interlinepenalty + \else + \@tempswatrue + \ifhmode\@@par\penalty\interlinepenalty\fi + \fi}% + \obeylines + \everypar \expandafter{\the\everypar \unpenalty}% + \ifx\code@preamble\pgfutil@empty\else + \pgfutil@tempdima=\hsize + \vbox{\hsize=\pgfutil@tempdima + \raggedright\scriptsize\detokenize\expandafter{\code@preamble}}% + \fi + \pgfkeysvalueof{/codeexample/typeset listing/.@cmd}{#1}\pgfeov + }% +} + +\makeatother + +\usepackage{pgfmanual} + + +% autoxref is now always on + +% \makeatletter +% % \pgfautoxrefs will be defined by 'make dist' +% \pgfutil@ifundefined{pgfautoxrefs}{% +% \renewcommand\pgfmanualpdflabel[3][]{#3}% NO-OP +% \def\pgfmanualpdfref#1#2{#2}% +% \pgfkeys{ +% /pdflinks/codeexample links=false,% DISABLED. +% }% +% }{} +% \makeatother + +\newdimen\pgfmanualcslinkpreskip + +% Styling of the pretty printer +\pgfkeys{ + /codeexample/syntax hilighting/.style={ + /codeexample/prettyprint/key name/.code={\textcolor{keycolor}{\pgfmanualpdfref{##1}{\noligs{##1}}}}, + /codeexample/prettyprint/key name with handler/.code 2 args={\textcolor{keycolor}{\pgfmanualpdfref{##1}{\noligs{##1}}}/\textcolor{blue!70!black}{\pgfmanualpdfref{/handlers/##2}{\noligs{##2}}}}, + /codeexample/prettyprint/key value display only/.code={\textcolor{keycolor}{{\itshape{\let\pgfmanualwordstartup\relax\pgfmanualprettyprintcode{##1}}}}}, + /codeexample/prettyprint/cs/.code={\textcolor{cscolor}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{\noligs{##1}}}}, + /codeexample/prettyprint/cs with args/.code 2 args={\textcolor{black}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{\noligs{##1}}}\{\textcolor{black}{\pgfmanualprettyprintcode{##2}}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\textcolor{black}{\pgfmanualcslinkpreskip4.25pt\pgfmanualpdfref{##1}{\noligs{##1}}}\{\textcolor{black}{\pgfmanualprettyprintpgfkeys{##2}}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/begin/.initial=1, + /codeexample/prettyprint/cs/begin/.code 2 args={\textcolor{black}{##1}\{\textcolor{cscolor}{\pgfmanualpdfref{##2}{\noligs{##2}}}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/end/.initial=1, + /codeexample/prettyprint/cs/end/.code 2 args={\textcolor{black}{##1}\{\textcolor{cscolor}{\pgfmanualpdfref{##2}{\noligs{##2}}}\pgfmanualclosebrace}, + /codeexample/prettyprint/word/.code={\pgfmanualwordstartup{\begingroup\pgfkeyssetvalue{/pdflinks/search key prefixes in}{}\pgfmanualpdfref{##1}{\noligs{##1}}\endgroup}}, + /codeexample/prettyprint/point/.code={\textcolor{pointcolor}{\noligs{##1}}},% + /codeexample/prettyprint/point with cs/.code 2 args={\textcolor{pointcolor}{(\pgfmanualpdfref{##1}{\noligs{##1}}:\noligs{##2}}},% + /codeexample/prettyprint/comment font=\itshape, + /codeexample/prettyprint/base color/.initial=\color{basecolor}, + /pdflinks/render hyperlink/.code={% + {\setbox0=\hbox{##1}% + \rlap{{\color{linkcolor}\dimen0\wd0\advance\dimen0by-\pgfmanualcslinkpreskip\hskip\pgfmanualcslinkpreskip\vrule width\dimen0 height-1pt depth1.6pt}}% + \box0% + }% + } + },/codeexample/syntax hilighting +} + +\colorlet{keycolor}{black} +\colorlet{cscolor}{black} +\colorlet{pointcolor}{black} +\colorlet{basecolor}{black} +\colorlet{linkcolor}{black!8} + +\def\pgfmanualswitchoncolors{% + \colorlet{keycolor}{green!50!black}% + \colorlet{cscolor}{blue!70!black} + \colorlet{pointcolor}{violet} + \colorlet{basecolor}{black!55} + \colorlet{linkcolor}{white} +} + +\makeatletter + +\def\pgfmanualwordstartup{\textcolor{black}} + +\def\noligs#1{\pgfmanualnoligs#1\kern0pt--\pgf@stop}% +\def\pgfmanualnoligs#1--{% + \pgfutil@ifnextchar\pgf@stop{#1\pgfutil@gobble}{#1-\kern0pt-\kern0pt\pgfmanualnoligs}% +} +\makeatother + + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "beameruserguide" +%%% End: diff --git a/graphics/pgf/base/tex/latex/doc/pgfmanual.code.tex b/graphics/pgf/base/tex/latex/doc/pgfmanual.code.tex new file mode 100644 index 0000000000..3c5ebee2ab --- /dev/null +++ b/graphics/pgf/base/tex/latex/doc/pgfmanual.code.tex @@ -0,0 +1,64 @@ +% Copyright 2019 by Till Tantau and Christian Feuersänger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\input pgfmanual.prettyprinter.code.tex +\input pgfmanual.pdflinks.code.tex + +% TODO for auto xrefs: +% 1. check the already identified labels, preferably using +% /pdflinks/show labels=true +% and the image externalization debug mode (see pgfmanual-en-main.tex) +% (to strip almost all images away) +% +% 2. Insert '\declareandlabel' in the document whenever something has been +% defined in the text, so it should get a pdf anchor (see +% pgfmanual.pdflinks.code.tex ) +% +% 2.1 perhaps insert \pgfmanualpdflabel{<label>}{} where needed. +% +% 3. Verify that the |...| commands occurring in situations where catcodes can't +% be changed (footnotes or macro arguments) work as expected. +% +% 4. Consider telling the pretty printer that several control sequences +% have arguments which are options (see below for the predefined list). +% This may apply to \pgfpageslogicalpageoptions or so. +% +% 5. @Christian: consider extensions of the parser such that it identifies path commands (at least partially) +% +% + +\def\pgfmanual@warning#1{\pgf@typeout{! Package pgfmanual Warning: #1}}% + + +\pgfkeys{ + % set this to 'false' to disable auto reference generation. + % However, a little bit runtime overhead will still remain + % (and the \pgfmanualpdflabel commands will still be used) + /pdflinks/codeexample links=true, + % + /codeexample/prettyprint/cs arguments/tikzset/.initial=1, + /codeexample/prettyprint/cs/tikzset/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/usetikzlibrary/.initial=1, + /codeexample/prettyprint/cs/usetikzlibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/usepgflibrary/.initial=1, + /codeexample/prettyprint/cs/usepgflibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace}, + % + % + % + % whenever an unqualified key is found, the following key prefix + % list is tried to find a match. + /pdflinks/search key prefixes in={/tikz/,/pgf/}, + % + % the link prefix written to the pdf file: + /pdflinks/internal link prefix=pgf, + % + /pdflinks/warnings=false, + % for debugging: + /pdflinks/show labels=false, +}% diff --git a/graphics/pgf/base/tex/latex/doc/pgfmanual.pdflinks.code.tex b/graphics/pgf/base/tex/latex/doc/pgfmanual.pdflinks.code.tex new file mode 100644 index 0000000000..e8dfaa565e --- /dev/null +++ b/graphics/pgf/base/tex/latex/doc/pgfmanual.pdflinks.code.tex @@ -0,0 +1,432 @@ +%-------------------------------------------- +% +% 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 <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +% 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{<label>}{<text>} +% #1: the label. +% The text #2 will be shown in the resulting pdf (if it is not empty). +% +% There is also support for catcode changes if <label> contains +% something which shouldn't be written as-is into .aux files: +% \pgfmanualpdflabel[\catcode`\|=12 ]{|-}{} +% -> this will write +% \begingroup \catcode `\|=12 +% <code to deal with the label |- > +% \endgroup +% into the .aux file. +% +\def\pgfmanualpdflabel{\pgfutil@ifnextchar[{\pgfmanualpdflabel@opt}{\pgfmanualpdflabel@opt[]}}% +\def\pgfmanualpdflabel@opt[#1]#2#3{% + \begingroup + % + \def\pgfmanualpdf@catcode{#1}% + \pgfmanualpdf@catcode + % + \pgfmanualpdflabel@generate{#2}{#3}% + % + % this is pgfplots-specific: pgfplots supports generic styles which + % contain '\x' where '\x' iterates through 'x,y,z'. + \pgfutil@in@\x{#2}% + \ifpgfutil@in@ + \def\x{y}% + \pgfmanualpdflabel@generate{#2}{#3}% + \def\x{z}% + \pgfmanualpdflabel@generate{#2}{#3}% + \fi + \endgroup +}% +\def\pgfmanualpdflabel@generate#1#2{% + \pgfmanual@handlespeciallabeltokens@in{#1}% + % + \def\pgfmanualpdflabel@generateone{0}% + \pgfutil@ifundefined{pgfd@lbl@\pgfmanualpdflabel@@}{% + % ok, no such label is known. + \def\pgfmanualpdflabel@generateone{1}% + }{% + \if\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname a% "a"ux + % ah, it is "just" known from a previous run, but there is + % no code in the pdf! Write it! + \def\pgfmanualpdflabel@generateone{1}% + \else + % ok, we already wrote one before. Skip. + \fi + }% + \if\pgfmanualpdflabel@generateone1% + \ifpgfmanualshowlabels + \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{\pgfmanualpdflabel@@}\pgfeov + \fi + % + \if@filesw + \ifx\pgfmanualpdf@catcode\pgfutil@empty + \else + \toks0=\expandafter{\pgfmanualpdf@catcode}% + \immediate\write\@auxout{% + \noexpand\begingroup + \the\toks0 + }% + \fi + \immediate\write\@auxout{% + \noexpand\expandafter\noexpand\gdef + \noexpand\csname pgfd@lbl@\pgfmanualpdflabel@@\noexpand\endcsname{a}% a = known in "a"ux file + }% + \ifx\pgfmanualpdf@catcode\pgfutil@empty + \else + \immediate\write\@auxout{\noexpand\endgroup}% + \fi + \fi + \expandafter\gdef\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname{w}% 1. remember the label AND remember that we "w"rote it into the pdf. + \edef\pgfmanualpdflabel@@{\pgfkeysvalueof{/pdflinks/internal link prefix}.\pgfmanualpdflabel@@}% + \ifvmode% + \expandafter\hypertarget\expandafter{\pgfmanualpdflabel@@}{#2}% + \else% + {\setbox0=\hbox{\raise1em\hbox{\expandafter\hypertarget\expandafter{\pgfmanualpdflabel@@}{}}}\ht0=0pt\box0}#2% + \fi% + \else + #2% + \fi +}% + +% A pdf reference to label `#1' with (TeX) text `#2'. +% @see also \verbpdfref. +\def\pgfmanualpdfref#1#2{% + \begingroup + \pgfmanual@handlespeciallabeltokens@in{#1}% + % + \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname + \else + \global\let\pgfmanual@glob=\pgfmanualpdflabel@@ + \def\pgfmanual@tempa{\foreach \prefix in }% + \pgfkeysgetvalue{/pdflinks/search key prefixes in}\pgfmanual@tempb + \expandafter\pgfmanual@tempa\expandafter{\pgfmanual@tempb}{% + \edef\pgfmanualpdflabel@@{\prefix\pgfmanualpdflabel@@}% + \expandafter\pgfmanual@handlespeciallabeltokens@in\expandafter{\pgfmanualpdflabel@@}% + \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname + \xdef\pgfmanual@glob{\pgfmanualpdflabel@@}% + \breakforeach + \fi + }% + \let\pgfmanualpdflabel@@=\pgfmanual@glob + \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname + \else + \ifpgfmanualpdfwarnings + \begingroup + \toks0={#1}% + \pgfmanual@warning{pgfmanualpdfref{\the\toks0 }: target label does not exist.}% + \endgroup + \fi + #2% + \let\pgfmanualpdflabel@@=\pgfutil@empty + \fi + \fi + \ifx\pgfmanualpdflabel@@\pgfutil@empty + \else + \expandafter\pgfmanualpdfref@\expandafter{\pgfmanualpdflabel@@}{#2}% + \fi + \endgroup +}% +\def\pgfmanualpdfref@#1#2{% + \pgfkeysgetvalue{/pdflinks/internal link prefix}\pgfmanual@temp + \expandafter\hyperlink\expandafter{\pgfmanual@temp.#1}{\pgfkeysvalueof{/pdflinks/render hyperlink/.@cmd}{#2}\pgfeov}% + \ifpgfmanualshowlabels + \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{#1}\pgfeov + \fi +}% + +% Handles special tokens in a pdf label which should be treated with +% care. +% +% For example, backslashes might produce problems. +% This occurs quite frequently with automatically generated hyperrefs +% inside of codeexamples where \pgfmanualpdfref will be invoked - +% there, we get the catcode 12 backslashes. +% Check for them! +% +% #1: a token list which shall be used either as cross ref or as +% label. +% +% On output, the macro \pgfmanualpdflabel@@ will be '\edef'ed to the +% new, possibly modified value. +\def\pgfmanual@handlespeciallabeltokens@in#1{% + \begingroup + \pgfmanualpdf@installreplacements + \expandafter\pgfutil@in@\pgfmanual@pretty@backslash{#1}% + \ifpgfutil@in@ + % assume the backslash is the first char and substitute it: + \pgfmanualpdfref@substitute@backslash#1\relax + \else + \edef\pgfmanualpdflabel@@{#1}% + \fi + \def\pgfmanual@tmp{\pgfutilstrreplace{ }{\space}}% + \expandafter\pgfmanual@tmp\expandafter{\pgfmanualpdflabel@@}% + \edef\pgfmanualpdflabel@@{\pgfretval}% + \pgfmath@smuggleone\pgfmanualpdflabel@@ + \endgroup +}% + +\expandafter\def\expandafter\pgfmanualpdfref@substitute@backslash\expandafter#\expandafter1\pgfmanual@pretty@backslash#2\relax{% + \edef\pgfmanualpdflabel@@{#1\textbackslash #2}% +}% + +% Typesets '#1' in red,\texttt like every declaration. It will also +% generate a pdf cross ref anchor for #1. +% +% WARNING: this changes catcodes! In case this is not acceptable in +% your context, you will need to generate a \pgfmanualpdflabel +% manually. +% +% \declareandlabel{\controlsequence} can be used as |\controlsequence| +\def\declareandlabel{% + \begingroup + \pgfmanual@verb@preparecatcodes@ + \def\pgfmanualprettyprinterhandlecollectedargs##1{% + \pgfmanualpdflabel##1{\texttt{\declare##1}}% mark: '##1' contains already braces. + \endgroup + }% + \pgfmanualprettyprintercollectargcount1{\relax}% +} + +% +% \verbpdfref{\controlsequence more stuff} +% is the same as writing |\controlsequence more stuff|, but the +% *complete* argument is supposed to be one label. +% +% The difference to \pgfmanualpdfref{...}{} is that the argument is +% supposed to be verbatim text. +\def\verbpdfref{% + \begingroup + \pgfmanual@verb@preparecatcodes@ + \def\pgfmanualprettyprinterhandlecollectedargs##1{% + \pgfmanualpdfref##1{\texttt{##1}}% mark: '##1' contains already braces. + \endgroup + }% + \pgfmanualprettyprintercollectargcount1{\relax}% +} + +% Prepare active vertical bars, |....| for auto-pretty cross +% referencing. +% +% Example: +% |\pgfkeys| -> will generate a hyperref! +{ + \catcode`\|=12 + \gdef\pgfmanual@verb@bar{|}% +% \gdef\pgfmanual@verb@collect#1|{% +% % this command will also handle control sequences. +% \texttt{\pgfmanualprettyprintpgfkeys{#1}}% +% \endgroup +% }% + \catcode`\|=13 + \gdef\pgfmanual@verb@activebar{|}% +} +\def\pgfmanual@verb{% + \begingroup + \pgfmanual@verb@preparecatcodes@ + \toksdef\t@pgfmanual@verb=0 + \t@pgfmanual@verb={}% + \pgfmanual@verb@collect +} +% this version of \pgfmanual@verb@collect is less efficient than the +% one uncommented above. BUT: it can auto-detect the case when +% |...| has been provided somewhere where I can't change catcodes! +% The other one would simply fail to compile. +\def\pgfmanual@verb@collect#1{% + \def\pgfmanual@temp{#1}% + \ifx\pgfmanual@temp\pgfmanual@verb@bar + % ok, finish: + \edef\pgfmanual@verb@collect@next{% + % this command will also handle control sequences. + \noexpand\endgroup + \noexpand\texttt{\noexpand\pgfmanualprettyprintpgfkeys{\the\t@pgfmanual@verb}}% + }% + \else + \ifx\pgfmanual@temp\pgfmanual@verb@activebar + % ohoh... that should not happen! It means someone invoked + % |...| within an argument; I couldn't change catcodes. + % Ok, resort to a simple fallback solution. + % FIXME : I have just realized that THIS DOESN'T PRESERVE SPACES + \edef\pgfmanual@verb@collect@next{% + \noexpand\endgroup + \noexpand\texttt{\the\t@pgfmanual@verb}% + }% + \else + \t@pgfmanual@verb=\expandafter{\the\t@pgfmanual@verb #1}% + \let\pgfmanual@verb@collect@next=\pgfmanual@verb@collect + \fi + \fi + \pgfmanual@verb@collect@next +}% + +\AtBeginDocument{% + \ifpgfmanualprettyenabled + \catcode`\|=13 + \expandafter\let\pgfmanual@verb@activebar=\pgfmanual@verb + \fi +}% + +\def\pgfmanual@verb@preparecatcodes@{% + \let\do\@makeother% + \dospecials% + \catcode`\%=12 % THATS IMPORTANT! Do *not* handle comments! + % these catcodes are expected by the pretty printer... + %\catcode`\^^M=13 + \catcode`\ =13 + \catcode`\^^I=13 + \expandafter\def\pgfmanual@pretty@activespace{\space}% + \expandafter\def\pgfmanual@pretty@activetab{\space\space\space\space}% +}% +\endinput +% vi: ts=4 sw=4 diff --git a/graphics/pgf/base/tex/latex/doc/pgfmanual.prettyprinter.code.tex b/graphics/pgf/base/tex/latex/doc/pgfmanual.prettyprinter.code.tex new file mode 100644 index 0000000000..d01b375a9c --- /dev/null +++ b/graphics/pgf/base/tex/latex/doc/pgfmanual.prettyprinter.code.tex @@ -0,0 +1,1120 @@ +%-------------------------------------------- +% +% 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 <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +% this is some kind of "plug-in" for pgfmanual-en-macros.tex which +% provides pretty printing of the code lines in 'codeexample'. +% +% It requires to be invoked with \pgfmanualprettyprintcode{#1} at the +% right place. +% +% ATTENTION: +% this is NOT a sophisticated syntax highlighter like lstlistings! +% It has rather strict assumptions about how to use it (the input must +% have been read verbatim, for example). + +% Special code for syntax highlighting: +% +% +% USER INTERFACE +\pgfkeys{% + % this is the public hook into + % \begin{codeexample}...\end{codeexample} which triggers pretty + % printing: + /codeexample/typeset listing/.code= {\pgfmanualprettyprintcode{#1}}, + % + % this key will be invoked whenever a key in key-value context has been identified. + % + % It won't be invoked for handled keys like |my style/.style=....|, see below. + % + % #1 will be the keys name. + /codeexample/prettyprint/key name/.code={#1}, + % + % A variant which will be used instead of |key name| if the key + % has a key handler. For example, when the pretty printer finds + % |my style/.style|, it will call + % |key name with handler={my style}{.style}. + /codeexample/prettyprint/key name with handler/.code 2 args={#1/#2}, + % + % Will be invoked whenever the value of a key has been found. + % It will be invoked AFTER 'key name' and not at all if there was + % no value. + % + % #1: the key's name + % #2: the key's value. + % + % The default implementation checks if there is a special handler + % for the key name '#1', in + % /codeexample/prettyprint/key value/#1. + % For example: + % /codeexample/prettyprint/key value/my key/.code 2 args={name=#1, value =#2} + % If such a key exists, it will be invoked with {#1}{#2} as + % arguments. Otherwise, the generic method + % /codeexample/prettyprint/key value with style detection={#1}{#2} + % will be invoked. + /codeexample/prettyprint/key value/.code 2 args={% + \pgfkeysifdefined{/codeexample/prettyprint/key value/#1}{% + \pgfkeysalso{/codeexample/prettyprint/key value/#1={#1}{#2}}% + }{% + \pgfkeysalso{/codeexample/prettyprint/key value with style detection={#1}{#2}}% + }% + }, + % A helper macro for the default 'key value' implementation. + /codeexample/prettyprint/key value with style detection/.code 2 args={% + \pgfutil@in@{style}{#1}% + \ifpgfutil@in@ + \pgfmanualprettyprintpgfkeys{#2}% + \else + \pgfkeysalso{/codeexample/prettyprint/key value display only={#2}}% + \fi + },% + % + % Will be invoked by the default 'key value' implementation to + % typeset the value as such. + /codeexample/prettyprint/key value display only/.code={#1}, + % + % Used to typeset a single word. A word is something which has not + % been identified in any other context; a maximal sequence of + % non-white-space tokens. + /codeexample/prettyprint/word/.code={#1}, + % + % A two-argument code key which invokes '#1' if spaces shall + % delimit words and '#2' if not. + % This may be useless. Handle with care! + /codeexample/prettyprint/if space is word delim/.code 2 args={% + #1% + },% + % + % A three-argument code key which should invoke '#2' if the single + % token '#1' is a word delimiter and '#3' if that is not the case. + % Note that '#1' doesn't have the usual catcodes (see the + % \pgfmanual@pretty@** macros)! + % Furthermore, white spaces are treated separately. + /codeexample/prettyprint/if is word delim/.code args={#1#2#3}{% + \edef\pgfmanual@check{,;().;\pgfmanual@pretty@lbrace\pgfmanual@pretty@rbrace}% + \def\pgfmanual@check@{\pgfutil@in@{#1}}% + \expandafter\pgfmanual@check@\expandafter{\pgfmanual@check}% + \ifpgfutil@in@ #2\else #3\fi + },% + % + % Used to typeset a single control sequence. + % #1 is the control sequence's name as a sequence of catcode 12 + % tokens. + /codeexample/prettyprint/cs/.code={#1}, + % + % Used to typeset a single control sequence together with one or + % more arguments. + % + % #1 is the control sequence's name (including the backslash as + % literal string) and + % #2,#3,...,#9 are the arguments. The number of arguments depends + % on the 'cs arguments/<CS NAME>' key; it contains the integer + % number. + % + % For example, if + % |cs arguments/pgfkeys/.initial=1|, + % the pretty printer invokes + % |cs with args={\pgfkeys}{<argument>}. + % + % If + % |cs arguments/mycommand/.initial=2|, + % the pretty printer invokes + % |cs with args={\pgfkeys}{<argument1>}{<argument2>}. + % In this case, 'cs with args' needs to be defined in a way which + % allows to deal with 3 arguments. + % + % Please note that the value do not contain braces! The braces + % need to be inserted manually. + % + % Special cases: + % 1. If end-of-input is encountered BEFORE the expected number of + % arguments has been found, the following happens: + % - if not even one (partial) argument has been found, the + % /codeexample/prettyprint/cs/.@cmd key will be used instead. + % - the \ifpgfmanualprettyprinterarghasunmatchedbraces boolean + % indicates if the trailing brace is missing. + /codeexample/prettyprint/cs with args/.code 2 args={#1\{#2\pgfmanualclosebrace}, + % + % For every identified control sequence, the key + % /codeexample/prettyprint/cs arguments/<CSNAME> + % will be checked. If it exists, it contains an integer with the + % number of arguments it takes. + % The <CSNAME> must not contain the '\'. + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + % + % For every identified control sequence, the key + % /codeexample/prettyprint/cs/<CSNAME>/.@cmd + % will be checked. If it exists, it will be used instead of + % 'cs with args' (with the same special case restrictions for + % early end-of-input). + % + % The <CSNAME> must not contain the '\'. + % + % This allows special treatment for special + % commands like \pgfkeys: + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={#1\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, + % + % recognise environments: + /codeexample/prettyprint/cs arguments/begin/.initial=1, + /codeexample/prettyprint/cs/begin/.code 2 args={#1\{#2\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/end/.initial=1, + /codeexample/prettyprint/cs/end/.code 2 args={#1\{#2\pgfmanualclosebrace}, + % + % a point coordinate (#1) + % Note that '#1' will contain the braces (if there was one), + /codeexample/prettyprint/point/.code={#1},% + % + % a point coordinate with explicit coordinate system: (#1:#2) + % Note that '#2' will contain the terminating brace (if there was one) + % #1: the coordinate system name (*without* the leading brace). + % The leading brace must be re-inserted by this style. + /codeexample/prettyprint/point with cs/.code 2 args={(#1:#2},% + % + % The font / color command to use for comments. Will be set at + % the beginning of a comment + /codeexample/prettyprint/comment font/.initial=,% + % the same with specialised code: + %/codeexample/prettyprint/point with cs/<CS NAME>/.code 2 args={(#1:#2},% + % + % + % A predefined style which colors every identified token. It's + % purpose is only debugging. + /codeexample/prettyprint/colored/.style={% + /codeexample/prettyprint/key name/.code={\textcolor{red!75!black}{##1}}, + /codeexample/prettyprint/key name with handler/.code 2 args={\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}}, + /codeexample/prettyprint/key value display only/.code={\textcolor{yellow}{##1}}, + /codeexample/prettyprint/cs/.code={\textcolor{green}{##1}}, + /codeexample/prettyprint/cs with args/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\textcolor{green}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/begin/.initial=1, + /codeexample/prettyprint/cs/begin/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/end/.initial=1, + /codeexample/prettyprint/cs/end/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/word/.code={\textcolor{brown}{##1}}, + /codeexample/prettyprint/point/.code={\textcolor{red}{##1}},% + /codeexample/prettyprint/point with cs/.code 2 args={(\textcolor{green}{##1}:\textcolor{red}{##2}},% + },% + % A further debugging helper. + /codeexample/prettyprint/colored and verbose/.style={% + /codeexample/prettyprint/colored, + /codeexample/prettyprint/key name/.code={\message{[key name=##1]}\textcolor{red!75!black}{##1}}, + /codeexample/prettyprint/key name with handler/.code 2 args={\message{[key name with handler=##1/##2]}\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}}, + /codeexample/prettyprint/key value display only/.code={\def\temp{##1}\message{[key value=\meaning\temp]}\textcolor{yellow}{##1}}, + /codeexample/prettyprint/cs/.code={\message{[cs=##1]}\textcolor{green}{##1}}, + /codeexample/prettyprint/cs with args/.code 2 args={\def\temp{##2}\message{[cs with args={##1}{\meaning\temp}]}\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/word/.code={\message{[word=##1]}\textcolor{brown}{##1}}, + /codeexample/prettyprint/point/.code={\message{[point=##1]}\textcolor{red}{##1}},% + /codeexample/prettyprint/point with cs/.code 2 args={\message{[point with cs={##1}{##2}]}(\textcolor{green}{##1}:\textcolor{red}{##2}},% + },% + %/codeexample/prettyprint/colored, + %/codeexample/prettyprint/colored and verbose, +}% + +\newif\ifpgfmanualprettyenabled +\pgfmanualprettyenabledtrue + +% User interface command to handle unmatched braces: +% +% It expands to '\}' unless the preceding argument had unmatched braces. +\def\pgfmanualclosebrace{% + \ifpgfmanualprettyprinterarghasunmatchedbraces + \else + \}% + \fi +}% + + +% Typesets '#1', possibly using some sort of pretty printer. +% +% The argument '#1' is expected to be a long token list in which +% 1. all characters have catcode 11 or 12 (normal letters), +% 2. white spaces, tabs and newlines have catcode 13 (are active). +% +% @see \pgfmanualprettyprintpgfkeys +\long\def\pgfmanualprettyprintcode#1{% +%\def\temp{#1}\message{STARTING PRETTY PRINTING for \meaning\temp}% + \ifpgfmanualprettyenabled + \begingroup + \pgfmanualprettyprintstyles + \pgfmanual@pretty@mainloop#1\pgfmanual@EOI + \endgroup + \else + #1% + \fi +}% +% DISABLE: +%\long\def\pgfmanualprettyprintcode#1{#1}% + +\def\pgfmanualprettyprintstyles{% +%\tracingmacros=2 \tracingcommands=2 \message{PRETTYPRINT INIT}% + \def\{{\pgfmanual@pretty@lbrace}% + \def\}{\pgfmanual@pretty@rbrace}% + \pgfmanual@pretty@installcommenthandler + \let\pgfmanualprettyprintstyles=\relax +}% + + +\newif\ifpgfmanualprettycommentactive + +% we can't use the \@typeset@till@return method for comments because +% the pretty printer needs full control over the token list. +% +% We try a replacement here. +% +% FIXME +% THIS INTRODUCES A NEW GROUP! Does that hurt the pretty printer?? +% +\def\pgfmanual@pretty@installcommenthandler{% + \expandafter\def\pgfmanual@pretty@activepercent{% + \begingroup% + \pgfmanualprettycommentactivetrue + \expandafter\let\pgfmanual@pretty@activenl=\pgfmanual@pretty@recoveraftercomment + \expandafter\def\pgfmanual@pretty@activepercent{\%}% + \pgfkeysvalueof{/codeexample/prettyprint/comment font}%\tt + \%% + }% +}% +\def\pgfmanual@pretty@recoveraftercomment{% + \endgroup + \pgfmanual@pretty@activenl +}% + +\def\pgfmanual@EOI{\pgfmanual@EOI}% + +{ + \catcode`\[=0 + \catcode`\\=12 + [gdef[pgfmanual@pretty@backslash{\}% +} +\begingroup + \catcode`\:=12 + \catcode`\(=12 + \catcode`\)=12 + \gdef\pgfmanual@pretty@colon{:}% + \gdef\pgfmanual@pretty@lroundbrace{(}% + \gdef\pgfmanual@pretty@rroundbrace{)}% + \catcode`\[=1 + \catcode`\]=2 + \catcode`\{=12 + \catcode`\}=12 + \gdef\pgfmanual@pretty@lbrace[{]% + \gdef\pgfmanual@pretty@rbrace[}]% + \catcode`\{=1 + \catcode`\}=2 + \catcode`\[=12 + \catcode`\]=12 + \catcode`\,=12 + \catcode`\ =10\relax\gdef\pgfmanual@pretty@space{ }% + \gdef\pgfmanual@pretty@lbracket{[}% + \gdef\pgfmanual@pretty@rbracket{]}% + \gdef\pgfmanual@pretty@comma{,}% + \catcode`\==12 + \gdef\pgfmanual@pretty@eq{=}% +\endgroup +\begingroup + \catcode`\%=12 + \gdef\pgfmanual@pretty@percent{%} + \catcode`\%=13 + \gdef\pgfmanual@pretty@activepercent{%} + \catcode`\^^M=13 + \gdef\pgfmanual@pretty@activenl{^^M}\endgroup +\begingroup +\catcode`\^^I=13\relax\gdef\pgfmanual@pretty@activetab{^^I}% +\catcode`\ =13\relax\gdef\pgfmanual@pretty@activespace{ }\endgroup + +% loops through all tokens. +% #1 is a single token. +\def\pgfmanual@pretty@mainloop{% + \def\pgfmanual@pretty@mainloop@currentword{}% + \pgfmanual@pretty@mainloop@ +}% +\long\def\pgfmanual@pretty@mainloop@#1{% + \def\pgfmanual@loc@TMPa{#1}% + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@mainloop@ + \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI + % stop iteration. + \pgfmanual@pretty@mainloop@finishword + \let\pgfmanual@pretty@mainloop@NEXT=\relax + \else + \ifpgfmanualprettycommentactive + #1\kern0pt% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbracket% + % we found the start of OPTIONS '[ ... ]'. + \pgfmanual@pretty@mainloop@finishword + % Attempt syntax highlighting for pgfkeys: + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@pgfkeys + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@backslash + % we found the start of a control sequence '\command' + \pgfmanual@pretty@mainloop@finishword + % + % collect the control sequence name into + % \pgfmanual@loc@TMPa, but without the backslash: + \let\pgfmanual@loc@TMPa=\pgfutil@empty + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectcs@loop + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lroundbrace% + \pgfmanual@pretty@mainloop@finishword + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectpoint + \else + \def\pgfmanual@isspace{0}% + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) or comment + \def\pgfmanual@isspace{1}% + \else + \ifnum10=\catcode`#1 + \def\pgfmanual@isspace{1}% + \fi + \fi + \if\pgfmanual@isspace1% + \pgfkeysvalueof{/codeexample/prettyprint/if space is word delim/.@cmd}{% + \pgfmanual@pretty@mainloop@finishword + #1% ok, show it. + }{% + % collect the word. + \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}% + }% + \else + \pgfkeysvalueof{/codeexample/prettyprint/if is word delim/.@cmd}{#1}{% + \pgfmanual@pretty@mainloop@finishword + #1% ok, show the delimiter. + }{% + % collect the word. + \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}% + }\pgfeov% + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@mainloop@NEXT +}% + +\def\pgfmanual@pretty@mainloop@finishword{% + \ifx\pgfmanual@pretty@mainloop@currentword\pgfutil@empty + \else + \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/word/.@cmd}}% + \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@mainloop@currentword\pgfeov + \let\pgfmanual@pretty@mainloop@currentword=\pgfutil@empty + \fi +}% + +\def\pgfmanual@pretty@collectpoint{% + \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanual@pretty@collectargs@finish@collectpoint + \expandafter\pgfmanualprettyprintercollectupto\pgfmanual@pretty@rroundbrace + {\afterpgfmanual@pretty@collectpoint}% +} + +{ +\catcode`\:=12 +\gdef\pgfmanual@pretty@collectargs@finish@collectpoint#1#2{% + \expandafter\pgfutil@in@\pgfmanual@pretty@colon{#1}% + \ifpgfutil@in@ + \def\pgfmanual@pretty@collectpoint@getcoordsystem##1:##2\relax{% + \begingroup + \pgfmanual@pretty@restorespaces + % remove active spaces from ##1: + \xdef\pgfmanual@pretty@glob@TMPa{##1}% + \endgroup + \pgfkeysifdefined{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}{% + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}}% + }{% + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/.@cmd}}% + }% + \expandafter\def\expandafter\pgfmanual@loc@TMPa\expandafter{\expandafter{\pgfmanual@pretty@glob@TMPa}{##2}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov + }% + \if1#2% + \pgfmanual@pretty@collectpoint@getcoordsystem#1)\relax + \else + \pgfmanual@pretty@collectpoint@getcoordsystem#1\relax + \fi + \else + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point/.@cmd}}% + \if1#2% + \pgfmanual@loc@TMPb(#1)\pgfeov + \else + \pgfmanual@loc@TMPb(#1\pgfeov + \fi + \fi +}% +} +\def\afterpgfmanual@pretty@collectpoint{\pgfmanual@pretty@mainloop}% + +% loops through all tokens, assembling the cs name as it goes. +% #1 is a single token. +\def\pgfmanual@pretty@collectcs@loop#1{% + \let\pgfmanual@pretty@collectcs@loop@NEXT=\pgfmanual@pretty@collectcs@loop + \def\pgfmanual@loc@TMPb{#1}% + \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI + \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}% + \else + % a csname may only use letters. And: only letters have a + % positive lcccode! + \ifnum\lccode`#1=0 + \ifx\pgfmanual@loc@TMPb\pgfmanual@attext% + % ok, we may also accept an `@': + \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}% + \else + % This here is the first non-letter. + \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}% + \fi + \else + % continue iterating and assemble the csname... + \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}% + \fi + \fi + \pgfmanual@pretty@collectcs@loop@NEXT +}% +\def\afterpgfmanual@pretty@cs{\pgfmanual@pretty@mainloop}% +\def\pgfmanual@attext{@} + +\def\pgfmanual@pretty@collectcs@loop@END{% + \pgfkeysifdefined{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}{% + % oh. The collected control sequence expects arguments. That + % means a lot of work since there are no nestable braces in + % the token list! All of them have catcode 12... we need to do + % that manually. + \let\pgfmanualprettyprinterhandlecollectedargs=\pgfmanual@pretty@collectargs@finish@cs + \def\pgfmanual@pretty@collectcs@loop@END@next{% + \pgfmanualprettyprintercollectargcount + {\pgfkeysvalueof{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}}% + {\afterpgfmanual@pretty@cs}% + }% + }{% + % re-insert the backslash: + \edef\pgfmanual@loc@TMPa{\pgfmanual@pretty@backslash \pgfmanual@loc@TMPa}% + % ok, report the macro and continue with the main loop. + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov + \let\pgfmanual@pretty@collectcs@loop@END@next=\afterpgfmanual@pretty@cs + }% + \pgfmanual@pretty@collectcs@loop@END@next +}% + +\newif\ifpgfmanualprettyprinterarghasunmatchedbraces + +% Collects arguments inside of a token list, dealing with nested +% catcode-12-braces. +% +% #1: is the NUMBER of arguments to collect. +% #2: is TeX code which shall be invoked after +% \pgfmanualprettyprinterhandlecollectedargs has been invoked (see +% below). +% +% PRECONDITION: +% there is a large token list following +% \pgfmanualprettyprintercollectargcount with balanced braces. The braces +% have \catcode 12. +% POSTCONDITION: +% 1. the arguments will be collected as +% '<result> := {<first arg>}{<second arg>}', +% 2.1 the macro \pgfmanualprettyprinternumcollectedargs will contain +% the *actual* number of *completely* collected arguments, +% 2.2 the if \ifpgfmanualprettyprinterarghasunmatchedbraces will be +% set to \c true if the last found argument had an unmatched brace, +% 3. then, \pgfmanualprettyprinterhandlecollectedargs{<result>} will be +% invoked. Just define \pgfmanualprettyprinterhandlecollectedargs +% properly. +% Afterwards, #2 will be invoked to recover from the argument +% collection. +% +% +% Example: +% \pgfmanualprettyprintercollectargcount{2}{\donnextstep} +% {_12 first argument }_12 {_12 second argument }_12 next tokens% +% +% will result in the expansion +% \pgfmanualprettyprinterhandlecollectedargs{{_1 first argument }_2 {_1 second argument }_2 } +% \donnextstep +% next tokens +% +% +% +% ATTENTION: +% \pgfmanualprettyprinterhandlecollectedargs will be invoked with a SINGLE +% argument. The argument as such will contain extra braces, one pair +% of braces for each of the #1 arguments. These braces will have +% catcode 1 and 2, i.e. they can *really* be used in TeX. Thus, the +% finish routine will be invoked with +% \pgfmanualprettyprinterhandlecollectedargs{{<arg>}} +% for one argument and with +% \pgfmanualprettyprinterhandlecollectedargs{{<first arg>}{<second arg>}} +% for two and more arguments. Note the extra set of braces for one +% arg. +% It might happen that not all arguments have been found if +% end-of-input occurred before. The +% \pgfmanualprettyprinterhandlecollectedargs routine has to check +% this using the macro \pgfmanualprettyprinternumcollectedargs which +% contains the actual number of collected args. +% +% @remark This macro checks for the end-of-input indicator, \pgfmanual@EOI. In case it encounters +% \pgfmanual@EOI, it +% 1. stops collecting, leaving the \pgfmanual@EOI as next token to be read, +% 2. sets \ifpgfmanualprettyprinterarghasunmatchedbraces to \iftrue if necessary, +% 3. assigns \pgfmanualprettyprinternumcollectedargs +% 4. invokes the finish routine. +% The \pgfmanual@EOI needs to be collected by following routines in +% this case. You can also use \pgfutil@ifnextchar\pgfmanual@EOI{}{} in +% following routines to check for \pgfmanual@EOI. +\def\pgfmanualprettyprintercollectargcount#1#2{% + \pgfmanualprettyprinterarghasunmatchedbracesfalse + \begingroup + \edef\pgfmanual@loc@csargcount{#1}% + \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10 + \t@afterpgfmanualprettyprinterhandlecollected={#2}% + \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta + \let\c@pgfmanual@pretty@curargcount=\c@pgf@countb + % I will track open braces and the number of completely + % collected arguments here: + \c@pgfmanual@pretty@openbracecount=0 + \c@pgfmanual@pretty@curargcount=0 + % + % and I will accumulate the argument token lists as such here: + \toksdef\t@pgfmanual@currentarg=0 + \toksdef\t@pgfmanual@allargs=1 + \t@pgfmanual@currentarg={}% + \t@pgfmanual@allargs={}% + % + \pgfmanual@pretty@collectargs@loop +}% + +% loops through all tokens, collecting the required number of +% arguments. This involves to track nested braces manually. +% #1 is a single token. +\def\pgfmanual@pretty@collectargs@loop#1{% + \let\pgfmanual@pretty@collectargs@loop@NEXT=\pgfmanual@pretty@collectargs@loop + \def\pgfmanual@loc@TMPc{#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI + \ifnum\c@pgfmanual@pretty@openbracecount>0 + \ifpgfmanualpdfwarnings + \pgfplots@warning{The pretty printer did not found the closing curly brace!? This will potentially lead to display errors}% + \fi + \fi + \edef\pgfmanual@pretty@collectargs@loop@NEXT{% + \noexpand\endgroup + \ifnum\c@pgfmanual@pretty@openbracecount>0 + \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue + \fi + \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% + \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}% + \the\t@afterpgfmanualprettyprinterhandlecollected + \noexpand\pgfmanual@EOI% <- put this token back into token list! + }% + \else + \ifpgfmanualprettycommentactive + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl + \pgfmanualprettycommentactivefalse + \fi + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \pgfmanualprettycommentactivetrue + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace + \advance\c@pgfmanual@pretty@openbracecount by1 + \ifnum\c@pgfmanual@pretty@openbracecount>1 + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace + \advance\c@pgfmanual@pretty@openbracecount by-1 + \ifnum\c@pgfmanual@pretty@openbracecount=0 + % we have one complete argument ready! + % append it -- with REAL braces if needed: + \edef\pgfmanual@loc@TMPc{\the\t@pgfmanual@allargs{\the\t@pgfmanual@currentarg}}% + \t@pgfmanual@allargs=\expandafter{\pgfmanual@loc@TMPc}% + \t@pgfmanual@currentarg={}% + % + % check it we need more arguments: + \advance\c@pgfmanual@pretty@curargcount by1 + \ifnum\c@pgfmanual@pretty@curargcount=\pgfmanual@loc@csargcount\relax + \edef\pgfmanual@pretty@collectargs@loop@NEXT{% + \noexpand\endgroup + \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% + \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs}% + \the\t@afterpgfmanualprettyprinterhandlecollected + }% + \fi + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \else + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) or comment + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \ifnum10=\catcode`#1 + % we found a white space (space, TAB + % or NL) with unexpected catcode + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \ifnum\c@pgfmanual@pretty@openbracecount=0 + \ifpgfmanualpdfwarnings + \begingroup + \toks4{#1}% + \pgfplots@warning{The pretty printer did not find the expected \pgfmanual@loc@csargcount\space arguments (only token \the\toks4 )}% + \endgroup + \fi + \edef\pgfmanual@pretty@collectargs@loop@NEXT{% + \noexpand\endgroup + \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% + \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}% + \the\t@afterpgfmanualprettyprinterhandlecollected + \noexpand#1% <- put this token back into token list! + }% + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@collectargs@loop@NEXT +}% + +\newif\ifpgfmanualprettyprinterfoundterminator + +\def\pgfmanualprettyprinterhandlecollectedargsVtwo@default#1#2{% + \if1#2% + \pgfmanualprettyprinterfoundterminatortrue + \else + \pgfmanualprettyprinterfoundterminatorfalse + \fi + \pgfmanualprettyprinterhandlecollectedargs{#1}% +}% +\def\pgfmanualprettyprintercollectupto@restore@callback{% + \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanualprettyprinterhandlecollectedargsVtwo@default +}% +\pgfmanualprettyprintercollectupto@restore@callback + +% Collects tokens inside of a token list up to a single delimiting token, dealing with nested +% catcode-12-braces. +% +% #1: list of tokens, each of which is marking the end. It won't be collected. +% #2: is code to invoke after +% \pgfmanualprettyprinterhandlecollectedargsVtwo has been invoked. +% +% PRECONDITION: +% there is a large token list following +% \pgfmanualprettyprintercollectargcount with balanced braces. The braces +% have \catcode 12. +% POSTCONDITION: +% - the arguments will be collected as +% '<result> := <token list>' +% and then, +% \pgfmanualprettyprinterhandlecollectedargsVtwo{<result>}{<found terminator>? 1 : 0} will be +% invoked. Just define +% \pgfmanualprettyprinterhandlecollectedargsVtwo +% properly. +% Then, #2 will be invoked. +% +% @see \pgfmanualprettyprintercollectargcount for more details. +% +\def\pgfmanualprettyprintercollectupto#1#2{% + \pgfmanualprettyprinterarghasunmatchedbracesfalse + \def\pgfmanualprettyprinterterminator{}% + \begingroup + \def\pgfmanual@loc@delimittokens{#1}% + \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10 + \t@afterpgfmanualprettyprinterhandlecollected={#2}% + % + \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta + % I will track open braces here: + \c@pgfmanual@pretty@openbracecount=0 + % + % and I will accumulate the argument token lists as such here: + \toksdef\t@pgfmanual@currentarg=0 + \t@pgfmanual@currentarg={}% + % + \pgfmanual@pretty@collectupto@loop +}% + +% Stores the token that marks the end in the first argument of +% \pgfmanualprettyprintercollectupto. For example if the token list was {,]} +% and ] was encountered first, then \pgfmanualprettyprinterterminator will +% be ]. +\def\pgfmanualprettyprinterterminator{} + +% loops through all tokens, collecting the required number of +% arguments. This involves to track nested braces manually. +% #1 is a single token. +\def\pgfmanual@pretty@collectupto@loop#1{% + \let\pgfmanual@pretty@collectupto@loop@NEXT=\pgfmanual@pretty@collectupto@loop + \def\pgfmanual@loc@TMPc{#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI + \edef\pgfmanual@pretty@collectupto@loop@NEXT{% + \noexpand\endgroup + \ifnum\c@pgfmanual@pretty@openbracecount>0 + \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue + \fi + \noexpand\pgfmanualprettyprinterhandlecollectedargsVtwo{\the\t@pgfmanual@currentarg}{0}% + \noexpand\pgfmanualprettyprintercollectupto@restore@callback + \the\t@afterpgfmanualprettyprinterhandlecollected + \noexpand\pgfmanual@EOI% <- put this token back into token list! + }% + \else + \ifpgfmanualprettycommentactive + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl + \pgfmanualprettycommentactivefalse + \fi + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \pgfmanualprettycommentactivetrue + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace + \advance\c@pgfmanual@pretty@openbracecount by1 + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace + \advance\c@pgfmanual@pretty@openbracecount by-1 + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \expandafter\expandafter\expandafter\pgfutil@in@\expandafter\pgfmanual@loc@TMPc\expandafter{\pgfmanual@loc@delimittokens}% + \ifpgfutil@in@ + \ifnum\c@pgfmanual@pretty@openbracecount=0 + % do NOT include the delimit token. + \edef\pgfmanual@pretty@collectupto@loop@NEXT{% + \noexpand\endgroup + \noexpand\def\noexpand\pgfmanualprettyprinterterminator{\pgfmanual@loc@TMPc}% + \noexpand\pgfmanualprettyprinterhandlecollectedargsVtwo{\the\t@pgfmanual@currentarg}{1}% + \noexpand\pgfmanualprettyprintercollectupto@restore@callback + \the\t@afterpgfmanualprettyprinterhandlecollected + }% + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@collectupto@loop@NEXT +}% + +\def\pgfmanual@pretty@collectargs@finish@cs#1{% + \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{1}% + \ifnum\pgfmanualprettyprinternumcollectedargs=0 + \ifpgfmanualprettyprinterarghasunmatchedbraces + \else + \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{0}% + \fi + \fi + \if\pgfmanual@pretty@collectargs@finish@cs@hasargs1% + % report the macro and its arguments: + \pgfkeysifdefined{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}{% + % oh, we have a separate routine for this macro! Ok, use it: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}}% + }{% + % use the generic routine: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs with args/.@cmd}}% + }% + % re-insert the backslash: + \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa #1\pgfeov + \else + % Oh. We probably got |\pgfkeys| instead of |\pgfkeys{arg}| + % re-insert the backslash: + \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}% + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov + #1\relax% simply typeset any encountered tokens after the control sequence. + \fi +}% + +% A user macro which pretty prints a set of keys. +% +% If '#1' is NOT an argument for \pgfkeys, +% \pgfmanualprettyprintpgfkeys will try to recognise at least control +% sequences (in the same way as usual). Thus, you can even use this +% method if there *could* be pgfkeys arguments in an automated pretty +% printing environment. +% +% However, '#1' should only have catcode 12 characters with the +% exception of catcode 13 for newlines, spaces and comments. +\long\def\pgfmanualprettyprintpgfkeys#1{% + \ifpgfmanualprettyenabled + \begingroup + \pgfmanualprettyprintstyles + \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI + \endgroup + \else + #1% + \fi +} + +\def\pgfmanual@pretty@pgfkeys{% + \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanual@pretty@pgfkeys@start + \pgfmanualprettyprintercollectupto]{\pgfmanual@pretty@mainloop}%% +}% +\long\def\pgfmanual@pretty@pgfkeys@start#1#2{% + [% + \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI + \if1#2% + ]% + \fi +}% +% iterates through single tokens, detecting key names and values while +% it goes. +\long\def\pgfmanual@pretty@pgfkeys@loop#1{% + \def\pgfmanual@loc@TMPa{#1}% + \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI + \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\relax}% + \else + \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@loop}% + \ifpgfmanualprettycommentactive + #1\kern0pt% + \else + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) or comment + #1% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@comma% + %\let\pgfmanual@pretty@pgfkeys@loop@NEXT=\pgfmanual@pretty@pgfkeys@checkforEOI + ,% + \else + \ifnum10=\catcode`#1 + % another white space... I thought they'd have + % catcode 13. doesn't matter. + #1% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbrace + % braces may not occur in the first place - + % but there are circumstances where it is + % convenient to deal with them here (when + % processing arguments of styles) + % Do it. + #1% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@rbrace + #1% + \else + % found the beginning of a key! + % We will collect the key name into + % \toks0. + \toks0={}% + % + % Handle it: + % FIXME what if we found an opening brace!? + \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@collectkey #1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@pgfkeys@loop@NEXT +}% +\def\pgfmanual@pretty@pgfkeys@collectkey#1{% + \def\pgfmanual@loc@TMPb{#1}% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectkey}% + \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI + % finish key name. + \edef\pgfmanual@loc@TMPb{\the\toks0 }% + \ifx\pgfmanual@loc@TMPb\pgfutil@empty + \else + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + \fi + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\relax}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@eq + % finish key name. + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + % now, we do the same with the value - we collect it into + % \toks0. + \toks0={}% + \def\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces{0}% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectvalue}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@comma + % finish key name. + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@activenl + % finish key name before newline. This is not + % necessarily as in TeX, but its simpler here + % because we don't need special cases for comments + % and we don't need to gobble following white + % spaces. + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@backslash + % This is confusing. I simply try to invoke + % the control sequence code and recover as + % good as possible. Let's see if that's + % useful. + \edef\pgfmanual@loc@TMPb{\the\toks0 }% + \ifx\pgfmanual@loc@TMPb\pgfutil@empty + \else + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + \fi + % + % we found the start of a control sequence '\command': + % + % collect the control sequence name into + % \pgfmanual@loc@TMPa, but without the backslash: + \begingroup + \let\pgfmanual@loc@TMPa=\pgfutil@empty + \def\afterpgfmanual@pretty@cs{% + \endgroup + \pgfmanual@pretty@pgfkeys@loop + }% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@collectcs@loop}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@lbrace + % Braces in key names are allowed (if they + % are not the first character of a key + % name) + \def\pgfmanualprettyprinterhandlecollectedargs##1{% + \toks1={##1}% + \edef\pgfmanual@loc@TMPc{% + \the\toks0 \pgfmanual@pretty@lbrace \the\toks1 + \ifpgfmanualprettyprinterarghasunmatchedbraces + \else + \pgfmanual@pretty@rbrace + \fi + }% + \toks0=\expandafter{\pgfmanual@loc@TMPc}% + }% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{% + \pgfmanualprettyprintercollectargcount{1}{\pgfmanual@pretty@pgfkeys@collectkey}% + #1% + }% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@rbrace + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% + \else + \toks0=\expandafter{\the\toks0 #1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@pgfkeys@collectkey@next +}% +\def\pgfmanual@pretty@pgfkeys@collectvalue#1{% + \def\pgfmanual@loc@TMPb{#1}% + \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\pgfmanual@pretty@pgfkeys@collectvalue + \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI + % the key value is empty. + %\expandafter\pgfmanual@pretty@pgfkeys@processvalue\expandafter{\the\toks0 }% + \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\relax + \else + \def\pgfmanual@pretty@isconsumed{0}% + \if\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces0% + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) + #1% + \def\pgfmanual@pretty@isconsumed{1}% + \else + \ifnum10=\catcode`#1 + % another white space... I thought they'd have + % catcode 13. doesn't matter. + \def\pgfmanual@pretty@isconsumed{1}% + #1% + \fi + \fi + \fi + \if\pgfmanual@pretty@isconsumed0% + \def\pgfmanualprettyprinterhandlecollectedargsVtwo##1##2{\pgfmanual@pretty@pgfkeys@processvalue{##1}}% the braces will be handled separately. + \def\pgfmanual@pretty@pgfkeys@collectvalue@next{% + \pgfmanualprettyprintercollectupto{,]}{\afterpgfmanual@pretty@collectargs@finish@value}#1% + }% + \fi + \fi + \pgfmanual@pretty@pgfkeys@collectvalue@next +}% +\def\afterpgfmanual@pretty@collectargs@finish@value{% + \expandafter\pgfmanual@pretty@pgfkeys@loop\pgfmanualprettyprinterterminator% re-insert the gobbled comma here! +}% + +{\catcode`\^^M=13 \catcode`\ =13\relax\catcode`\%=13\relax\gdef\pgfmanual@pretty@restorespaces{\def%{\pgfmanual@pretty@percent}\def^^M{\pgfmanual@pretty@space}\def {\pgfmanual@pretty@space}}} + +% #1: the key's name +\def\pgfmanual@pretty@pgfkeys@processkey#1{% + \begingroup + \pgfmanual@pretty@restorespaces + % remember this key name! It is used when we are dealing with + % its value later... (if it has a value) + \xdef\pgfmanual@pretty@pgfkeys@collectkey@keyname{#1}% + \endgroup + % + % check if it is a handled key. FIXME: this could be done in a + % rigorous way! This here assumes that all key handlers start with + % '.' and the '.' occurs never right after a '/' otherwise: + \def\pgfmanual@loc@TMPa{\pgfutil@in@{/.}}% + \expandafter\pgfmanual@loc@TMPa\expandafter{\pgfmanual@pretty@pgfkeys@collectkey@keyname}% + \ifpgfutil@in@ + % split into key name and handler name... + \def\pgfmanual@pretty@splitit##1/.##2\relax{% + \def\pgfmanual@loc@TMPb{{##1}{.##2}}% + }% + \expandafter\pgfmanual@pretty@splitit\pgfmanual@pretty@pgfkeys@collectkey@keyname\relax + % + % report key name AND handler: + \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name with handler/.@cmd}}% + \expandafter\pgfmanual@loc@TMPa\pgfmanual@loc@TMPb\pgfeov + \else + % report key name ... + \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name/.@cmd}}% + \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@pgfkeys@collectkey@keyname\pgfeov + \fi +} +\def\pgfmanual@pretty@pgfkeys@processvalue#1{% + % report or process the value, depending on the keyname. + % After all, it *may* be a style which needs to be pretty printed + % as well. + \pgfkeysifdefined{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}{% + % oh, we have a separate routine for this macro! Ok, use it: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}}% + }{% + % use the generic routine: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/.@cmd}}% + }% + \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@pgfkeys@collectkey@keyname}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa{#1}\pgfeov +} diff --git a/graphics/pgf/base/tex/latex/doc/pgfmanual.sty b/graphics/pgf/base/tex/latex/doc/pgfmanual.sty new file mode 100644 index 0000000000..9edf770834 --- /dev/null +++ b/graphics/pgf/base/tex/latex/doc/pgfmanual.sty @@ -0,0 +1,12 @@ +% Copyright 2018 by Till Tantau and Christian Feuersänger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesPackage{pgfmanual}[2009/10/15] + +\input pgfmanual.code.tex diff --git a/graphics/pgf/base/tex/latex/frontendlayer/libraries/tikzlibraryexternal.code.tex b/graphics/pgf/base/tex/latex/frontendlayer/libraries/tikzlibraryexternal.code.tex new file mode 100644 index 0000000000..3d2e48fa57 --- /dev/null +++ b/graphics/pgf/base/tex/latex/frontendlayer/libraries/tikzlibraryexternal.code.tex @@ -0,0 +1,115 @@ +% Copyright 2019 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% +% +% This file provides a high-level automatic export feature for tikz pictures. +% It allows to export EACH SINGLE FIGURE into a separate PDF. +% +% The simplest way is to use +% +% \tikzexternalize{myarticle} +% +% it simply converts every figure using the write18 method. If that is not possible, +% you need to reconfigure \tikzexternalize: it can generate a list of figure file names +% and you need to generate these figures manually (or with a script). +% +% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed +% commands if necessary. + +% load this package in order to get \pdf@mdfivesum . +% \pdf@mdfivesum is available for pdftex and lualatex and computes the +% md5 sum. Note that pdftex has \pdfmdfivesum, but lualatex does not +% have it. +% +% ... also used for \pdf@shellescape. +\usepackage{pdftexcmds} +\pgfutil@IfFileExists{atveryend.sty}{% + \usepackage{atveryend}% +}{% + \message{! Package tikz Warning: \string\usepackage{atveryend} impossible. Automatic resolving of references within external files impossible.}% +}% + +% source generic implementation: +\input tikzexternalshared.code.tex + +\pgfutil@IfUndefined{pdf@mdfivesum}{}{% + \let\tikzexternal@mdfivesum=\pdf@mdfivesum +}% + +\def\tikzexternal@TEXDIALECT@begpicture{\begin{tikzpicture}} +\def\tikzexternal@TEXDIALECT@endpicture{\end{tikzpicture}}% + +% this latex specific this assumes it starts at the beginning of an +% environment. The environment is named +% '\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring'. +% +% Everything up to \end{<name>} will be collected and passed as +% argument to the macro '#1'. +% +% This does also work if <name> is NOT tikzpicture! +\def\tikzexternal@TEXDIALECT@collectpicture#1{% + \begingroup + \t@tikzexternal@tmpa={}% + \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}% +} + +% Loop until we find '\end{tikzpicture}'. We have to make sure that +% even strings like '#1' are allowed inside of the collected argument. +\long\def\tikzexternal@laTeX@collect@until@end@tikzpicture#1#2\end#3{% + \def\tikzexternal@laTeX@collect@until@end@tikzpicture@{#3}% + \ifx\tikzexternal@laTeX@collect@until@end@tikzpicture@\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring + \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2}% + \edef\tikzexternal@TEXDIALECT@collectpicture@next{% + \noexpand\endgroup + \noexpand#1{\the\t@tikzexternal@tmpa}% + }% + \t@tikzexternal@tmpa={}% release memory. + \else + \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2\end{#3}}% + \def\tikzexternal@TEXDIALECT@collectpicture@next{% + \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}}% + \fi + \tikzexternal@TEXDIALECT@collectpicture@next +}% +\def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{tikzpicture}% + +\def\tikzexternal@handle@landscape{% + \ltx@ifpackageloaded{pdflscape}{% + % Work around a bug in conjunction with pdflscape and + % external: without this optimize-away-instruction, the + % externalized image would be rotated - and it will be rotated + % once more again when it is included. + % + % if we "optimize it away", the landscape stuff will be + % omitted. I hope this is enough... might not be entirely + % fool-proof; perhaps we need to set it to \relax. For now, it + % will probably do the job + \tikzset{ + external/.cd, + optimize command away=\landscape, + optimize command away=\endlandscape + }% + }{% + }% +}% + +% FIXME: See also https://github.com/latex3/latex2e/issues/441 +% for compatibility with the new LaTeX hook management redefine \@currname to +% force a separate scope +\let\tikzexternal@currname\@currname +\def\@currname{tikzlibraryexternal} + +\AtBeginDocument{% + \pgfutil@ifundefined{tikzexternalrealjob}{% + \global\let\tikzexternalrealjob=\jobname + }{}% + \tikzexternal@handle@landscape +}% + +\let\@currname\tikzexternal@currname diff --git a/graphics/pgf/base/tex/latex/frontendlayer/pgfpict2e.sty b/graphics/pgf/base/tex/latex/frontendlayer/pgfpict2e.sty new file mode 100644 index 0000000000..5bb19603ea --- /dev/null +++ b/graphics/pgf/base/tex/latex/frontendlayer/pgfpict2e.sty @@ -0,0 +1,112 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesPackage{pgfpict2e}[2004/11/28 ver 0.01] + +\RequirePackage{pgfcore} + +\def\pgf@pict@line(#1,#2)#3{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgfsetroundcap% + \pgfpathqmoveto{0}{0}% + \ifnum#1=0\relax% + \pgf@xa=0pt\relax% + \pgf@ya=#3\unitlength\relax% + \else% + \pgf@y=#2\unitlength% + \divide\pgf@y by#1\relax% + \pgf@xa=#3\unitlength\relax% + \pgf@ya=#3\pgf@y\relax% + \fi% + \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@ya}}% + \pgfusepath{stroke}% + \pgfsys@endpurepicture% +}% + +\def\line(#1,#2)#3{{\pgfsetarrows{-}\pgf@pict@line(#1,#2){#3}}}% +\def\vector(#1,#2)#3{{\pgfsetarrows{-latex}\pgf@pict@line(#1,#2){#3}}}% + +\def\@circle#1{{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgf@x=#1\unitlength% + \pgfpathqcircle{.5\pgf@x}% + \pgfusepathqstroke% + \pgfsys@endpurepicture}} + +\def\@dot#1{{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgf@x=#1\unitlength% + \pgfpathqcircle{.5\pgf@x}% + \pgfusepathqfill% + \pgfsys@endpurepicture}} + + +\def\oval{\pgfutil@ifnextchar[{\pgfpictIIe@oval}{\pgfpictIIe@oval[20pt]}} +\def\pgfpictIIe@oval[#1](#2,#3){\pgfutil@ifnextchar[{\pgfpictIIe@@oval[#1](#2,#3)}{\pgfpictIIe@@oval[#1](#2,#3)[]}} +\def\pgfpictIIe@@oval[#1](#2,#3)[#4]{{% + \pgfsys@beginpurepicture% + \@tfor\reserved@a:=#4\do{\csname pgfpictIIe@clip\reserved@a\endcsname}% + \pgf@x=#2\unitlength% + \pgf@y=#3\unitlength% + \pgf@x=-.5\pgf@x% + \pgf@y=-.5\pgf@y% + \pgfsys@transformshift{\the\pgf@x}{\the\pgf@y}% + \pgfsetlinewidth{\@wholewidth}% + \pgf@ya=#3\unitlength% + \advance\pgf@ya by-#1\relax% + \pgfpathmoveto{\pgfpoint{0pt}{\pgf@ya}}% + \pgfpatharc{180}{90}{#1}% + \pgf@xa=#2\unitlength% + \advance\pgf@xa by-#1\relax% + \pgfpathlineto{\pgfpoint{\pgf@xa}{#3\unitlength}}% + \pgfpatharc{90}{0}{#1}% + \pgfpathlineto{\pgfpoint{#2\unitlength}{#1}}% + \pgfpatharc{0}{-90}{#1}% + \pgfpathlineto{\pgfpoint{#1}{0pt}}% + \pgfpatharc{-90}{-180}{#1}% + \pgfpathclose% + \pgfusepathqstroke% + \pgfsys@endpurepicture% +}} +\def\pgfpictIIe@clipr{\pgfpathrectangle{\pgfpoint{0pt}{-1000pt}}{\pgfpoint{1000pt}{2000pt}}\pgfusepath{clip}} +\def\pgfpictIIe@clipl{\pgfpathrectangle{\pgfpoint{-1000pt}{-1000pt}}{\pgfpoint{1000pt}{2000pt}}\pgfusepath{clip}} +\def\pgfpictIIe@clipt{\pgfpathrectangle{\pgfpoint{-1000pt}{0pt}}{\pgfpoint{2000pt}{1000pt}}\pgfusepath{clip}} +\def\pgfpictIIe@clipb{\pgfpathrectangle{\pgfpoint{-1000pt}{-1000pt}}{\pgfpoint{2000pt}{1000pt}}\pgfusepath{clip}} + + +\renewcommand\bezier[1]{\pgfpictIIe@qbezier} +\renewcommand\qbezier[1][]{\pgfpictIIe@qbezier} +\def\pgfpictIIe@qbezier(#1,#2)(#3,#4)(#5,#6){{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgfpathmoveto{\pgfpoint{#1\unitlength}{#2\unitlength}}% + \pgfpathcurveto% + {\pgfpointmid{0.66666666}{\pgfpoint{#1\unitlength}{#2\unitlength}}{\pgfpoint{#3\unitlength}{#4\unitlength}}}% + {\pgfpointmid{0.66666666}{\pgfpoint{#5\unitlength}{#6\unitlength}}{\pgfpoint{#3\unitlength}{#4\unitlength}}}% + {\pgfpoint{#5\unitlength}{#6\unitlength}}%% + \pgfusepathqstroke% + \pgfsys@endpurepicture% +}} +\newcommand\cbezier[1][]{\pgfpictIIe@cbezier} +\def\pgfpictIIe@cbezier(#1,#2)(#3,#4)(#5,#6)(#7,#8){{% + \pgfsys@beginpurepicture% + \pgfsetlinewidth{\@wholewidth}% + \pgfpathmoveto{\pgfpoint{#1\unitlength}{#2\unitlength}}% + \pgfpathcurveto% + {\pgfpoint{#3\unitlength}{#4\unitlength}}% + {\pgfpoint{#5\unitlength}{#6\unitlength}}% + {\pgfpoint{#7\unitlength}{#8\unitlength}}%% + \pgfusepathqstroke% + \pgfsys@endpurepicture% +}} + +\endinput diff --git a/graphics/pgf/base/tex/latex/frontendlayer/tikz.sty b/graphics/pgf/base/tex/latex/frontendlayer/tikz.sty new file mode 100644 index 0000000000..9efacf0d75 --- /dev/null +++ b/graphics/pgf/base/tex/latex/frontendlayer/tikz.sty @@ -0,0 +1,15 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\RequirePackage{pgf,pgffor} % calc and xkeyval have been removed! + +\input{tikz.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/math/pgfmath.sty b/graphics/pgf/base/tex/latex/math/pgfmath.sty new file mode 100644 index 0000000000..2ab7c54624 --- /dev/null +++ b/graphics/pgf/base/tex/latex/math/pgfmath.sty @@ -0,0 +1,13 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs,pgfkeys} +\input{pgfmath.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/systemlayer/pgfsys.sty b/graphics/pgf/base/tex/latex/systemlayer/pgfsys.sty new file mode 100644 index 0000000000..c87aded119 --- /dev/null +++ b/graphics/pgf/base/tex/latex/systemlayer/pgfsys.sty @@ -0,0 +1,20 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} + +\DeclareOption{dvisvgm}{\def\pgfsysdriver{pgfsys-dvisvgm.def}} + +\ProcessOptions + +\input{pgfsys.code.tex} +\input{pgfsyssoftpath.code.tex} +\input{pgfsysprotocol.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/utilities/pgfcalendar.sty b/graphics/pgf/base/tex/latex/utilities/pgfcalendar.sty new file mode 100644 index 0000000000..52cb4c3771 --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/pgfcalendar.sty @@ -0,0 +1,15 @@ +% Copyright 2019 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} +\RequirePackage{pgfkeys} + +\input{pgfcalendar.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/utilities/pgffor.sty b/graphics/pgf/base/tex/latex/utilities/pgffor.sty new file mode 100644 index 0000000000..246e8259ed --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/pgffor.sty @@ -0,0 +1,16 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} +\RequirePackage{pgfkeys} +\RequirePackage{pgfmath} + +\input{pgffor.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/utilities/pgfkeys.sty b/graphics/pgf/base/tex/latex/utilities/pgfkeys.sty new file mode 100644 index 0000000000..aa0d3e02fe --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/pgfkeys.sty @@ -0,0 +1,12 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\input{pgfkeys.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/utilities/pgfpages.sty b/graphics/pgf/base/tex/latex/utilities/pgfpages.sty new file mode 100644 index 0000000000..f71239f2e0 --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/pgfpages.sty @@ -0,0 +1,1139 @@ +% Copyright 2019 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesPackage{pgfpages}[2011/01/05 ver 0.02] + +\RequirePackage{pgfcore,calc} + +\newcount\pgf@logicalpages +\newcount\pgf@firstshipout +\newcount\pgf@lastshipout +\newcount\pgf@currentshipout +\newcount\pgf@cpn +\newcount\pgf@shipoutnextto +\newdimen\pgfphysicalheight +\newdimen\pgfphysicalwidth + +\pgf@shipoutnextto=0\relax +\pgf@logicalpages=0\relax +\pgf@firstshipout=1\relax +\pgf@lastshipout=1\relax +\pgf@currentshipout=1\relax +\pgfphysicalheight=\paperheight +\pgfphysicalwidth=\paperwidth + +\newif\ifpgfphysicalpageempty +\newif\ifpgf@holdingphysicalpage + +\pgfphysicalpageemptytrue +\pgf@holdingphysicalpagefalse + + +% Define a layout +% +% #1 = layout name +% #2 = code before options have been set +% #2 = code after options have been set +% +% Example: +% +% \pgfpagesdeclarelayout{resize to}{ +% \pgfpagesphysicalpageoptions{logical pages=1,physical height=\pgfpageoptionheight,physical width=\pgfpageoptionwidth} +% \pgfpageslogicalpageoptions{1}{resized width=\pgfphysicalwidth,% +% resized height=\pgfphysicalheight,center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}}} + +\newcommand\pgfpagesdeclarelayout[3]{ + \expandafter\newcommand\csname pgfpages@layoutbefore@#1\endcsname{#2} + \expandafter\newcommand\csname pgfpages@layout@#1\endcsname{#3}} + + +% Use a layout +% +% #1 = layout name +% #2 = options +% +% Example: +% +% \pgfpagesuselayout{resize to}[a4paper] + +\def\pgfpagesuselayout#1{\pgfutil@ifnextchar[{\pgf@pagelayout{#1}}{\pgf@pagelayout{#1}[]}} +\def\pgf@pagelayout#1[#2]{ + \csname pgfpages@layoutbefore@#1\endcsname + \setkeys{pgfpagesuselayoutoption}{#2} + \pgfutil@ifundefined{pgfpages@layout@#1}{ + \PackageError{pgfpages}{Page layout `#1' undefined.}{} + } + { + \csname pgfpages@layout@#1\endcsname + } +} + + +% Predefined options + +\define@key{pgfpagesuselayoutoption}{physical paper width}% +{\def\pgfpageoptionwidth{#1}} + +\define@key{pgfpagesuselayoutoption}{physical paper height}% +{\def\pgfpageoptionheight{#1}} + +\define@key{pgfpagesuselayoutoption}{a0paper}[]% +{\def\pgfpageoptionheight{1189mm} \def\pgfpageoptionwidth{841mm}} + +\define@key{pgfpagesuselayoutoption}{a1paper}[]% +{\def\pgfpageoptionheight{841mm} \def\pgfpageoptionwidth{594mm}} + +\define@key{pgfpagesuselayoutoption}{a2paper}[]% +{\def\pgfpageoptionheight{594mm} \def\pgfpageoptionwidth{420mm}} + +\define@key{pgfpagesuselayoutoption}{a3paper}[]% +{\def\pgfpageoptionheight{420mm} \def\pgfpageoptionwidth{297mm}} + +\define@key{pgfpagesuselayoutoption}{a4paper}[]% +{\def\pgfpageoptionheight{297mm} \def\pgfpageoptionwidth{210mm}} + +\define@key{pgfpagesuselayoutoption}{a5paper}[]% +{\def\pgfpageoptionheight{210mm} \def\pgfpageoptionwidth{148mm}} + +\define@key{pgfpagesuselayoutoption}{a6paper}[]% +{\def\pgfpageoptionheight{148mm} \def\pgfpageoptionwidth{105mm}} + +\define@key{pgfpagesuselayoutoption}{letterpaper}[]% +{\def\pgfpageoptionheight{11in} \def\pgfpageoptionwidth{8.5in}} + +\define@key{pgfpagesuselayoutoption}{legalpaper}[]% +{\def\pgfpageoptionheight{14in} \def\pgfpageoptionwidth{8.5in}} + +\define@key{pgfpagesuselayoutoption}{executivepaper}[]% +{\def\pgfpageoptionheight{10.5in}\def\pgfpageoptionwidth{7.25in}} + +\define@key{pgfpagesuselayoutoption}{landscape}[]% +{ + \let\pgf@temp=\pgfpageoptionwidth + \let\pgfpageoptionwidth=\pgfpageoptionheight + \let\pgfpageoptionheight=\pgf@temp +} + +\define@key{pgfpagesuselayoutoption}{border shrink}% +{\def\pgfpageoptionborder{#1}} + +\define@key{pgfpagesuselayoutoption}{corner width}% +{\def\pgfpageoptioncornerwidth{#1}} + +\define@key{pgfpagesuselayoutoption}{odd numbered pages right}[]% +{\def\pgfpageoptionfirstshipout{2}} + +\define@key{pgfpagesuselayoutoption}{second right}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{\paperheight}% + \def\pgfpageoptiontwowidth{2\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second left}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{\paperheight}% + \def\pgfpageoptiontwowidth{2\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second top}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% + \def\pgfpageoptiontwoheight{2\paperheight}% + \def\pgfpageoptiontwowidth{\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second bottom}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{2\paperheight}% + \def\pgfpageoptiontwowidth{\paperwidth}% +} + + + +% Predefined layouts + +\pgfpagesdeclarelayout{rounded corners} +{ + \def\pgfpageoptioncornerwidth{10pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=1 + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight},% + corner width=\pgfpageoptioncornerwidth% + }% +} + +\pgfpagesdeclarelayout{resize to} +{ + \def\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=1,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpageslogicalpageoptions{1} + {% + resized width=\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + border shrink=\pgfpageoptionborder,% + center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% +} + +\pgfpagesdeclarelayout{two screens with lagging second} +{} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptiontwoheight,% + physical width=\pgfpageoptiontwowidth,% + last logical shipout=1,% + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpageoptionfirstcenter,% + }% + \pgfpageslogicalpageoptions{2} + {% + center=\pgfpageoptionsecondcenter,% + copy from=1% + }% +} + +\pgfpagesdeclarelayout{two screens with optional second} +{} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptiontwoheight,% + physical width=\pgfpageoptiontwowidth,% + last logical shipout=1% + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpageoptionfirstcenter,% + }% + \pgfpageslogicalpageoptions{2} + {% + center=\pgfpageoptionsecondcenter,% + copy from=2% + }% +} + +\pgfpagesdeclarelayout{2 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionfirstshipout{1} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth,% + current logical shipout=\pgfpageoptionfirstshipout% + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{4 on 1} +{ + \edef\pgfpageoptionheight{\the\paperheight} + \edef\pgfpageoptionwidth{\the\paperwidth} + \edef\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=4,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% +} + + +\pgfpagesdeclarelayout{6 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=6,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.167\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.833\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.833\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.167\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{8 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=8,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{16 on 1} +{ + \edef\pgfpageoptionheight{\the\paperheight} + \edef\pgfpageoptionwidth{\the\paperwidth} + \edef\pgfpageoptionborder{0pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=16,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{9} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{10} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{11} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{12} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{13} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{14} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{15} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{16} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% +} + + +% Change/set main option +% +% #1 = options +% +% Options: +% +% logical pages = number of logical pages per physical page +% logical shipouts = number of shipouts needed to fill a physical page +% (may be less than the number of logical pages, +% if some logical pages are calculated +% automatically) +% current logical shipout = number of logical shipout that will come +% next. +% +% Example: +% +% \pgfpagesphysicalpageoptions{logical pages=2,logical shipouts=1} + +\newcommand\pgfpagesphysicalpageoptions[1]{% + \pgf@lastshipout=0\relax% + \pgf@currentshipout=0\relax% + \setkeys{pgfpages@main}{#1}% + \ifnum\pgf@lastshipout=0\relax%not set + \pgf@lastshipout=\pgf@logicalpages% + \fi% + \ifnum\pgf@currentshipout=0\relax%not set + \pgf@currentshipout=\pgf@firstshipout% + \fi% +} + + +\define@key{pgfpages@main}{logical pages}{\pgf@logicalpages=#1\relax} +\define@key{pgfpages@main}{first logical shipout}{\pgf@firstshipout=#1\relax} +\define@key{pgfpages@main}{last logical shipout}{\pgf@lastshipout=#1\relax} +\define@key{pgfpages@main}{current logical shipout}{\pgf@currentshipout=#1\relax} +\define@key{pgfpages@main}{physical height}{\pgfphysicalheight=#1\relax} +\define@key{pgfpages@main}{physical width}{\pgfphysicalwidth=#1\relax} + + + +% Setup/change parameters of a logical page. You must call this +% macro for each logical page. +% +% #1 = logical page number +% #2 = options +% +% Options: +% +% original height = height of the logical page (\paperheight at point of +% first invocation by default) +% original width = width of the logical page (\paperwidth by default) +% resized height = height of the logical page after resizing +% resized width = width of the logical page after resizing +% border shrink = length that is subtracted from resized height and +% resized width +% border code = pgf commands to be used for drawing a border (a +% path with the border set will already have been +% set) +% rounded corners = clip the frame against a rectangle of the size of +% the frame with corners of the given radius +% scale = factor by which the page is enlarged/shrunk +% center = center of the logical page in the physical page +% rotation = degree by which the page is rotated around its center +% xscale = scale only x-axis (use -1 to flip along y-axis) +% yscale = scale only y-axis (use -1 to flip along x-axis) +% copy from = copy the contents from this logical page of the +% previous physical page, if no contents is specified +% +% If more than one of the three options ``resized height'', ``resized +% width'' and ``scale'' are given, the smallest resulting scaling +% wins. +% +% Example: +% +% \pgfpageslogicalpageoptions{1}{scale=0.5,center=\pgfpoint{0cm}{2cm}} + +\newcommand\pgfpageslogicalpageoptions[2]{% + \pgf@cpn=#1\relax% + \expandafter\ifx\csname pgfpages@box@#1\endcsname\relax% + \expandafter\newbox\csname pgfpages@box@#1\endcsname% + \edef\pgf@temp{% + \noexpand\pgf@psetcurrent{height}{\the\paperheight}% + \noexpand\pgf@psetcurrent{width}{\the\paperwidth}% + }% + \pgf@temp% + \fi% + \setkeys{pgfpages@page}{#2}% + \pgf@calculateresizes{height}% + \pgf@calculateresizes{width}% + \pgfsetupphysicalpagesizes% +} + +\def\pgf@epset#1#2#3{\expandafter\edef\csname pgfpages@p@#1@#2\endcsname{#3}} +\def\pgf@epsetcurrent#1#2{\pgf@pset{\the\pgf@cpn}{#1}{#2}} +\def\pgf@pset#1#2#3{\expandafter\def\csname pgfpages@p@#1@#2\endcsname{#3}} +\def\pgf@pget#1#2{\csname pgfpages@p@#1@#2\endcsname} +\def\pgf@psetcurrent#1#2{\pgf@pset{\the\pgf@cpn}{#1}{#2}} +\def\pgf@pgetcurrent#1{\pgf@pget{\the\pgf@cpn}} + +\define@key{pgfpages@page}{scale}{\pgf@epsetcurrent{scale}{#1}} +\define@key{pgfpages@page}{xscale}{\pgf@epsetcurrent{xscale}{#1}} +\define@key{pgfpages@page}{yscale}{\pgf@epsetcurrent{yscale}{#1}} +\define@key{pgfpages@page}{original height}{\pgf@epsetcurrent{height}{#1}} +\define@key{pgfpages@page}{original width}{\pgf@epsetcurrent{width}{#1}} +\define@key{pgfpages@page}{resized height}{\pgf@epsetcurrent{reheight}{#1}} +\define@key{pgfpages@page}{resized width}{\pgf@epsetcurrent{rewidth}{#1}} +\define@key{pgfpages@page}{center}{\pgf@psetcurrent{center}{#1}} +\define@key{pgfpages@page}{rotation}{\pgf@epsetcurrent{rotation}{#1}} +\define@key{pgfpages@page}{copy from}{\pgf@epsetcurrent{copy}{#1}} +\define@key{pgfpages@page}{border shrink}{\pgf@epsetcurrent{border}{#1}} +\define@key{pgfpages@page}{border code}{\pgf@psetcurrent{bordercode}{#1}} +\define@key{pgfpages@page}{corner width}{\pgf@psetcurrent{cornerwidth}{#1}} + +\def\pgf@calculateresizes#1{% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @re#1\endcsname\relax% + \else% + \expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @re#1\endcsname\relax% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @border\endcsname\relax% + \else% + \expandafter\pgfutil@tempdimb\csname pgfpages@p@\the\pgf@cpn @border\endcsname\relax% + \advance\pgfutil@tempdima by-2\pgfutil@tempdimb\relax% + \fi% + \expandafter\pgfutil@tempdimb\csname pgfpages@p@\the\pgf@cpn @#1\endcsname\relax% + \pgfutil@tempcnta=\pgfutil@tempdimb% + \divide\pgfutil@tempcnta by 65536\relax% + \ifnum\pgfutil@tempcnta=0\relax% + \pgfutil@tempcnta=1\relax% + \fi% + \divide\pgfutil@tempdima by\pgfutil@tempcnta\relax% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @scale\endcsname\relax% + \pgfutil@tempdimb=10000pt% + \else% + \expandafter\pgfutil@tempdimb\expandafter=\csname pgfpages@p@\the\pgf@cpn @scale\endcsname pt\relax% + \fi% + \ifdim\pgfutil@tempdima<\pgfutil@tempdimb% + \edef\pgf@temp{{scale}{\expandafter\Pgf@geT\the\pgfutil@tempdima}}% + \expandafter\pgf@psetcurrent\pgf@temp% + \fi% + \fi% +} + + + +% Shipout a physical page immediately +% +% Example: +% +% \pgfshipoutphysicalpage + +\newcommand\pgfshipoutphysicalpage{% + \ifnum\pgf@logicalpages>0\relax% + \pgfpages@buildshipoutbox% + \pgfpages@shipoutshipoutbox% + \pgfpages@performcopying% + \global\pgfphysicalpageemptytrue% + \global\pgf@holdingphysicalpagefalse% + \fi% +} + +\newbox\pgfpages@shipoutbox + +\def\pgfpages@buildshipoutbox{% + \setbox\pgfpages@shipoutbox=\vbox{{% + \set@typeset@protect% + \offinterlineskip% + \pgfsys@beginpicture% + \pgf@cpn=1\relax% + \loop% + \setbox0=\hbox to \csname pgfpages@p@\the\pgf@cpn @width\endcsname{% + \hskip1in% + \vbox to \csname pgfpages@p@\the\pgf@cpn @height\endcsname% + {\vskip1in\offinterlineskip\expandafter\copy\csname + pgfpages@box@\the\pgf@cpn\endcsname\vss}\hss}% + \pgfsys@beginscope% + % Translate lower left corner + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @center\endcsname\relax% + \else% + \pgflowlevel{\pgftransformshift{\csname pgfpages@p@\the\pgf@cpn @center\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @scale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformscale{\csname pgfpages@p@\the\pgf@cpn @scale\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @xscale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformxscale{\csname pgfpages@p@\the\pgf@cpn @xscale\endcsname}{1}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @yscale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformyscale{\csname pgfpages@p@\the\pgf@cpn @yscale\endcsname}}% + \fi% + \pgfscope% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @rotation\endcsname\relax% + \else% + \pgflowlevel{\pgftransformrotate{\csname + pgfpages@p@\the\pgf@cpn @rotation\endcsname}}% + \fi% + \pgfutil@tempdima=\csname pgfpages@p@\the\pgf@cpn @width\endcsname\relax% + \pgfutil@tempdimb=\csname pgfpages@p@\the\pgf@cpn @height\endcsname\relax% + \pgflowlevel{\pgftransformshift{\pgfpoint{-.5\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}}% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @bordercode\endcsname\relax% + \else% + \pgfpathmoveto{\pgfpointorigin}% + \pgfpathlineto{\pgfpoint{\wd0}{0pt}}% + \pgfpathlineto{\pgfpoint{\wd0}{\ht0}}% + \pgfpathlineto{\pgfpoint{0pt}{\ht0}}% + \pgfpathclose% + {\csname pgfpages@p@\the\pgf@cpn @bordercode\endcsname}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @cornerwidth\endcsname\relax% + \else% + { + \expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @cornerwidth\endcsname\relax% + \color{black} + \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfusepath{fill}% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfutil@tempdima}} + \pgfpathcurveto{\pgfpoint{0pt}{0.555\pgfutil@tempdima}}{\pgfpoint{.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{0pt}} + \pgfpathlineto{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}} + \pgfpathcurveto{\pgfpoint{\wd0-.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\wd0}{.555\pgfutil@tempdima}}{\pgfpoint{\wd0}{\pgfutil@tempdima}} + \pgfpathlineto{\pgfpoint{\wd0}{\ht0-\pgfutil@tempdima}} + \pgfpathcurveto{\pgfpoint{\wd0}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{\wd0-.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0}} + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\ht0}} + \pgfpathcurveto{\pgfpoint{.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{0pt}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}} + \pgfpathclose + \pgfusepath{clip} + \color{white} + \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\wd0}{\ht0}} + \pgfusepath{fill} + } + \fi% + \ht0=0pt% + \wd0=0pt% + \dp0=0pt% + \pgfsys@hbox0% + \endpgfscope% + \pgfsys@endscope% + \ifnum\pgf@cpn<\pgf@logicalpages% + \advance \pgf@cpn by 1\relax% + \repeat% + \pgfsys@endpicture% + }}% +} + + +\def\pgfpages@shipoutshipoutbox{% + \begingroup + \let \protect \noexpand + \@resetactivechars + \global\let\@@if@newlist\if@newlist + \global\@newlistfalse + \@parboxrestore% + \pgfpages@originalshipout% + \vbox{\hbox{% + \pgfsetupphysicalpagesizes% + \hskip-1in% + \vbox to \pgfphysicalheight{% + \vss\box\pgfpages@shipoutbox% + \vskip1in% + }}% + \pgfsetupphysicalpagesizes% + }% + \endgroup% +} + +\def\pgfpages@performcopying{ + \pgf@cpn=1\relax% copy first + \loop% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @copy\endcsname\relax + \else% + \edef\pgf@temp{\noexpand\global\noexpand\setbox\csname pgfpages@box@% + \the\pgf@cpn\endcsname=\noexpand\copy\csname pgfpages@box@\csname + pgfpages@p@\the\pgf@cpn @copy\endcsname\endcsname}% + \pgf@temp% + \fi% + \ifnum\pgf@cpn<\pgf@logicalpages% + \advance \pgf@cpn by 1\relax% + \repeat% + \pgf@cpn=1\relax% then void + \loop% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @copy\endcsname\relax + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@cpn\endcsname=\box\voidb@x% + \else% + \fi% + \ifnum\pgf@cpn<\pgf@logicalpages% + \advance \pgf@cpn by 1\relax% + \repeat% +} + + + +% Save original shipout commands +% +% Example: +% +% \pgfhookintoshipout + +\newcommand\pgfhookintoshipout{ + \ifx\CROP@shipout\undefined + \let\pgfpages@originalshipout=\shipout + \let\shipout=\pgfpages@interceptshipout + \else + \let\pgfpages@originalshipout=\CROP@shipout + \let\CROP@shipout=\pgfpages@interceptshipout + \fi +} + +\def\pgfpages@interceptshipout{% + \ifnum\pgf@shipoutnextto>0\relax + \def\pgf@next{% + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname=\box\voidb@x% + \afterassignment\pgfpages@shipouttestnext% + \pgfpagesshipoutlogicalpage{\the\pgf@shipoutnextto}% + }% + \else% + \ifpgf@holdingphysicalpage% shipout physical page now + {\pgfshipoutphysicalpage}% + \fi% + \ifnum\pgf@logicalpages=0\relax + \def\pgf@next{\pgfpages@originalshipout}% + \else% + \def\pgf@next{% + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@currentshipout\endcsname=\box\voidb@x% + \afterassignment\pgfpages@shipouttest% + \pgfpagesshipoutlogicalpage{\the\pgf@currentshipout}% + }% + \fi% + \fi% + \pgf@next% +} + +\def\pgfpages@shipouttest{% + \ifvoid\csname pgfpages@box@\the\pgf@currentshipout\endcsname\relax% + \aftergroup\pgfpages@preparenextshipout% + \else% + \pgfpages@preparenextshipout% + \fi% +} + +\def\pgfpages@shipouttestnext{% + \ifvoid\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname\relax% + \aftergroup\pgfpages@preparenextshipout% + \else% + \pgfpages@preparenextshipout% + \fi% +} + +\def\pgfpages@preparenextshipout{% + \ifnum\pgf@shipoutnextto=0\relax% + \global\advance\pgf@currentshipout by 1\relax% + \else% + \global\pgf@shipoutnextto=0\relax% + \fi% + \ifnum\pgf@currentshipout>\pgf@lastshipout\relax% + \global\pgf@currentshipout=\pgf@firstshipout\relax% + \global\pgf@holdingphysicalpagetrue% + \fi% +} + + + +% Shipout a logical page +% +% #1 = logical page number +% +% The command should be followed by a box. This box will become the +% contents of the logical page. +% +% Example: +% +% \pgfpagesshipoutlogicalpage{0}\vbox{Hi!} + +\newcommand\pgfpagesshipoutlogicalpage[1]{% + \global\pgfphysicalpageemptyfalse% + \expandafter\global\expandafter\setbox\csname pgfpages@box@#1\endcsname=} + + + +% Finish current page and shipout next page to a specific logical page. +% +% #1 = logical page number +% +% When the current page has been typset, it will be become the given +% logical page. This command ``interrupts'' the normal order of +% logical pages. +% +% Example: +% +% \pgfpagesuselayout{two screens with optional second} +% +% Text for main page.\clearpage +% +% \pgfpagescurrentpagewillbelogicalpage{2} +% +% Text that goes to second page +% +% \clearpage +% +% Text for main page. + +\newcommand\pgfpagescurrentpagewillbelogicalpage[1]{% + \global\pgf@shipoutnextto=#1\relax% +} + + +% Setup the physical page sizes +% +% Example: +% +% \pgfsetupphysicalpagesizes + +\newcommand\pgfsetupphysicalpagesizes{% + \pgfsys@global@papersize{\the\pgfphysicalwidth}{\the\pgfphysicalheight}% +} + + +% +% Start/End setup +% +\pgfhookintoshipout + +\AtEndDocument +{ + \clearpage + \ifpgfphysicalpageempty + \else + \pgfshipoutphysicalpage + \fi +} + diff --git a/graphics/pgf/base/tex/latex/utilities/pgfparser.sty b/graphics/pgf/base/tex/latex/utilities/pgfparser.sty new file mode 100644 index 0000000000..5e1956b39f --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/pgfparser.sty @@ -0,0 +1,15 @@ +% Copyright 2020 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\RequirePackage{pgfrcs} +\RequirePackage{pgfkeys} + +\input{pgfmoduleparser.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/utilities/pgfrcs.sty b/graphics/pgf/base/tex/latex/utilities/pgfrcs.sty new file mode 100644 index 0000000000..b7124aab51 --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/pgfrcs.sty @@ -0,0 +1,15 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\input pgfutil-common.tex +\input pgfutil-latex.def + +\input{pgfrcs.code.tex} + +\endinput diff --git a/graphics/pgf/base/tex/latex/utilities/tikzexternal.sty b/graphics/pgf/base/tex/latex/utilities/tikzexternal.sty new file mode 100644 index 0000000000..5add24053a --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/tikzexternal.sty @@ -0,0 +1,143 @@ +% Copyright 2020 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% +% In addition to the above licenses, this particular file may also be +% directly inlined into other documents and this copyright notice may +% be removed. Additionally, when you inline this file, you may modify +% it as needed and you may remove comments. +% +% This file is intended to be distributed or even inlined into a file +% when a document needs to be typeset on a system that does not have +% pgf/TikZ installed. +% +% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes the +% \includegraphics with the correct file name instead. + +\RequirePackage{graphicx} + +\toksdef\t@tikzexternal@tmpa=0 +\toksdef\t@tikzexternal@tmpb=1 + +\def\tikzexternalize{\@ifnextchar[{\tikzexternalize@opt}{\tikzexternalize@opt[]}}% +\def\tikzexternalize@opt[#1]{\@ifnextchar\bgroup{\def\tikzexternal@realjob}{\let\tikzexternal@realjob=\jobname}}% + +\def\tikzsetnextfilename#1{\gdef\tikzexternal@nextfile{#1}} +\def\tikzsetexternalprefix#1{\def\tikzexternal@filenameprefix{#1}} +\def\tikzsetfigurename#1{\def\tikzexternal@figurename{#1}}% +\def\tikzappendtofigurename#1{\expandafter\def\expandafter\tikzexternal@figurename\expandafter{\tikzexternal@figurename #1}}% +\tikzsetnextfilename{} +\tikzsetexternalprefix{} +\tikzsetfigurename{\tikzexternal@realjob-figure}% + +\long\def\tikzpicture#1\end#2{% collect every thing up to \end{tikzpicture} + \def\tikzexternal@laTeX@collectpicture@@{#2}% + \ifx\tikzexternal@laTeX@collectpicture@@\tikzexternal@laTeX@tikzpicturestring + \tikzexternal@image + \end{tikzpicture}% + \else + \expandafter + \tikzpicture + \fi +}% +\def\endtikzpicture{} +\def\tikzexternal@laTeX@tikzpicturestring{tikzpicture}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Replacement for \tikz short command: +\def\tikz{\@ifnextchar[{\tikz@opt}{\tikz@opt[]}} +\def\tikz@opt[#1]{\@ifnextchar\bgroup{\tikz@opt@{#1}}{\tikz@opt@@{#1}}} +\def\tikz@opt@#1#2{\tikz@opt@process{#1}{#2}} +\def\tikz@opt@@#1{% + \def\tikz@next{\tikz@collectnormalsemicolon{#1}}% + \ifnum\the\catcode`\;=\active\relax% + \def\tikz@next{\tikz@collectactivesemicolon{#1}}% + \fi% + \tikz@next} +\def\tikz@collectnormalsemicolon#1#2;{\tikz@opt@process{#1}{#2;}} +{ + \catcode`\;=\active + \gdef\tikz@collectactivesemicolon#1#2;{% + \tikz@opt@process{#1}{#2;}% + } +} +\def\tikz@opt@process#1#2{\tikzexternal@image} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\def\tikzexternal@image{% + \leavevmode + \begingroup + \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}% + \ifx\tikzexternal@nextfile\empty + \expandafter\ifx\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax + \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}% + \fi + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}% + \count0=\csname c@tikzext@no@\tikzexternal@figurename\endcsname + \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\the\count0 }% + \advance\count0 by1\relax + \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\count0 }% + \else + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}% + \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% + \fi + \endgroup + \global\let\tikzexternal@nextfile=\empty + \pgfincludeexternalgraphics\tikzexternal@curfilename +}% +\def\tikzset#1{}\def\pgfkeys#1{}\def\pgfqkeys#1#2{} +\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\pgfincludeexternalgraphics{#1}} +\def\tikzifinpicture#1#2{#2} +\def\pgfincludeexternalgraphics#1{% + \begingroup + \pgfexternalreaddpth{#1}% + \setbox1=\hbox{\includegraphics{#1}}% + \ifdim\pgfretval=0pt + \box1 + \else + \dimen0=\pgfretval\relax + \hbox{\lower\dimen0 \box1 }% + \fi + \endgroup +} +\newread\r@pgf@reada +\def\pgfexternalreaddpth#1{% + \edef\pgfexternalreaddpth@restore{% + \noexpand\endlinechar=\the\endlinechar\space + \noexpand\catcode`\noexpand\@=\the\catcode`\@\space + }% + \def\pgfretval{0pt}% + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + \pgfexternalreaddpth@restore +}% +\def\pgfincludeexternalgraphics@read@dpth{% + \ifeof\r@pgf@reada + \closein\r@pgf@reada + \else + \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline + \ifx\pgfincludeexternalgraphics@auxline\empty + \else + \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI + \fi + \expandafter\pgfincludeexternalgraphics@read@dpth + \fi +}% +\long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% + \ifcat\noexpand#1\relax + \if@filesw + {\toks0={#1#2}% + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + \else% + \def\pgfretval{#1#2}% + \fi +}% diff --git a/graphics/pgf/base/tex/latex/utilities/xxcolor.sty b/graphics/pgf/base/tex/latex/utilities/xxcolor.sty new file mode 100644 index 0000000000..9a4bb4e5b6 --- /dev/null +++ b/graphics/pgf/base/tex/latex/utilities/xxcolor.sty @@ -0,0 +1,108 @@ +% Copyright 2018 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesPackage{xxcolor}[2003/10/24 ver 0.1] +\NeedsTeXFormat{LaTeX2e}[1995/12/01] + +\RequirePackage{xcolor} + + + +% Command \newcolormixin{\somecommand} +% +% Description: +% +% After this command has been called, you can assign a partial color +% specification to \somecommand. Every time a color is set, the +% partial color specification in \somecommand will be applied to the +% current color. +% +% Examples: +% +% \newcolormixin\mymixin +% \def\mymixin{!50!white} +% +% \newcolormixin\anothermixin +% \def\anothermixin{!50!red} + +\def\newcolormixin#1{% + \expandafter\def\csname XC@mixin@\the\XC@nummixins\endcsname{#1}% + \advance\XC@nummixins\@ne% + \ifx#1\@undefined\def#1{}\fi} + +\newcount\XC@nummixins +\newcount\XC@countmixins + + +% Command \applycolormixins{colorname} +% +% Description: +% +% Applies all color mixins that have been defined using \newcolormixin +% to the color named colorname. +% +% Examples: +% +% \applycolormixins{mycolor} + +\def\applycolormixins#1{% + \XC@countmixins=0\relax% + \loop% + \ifnum\XC@countmixins<\XC@nummixins% + \colorlet{#1}{#1\csname XC@mixin@\the\XC@countmixins\endcsname}% + \advance\XC@countmixins\@ne\relax% + \repeat% +} + + +% Internal: + +\ifx\XC@mcolor\relax + \let\XC@mcolor\@empty +\fi + +\g@addto@macro\XC@mcolor{% + \ifnum\XC@nummixins>0% + \colorlet{XC@mixtmp}{.}% + \applycolormixins{XC@mixtmp}% + \pgfutil@namelet{current@color}{\string\color@XC@mixtmp}% + \fi% +} + + + +% Environment colormixin +% +% #1 = full xcolor specification after the first ! ("white" may not be +% omitted) +% +% Description: +% +% Inside the environment, all colors get the specified mixin. May be +% nested. +% +% Examples: +% +% \color{red}This is red. +% \begin{colormixin}{25!black} +% This is dark red. +% \color{blue} +% This is dark blue. +% \end{colormixin} +% This is normal red once more. + +\newcolormixin\colorcurrentmixin + +\newenvironment{colormixin}[1]% +{\edef\colorcurrentmixin{!#1\colorcurrentmixin}\color{.}}{} + +\def\pgfalternateextension{\colorcurrentmixin} + +\endinput + |