diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex index b2f55e82923..4eba7a9787f 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex @@ -8,8 +8,8 @@ % See the file doc/generic/pgf/licenses/LICENSE for more details. -% -% This file provides utitiliy commands that are used throughout pgf. +% +% This file provides utility commands that are used throughout pgf. % % For most commands, the definition of these commands is just given % below. We cannot use the LaTeX definition of these commands since @@ -20,7 +20,7 @@ % context) is to be preferred over the generic definition below. In % this case, the definition of the format is installed when the file % pgfutil-XXXX.tex is read, where XXXX is the format name (latex, -% plain, or context). +% plain, or context). @@ -70,6 +70,9 @@ } \long\def\pgfutil@firstofone#1{#1} \long\def\pgfutil@firstoftwo#1#2{#1} +\long\def\pgfutil@letfirst#1#2{\pgfutil@letfirst@#1#2\pgfutil@letfirst@end} +\long\def\pgfutil@letfirst@#1#2#3\pgfutil@letfirst@end{\let#1=#2} +\def\pgfutil@letfirst@end{} \long\def\pgfutil@secondoftwo#1#2{#2} \def\pgfutil@empty{} \def\pgfutil@gobble@until@relax#1\relax{} @@ -86,6 +89,29 @@ \newif\ifpgfutil@tempswa \newif\ifpgfutil@tempswb +% \pgfutil@pushmacro +% \pgfutil@popmacro +% +% Macro stack. Allows pushing a macro over \egroup. Taken from ConTeXt + +\let\pgfutil@pushmacro@string\pgfutil@empty + +\def\pgfutil@pushmacro#1{% + \xdef\pgfutil@pushmacro@string{\string#1}% + \ifcsname pgfutil@pushedmacro@\pgfutil@pushmacro@string\endcsname\else + % \newcount is \outer in Plain + \csname newcount\expandafter\endcsname\csname pgfutil@pushedmacro@\pgfutil@pushmacro@string\endcsname + \fi + \global\advance\csname pgfutil@pushedmacro@\pgfutil@pushmacro@string\endcsname 1\relax + \expandafter\glet\csname\the\csname pgfutil@pushedmacro@\pgfutil@pushmacro@string\endcsname\pgfutil@pushmacro@string\endcsname#1% +} + +\def\pgfutil@popmacro#1{% + \xdef\pgfutil@pushmacro@string{\string#1}% + \expandafter\let\expandafter#1\csname\the\csname pgfutil@pushedmacro@\pgfutil@pushmacro@string\endcsname\pgfutil@pushmacro@string\endcsname + \global\advance\csname pgfutil@pushedmacro@\pgfutil@pushmacro@string\endcsname -1\relax +} + % pgfutil@ifnextchar \long\def\pgfutil@ifnextchar#1#2#3{% @@ -238,12 +264,12 @@ % Include a library file. % % #1 = List of names of library file. -% +% % Description: % % This command includes a list of library files. For each file X in the % list, the file pgflibraryX.code.tex is included, provided this has -% not been done earlier. +% not been done earlier. % % For the convenience of Context users, both round and square brackets % are possible for the argument. @@ -273,7 +299,7 @@ \pgferror{I did not find the pgf library '\pgf@temp'. I looked for the file named pgflibrary\pgf@temp.code.tex, but could not find it in in - the current texmf trees.} + the current texmf trees.} }% \catcode`\@=\csname pgf@library@#1@atcode\endcsname \catcode`\|=\csname pgf@library@#1@barcode\endcsname @@ -287,12 +313,12 @@ % Include a module file. % % #1 = List of names of module files. -% +% % Description: % % This command includes a list of module files. For each file X in the % list, the file pgfmoduleX.code.tex is included, provided this has -% not been done earlier. +% not been done earlier. % % For the convenience of Context users, both round and square brackets % are possible for the argument. @@ -340,7 +366,7 @@ % If '#1' is a usual file name without anything fancy, \pgfretval % will simply contain it. However, if '#1' contains double colons % (introduces, for example, by pdftex because there are white - % spaces in '#1'), the routine + % spaces in '#1'), the routine % - removes the double colons, % - re-inserts them outside of the string. % @@ -434,7 +460,7 @@ \def\pgfretval{####1}% }% \pgfutil@tmp#2\pgf@EOI% - % + % % ... and execute the <true> code: #3\relax% \else @@ -475,7 +501,7 @@ % Solves a linear equation system of size 2x2 using gauss elimination. % % It employs TeX register arithmetics to do so. -% #1: should contain 4 sets of braces with matrix entries, +% #1: should contain 4 sets of braces with matrix entries, % {<a11>}{<a12>} % {<a21>}{<a22>} % where each entry should be a number without unit. @@ -538,7 +564,7 @@ {\csname m\Pa a\endcsname}% \let\pivot=\pgfmathresult % - % \factor := 1/aa * ba + % \factor := 1/aa * ba \csname \Pb a\endcsname=\pivot\csname \Pb a\endcsname \edef\factor{\expandafter\pgf@sys@tonumber\csname \Pb a\endcsname}% % @@ -658,7 +684,7 @@ \expandafter\pgfmathfloatreciprocal@\expandafter{\csname m\Pa a\endcsname}% \let\pivot=\pgfmathresult % - % \factor := 1/aa * ba + % \factor := 1/aa * ba \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pb a\endcsname}{\pivot}% \let\factor=\pgfmathresult \expandafter\let\csname m\Pb a\endcsname=\factor @@ -746,7 +772,7 @@ % Used by latex for doing reruns % #1 = an internal label -% #2 = a to-be-tested text +% #2 = a to-be-tested text \def\pgfutil@check@rerun#1#2{} % new tempdims: @@ -799,7 +825,7 @@ % Advances a number stored in a macro and writes the result back into % the macro. -% #1 is a macro containing a number. +% #1 is a macro containing a number. \def\pgfutil@advancestringcounter#1{% \begingroup \c@pgf@counta=#1\relax |