| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
%%% This file is a copy of some part of PGF/Tikz. |
| 3 |
%%% It has been copied here to provide : |
| 4 |
%%% - compatibility with older PGF versions |
| 5 |
%%% - availability of PGF contributions by Christian Feuersaenger |
| 6 |
%%% which are necessary or helpful for pgfplots. |
| 7 |
%%% |
| 8 |
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND |
| 9 |
%%% PGF parts. The copyrights are as they appear in PGF. |
| 10 |
%%% |
| 11 |
%%% Note that pgfplots has compatible licenses. |
| 12 |
%%% |
| 13 |
%%% This copy has been modified in the following ways: |
| 14 |
%%% - nested \input commands have been updated |
| 15 |
%%% |
| 16 |
% |
| 17 |
% Support for the contents of this file will NOT be done by the PGF/TikZ team. |
| 18 |
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction |
| 19 |
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything: |
| 20 |
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help. |
| 21 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 22 |
%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%% |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
% Copyright 2006 by Till Tantau |
| 27 |
% |
| 28 |
% This file may be distributed and/or modified |
| 29 |
% |
| 30 |
% 1. under the LaTeX Project Public License and/or |
| 31 |
% 2. under the GNU Public License. |
| 32 |
% |
| 33 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 34 |
|
| 35 |
\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.38 2012/11/30 12:00:51 tantau Exp $ |
| 36 |
|
| 37 |
% Globals |
| 38 |
|
| 39 |
\newbox\pgfpic |
| 40 |
\newbox\pgf@hbox |
| 41 |
|
| 42 |
\newbox\pgf@layerbox@main |
| 43 |
|
| 44 |
\newcount\pgf@picture@serial@count |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
% This if decides whether the position of pictures on the page is |
| 49 |
% protocolled or not. Normally, |
| 50 |
% this is switched off as it works only with certain drivers and it |
| 51 |
% causes external files to be written. When switched on, the position |
| 52 |
% of pgfpictures are protocolled and can be referenced using |
| 53 |
% \pgfsys@getposition{XXX} where XXX is the value of \pgfpictureid |
| 54 |
% inside the picture. |
| 55 |
\newif\ifpgfrememberpicturepositiononpage |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
% Scopes |
| 61 |
|
| 62 |
|
| 63 |
% Pgf scope environment. All changes of the graphic state are local to |
| 64 |
% the scope. |
| 65 |
% |
| 66 |
% Example: |
| 67 |
% |
| 68 |
% \begin{pgfscope} |
| 69 |
% \pgfsetlinewidth{3pt} |
| 70 |
% \pgfline{\pgfxy(0,0)}{\pgfxy(3,3)} |
| 71 |
% \end{pgfscope} |
| 72 |
|
| 73 |
\def\pgfscope{% |
| 74 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty% |
| 75 |
\pgfsys@beginscope% |
| 76 |
\pgf@resetpathsizes% |
| 77 |
\edef\pgfscope@linewidth{\the\pgflinewidth}% |
| 78 |
\begingroup} |
| 79 |
\def\endpgfscope{% |
| 80 |
\endgroup% |
| 81 |
\global\pgflinewidth=\pgfscope@linewidth% |
| 82 |
\pgfsys@endscope} |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
% Quickly insert a box can contain normal TeX text at the origin. |
| 88 |
% |
| 89 |
% #1 = box of width/height and depth 0pt |
| 90 |
% |
| 91 |
% Example: |
| 92 |
% |
| 93 |
% \pgfqbox{\mybox} |
| 94 |
|
| 95 |
\def\pgfqbox#1{% |
| 96 |
\pgfsys@hbox#1% |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
% Insert a box that can contain normal TeX text at the origin, but |
| 101 |
% with the current coordinate transformation matrix synced with the |
| 102 |
% low-level transformation matrix. |
| 103 |
% |
| 104 |
% #1 = box of width/height and depth 0pt |
| 105 |
% |
| 106 |
% In essence, this command does the same as if you first said |
| 107 |
% \pgflowlevelsynccm and then \pgfqbox. However, pgf will use a |
| 108 |
% ``TeX-translation'' for the translation part of the transformation |
| 109 |
% cm. This will ensure that hyperlinks ``survive'' at least |
| 110 |
% translations. |
| 111 |
% |
| 112 |
% Example: |
| 113 |
% |
| 114 |
% \pgfqboxsynced{\mybox} |
| 115 |
|
| 116 |
\def\pgfqboxsynced#1{% |
| 117 |
\pgfsys@hboxsynced#1% |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
% Puts some text in a box and inserts it with the current |
| 122 |
% transformations applied. |
| 123 |
% |
| 124 |
% #1 = List of optional positioning. Possible values are ``left'', ``right'', |
| 125 |
% ``top'', ``bottom'' and ``base''. |
| 126 |
% #2 = TeX text. May contain verbatims. |
| 127 |
% |
| 128 |
% Example: |
| 129 |
% |
| 130 |
% \pgftransformshift{\pgfpoint{1cm}{0cm}} |
| 131 |
% \pgftext{Hello World!} |
| 132 |
|
| 133 |
\def\pgftext{\pgfutil@ifnextchar[\pgf@text{\pgf@text[]}}% |
| 134 |
\def\pgf@text[#1]{% |
| 135 |
\def\pgf@text@options{#1}% |
| 136 |
\pgf@maketext\pgf@after@text} |
| 137 |
\def\pgf@after@text{% |
| 138 |
{% |
| 139 |
\def\pgf@text@hshift{center}% |
| 140 |
\def\pgf@text@vshift{center}% |
| 141 |
\expandafter\pgf@text@setkeys\expandafter{\pgf@text@options}% |
| 142 |
\csname pgf@halign\pgf@text@hshift\endcsname% |
| 143 |
\csname pgf@valign\pgf@text@vshift\endcsname% |
| 144 |
% Protocol sizes: |
| 145 |
\pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\dp\pgf@hbox}}}% |
| 146 |
\pgf@protocolsizes{\pgf@x}{\pgf@y}% |
| 147 |
\pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\dp\pgf@hbox}}}% |
| 148 |
\pgf@protocolsizes{\pgf@x}{\pgf@y}% |
| 149 |
\pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\ht\pgf@hbox}}}% |
| 150 |
\pgf@protocolsizes{\pgf@x}{\pgf@y}% |
| 151 |
\pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\ht\pgf@hbox}}}% |
| 152 |
\pgf@protocolsizes{\pgf@x}{\pgf@y}% |
| 153 |
\pgfqboxsynced{\pgf@hbox}% |
| 154 |
}% |
| 155 |
} |
| 156 |
\def\pgf@text@setkeys{\pgfqkeys{/pgf/text}}% |
| 157 |
|
| 158 |
\pgfkeys{/pgf/text/left/.code=\def\pgf@text@hshift{left}} |
| 159 |
\pgfkeys{/pgf/text/center/.code=} |
| 160 |
\pgfkeys{/pgf/text/right/.code=\def\pgf@text@hshift{right}} |
| 161 |
\pgfkeys{/pgf/text/top/.code=\def\pgf@text@vshift{top}} |
| 162 |
\pgfkeys{/pgf/text/bottom/.code=\def\pgf@text@vshift{bottom}} |
| 163 |
\pgfkeys{/pgf/text/base/.code=\def\pgf@text@vshift{base}} |
| 164 |
\pgfkeys{/pgf/text/at/.cd,.code=\pgftransformshift{#1},.value required} |
| 165 |
\pgfkeys{/pgf/text/x/.cd,.code=\pgftransformxshift{#1},.value required} |
| 166 |
\pgfkeys{/pgf/text/y/.cd,.code=\pgftransformyshift{#1},.value required} |
| 167 |
\pgfkeys{/pgf/text/rotate/.cd,.code=\pgftransformrotate{#1},.value required} |
| 168 |
|
| 169 |
\def\pgf@halignleft{}% do nothing |
| 170 |
\def\pgf@haligncenter{\pgftransformxshift{+-.5\wd\pgf@hbox}} |
| 171 |
\def\pgf@halignright{\pgftransformxshift{+-\wd\pgf@hbox}}% |
| 172 |
\def\pgf@valignbase{}% do nothing |
| 173 |
\def\pgf@valignbottom{\pgftransformyshift{+\dp\pgf@hbox}}% |
| 174 |
\def\pgf@valigncenter{\pgftransformyshift{+.5\dp\pgf@hbox}\pgftransformyshift{+-.5\ht\pgf@hbox}}% |
| 175 |
\def\pgf@valigntop{\pgftransformyshift{+-\ht\pgf@hbox}}% |
| 176 |
|
| 177 |
|
| 178 |
% Internal function for creating a hbox. |
| 179 |
\def\pgf@maketext#1{% |
| 180 |
\def\pgf@@maketextafter{#1}% |
| 181 |
\setbox\pgf@hbox=\hbox\bgroup% |
| 182 |
\pgfinterruptpicture% |
| 183 |
\bgroup% |
| 184 |
\aftergroup\pgf@collectresetcolor% |
| 185 |
\let\next=% |
| 186 |
} |
| 187 |
\def\pgf@collectresetcolor{% |
| 188 |
\pgfutil@ifnextchar\reset@color% |
| 189 |
{\reset@color\afterassignment\pgf@collectresetcolor\let\pgf@temp=}% |
| 190 |
{\pgf@textdone}% |
| 191 |
} |
| 192 |
\def\pgf@textdone{% |
| 193 |
\endpgfinterruptpicture% |
| 194 |
\egroup% |
| 195 |
\pgf@@maketextafter% |
| 196 |
} |
| 197 |
|
| 198 |
\long\def\pgf@makehbox#1{% |
| 199 |
\setbox\pgf@hbox=\hbox{{% |
| 200 |
\pgfinterruptpicture% |
| 201 |
#1% |
| 202 |
\endpgfinterruptpicture% |
| 203 |
}}} |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
% Picture environment |
| 208 |
% |
| 209 |
% Example: |
| 210 |
% |
| 211 |
% \begin{pgfpicture} |
| 212 |
% \pgfsetendarrow{\pgfarrowto} |
| 213 |
% \pgfpathmoveto{\pgfpointxy{-0.9}{0.2}} |
| 214 |
% \pgfpathlineto{\pgfpointxy{0.9}{0.4}} |
| 215 |
% \pgfusepath{stroke} |
| 216 |
% \end{pgfpicture} |
| 217 |
|
| 218 |
\newif\ifpgfpicture |
| 219 |
|
| 220 |
\def\pgfresetboundingbox{% |
| 221 |
\global\pgf@picmaxx=-16000pt\relax% |
| 222 |
\global\pgf@picminx=16000pt\relax% |
| 223 |
\global\pgf@picmaxy=-16000pt\relax% |
| 224 |
\global\pgf@picminy=16000pt\relax% |
| 225 |
}% |
| 226 |
|
| 227 |
\def\pgfpicture{% |
| 228 |
\begingroup% |
| 229 |
\pgfpicturetrue% |
| 230 |
\global\advance\pgf@picture@serial@count by1\relax% |
| 231 |
\edef\pgfpictureid{pgfid\the\pgf@picture@serial@count}% |
| 232 |
\let\pgf@nodecallback=\pgfutil@gobble% |
| 233 |
\pgf@picmaxx=-16000pt\relax% |
| 234 |
\pgf@picminx=16000pt\relax% |
| 235 |
\pgf@picmaxy=-16000pt\relax% |
| 236 |
\pgf@picminy=16000pt\relax% |
| 237 |
\pgf@relevantforpicturesizetrue% |
| 238 |
\pgf@resetpathsizes% |
| 239 |
\pgfutil@ifnextchar\bgroup\pgf@oldpicture\pgf@picture} |
| 240 |
\def\pgf@oldpicture#1#2#3#4{% |
| 241 |
\pgfmathsetlength\pgf@picminx{#1}% |
| 242 |
\pgfmathsetlength\pgf@picminy{#2}% |
| 243 |
\pgfmathsetlength\pgf@picmaxx{#3}% |
| 244 |
\pgfmathsetlength\pgf@picmaxy{#4}% |
| 245 |
\pgf@relevantforpicturesizefalse% |
| 246 |
\pgf@picture} |
| 247 |
|
| 248 |
\def\pgf@picture{% |
| 249 |
\setbox\pgfpic\hbox to0pt\bgroup% |
| 250 |
\begingroup% |
| 251 |
\pgfsys@beginpicture% |
| 252 |
\pgfsys@beginscope% |
| 253 |
\begingroup% |
| 254 |
\pgfsetcolor{.}% |
| 255 |
\pgfsetlinewidth{0.4pt}% |
| 256 |
\pgftransformreset% |
| 257 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty% |
| 258 |
\begingroup% |
| 259 |
\let\pgf@setlengthorig=\setlength% |
| 260 |
\let\pgf@addtolengthorig=\addtolength% |
| 261 |
\let\pgf@selectfontorig=\selectfont% |
| 262 |
\let\setlength=\pgf@setlength% |
| 263 |
\let\addtolength=\pgf@addtolength% |
| 264 |
\let\selectfont=\pgf@selectfont% |
| 265 |
\nullfont\spaceskip0pt\xspaceskip0pt% |
| 266 |
\setbox\pgf@layerbox@main\hbox to0pt\bgroup% |
| 267 |
\begingroup% |
| 268 |
} |
| 269 |
\def\endpgfpicture{% |
| 270 |
\ifpgfrememberpicturepositiononpage% |
| 271 |
\hbox to0pt{\pgfsys@markposition{\pgfpictureid}}% |
| 272 |
\fi% |
| 273 |
% ok, now let's position the box |
| 274 |
\ifdim\pgf@picmaxx=-16000pt\relax% |
| 275 |
% empty picture. make size 0. |
| 276 |
\global\pgf@picmaxx=0pt\relax% |
| 277 |
\global\pgf@picminx=0pt\relax% |
| 278 |
\global\pgf@picmaxy=0pt\relax% |
| 279 |
\global\pgf@picminy=0pt\relax% |
| 280 |
\fi% |
| 281 |
% Shift baseline outside: |
| 282 |
\pgf@relevantforpicturesizefalse% |
| 283 |
\pgf@process{\pgf@baseline}% |
| 284 |
\xdef\pgf@shift@baseline{\the\pgf@y}% |
| 285 |
% |
| 286 |
\pgf@process{\pgf@trimleft}% |
| 287 |
\global\advance\pgf@x by-\pgf@picminx |
| 288 |
% prepare \hskip\pgf@trimleft@final. |
| 289 |
% note that \pgf@trimleft@final is also queried |
| 290 |
% by the pgf image externalization. |
| 291 |
\xdef\pgf@trimleft@final{-\the\pgf@x}% |
| 292 |
% |
| 293 |
\pgf@process{\pgf@trimright}% |
| 294 |
\global\advance\pgf@x by-\pgf@picmaxx |
| 295 |
% prepare \hskip\pgf@trimright@final. |
| 296 |
% note that \pgf@trimright@final is also queried |
| 297 |
% by the pgf image externalization. |
| 298 |
\xdef\pgf@trimright@final{\the\pgf@x}% |
| 299 |
% |
| 300 |
\pgf@remember@layerlist@globally |
| 301 |
\endgroup% |
| 302 |
\hss% |
| 303 |
\egroup% |
| 304 |
\pgf@restore@layerlist@from@global |
| 305 |
\pgf@insertlayers% |
| 306 |
\endgroup% |
| 307 |
\pgfsys@discardpath% |
| 308 |
\endgroup% |
| 309 |
\pgfsys@endscope% |
| 310 |
\pgfsys@endpicture% |
| 311 |
\endgroup% |
| 312 |
\hss |
| 313 |
\egroup% |
| 314 |
\pgfsys@typesetpicturebox\pgfpic% |
| 315 |
\endgroup% |
| 316 |
} |
| 317 |
|
| 318 |
\def\pgf@remember@layerlist@globally{% |
| 319 |
\global\let\pgf@layerlist@=\pgf@layerlist |
| 320 |
}% |
| 321 |
\def\pgf@restore@layerlist@from@global{% |
| 322 |
\let\pgf@layerlist=\pgf@layerlist@ |
| 323 |
}% |
| 324 |
\def\pgf@insertlayers{% |
| 325 |
\box\pgf@layerbox@main% |
| 326 |
} |
| 327 |
|
| 328 |
\def\pgf@selectfont{\pgf@selectfontorig\nullfont} |
| 329 |
|
| 330 |
\def\pgf@setlength#1#2{% these will be used only when \nullfont is active |
| 331 |
\begingroup% keep font setting local |
| 332 |
\pgfutil@selectfont% restore font |
| 333 |
\pgf@setlengthorig#1{#2}% calculate dimension (possibly using calc) |
| 334 |
\expandafter% |
| 335 |
\endgroup% |
| 336 |
\expandafter#1\expandafter=\the#1\relax} |
| 337 |
\def\pgf@addtolength#1#2{% |
| 338 |
\begingroup% keep font setting local |
| 339 |
\pgfutil@selectfont% restore font |
| 340 |
\pgf@addtolengthorig#1{#2}% calculate dimension (possibly using calc) |
| 341 |
\expandafter% |
| 342 |
\endgroup% |
| 343 |
\expandafter#1\expandafter=\the#1\relax} |
| 344 |
|
| 345 |
|
| 346 |
% Sets the baseline at the y-coordinate of a given point |
| 347 |
% |
| 348 |
% #1 = point |
| 349 |
% |
| 350 |
% Sets the baseline of the picture to the y-coordinate of a given |
| 351 |
% point. However, the point will be evaluated *at the end of the |
| 352 |
% picture*. |
| 353 |
% |
| 354 |
% Example: |
| 355 |
% |
| 356 |
% \pgfsetbaselinepointlater{\pgfpointanchor{mynode}{base}} |
| 357 |
|
| 358 |
\def\pgfsetbaselinepointlater#1{\def\pgf@baseline{#1}} |
| 359 |
|
| 360 |
|
| 361 |
% Sets the baseline at the y-coordinate of a given point, now |
| 362 |
% |
| 363 |
% #1 = point |
| 364 |
% |
| 365 |
% Sets the baseline of the picture to the y-coordinate of a given |
| 366 |
% point. |
| 367 |
% |
| 368 |
% Example: |
| 369 |
% |
| 370 |
% \pgfsetbaselinepointnow{\pgfpoint{1cm}{2pt}} |
| 371 |
|
| 372 |
\def\pgfsetbaselinepointnow#1{% |
| 373 |
\pgf@process{#1}% |
| 374 |
\edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% |
| 375 |
\pgfsetbaselinepointlater{\pgf@setter@baseline}% |
| 376 |
} |
| 377 |
|
| 378 |
\def\pgf@default@text{default}% |
| 379 |
|
| 380 |
% Sets the baseline |
| 381 |
% |
| 382 |
% #1 = baseline |
| 383 |
% |
| 384 |
% Sets the baseline of the picture. Default is the lower border, which |
| 385 |
% is the same as \pgf@picminy |
| 386 |
% |
| 387 |
% Example: |
| 388 |
% |
| 389 |
% \pgfsetbaseline{1cm+2pt} |
| 390 |
% \pgfsetbaseline{default}% resets to default value |
| 391 |
|
| 392 |
\def\pgfsetbaseline#1{% |
| 393 |
\def\pgf@temp{#1}% |
| 394 |
\ifx\pgf@temp\pgf@default@text |
| 395 |
\pgfsetbaseline{\pgf@picminy}% |
| 396 |
\else |
| 397 |
\pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}% |
| 398 |
\fi |
| 399 |
} |
| 400 |
\pgfsetbaseline{\pgf@picminy} |
| 401 |
|
| 402 |
% controls how the image externalization implements trim: |
| 403 |
\newif\ifpgf@trim@lowlevel |
| 404 |
\pgfkeys{ |
| 405 |
/pgf/trim lowlevel/.is if=pgf@trim@lowlevel, |
| 406 |
/pgf/trim lowlevel/.default=true, |
| 407 |
} |
| 408 |
|
| 409 |
% Same as the y-baseline for horizontal alignment. |
| 410 |
% The effect is different, though: it is some kind of trimming which |
| 411 |
% leaves the bounding box intact. |
| 412 |
\def\pgfsettrimleftpointlater#1{\def\pgf@trimleft{#1}} |
| 413 |
\def\pgfsettrimleftpointnow#1{% |
| 414 |
\pgf@process{#1}% |
| 415 |
\edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% |
| 416 |
\pgfsettrimleftpointlater{\pgf@setter@baseline}% |
| 417 |
} |
| 418 |
% \pgfsettrimleft{<x coord>} |
| 419 |
% or |
| 420 |
% \pgfsettrimleft{default} |
| 421 |
\def\pgfsettrimleft#1{% |
| 422 |
\def\pgf@temp{#1}% |
| 423 |
\ifx\pgf@temp\pgf@default@text |
| 424 |
\pgfsettrimleft{\pgf@picminx} |
| 425 |
\else |
| 426 |
\pgfsettrimleftpointlater{\pgfpoint{#1}{0pt}}% |
| 427 |
\fi |
| 428 |
} |
| 429 |
\pgfsettrimleft{\pgf@picminx} |
| 430 |
|
| 431 |
\def\pgfsettrimrightpointlater#1{\def\pgf@trimright{#1}} |
| 432 |
\def\pgfsettrimrightpointnow#1{% |
| 433 |
\pgf@process{#1}% |
| 434 |
\edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% |
| 435 |
\pgfsettrimrightpointlater{\pgf@setter@baseline}% |
| 436 |
} |
| 437 |
% \pgfsettrimright{<x coord>} |
| 438 |
% or |
| 439 |
% \pgfsettrimright{default} |
| 440 |
\def\pgfsettrimright#1{% |
| 441 |
\def\pgf@temp{#1}% |
| 442 |
\ifx\pgf@temp\pgf@default@text |
| 443 |
\pgfsettrimright{\pgf@picmaxx}% |
| 444 |
\else |
| 445 |
\pgfsettrimrightpointlater{\pgfpoint{#1}{0pt}}% |
| 446 |
\fi |
| 447 |
} |
| 448 |
\pgfsettrimright{\pgf@picmaxx} |
| 449 |
|
| 450 |
|
| 451 |
% Interrupt path |
| 452 |
% |
| 453 |
% Description: |
| 454 |
% |
| 455 |
% The environment can be used to insert some drawing commands while |
| 456 |
% constructing a path. The drawing commands inside the environment |
| 457 |
% will not interfere with the path being constructed ``outside.'' |
| 458 |
% However, you must ward against graphic state changes using a scope. |
| 459 |
% |
| 460 |
% Example: Draw two parallel lines |
| 461 |
% |
| 462 |
% \pgfmoveto{\pgfpoint{0cm}{0cm}} |
| 463 |
% \begin{pgfinterruptpath} |
| 464 |
% \pgfmoveto{\pgfpoint{1cm}{0cm}} |
| 465 |
% \pgfmoveto{\pgfpoint{1cm}{1cm}} |
| 466 |
% \pgfusepath{stroke} |
| 467 |
% \end{pgfinterruptpath} |
| 468 |
% \pgflineto{\pgfpoint{0cm}{1cm}} |
| 469 |
% \pgfusepath{stroke} |
| 470 |
|
| 471 |
\def\pgfinterruptpath |
| 472 |
{% |
| 473 |
\begingroup% |
| 474 |
% save all sorts of things... |
| 475 |
\edef\pgf@interrupt@savex{\the\pgf@path@lastx}% |
| 476 |
\edef\pgf@interrupt@savey{\the\pgf@path@lasty}% |
| 477 |
\pgf@getpathsizes\pgf@interrupt@pathsizes% |
| 478 |
\pgfsyssoftpath@getcurrentpath\pgf@interrupt@path% |
| 479 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty% |
| 480 |
\edef\pgfscope@linewidth{\the\pgflinewidth}% |
| 481 |
\let\pgf@interrupt@lastmoveto=\pgfsyssoftpath@lastmoveto% |
| 482 |
\begingroup% |
| 483 |
} |
| 484 |
\def\endpgfinterruptpath |
| 485 |
{% |
| 486 |
\endgroup% |
| 487 |
\global\pgflinewidth=\pgfscope@linewidth% |
| 488 |
\pgfsyssoftpath@setcurrentpath\pgf@interrupt@path% |
| 489 |
\pgf@setpathsizes\pgf@interrupt@pathsizes% |
| 490 |
\global\pgf@path@lastx=\pgf@interrupt@savex% |
| 491 |
\global\pgf@path@lasty=\pgf@interrupt@savey% |
| 492 |
\global\let\pgfsyssoftpath@lastmoveto=\pgf@interrupt@lastmoveto% |
| 493 |
\endgroup% |
| 494 |
} |
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
% Interrupt bounding box |
| 499 |
% |
| 500 |
% Description: |
| 501 |
% |
| 502 |
% The environment can be used to temporarily setup a new bounding box |
| 503 |
% computation. The bounding box will be made empty at the beginning of |
| 504 |
% the environment and will be reset to its old value after the |
| 505 |
% environment. |
| 506 |
% |
| 507 |
% Example: |
| 508 |
% |
| 509 |
% \begin{pgfinterruptboundinbox} |
| 510 |
% \pgfmoveto{\pgfpoint{1cm}{0cm}} |
| 511 |
% \pgfmoveto{\pgfpoint{1cm}{1cm}} |
| 512 |
% \pgfusepath{stroke} |
| 513 |
% \end{pgfinterruptboundinbox} |
| 514 |
|
| 515 |
\def\pgfinterruptboundingbox |
| 516 |
{% |
| 517 |
\begingroup% |
| 518 |
\edef\pgf@interrupt@savemaxx{\the\pgf@picmaxx}% |
| 519 |
\edef\pgf@interrupt@saveminx{\the\pgf@picminx}% |
| 520 |
\edef\pgf@interrupt@savemaxy{\the\pgf@picmaxy}% |
| 521 |
\edef\pgf@interrupt@saveminy{\the\pgf@picminy}% |
| 522 |
\pgf@picmaxx=-16000pt\relax% |
| 523 |
\pgf@picminx=16000pt\relax% |
| 524 |
\pgf@picmaxy=-16000pt\relax% |
| 525 |
\pgf@picminy=16000pt\relax% |
| 526 |
\pgf@size@hookedfalse% |
| 527 |
\let\pgf@path@size@hook=\pgfutil@empty% |
| 528 |
} |
| 529 |
\def\endpgfinterruptboundingbox |
| 530 |
{% |
| 531 |
\global\pgf@picmaxx=\pgf@interrupt@savemaxx% |
| 532 |
\global\pgf@picmaxy=\pgf@interrupt@savemaxy% |
| 533 |
\global\pgf@picminx=\pgf@interrupt@saveminx% |
| 534 |
\global\pgf@picminy=\pgf@interrupt@saveminy% |
| 535 |
\endgroup% |
| 536 |
} |
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
% Interrupts a picture |
| 543 |
% |
| 544 |
% Description: |
| 545 |
% |
| 546 |
% This environment interrupts a picture and temporarily returns to |
| 547 |
% normal TeX mode. All sorts of things are saved and restored by this |
| 548 |
% environment. |
| 549 |
% |
| 550 |
% WARNING: Using this environment in conjuction with low level |
| 551 |
% transformations can *strongly* upset the typesetting. Typically, the |
| 552 |
% contents of this environment should have size/height/depth 0pt in |
| 553 |
% the end. |
| 554 |
% |
| 555 |
% WARNING: This environment should only be used inside typesetting a |
| 556 |
% box and this box must in turn be inserted using \pgfqbox. |
| 557 |
% |
| 558 |
% Example: Draw two parallel lines |
| 559 |
% |
| 560 |
% \pgfmoveto{\pgfpoint{0cm}{0cm}} |
| 561 |
% \setbox\mybox=\hbox{ |
| 562 |
% \begin{pgfinterruptpicture} |
| 563 |
% This is normal text. |
| 564 |
% \begin{pgfpicture} % a subpicture |
| 565 |
% \pgfmoveto{\pgfpoint{1cm}{0cm}} |
| 566 |
% \pgfmoveto{\pgfpoint{1cm}{1cm}} |
| 567 |
% \pgfusepath{stroke} |
| 568 |
% \end{pgfpicture} |
| 569 |
% More text. |
| 570 |
% \end{pgfinterruptpicture} |
| 571 |
% } |
| 572 |
% \ht\mybox=0pt |
| 573 |
% \wd\mybox=0pt |
| 574 |
% \dp\mybox=0pt |
| 575 |
% \pgfqbox{\mybox}% |
| 576 |
% \pgfpathlineto{\pgfpoint{0cm}{1cm}} |
| 577 |
% \pgfusepath{stroke} |
| 578 |
|
| 579 |
\def\pgfinterruptpicture |
| 580 |
{% |
| 581 |
\begingroup% |
| 582 |
\pgfinterruptboundingbox% |
| 583 |
\pgftransformreset% |
| 584 |
\pgfinterruptpath% |
| 585 |
\ifx\pgf@selectfontorig\@undefined% |
| 586 |
\else% |
| 587 |
\let\setlength\pgf@setlengthorig% |
| 588 |
\let\addtolength\pgf@addtolengthorig% |
| 589 |
\let\selectfont\pgf@selectfontorig% |
| 590 |
\fi% |
| 591 |
\pgfutil@selectfont% |
| 592 |
\pgfpicturefalse% |
| 593 |
\let\pgf@positionnodelater@macro\relax% |
| 594 |
\pgf@savelayers% |
| 595 |
} |
| 596 |
\def\endpgfinterruptpicture |
| 597 |
{% |
| 598 |
\pgf@restorelayers% |
| 599 |
\endpgfinterruptpath% |
| 600 |
\endpgfinterruptboundingbox% |
| 601 |
\endgroup% |
| 602 |
} |
| 603 |
|
| 604 |
\let\pgf@savelayers=\relax |
| 605 |
\let\pgf@restorelayers=\relax |
| 606 |
|
| 607 |
\endinput |