diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex | 228 |
1 files changed, 205 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex index 02687fc29c3..50a820f6126 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.46 2015/05/08 10:23:50 tantau Exp $ +\ProvidesFileRCS{pgfcorescopes.code.tex} % Globals @@ -37,7 +37,7 @@ % Pgf scope environment. All changes of the graphic state are local to % the scope. -% +% % Example: % % \begin{pgfscope} @@ -64,30 +64,30 @@ % Quickly insert a box can contain normal TeX text at the origin. -% +% % #1 = box of width/height and depth 0pt -% +% % Example: % % \pgfqbox{\mybox} \def\pgfqbox#1{% \pgfsys@hbox#1% -} +} % Insert a box that can contain normal TeX text at the origin, but % with the current coordinate transformation matrix synced with the % low-level transformation matrix. -% +% % #1 = box of width/height and depth 0pt % % In essence, this command does the same as if you first said % \pgflowlevelsynccm and then \pgfqbox. However, pgf will use a % ``TeX-translation'' for the translation part of the transformation % cm. This will ensure that hyperlinks ``survive'' at least -% translations. -% +% translations. +% % Example: % % \pgfqboxsynced{\mybox} @@ -99,11 +99,11 @@ % Puts some text in a box and inserts it with the current % transformations applied. -% +% % #1 = List of optional positioning. Possible values are ``left'', ``right'', % ``top'', ``bottom'' and ``base''. % #2 = TeX text. May contain verbatims. -% +% % Example: % % \pgftransformshift{\pgfpoint{1cm}{0cm}} @@ -173,7 +173,7 @@ \def\pgf@textdone{% \endpgfinterruptpicture% \egroup% - \pgf@@maketextafter% + \pgf@@maketextafter% } \long\def\pgf@makehbox#1{% @@ -248,10 +248,10 @@ \def\endpgfpicture{% \ifpgfrememberpicturepositiononpage% \hbox to0pt{\pgfsys@markposition{\pgfpictureid}}% - \fi% + \fi% % ok, now let's position the box \ifdim\pgf@picmaxx=-16000pt\relax% - % empty picture. make size 0. + % empty picture. make size 0. \global\pgf@picmaxx=0pt\relax% \global\pgf@picminx=0pt\relax% \global\pgf@picmaxy=0pt\relax% @@ -261,14 +261,14 @@ \pgf@relevantforpicturesizefalse% \pgf@process{\pgf@baseline}% \xdef\pgf@shift@baseline{\the\pgf@y}% - % + % \pgf@process{\pgf@trimleft}% \global\advance\pgf@x by-\pgf@picminx % prepare \hskip\pgf@trimleft@final. % note that \pgf@trimleft@final is also queried % by the pgf image externalization. \xdef\pgf@trimleft@final{-\the\pgf@x}% - % + % \pgf@process{\pgf@trimright}% \global\advance\pgf@x by-\pgf@picmaxx % prepare \hskip\pgf@trimright@final. @@ -282,7 +282,7 @@ \egroup% \pgf@restore@layerlist@from@global \pgf@insertlayers% - \endgroup% + \endgroup% \pgfsys@discardpath% \endgroup% \pgfsys@endscope% @@ -328,7 +328,7 @@ % % Sets the baseline of the picture to the y-coordinate of a given % point. However, the point will be evaluated *at the end of the -% picture*. +% picture*. % % Example: % @@ -434,7 +434,7 @@ % The environment can be used to insert some drawing commands while % constructing a path. The drawing commands inside the environment % will not interfere with the path being constructed ``outside.'' -% However, you must ward against graphic state changes using a scope. +% However, you must ward against graphic state changes using a scope. % % Example: Draw two parallel lines % @@ -458,7 +458,6 @@ \pgfsyssoftpath@setcurrentpath\pgfutil@empty% \edef\pgfscope@linewidth{\the\pgflinewidth}% \let\pgf@interrupt@lastmoveto=\pgfsyssoftpath@lastmoveto% - \let\pgf@interrupt@nlt@infos=\pgf@nlt@infos% \begingroup% } \def\endpgfinterruptpath @@ -470,7 +469,6 @@ \global\pgf@path@lastx\pgf@interrupt@savex% \global\pgf@path@lasty\pgf@interrupt@savey% \global\let\pgfsyssoftpath@lastmoveto\pgf@interrupt@lastmoveto% - \global\let\pgf@nlt@infos=\pgf@interrupt@nlt@infos% \endgroup% } @@ -483,9 +481,9 @@ % The environment can be used to temporarily setup a new bounding box % computation. The bounding box will be made empty at the beginning of % the environment and will be reset to its old value after the -% environment. +% environment. % -% Example: +% Example: % % \begin{pgfinterruptboundinbox} % \pgfmoveto{\pgfpoint{1cm}{0cm}} @@ -519,6 +517,190 @@ +% Creates an id scope. +% +% Description: +% +% An id scope is not (conceptually) a graphic scope, but a scope that +% has a unique name or "id". This id can be used as a reference point +% for instance for a hyperlink or for an animation (currently, only +% SVG supports ids, all other drivers ignore id scopes). +% +% Prior to using \pgfidscope, call \pgfuseid to install an +% id (and possibly \pgfusetype). The scope will then get this id and, +% likely, a graphic scope is installed. If \pgfuseid has not been +% called or if you try to call \pgfidscope again for the same id, +% nothing happens (except for a \TeX\ group being established). + +\def\pgfidscope{\pgfsys@begin@idscope} +\def\endpgfidscope{\pgfsys@end@idscope} + +\let\startpgfidscope\pgfidscope +\let\stoppgfidscope\pgfendidscope + + + + +% Use an id on the next graphic object +% +% #1 = a name +% +% The next scope or path can be the target of an animation command or +% a hyperlink. + +\def\pgfuseid#1{% + \edef\pgf@temp{#1}% + \ifx\pgf@temp\pgfutil@empty% + \else% + \pgf@lookup@id{#1}% + \pgfsys@use@id{\pgf@next@id}% + \expandafter\xdef\csname pgf@id@names@#1\endcsname{{\pgf@next@id}{}}% + \fi% +} + +\def\pgf@lookup@id#1{% + \expandafter\let\expandafter\pgf@id@name\csname pgf@id@names@#1\endcsname% + \ifx\pgf@id@name\relax% + \let\pgf@prev@id\pgfutil@empty% + \let\pgf@next@id\pgfutil@empty% + \else% + \expandafter\pgf@id@parse\pgf@id@name% + \fi% + \ifx\pgf@next@id\pgfutil@empty% + \pgfsys@new@id\pgf@next@id% + \expandafter\xdef\csname pgf@id@names@#1\endcsname{{\pgf@prev@id}{\pgf@next@id}}% + \fi% +} +\def\pgf@id@parse#1#2{% + \def\pgf@prev@id{#1}% + \def\pgf@next@id{#2}% +} + + + +% Clear the current id +% +% Description: +% +% Sets the current id to be empty so that it cannot be referenced. + +\def\pgfclearid{% + \pgfsys@clear@id% +} + + +% Get the id that will be given to a name upon the next use +% +% #1 = a macro +% #2 = a name +% +% Description: +% +% #1 will get the id that will be used by \pgfuseid next time for the +% given name. + +\def\pgfidrefnextuse#1#2{% + \edef\pgf@temp{#2}\ifx\pgf@temp\pgfutil@empty\pgferror{Missing name reference for ``\string#1''}\fi% + \pgf@lookup@id{#2}% + \let#1\pgf@next@id% +} + + +% Get the id was last used +% +% #1 = a macro +% #2 = a name +% +% Description: +% +% #1 will get the id that was last used by \pgfuseid for #2. + +\def\pgfidrefprevuse#1#2{% + \edef\pgf@temp{#2}\ifx\pgf@temp\pgfutil@empty\pgferror{Missing name reference for ``\string#1''}\fi% + \pgf@lookup@id{#2}% + \let#1\pgf@prev@id% +} + + +% Use a type +% +% #1 = an id type; when starting with a dot, it is added to the +% current type. +% +% The next scope or path can be the target of an animation command or +% a hyperlink. + +\def\pgfusetype#1{% + \edef\pgf@temp{#1}% + \expandafter\pgfutil@ifnextchar\expandafter.\expandafter\pgf@id@use@type@add\expandafter\pgf@id@use@type@replace\pgf@temp\pgf@stop +} +\def\pgf@id@use@type@add.#1\pgf@stop{\pgfsys@append@type{#1}} +\def\pgf@id@use@type@replace#1\pgf@stop{\pgfsys@use@type{#1}} + +% Push the current type on a global stack +% +% Description: +% +% The current type is pushed onto a global type stack. It can be +% restored using \pgfpoptype. + +\def\pgfpushtype{\pgfsys@push@type} + + +% Pop a type from the type stack +% +% Description: +% +% Restores the most current value from the type stack. + +\def\pgfpoptype{\pgfsys@pop@type} + + + + +% Alias an id locally or globally +% +% #1 = the alias name +% #2 = a existing id name +% +% Description: +% +% Creates an alias of a name + +\def\pgfaliasid#1#2{% + \expandafter\let\expandafter\pgf@temp\csname pgf@id@names@#2\endcsname% + \expandafter\let\csname pgf@id@names@#1\endcsname\pgf@temp% +} +\def\pgfgaliasid#1#2{% + \expandafter\let\expandafter\pgf@temp\csname pgf@id@names@#2\endcsname% + \expandafter\global\expandafter\let\csname pgf@id@names@#1\endcsname\pgf@temp% +} + + +% Check whether a name has been forward-referenced +% +% #1 = a name +% #2 = what to do, when has been forward-referenced +% #3 = what to do otherwise +% +% Description: +% +% Depending on whether #1 has been forward-referenced, #2 or #3 will be executed. + +\def\pgfifidreferenced#1#2#3{% + \expandafter\let\expandafter\pgf@id@name\csname pgf@id@names@#1\endcsname% + \ifx\pgf@id@name\relax% + #3% + \else + \expandafter\pgf@id@parse\pgf@id@name% + \ifx\pgf@next@id\pgfutil@empty% + #3% + \else% + #2% + \fi% + \fi% +} + % Interrupts a picture % @@ -528,7 +710,7 @@ % normal TeX mode. All sorts of things are saved and restored by this % environment. % -% WARNING: Using this environment in conjuction with low level +% WARNING: Using this environment in conjunction with low level % transformations can *strongly* upset the typesetting. Typically, the % contents of this environment should have size/height/depth 0pt in % the end. |