| 1 |
% Original code copyright 2006 by Till Tantau |
| 2 |
% Extension copyright 2012-2020 by Andrew Stacey |
| 3 |
% |
| 4 |
% This file may be distributed and/or modified under |
| 5 |
% the LaTeX Project Public License |
| 6 |
% |
| 7 |
|
| 8 |
\ProvidesPackage{pgfmorepages}[2020/04/16 v1.20 multiple page manipulation] |
| 9 |
|
| 10 |
\@ifpackageloaded{pgfpages}{% |
| 11 |
\PackageWarning{pgfmorepages}{I notice that the package "pgfpages" has already been loaded. This is an extension of that package and redefines various internal pieces so the two should not be used together.} |
| 12 |
}{} |
| 13 |
|
| 14 |
|
| 15 |
\RequirePackage{pgfcore,calc} |
| 16 |
|
| 17 |
\newcount\pgf@logicalpages |
| 18 |
\newcount\pgf@physicalpages |
| 19 |
\newcount\pgf@firstshipout |
| 20 |
\newcount\pgf@lastshipout |
| 21 |
\newcount\pgf@currentshipout |
| 22 |
\newcount\pgf@cpn |
| 23 |
\newcount\pgf@clpn |
| 24 |
\newcount\pgf@cppn |
| 25 |
\newcount\pgfactualpage |
| 26 |
\newcount\pgf@shipoutnextto |
| 27 |
\newdimen\pgfphysicalheight |
| 28 |
\newdimen\pgfphysicalwidth |
| 29 |
\newif\ifpgfpagesship |
| 30 |
|
| 31 |
\pgf@shipoutnextto=0\relax |
| 32 |
\pgf@logicalpages=0\relax |
| 33 |
\pgf@physicalpages=1\relax |
| 34 |
\pgf@firstshipout=1\relax |
| 35 |
\pgf@lastshipout=1\relax |
| 36 |
\pgf@currentshipout=1\relax |
| 37 |
\pgfphysicalheight=\paperheight |
| 38 |
\pgfphysicalwidth=\paperwidth |
| 39 |
\pgfactualpage=0 |
| 40 |
\def\pgf@currentpage{1} |
| 41 |
|
| 42 |
\newif\ifpgfphysicalpageempty |
| 43 |
\newif\ifpgf@holdingphysicalpage |
| 44 |
|
| 45 |
\pgfphysicalpageemptytrue |
| 46 |
\pgf@holdingphysicalpagefalse |
| 47 |
|
| 48 |
% Define a layout |
| 49 |
% |
| 50 |
% #1 = layout name |
| 51 |
% #2 = code before options have been set |
| 52 |
% #2 = code after options have been set |
| 53 |
% |
| 54 |
% Example: |
| 55 |
% |
| 56 |
% \pgfpagesdeclarelayout{resize to}{ |
| 57 |
% \pgfpagesphysicalpageoptions{logical pages=1,physical height=\pgfpageoptionheight,physical width=\pgfpageoptionwidth} |
| 58 |
% \pgfpageslogicalpageoptions{1}{resized width=\pgfphysicalwidth,% |
| 59 |
% resized height=\pgfphysicalheight,center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}}} |
| 60 |
|
| 61 |
\let\pgfpages@layouts=\pgfutil@gobble |
| 62 |
|
| 63 |
\newcommand\pgfpagesdeclarelayout[3]{% |
| 64 |
\pgfutil@ifundefined{pgfpages@layout@#1}{% |
| 65 |
\expandafter\def\expandafter\pgfpages@layouts\expandafter{\pgfpages@layouts, #1} |
| 66 |
\expandafter\newcommand\csname pgfpages@layoutbefore@#1\endcsname{#2} |
| 67 |
\expandafter\newcommand\csname pgfpages@layout@#1\endcsname{#3} |
| 68 |
}{% |
| 69 |
\PackageWarning{pgfmorepages}{Layout #1 already defined}% |
| 70 |
}} |
| 71 |
|
| 72 |
|
| 73 |
% Use a layout |
| 74 |
% |
| 75 |
% #1 = layout name |
| 76 |
% #2 = options |
| 77 |
% |
| 78 |
% Example: |
| 79 |
% |
| 80 |
% \pgfpagesuselayout{resize to}[a4paper] |
| 81 |
|
| 82 |
\def\pgfpagesuselayout#1{\pgfutil@ifnextchar[{\pgf@pagelayout{#1}}{\pgf@pagelayout{#1}[]}} |
| 83 |
\def\pgf@pagelayout#1[#2]{% |
| 84 |
\pgfutil@ifundefined{pgfpages@layout@#1}{% |
| 85 |
\PackageError{pgfmorepages}{Page layout `#1' undefined. Currently defined layouts are: \pgfpages@layouts \pgfmorepages@extramessage}{}% |
| 86 |
}% |
| 87 |
{% |
| 88 |
\pgfpages@reset |
| 89 |
\csname pgfpages@layoutbefore@#1\endcsname |
| 90 |
\setkeys{pgfpagesuselayoutoption}{#2}% |
| 91 |
\csname pgfpages@layout@#1\endcsname |
| 92 |
}% |
| 93 |
} |
| 94 |
|
| 95 |
\def\pgfpages@reset{% |
| 96 |
\pgfshipoutphysicalpage |
| 97 |
\pgfphysicalheight=\paperheight |
| 98 |
\pgfphysicalwidth=\paperwidth |
| 99 |
\pgf@cppn=1\relax% |
| 100 |
\loop% |
| 101 |
\expandafter\let\csname pgfpages@lp@\the\pgf@cppn @skipcode\endcsname\relax |
| 102 |
\expandafter\let\csname pgfpages@lp@\the\pgf@cppn @height\endcsname\relax |
| 103 |
\expandafter\let\csname pgfpages@lp@\the\pgf@cppn @width\endcsname\relax |
| 104 |
\expandafter\let\csname pgfpages@lp@\the\pgf@cppn @copy\endcsname\relax |
| 105 |
\expandafter\let\csname pgf@lpageson@\the\pgf@cppn\endcsname=\relax |
| 106 |
\advance \pgf@cppn by 1\relax% |
| 107 |
\expandafter\unless\expandafter\ifx\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax% |
| 108 |
\repeat% |
| 109 |
\pgf@clpn=1\relax% |
| 110 |
\loop% |
| 111 |
\expandafter\let\csname pgfpages@pp@\the\pgf@clpn @skipcode\endcsname\relax |
| 112 |
\expandafter\let\csname pgfpages@box@\the\pgf@clpn\endcsname=\relax |
| 113 |
\advance \pgf@clpn by 1\relax% |
| 114 |
\expandafter\unless\expandafter\ifx\csname pgfpages@box@\the\pgf@clpn\endcsname\relax% |
| 115 |
\repeat% |
| 116 |
\pgf@cppn=1\relax% |
| 117 |
\pgf@clpn=1\relax% |
| 118 |
\loop% |
| 119 |
\loop% |
| 120 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @reheight\endcsname\relax |
| 121 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @rewidth\endcsname\relax |
| 122 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @border\endcsname\relax |
| 123 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @bordercode\endcsname\relax |
| 124 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @center\endcsname\relax |
| 125 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @cornerwidth\endcsname\relax |
| 126 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @scale\endcsname\relax% |
| 127 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @xscale\endcsname\relax% |
| 128 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @yscale\endcsname\relax% |
| 129 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @rotation\endcsname\relax% |
| 130 |
\expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @skipcode\endcsname\relax% |
| 131 |
\advance\pgf@clpn by 1\relax |
| 132 |
\expandafter\unless\expandafter\ifx\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @reheight\endcsname\relax |
| 133 |
\repeat |
| 134 |
\pgf@clpn=1\relax% |
| 135 |
\advance\pgf@cppn by 1\relax |
| 136 |
\expandafter\unless\expandafter\ifx\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @reheight\endcsname\relax |
| 137 |
\repeat |
| 138 |
} |
| 139 |
|
| 140 |
% Predefined options |
| 141 |
|
| 142 |
\define@key{pgfpagesuselayoutoption}{physical paper width}% |
| 143 |
{\def\pgfpageoptionwidth{#1}} |
| 144 |
|
| 145 |
\define@key{pgfpagesuselayoutoption}{physical paper height}% |
| 146 |
{\def\pgfpageoptionheight{#1}} |
| 147 |
|
| 148 |
\define@key{pgfpagesuselayoutoption}{a0paper}[]% |
| 149 |
{\def\pgfpageoptionheight{1189mm} \def\pgfpageoptionwidth{841mm}} |
| 150 |
|
| 151 |
\define@key{pgfpagesuselayoutoption}{a1paper}[]% |
| 152 |
{\def\pgfpageoptionheight{841mm} \def\pgfpageoptionwidth{594mm}} |
| 153 |
|
| 154 |
\define@key{pgfpagesuselayoutoption}{a2paper}[]% |
| 155 |
{\def\pgfpageoptionheight{594mm} \def\pgfpageoptionwidth{420mm}} |
| 156 |
|
| 157 |
\define@key{pgfpagesuselayoutoption}{a3paper}[]% |
| 158 |
{\def\pgfpageoptionheight{420mm} \def\pgfpageoptionwidth{297mm}} |
| 159 |
|
| 160 |
\define@key{pgfpagesuselayoutoption}{a4paper}[]% |
| 161 |
{\def\pgfpageoptionheight{297mm} \def\pgfpageoptionwidth{210mm}} |
| 162 |
|
| 163 |
\define@key{pgfpagesuselayoutoption}{a5paper}[]% |
| 164 |
{\def\pgfpageoptionheight{210mm} \def\pgfpageoptionwidth{148mm}} |
| 165 |
|
| 166 |
\define@key{pgfpagesuselayoutoption}{a6paper}[]% |
| 167 |
{\def\pgfpageoptionheight{148mm} \def\pgfpageoptionwidth{105mm}} |
| 168 |
|
| 169 |
\define@key{pgfpagesuselayoutoption}{letterpaper}[]% |
| 170 |
{\def\pgfpageoptionheight{11in} \def\pgfpageoptionwidth{8.5in}} |
| 171 |
|
| 172 |
\define@key{pgfpagesuselayoutoption}{legalpaper}[]% |
| 173 |
{\def\pgfpageoptionheight{14in} \def\pgfpageoptionwidth{8.5in}} |
| 174 |
|
| 175 |
\define@key{pgfpagesuselayoutoption}{executivepaper}[]% |
| 176 |
{\def\pgfpageoptionheight{10.5in}\def\pgfpageoptionwidth{7.25in}} |
| 177 |
|
| 178 |
\define@key{pgfpagesuselayoutoption}{landscape}[]% |
| 179 |
{ |
| 180 |
\let\pgf@temp=\pgfpageoptionwidth |
| 181 |
\let\pgfpageoptionwidth=\pgfpageoptionheight |
| 182 |
\let\pgfpageoptionheight=\pgf@temp |
| 183 |
} |
| 184 |
|
| 185 |
\define@key{pgfpagesuselayoutoption}{border shrink}% |
| 186 |
{\def\pgfpageoptionborder{#1}} |
| 187 |
|
| 188 |
\define@key{pgfpagesuselayoutoption}{border code}% |
| 189 |
{\def\pgfpageoptionbordercode{#1}} |
| 190 |
|
| 191 |
\define@key{pgfpagesuselayoutoption}{corner width}% |
| 192 |
{\def\pgfpageoptioncornerwidth{#1}} |
| 193 |
|
| 194 |
\define@key{pgfpagesuselayoutoption}{odd numbered pages right}[]% |
| 195 |
{\def\pgfpageoptionfirstshipout{2}} |
| 196 |
|
| 197 |
\define@key{pgfpagesuselayoutoption}{second right}[]% |
| 198 |
{% |
| 199 |
\def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% |
| 200 |
\def\pgfpageoptionsecondcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% |
| 201 |
\def\pgfpageoptiontwoheight{\paperheight}% |
| 202 |
\def\pgfpageoptiontwowidth{2\paperwidth}% |
| 203 |
} |
| 204 |
|
| 205 |
\define@key{pgfpagesuselayoutoption}{second left}[]% |
| 206 |
{% |
| 207 |
\def\pgfpageoptionfirstcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% |
| 208 |
\def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% |
| 209 |
\def\pgfpageoptiontwoheight{\paperheight}% |
| 210 |
\def\pgfpageoptiontwowidth{2\paperwidth}% |
| 211 |
} |
| 212 |
|
| 213 |
\define@key{pgfpagesuselayoutoption}{second top}[]% |
| 214 |
{% |
| 215 |
\def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% |
| 216 |
\def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% |
| 217 |
\def\pgfpageoptiontwoheight{2\paperheight}% |
| 218 |
\def\pgfpageoptiontwowidth{\paperwidth}% |
| 219 |
} |
| 220 |
|
| 221 |
\define@key{pgfpagesuselayoutoption}{second bottom}[]% |
| 222 |
{% |
| 223 |
\def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% |
| 224 |
\def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% |
| 225 |
\def\pgfpageoptiontwoheight{2\paperheight}% |
| 226 |
\def\pgfpageoptiontwowidth{\paperwidth}% |
| 227 |
} |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
% Predefined layouts |
| 232 |
|
| 233 |
\pgfpagesdeclarelayout{rounded corners} |
| 234 |
{ |
| 235 |
\def\pgfpageoptioncornerwidth{10pt} |
| 236 |
} |
| 237 |
{ |
| 238 |
\pgfpagesphysicalpageoptions |
| 239 |
{% |
| 240 |
logical pages=1 |
| 241 |
} |
| 242 |
\pgfpagessetdefaults{% |
| 243 |
border code=\pgfpageoptionbordercode |
| 244 |
} |
| 245 |
\pgfpageslogicalpageoptions{1} |
| 246 |
{% |
| 247 |
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight},% |
| 248 |
corner width=\pgfpageoptioncornerwidth% |
| 249 |
}% |
| 250 |
} |
| 251 |
|
| 252 |
\pgfpagesdeclarelayout{resize to} |
| 253 |
{ |
| 254 |
\def\pgfpageoptionborder{0pt} |
| 255 |
\def\pgfpageoptionbordercode{} |
| 256 |
} |
| 257 |
{ |
| 258 |
\pgfpagesphysicalpageoptions |
| 259 |
{% |
| 260 |
logical pages=1,% |
| 261 |
physical height=\pgfpageoptionheight,% |
| 262 |
physical width=\pgfpageoptionwidth% |
| 263 |
} |
| 264 |
\pgfpagessetdefaults{% |
| 265 |
border code=\pgfpageoptionbordercode |
| 266 |
} |
| 267 |
\pgfpageslogicalpageoptions{1} |
| 268 |
{% |
| 269 |
resized width=\pgfphysicalwidth,% |
| 270 |
resized height=\pgfphysicalheight,% |
| 271 |
border shrink=\pgfpageoptionborder,% |
| 272 |
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 273 |
}% |
| 274 |
} |
| 275 |
|
| 276 |
\pgfpagesdeclarelayout{two screens with lagging second} |
| 277 |
{} |
| 278 |
{ |
| 279 |
\pgfpagesphysicalpageoptions |
| 280 |
{% |
| 281 |
logical pages=2,% |
| 282 |
physical height=\pgfpageoptiontwoheight,% |
| 283 |
physical width=\pgfpageoptiontwowidth,% |
| 284 |
last logical shipout=1,% |
| 285 |
} |
| 286 |
\pgfpagessetdefaults{% |
| 287 |
border code=\pgfpageoptionbordercode |
| 288 |
} |
| 289 |
\pgfpageslogicalpageoptions{1} |
| 290 |
{% |
| 291 |
center=\pgfpageoptionfirstcenter,% |
| 292 |
}% |
| 293 |
\pgfpageslogicalpageoptions{2} |
| 294 |
{% |
| 295 |
center=\pgfpageoptionsecondcenter,% |
| 296 |
copy from=1% |
| 297 |
}% |
| 298 |
} |
| 299 |
|
| 300 |
\pgfpagesdeclarelayout{two screens with optional second} |
| 301 |
{} |
| 302 |
{ |
| 303 |
\pgfpagesphysicalpageoptions |
| 304 |
{% |
| 305 |
logical pages=2,% |
| 306 |
physical height=\pgfpageoptiontwoheight,% |
| 307 |
physical width=\pgfpageoptiontwowidth,% |
| 308 |
last logical shipout=1% |
| 309 |
} |
| 310 |
\pgfpagessetdefaults{% |
| 311 |
border code=\pgfpageoptionbordercode |
| 312 |
} |
| 313 |
\pgfpageslogicalpageoptions{1} |
| 314 |
{% |
| 315 |
center=\pgfpageoptionfirstcenter,% |
| 316 |
}% |
| 317 |
\pgfpageslogicalpageoptions{2} |
| 318 |
{% |
| 319 |
center=\pgfpageoptionsecondcenter,% |
| 320 |
copy from=2% |
| 321 |
}% |
| 322 |
} |
| 323 |
|
| 324 |
\pgfpagesdeclarelayout{2 on 1} |
| 325 |
{ |
| 326 |
\edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default |
| 327 |
\edef\pgfpageoptionwidth{\the\paperheight} |
| 328 |
\def\pgfpageoptionborder{0pt} |
| 329 |
\def\pgfpageoptionbordercode{} |
| 330 |
\def\pgfpageoptionfirstshipout{1} |
| 331 |
} |
| 332 |
{ |
| 333 |
\pgfpagesphysicalpageoptions |
| 334 |
{% |
| 335 |
logical pages=2,% |
| 336 |
physical height=\pgfpageoptionheight,% |
| 337 |
physical width=\pgfpageoptionwidth,% |
| 338 |
current logical shipout=\pgfpageoptionfirstshipout% |
| 339 |
} |
| 340 |
\pgfpagessetdefaults{% |
| 341 |
border code=\pgfpageoptionbordercode |
| 342 |
} |
| 343 |
\ifdim\paperheight>\paperwidth\relax |
| 344 |
% put side-by-side |
| 345 |
\pgfpageslogicalpageoptions{1} |
| 346 |
{% |
| 347 |
border shrink=\pgfpageoptionborder,% |
| 348 |
resized width=.5\pgfphysicalwidth,% |
| 349 |
resized height=\pgfphysicalheight,% |
| 350 |
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 351 |
}% |
| 352 |
\pgfpageslogicalpageoptions{2} |
| 353 |
{% |
| 354 |
border shrink=\pgfpageoptionborder,% |
| 355 |
resized width=.5\pgfphysicalwidth,% |
| 356 |
resized height=\pgfphysicalheight,% |
| 357 |
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 358 |
}% |
| 359 |
\else |
| 360 |
% stack on top of one another |
| 361 |
\pgfpageslogicalpageoptions{1} |
| 362 |
{% |
| 363 |
border shrink=\pgfpageoptionborder,% |
| 364 |
resized width=\pgfphysicalwidth,% |
| 365 |
resized height=.5\pgfphysicalheight,% |
| 366 |
center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 367 |
}% |
| 368 |
\pgfpageslogicalpageoptions{2} |
| 369 |
{% |
| 370 |
border shrink=\pgfpageoptionborder,% |
| 371 |
resized width=\pgfphysicalwidth,% |
| 372 |
resized height=.5\pgfphysicalheight,% |
| 373 |
center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 374 |
}% |
| 375 |
\fi |
| 376 |
} |
| 377 |
|
| 378 |
|
| 379 |
\pgfpagesdeclarelayout{4 on 1} |
| 380 |
{ |
| 381 |
\edef\pgfpageoptionheight{\the\paperheight} |
| 382 |
\edef\pgfpageoptionwidth{\the\paperwidth} |
| 383 |
\edef\pgfpageoptionborder{0pt} |
| 384 |
\def\pgfpageoptionbordercode{} |
| 385 |
} |
| 386 |
{ |
| 387 |
\pgfpagesphysicalpageoptions |
| 388 |
{% |
| 389 |
logical pages=4,% |
| 390 |
physical height=\pgfpageoptionheight,% |
| 391 |
physical width=\pgfpageoptionwidth% |
| 392 |
} |
| 393 |
\pgfpagessetdefaults{% |
| 394 |
border code=\pgfpageoptionbordercode |
| 395 |
} |
| 396 |
\pgfpageslogicalpageoptions{1} |
| 397 |
{% |
| 398 |
border shrink=\pgfpageoptionborder,% |
| 399 |
resized width=.5\pgfphysicalwidth,% |
| 400 |
resized height=.5\pgfphysicalheight,% |
| 401 |
center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 402 |
}% |
| 403 |
\pgfpageslogicalpageoptions{2} |
| 404 |
{% |
| 405 |
border shrink=\pgfpageoptionborder,% |
| 406 |
resized width=.5\pgfphysicalwidth,% |
| 407 |
resized height=.5\pgfphysicalheight,% |
| 408 |
center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 409 |
}% |
| 410 |
\pgfpageslogicalpageoptions{3} |
| 411 |
{% |
| 412 |
border shrink=\pgfpageoptionborder,% |
| 413 |
resized width=.5\pgfphysicalwidth,% |
| 414 |
resized height=.5\pgfphysicalheight,% |
| 415 |
center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 416 |
}% |
| 417 |
\pgfpageslogicalpageoptions{4} |
| 418 |
{% |
| 419 |
border shrink=\pgfpageoptionborder,% |
| 420 |
resized width=.5\pgfphysicalwidth,% |
| 421 |
resized height=.5\pgfphysicalheight,% |
| 422 |
center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 423 |
}% |
| 424 |
} |
| 425 |
|
| 426 |
\pgfpagesdeclarelayout{6 on 1} |
| 427 |
{ |
| 428 |
\edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default |
| 429 |
\edef\pgfpageoptionwidth{\the\paperheight} |
| 430 |
\def\pgfpageoptionborder{0pt} |
| 431 |
\def\pgfpageoptionbordercode{} |
| 432 |
} |
| 433 |
{ |
| 434 |
\pgfpagesphysicalpageoptions |
| 435 |
{% |
| 436 |
logical pages=6,% |
| 437 |
physical height=\pgfpageoptionheight,% |
| 438 |
physical width=\pgfpageoptionwidth% |
| 439 |
} |
| 440 |
\pgfpagessetdefaults{% |
| 441 |
border code=\pgfpageoptionbordercode |
| 442 |
} |
| 443 |
\ifdim\paperheight>\paperwidth\relax |
| 444 |
% put side-by-side |
| 445 |
\pgfpageslogicalpageoptions{1} |
| 446 |
{% |
| 447 |
border shrink=\pgfpageoptionborder,% |
| 448 |
resized width=.25\pgfphysicalwidth,% |
| 449 |
resized height=.5\pgfphysicalheight,% |
| 450 |
center=\pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 451 |
}% |
| 452 |
\pgfpageslogicalpageoptions{2} |
| 453 |
{% |
| 454 |
border shrink=\pgfpageoptionborder,% |
| 455 |
resized width=.25\pgfphysicalwidth,% |
| 456 |
resized height=.5\pgfphysicalheight,% |
| 457 |
center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 458 |
}% |
| 459 |
\pgfpageslogicalpageoptions{3} |
| 460 |
{% |
| 461 |
border shrink=\pgfpageoptionborder,% |
| 462 |
resized width=.25\pgfphysicalwidth,% |
| 463 |
resized height=.5\pgfphysicalheight,% |
| 464 |
center=\pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 465 |
}% |
| 466 |
\pgfpageslogicalpageoptions{4} |
| 467 |
{% |
| 468 |
border shrink=\pgfpageoptionborder,% |
| 469 |
resized width=.25\pgfphysicalwidth,% |
| 470 |
resized height=.5\pgfphysicalheight,% |
| 471 |
center=\pgfpoint{.167\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 472 |
}% |
| 473 |
\pgfpageslogicalpageoptions{5} |
| 474 |
{% |
| 475 |
border shrink=\pgfpageoptionborder,% |
| 476 |
resized width=.25\pgfphysicalwidth,% |
| 477 |
resized height=.5\pgfphysicalheight,% |
| 478 |
center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 479 |
}% |
| 480 |
\pgfpageslogicalpageoptions{6} |
| 481 |
{% |
| 482 |
border shrink=\pgfpageoptionborder,% |
| 483 |
resized width=.25\pgfphysicalwidth,% |
| 484 |
resized height=.5\pgfphysicalheight,% |
| 485 |
center=\pgfpoint{.833\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 486 |
}% |
| 487 |
\else |
| 488 |
% stack on top of one another |
| 489 |
\pgfpageslogicalpageoptions{1} |
| 490 |
{% |
| 491 |
border shrink=\pgfpageoptionborder,% |
| 492 |
resized width=.5\pgfphysicalwidth,% |
| 493 |
resized height=.25\pgfphysicalheight,% |
| 494 |
center=\pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}% |
| 495 |
}% |
| 496 |
\pgfpageslogicalpageoptions{2} |
| 497 |
{% |
| 498 |
border shrink=\pgfpageoptionborder,% |
| 499 |
resized width=.5\pgfphysicalwidth,% |
| 500 |
resized height=.25\pgfphysicalheight,% |
| 501 |
center=\pgfpoint{.75\pgfphysicalwidth}{.833\pgfphysicalheight}% |
| 502 |
}% |
| 503 |
\pgfpageslogicalpageoptions{3} |
| 504 |
{% |
| 505 |
border shrink=\pgfpageoptionborder,% |
| 506 |
resized width=.5\pgfphysicalwidth,% |
| 507 |
resized height=.25\pgfphysicalheight,% |
| 508 |
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 509 |
}% |
| 510 |
\pgfpageslogicalpageoptions{4} |
| 511 |
{% |
| 512 |
border shrink=\pgfpageoptionborder,% |
| 513 |
resized width=.5\pgfphysicalwidth,% |
| 514 |
resized height=.25\pgfphysicalheight,% |
| 515 |
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 516 |
}% |
| 517 |
\pgfpageslogicalpageoptions{5} |
| 518 |
{% |
| 519 |
border shrink=\pgfpageoptionborder,% |
| 520 |
resized width=.5\pgfphysicalwidth,% |
| 521 |
resized height=.25\pgfphysicalheight,% |
| 522 |
center=\pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}% |
| 523 |
}% |
| 524 |
\pgfpageslogicalpageoptions{6} |
| 525 |
{% |
| 526 |
border shrink=\pgfpageoptionborder,% |
| 527 |
resized width=.5\pgfphysicalwidth,% |
| 528 |
resized height=.25\pgfphysicalheight,% |
| 529 |
center=\pgfpoint{.75\pgfphysicalwidth}{.167\pgfphysicalheight}% |
| 530 |
}% |
| 531 |
\fi |
| 532 |
} |
| 533 |
|
| 534 |
|
| 535 |
\pgfpagesdeclarelayout{8 on 1} |
| 536 |
{ |
| 537 |
\edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default |
| 538 |
\edef\pgfpageoptionwidth{\the\paperheight} |
| 539 |
\def\pgfpageoptionborder{0pt} |
| 540 |
\def\pgfpageoptionbordercode{} |
| 541 |
} |
| 542 |
{ |
| 543 |
\pgfpagesphysicalpageoptions |
| 544 |
{% |
| 545 |
logical pages=8,% |
| 546 |
physical height=\pgfpageoptionheight,% |
| 547 |
physical width=\pgfpageoptionwidth% |
| 548 |
} |
| 549 |
\pgfpagessetdefaults{% |
| 550 |
border code=\pgfpageoptionbordercode |
| 551 |
} |
| 552 |
\ifdim\paperheight>\paperwidth\relax |
| 553 |
% put side-by-side |
| 554 |
\pgfpageslogicalpageoptions{1} |
| 555 |
{% |
| 556 |
border shrink=\pgfpageoptionborder,% |
| 557 |
resized width=.25\pgfphysicalwidth,% |
| 558 |
resized height=.5\pgfphysicalheight,% |
| 559 |
center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 560 |
}% |
| 561 |
\pgfpageslogicalpageoptions{2} |
| 562 |
{% |
| 563 |
border shrink=\pgfpageoptionborder,% |
| 564 |
resized width=.25\pgfphysicalwidth,% |
| 565 |
resized height=.5\pgfphysicalheight,% |
| 566 |
center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 567 |
}% |
| 568 |
\pgfpageslogicalpageoptions{3} |
| 569 |
{% |
| 570 |
border shrink=\pgfpageoptionborder,% |
| 571 |
resized width=.25\pgfphysicalwidth,% |
| 572 |
resized height=.5\pgfphysicalheight,% |
| 573 |
center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 574 |
}% |
| 575 |
\pgfpageslogicalpageoptions{4} |
| 576 |
{% |
| 577 |
border shrink=\pgfpageoptionborder,% |
| 578 |
resized width=.25\pgfphysicalwidth,% |
| 579 |
resized height=.5\pgfphysicalheight,% |
| 580 |
center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 581 |
}% |
| 582 |
\pgfpageslogicalpageoptions{5} |
| 583 |
{% |
| 584 |
border shrink=\pgfpageoptionborder,% |
| 585 |
resized width=.25\pgfphysicalwidth,% |
| 586 |
resized height=.5\pgfphysicalheight,% |
| 587 |
center=\pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 588 |
}% |
| 589 |
\pgfpageslogicalpageoptions{6} |
| 590 |
{% |
| 591 |
border shrink=\pgfpageoptionborder,% |
| 592 |
resized width=.25\pgfphysicalwidth,% |
| 593 |
resized height=.5\pgfphysicalheight,% |
| 594 |
center=\pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 595 |
}% |
| 596 |
\pgfpageslogicalpageoptions{7} |
| 597 |
{% |
| 598 |
border shrink=\pgfpageoptionborder,% |
| 599 |
resized width=.25\pgfphysicalwidth,% |
| 600 |
resized height=.5\pgfphysicalheight,% |
| 601 |
center=\pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 602 |
}% |
| 603 |
\pgfpageslogicalpageoptions{8} |
| 604 |
{% |
| 605 |
border shrink=\pgfpageoptionborder,% |
| 606 |
resized width=.25\pgfphysicalwidth,% |
| 607 |
resized height=.5\pgfphysicalheight,% |
| 608 |
center=\pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 609 |
}% |
| 610 |
\else |
| 611 |
% stack on top of one another |
| 612 |
\pgfpageslogicalpageoptions{1} |
| 613 |
{% |
| 614 |
border shrink=\pgfpageoptionborder,% |
| 615 |
resized width=.5\pgfphysicalwidth,% |
| 616 |
resized height=.25\pgfphysicalheight,% |
| 617 |
center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}% |
| 618 |
}% |
| 619 |
\pgfpageslogicalpageoptions{2} |
| 620 |
{% |
| 621 |
border shrink=\pgfpageoptionborder,% |
| 622 |
resized width=.5\pgfphysicalwidth,% |
| 623 |
resized height=.25\pgfphysicalheight,% |
| 624 |
center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}% |
| 625 |
}% |
| 626 |
\pgfpageslogicalpageoptions{3} |
| 627 |
{% |
| 628 |
border shrink=\pgfpageoptionborder,% |
| 629 |
resized width=.5\pgfphysicalwidth,% |
| 630 |
resized height=.25\pgfphysicalheight,% |
| 631 |
center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}% |
| 632 |
}% |
| 633 |
\pgfpageslogicalpageoptions{4} |
| 634 |
{% |
| 635 |
border shrink=\pgfpageoptionborder,% |
| 636 |
resized width=.5\pgfphysicalwidth,% |
| 637 |
resized height=.25\pgfphysicalheight,% |
| 638 |
center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}% |
| 639 |
}% |
| 640 |
\pgfpageslogicalpageoptions{5} |
| 641 |
{% |
| 642 |
border shrink=\pgfpageoptionborder,% |
| 643 |
resized width=.5\pgfphysicalwidth,% |
| 644 |
resized height=.25\pgfphysicalheight,% |
| 645 |
center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}% |
| 646 |
}% |
| 647 |
\pgfpageslogicalpageoptions{6} |
| 648 |
{% |
| 649 |
border shrink=\pgfpageoptionborder,% |
| 650 |
resized width=.5\pgfphysicalwidth,% |
| 651 |
resized height=.25\pgfphysicalheight,% |
| 652 |
center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}% |
| 653 |
}% |
| 654 |
\pgfpageslogicalpageoptions{7} |
| 655 |
{% |
| 656 |
border shrink=\pgfpageoptionborder,% |
| 657 |
resized width=.5\pgfphysicalwidth,% |
| 658 |
resized height=.25\pgfphysicalheight,% |
| 659 |
center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}% |
| 660 |
}% |
| 661 |
\pgfpageslogicalpageoptions{8} |
| 662 |
{% |
| 663 |
border shrink=\pgfpageoptionborder,% |
| 664 |
resized width=.5\pgfphysicalwidth,% |
| 665 |
resized height=.25\pgfphysicalheight,% |
| 666 |
center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}% |
| 667 |
}% |
| 668 |
\fi |
| 669 |
} |
| 670 |
|
| 671 |
|
| 672 |
\pgfpagesdeclarelayout{16 on 1} |
| 673 |
{ |
| 674 |
\edef\pgfpageoptionheight{\the\paperheight} |
| 675 |
\edef\pgfpageoptionwidth{\the\paperwidth} |
| 676 |
\edef\pgfpageoptionborder{0pt} |
| 677 |
\def\pgfpageoptionbordercode{} |
| 678 |
} |
| 679 |
{ |
| 680 |
\pgfpagesphysicalpageoptions |
| 681 |
{% |
| 682 |
logical pages=16,% |
| 683 |
physical height=\pgfpageoptionheight,% |
| 684 |
physical width=\pgfpageoptionwidth% |
| 685 |
} |
| 686 |
\pgfpagessetdefaults{% |
| 687 |
border code=\pgfpageoptionbordercode |
| 688 |
} |
| 689 |
\pgfpageslogicalpageoptions{1} |
| 690 |
{% |
| 691 |
border shrink=\pgfpageoptionborder,% |
| 692 |
resized width=.25\pgfphysicalwidth,% |
| 693 |
resized height=.25\pgfphysicalheight,% |
| 694 |
center=\pgfpoint{.125\pgfphysicalwidth}{.875\pgfphysicalheight}% |
| 695 |
}% |
| 696 |
\pgfpageslogicalpageoptions{2} |
| 697 |
{% |
| 698 |
border shrink=\pgfpageoptionborder,% |
| 699 |
resized width=.25\pgfphysicalwidth,% |
| 700 |
resized height=.25\pgfphysicalheight,% |
| 701 |
center=\pgfpoint{.375\pgfphysicalwidth}{.875\pgfphysicalheight}% |
| 702 |
}% |
| 703 |
\pgfpageslogicalpageoptions{3} |
| 704 |
{% |
| 705 |
border shrink=\pgfpageoptionborder,% |
| 706 |
resized width=.25\pgfphysicalwidth,% |
| 707 |
resized height=.25\pgfphysicalheight,% |
| 708 |
center=\pgfpoint{.625\pgfphysicalwidth}{.875\pgfphysicalheight}% |
| 709 |
}% |
| 710 |
\pgfpageslogicalpageoptions{4} |
| 711 |
{% |
| 712 |
border shrink=\pgfpageoptionborder,% |
| 713 |
resized width=.25\pgfphysicalwidth,% |
| 714 |
resized height=.25\pgfphysicalheight,% |
| 715 |
center=\pgfpoint{.875\pgfphysicalwidth}{.875\pgfphysicalheight}% |
| 716 |
}% |
| 717 |
\pgfpageslogicalpageoptions{5} |
| 718 |
{% |
| 719 |
border shrink=\pgfpageoptionborder,% |
| 720 |
resized width=.25\pgfphysicalwidth,% |
| 721 |
resized height=.25\pgfphysicalheight,% |
| 722 |
center=\pgfpoint{.125\pgfphysicalwidth}{.625\pgfphysicalheight}% |
| 723 |
}% |
| 724 |
\pgfpageslogicalpageoptions{6} |
| 725 |
{% |
| 726 |
border shrink=\pgfpageoptionborder,% |
| 727 |
resized width=.25\pgfphysicalwidth,% |
| 728 |
resized height=.25\pgfphysicalheight,% |
| 729 |
center=\pgfpoint{.375\pgfphysicalwidth}{.625\pgfphysicalheight}% |
| 730 |
}% |
| 731 |
\pgfpageslogicalpageoptions{7} |
| 732 |
{% |
| 733 |
border shrink=\pgfpageoptionborder,% |
| 734 |
resized width=.25\pgfphysicalwidth,% |
| 735 |
resized height=.25\pgfphysicalheight,% |
| 736 |
center=\pgfpoint{.625\pgfphysicalwidth}{.625\pgfphysicalheight}% |
| 737 |
}% |
| 738 |
\pgfpageslogicalpageoptions{8} |
| 739 |
{% |
| 740 |
border shrink=\pgfpageoptionborder,% |
| 741 |
resized width=.25\pgfphysicalwidth,% |
| 742 |
resized height=.25\pgfphysicalheight,% |
| 743 |
center=\pgfpoint{.875\pgfphysicalwidth}{.625\pgfphysicalheight}% |
| 744 |
}% |
| 745 |
\pgfpageslogicalpageoptions{9} |
| 746 |
{% |
| 747 |
border shrink=\pgfpageoptionborder,% |
| 748 |
resized width=.25\pgfphysicalwidth,% |
| 749 |
resized height=.25\pgfphysicalheight,% |
| 750 |
center=\pgfpoint{.125\pgfphysicalwidth}{.375\pgfphysicalheight}% |
| 751 |
}% |
| 752 |
\pgfpageslogicalpageoptions{10} |
| 753 |
{% |
| 754 |
border shrink=\pgfpageoptionborder,% |
| 755 |
resized width=.25\pgfphysicalwidth,% |
| 756 |
resized height=.25\pgfphysicalheight,% |
| 757 |
center=\pgfpoint{.375\pgfphysicalwidth}{.375\pgfphysicalheight}% |
| 758 |
}% |
| 759 |
\pgfpageslogicalpageoptions{11} |
| 760 |
{% |
| 761 |
border shrink=\pgfpageoptionborder,% |
| 762 |
resized width=.25\pgfphysicalwidth,% |
| 763 |
resized height=.25\pgfphysicalheight,% |
| 764 |
center=\pgfpoint{.625\pgfphysicalwidth}{.375\pgfphysicalheight}% |
| 765 |
}% |
| 766 |
\pgfpageslogicalpageoptions{12} |
| 767 |
{% |
| 768 |
border shrink=\pgfpageoptionborder,% |
| 769 |
resized width=.25\pgfphysicalwidth,% |
| 770 |
resized height=.25\pgfphysicalheight,% |
| 771 |
center=\pgfpoint{.875\pgfphysicalwidth}{.375\pgfphysicalheight}% |
| 772 |
}% |
| 773 |
\pgfpageslogicalpageoptions{13} |
| 774 |
{% |
| 775 |
border shrink=\pgfpageoptionborder,% |
| 776 |
resized width=.25\pgfphysicalwidth,% |
| 777 |
resized height=.25\pgfphysicalheight,% |
| 778 |
center=\pgfpoint{.125\pgfphysicalwidth}{.125\pgfphysicalheight}% |
| 779 |
}% |
| 780 |
\pgfpageslogicalpageoptions{14} |
| 781 |
{% |
| 782 |
border shrink=\pgfpageoptionborder,% |
| 783 |
resized width=.25\pgfphysicalwidth,% |
| 784 |
resized height=.25\pgfphysicalheight,% |
| 785 |
center=\pgfpoint{.375\pgfphysicalwidth}{.125\pgfphysicalheight}% |
| 786 |
}% |
| 787 |
\pgfpageslogicalpageoptions{15} |
| 788 |
{% |
| 789 |
border shrink=\pgfpageoptionborder,% |
| 790 |
resized width=.25\pgfphysicalwidth,% |
| 791 |
resized height=.25\pgfphysicalheight,% |
| 792 |
center=\pgfpoint{.625\pgfphysicalwidth}{.125\pgfphysicalheight}% |
| 793 |
}% |
| 794 |
\pgfpageslogicalpageoptions{16} |
| 795 |
{% |
| 796 |
border shrink=\pgfpageoptionborder,% |
| 797 |
resized width=.25\pgfphysicalwidth,% |
| 798 |
resized height=.25\pgfphysicalheight,% |
| 799 |
center=\pgfpoint{.875\pgfphysicalwidth}{.125\pgfphysicalheight}% |
| 800 |
}% |
| 801 |
} |
| 802 |
|
| 803 |
\pgfpagesdeclarelayout{4 on 2, odd then even}% |
| 804 |
{% |
| 805 |
\edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default |
| 806 |
\edef\pgfpageoptionwidth{\the\paperheight} |
| 807 |
\def\pgfpageoptionborder{0pt} |
| 808 |
\def\pgfpageoptionbordercode{} |
| 809 |
\def\pgfpageoptionfirstshipout{1} |
| 810 |
}% |
| 811 |
{% |
| 812 |
\pgfpagesphysicalpageoptions |
| 813 |
{% |
| 814 |
logical pages=4,% |
| 815 |
physical pages=2,% |
| 816 |
physical height=\pgfpageoptionheight,% |
| 817 |
physical width=\pgfpageoptionwidth,% |
| 818 |
current logical shipout=\pgfpageoptionfirstshipout% |
| 819 |
} |
| 820 |
\pgfpagessetdefaults{% |
| 821 |
border code=\pgfpageoptionbordercode |
| 822 |
} |
| 823 |
\ifdim\paperheight>\paperwidth\relax |
| 824 |
% put side-by-side |
| 825 |
\pgfpagesphysicalpage{1}{} |
| 826 |
\pgfpageslogicalpageoptions{1} |
| 827 |
{% |
| 828 |
border shrink=\pgfpageoptionborder,% |
| 829 |
resized width=.5\pgfphysicalwidth,% |
| 830 |
resized height=\pgfphysicalheight,% |
| 831 |
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 832 |
}% |
| 833 |
\pgfpageslogicalpageoptions{3} |
| 834 |
{% |
| 835 |
border shrink=\pgfpageoptionborder,% |
| 836 |
resized width=.5\pgfphysicalwidth,% |
| 837 |
resized height=\pgfphysicalheight,% |
| 838 |
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 839 |
}% |
| 840 |
\pgfpagesphysicalpage{2}{} |
| 841 |
\pgfpageslogicalpageoptions{2} |
| 842 |
{% |
| 843 |
border shrink=\pgfpageoptionborder,% |
| 844 |
resized width=.5\pgfphysicalwidth,% |
| 845 |
resized height=\pgfphysicalheight,% |
| 846 |
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 847 |
}% |
| 848 |
\pgfpageslogicalpageoptions{4} |
| 849 |
{% |
| 850 |
border shrink=\pgfpageoptionborder,% |
| 851 |
resized width=.5\pgfphysicalwidth,% |
| 852 |
resized height=\pgfphysicalheight,% |
| 853 |
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 854 |
}% |
| 855 |
\else |
| 856 |
% stack on top of one another |
| 857 |
\pgfpagesphysicalpage{1}{} |
| 858 |
\pgfpageslogicalpageoptions{1} |
| 859 |
{% |
| 860 |
border shrink=\pgfpageoptionborder,% |
| 861 |
resized width=\pgfphysicalwidth,% |
| 862 |
resized height=.5\pgfphysicalheight,% |
| 863 |
center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 864 |
}% |
| 865 |
\pgfpageslogicalpageoptions{3} |
| 866 |
{% |
| 867 |
border shrink=\pgfpageoptionborder,% |
| 868 |
resized width=\pgfphysicalwidth,% |
| 869 |
resized height=.5\pgfphysicalheight,% |
| 870 |
center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 871 |
}% |
| 872 |
\pgfpagesphysicalpage{2}{} |
| 873 |
\pgfpageslogicalpageoptions{2} |
| 874 |
{% |
| 875 |
border shrink=\pgfpageoptionborder,% |
| 876 |
resized width=\pgfphysicalwidth,% |
| 877 |
resized height=.5\pgfphysicalheight,% |
| 878 |
center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 879 |
}% |
| 880 |
\pgfpageslogicalpageoptions{4} |
| 881 |
{% |
| 882 |
border shrink=\pgfpageoptionborder,% |
| 883 |
resized width=\pgfphysicalwidth,% |
| 884 |
resized height=.5\pgfphysicalheight,% |
| 885 |
center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 886 |
}% |
| 887 |
\fi |
| 888 |
} |
| 889 |
|
| 890 |
\pgfpagesdeclarelayout{4 on 2, even then odd}% |
| 891 |
{% |
| 892 |
\edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default |
| 893 |
\edef\pgfpageoptionwidth{\the\paperheight} |
| 894 |
\def\pgfpageoptionborder{0pt} |
| 895 |
\def\pgfpageoptionbordercode{} |
| 896 |
\def\pgfpageoptionfirstshipout{1} |
| 897 |
}% |
| 898 |
{% |
| 899 |
\pgfpagesphysicalpageoptions |
| 900 |
{% |
| 901 |
logical pages=4,% |
| 902 |
physical pages=2,% |
| 903 |
physical height=\pgfpageoptionheight,% |
| 904 |
physical width=\pgfpageoptionwidth,% |
| 905 |
current logical shipout=\pgfpageoptionfirstshipout% |
| 906 |
} |
| 907 |
\pgfpagessetdefaults{% |
| 908 |
border code=\pgfpageoptionbordercode |
| 909 |
} |
| 910 |
\ifdim\paperheight>\paperwidth\relax |
| 911 |
% put side-by-side |
| 912 |
\pgfpagesphysicalpage{2}{} |
| 913 |
\pgfpageslogicalpageoptions{1} |
| 914 |
{% |
| 915 |
border shrink=\pgfpageoptionborder,% |
| 916 |
resized width=.5\pgfphysicalwidth,% |
| 917 |
resized height=\pgfphysicalheight,% |
| 918 |
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 919 |
}% |
| 920 |
\pgfpageslogicalpageoptions{3} |
| 921 |
{% |
| 922 |
border shrink=\pgfpageoptionborder,% |
| 923 |
resized width=.5\pgfphysicalwidth,% |
| 924 |
resized height=\pgfphysicalheight,% |
| 925 |
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 926 |
}% |
| 927 |
\pgfpagesphysicalpage{1}{} |
| 928 |
\pgfpageslogicalpageoptions{2} |
| 929 |
{% |
| 930 |
border shrink=\pgfpageoptionborder,% |
| 931 |
resized width=.5\pgfphysicalwidth,% |
| 932 |
resized height=\pgfphysicalheight,% |
| 933 |
center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 934 |
}% |
| 935 |
\pgfpageslogicalpageoptions{4} |
| 936 |
{% |
| 937 |
border shrink=\pgfpageoptionborder,% |
| 938 |
resized width=.5\pgfphysicalwidth,% |
| 939 |
resized height=\pgfphysicalheight,% |
| 940 |
center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% |
| 941 |
}% |
| 942 |
\else |
| 943 |
% stack on top of one another |
| 944 |
\pgfpagesphysicalpage{2}{} |
| 945 |
\pgfpageslogicalpageoptions{1} |
| 946 |
{% |
| 947 |
border shrink=\pgfpageoptionborder,% |
| 948 |
resized width=\pgfphysicalwidth,% |
| 949 |
resized height=.5\pgfphysicalheight,% |
| 950 |
center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 951 |
}% |
| 952 |
\pgfpageslogicalpageoptions{3} |
| 953 |
{% |
| 954 |
border shrink=\pgfpageoptionborder,% |
| 955 |
resized width=\pgfphysicalwidth,% |
| 956 |
resized height=.5\pgfphysicalheight,% |
| 957 |
center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 958 |
}% |
| 959 |
\pgfpagesphysicalpage{1}{} |
| 960 |
\pgfpageslogicalpageoptions{2} |
| 961 |
{% |
| 962 |
border shrink=\pgfpageoptionborder,% |
| 963 |
resized width=\pgfphysicalwidth,% |
| 964 |
resized height=.5\pgfphysicalheight,% |
| 965 |
center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% |
| 966 |
}% |
| 967 |
\pgfpageslogicalpageoptions{4} |
| 968 |
{% |
| 969 |
border shrink=\pgfpageoptionborder,% |
| 970 |
resized width=\pgfphysicalwidth,% |
| 971 |
resized height=.5\pgfphysicalheight,% |
| 972 |
center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% |
| 973 |
}% |
| 974 |
\fi |
| 975 |
} |
| 976 |
|
| 977 |
% Load more layouts |
| 978 |
|
| 979 |
\def\pgfmorepages@extramessage{. Extra layouts can be loaded with the command \string\pgfmorepagesloadextralayouts} |
| 980 |
\newcommand\pgfmorepagesloadextralayouts{% |
| 981 |
\input{pgfmorepageslayouts.code.tex}% |
| 982 |
\def\pgfmorepages@extramessage{}% |
| 983 |
} |
| 984 |
|
| 985 |
% Change/set main option |
| 986 |
% |
| 987 |
% #1 = options |
| 988 |
% |
| 989 |
% Options: |
| 990 |
% |
| 991 |
% logical pages = number of logical pages per physical page |
| 992 |
% logical shipouts = number of shipouts needed to fill a physical page |
| 993 |
% (may be less than the number of logical pages, |
| 994 |
% if some logical pages are calculated |
| 995 |
% automatically) |
| 996 |
% current logical shipout = number of logical shipout that will come |
| 997 |
% next. |
| 998 |
% |
| 999 |
% Example: |
| 1000 |
% |
| 1001 |
% \pgfpagesphysicalpageoptions{logical pages=2,logical shipouts=1} |
| 1002 |
|
| 1003 |
\newcommand\pgfpagesphysicalpageoptions[1]{% |
| 1004 |
\pgf@lastshipout=0\relax% |
| 1005 |
\pgf@currentshipout=0\relax% |
| 1006 |
\setkeys{pgfpages@main}{#1}% |
| 1007 |
\ifnum\pgf@lastshipout=0\relax%not set |
| 1008 |
\pgf@lastshipout=\pgf@logicalpages% |
| 1009 |
\fi% |
| 1010 |
\ifnum\pgf@currentshipout=0\relax%not set |
| 1011 |
\pgf@currentshipout=\pgf@firstshipout% |
| 1012 |
\fi% |
| 1013 |
} |
| 1014 |
|
| 1015 |
\define@key{pgfpages@main}{logical pages}{\pgf@logicalpages=#1\relax} |
| 1016 |
\define@key{pgfpages@main}{physical pages}{\pgf@physicalpages=#1\relax} |
| 1017 |
\define@key{pgfpages@main}{first logical shipout}{\pgf@firstshipout=#1\relax} |
| 1018 |
\define@key{pgfpages@main}{last logical shipout}{\pgf@lastshipout=#1\relax} |
| 1019 |
\define@key{pgfpages@main}{current logical shipout}{\pgf@currentshipout=#1\relax} |
| 1020 |
\define@key{pgfpages@main}{physical height}{\pgfphysicalheight=#1\relax} |
| 1021 |
\define@key{pgfpages@main}{physical width}{\pgfphysicalwidth=#1\relax} |
| 1022 |
|
| 1023 |
|
| 1024 |
|
| 1025 |
% Setup/change parameters of a logical page. You must call this |
| 1026 |
% macro for each logical page. |
| 1027 |
% |
| 1028 |
% #1 = logical page number |
| 1029 |
% #2 = options |
| 1030 |
% |
| 1031 |
% Options: |
| 1032 |
% |
| 1033 |
% original height = height of the logical page (\paperheight at point of |
| 1034 |
% first invocation by default) |
| 1035 |
% original width = width of the logical page (\paperwidth by default) |
| 1036 |
% resized height = height of the logical page after resizing |
| 1037 |
% resized width = width of the logical page after resizing |
| 1038 |
% border shrink = length that is subtracted from resized height and |
| 1039 |
% resized width |
| 1040 |
% border code = pgf commands to be used for drawing a border (a |
| 1041 |
% path with the border set will already have been |
| 1042 |
% set) |
| 1043 |
% rounded corners = clip the frame against a rectangle of the size of |
| 1044 |
% the frame with corners of the given radius |
| 1045 |
% scale = factor by which the page is enlarged/shrunk |
| 1046 |
% center = center of the logical page in the physical page |
| 1047 |
% rotation = degree by which the page is rotated around its center |
| 1048 |
% xscale = scale only x-axis (use -1 to flip along y-axis) |
| 1049 |
% yscale = scale only y-axis (use -1 to flip along x-axis) |
| 1050 |
% copy from = copy the contents from this logical page of the |
| 1051 |
% previous physical page, if no contents is specified |
| 1052 |
% |
| 1053 |
% If more than one of the three options ``resized height'', ``resized |
| 1054 |
% width'' and ``scale'' are given, the smallest resulting scaling |
| 1055 |
% wins. |
| 1056 |
% |
| 1057 |
% Example: |
| 1058 |
% |
| 1059 |
% \pgfpageslogicalpageoptions{1}{scale=0.5,center=\pgfpoint{0cm}{2cm}} |
| 1060 |
% \pgfpageslogicalpageoptions{1 on 2}{scale=0.5,center=\pgfpoint{0cm}{2cm}} |
| 1061 |
|
| 1062 |
\newcommand\pgfpageslogicalpageoptions[2]{% |
| 1063 |
% First step is to work out which physical page and which logical page we're dealing with. |
| 1064 |
% This could be set via the first argument if it is of the form ``x on y'': this means ``logical page x on physical page y''. |
| 1065 |
% Or we could set the physical page beforehand via the \pgfpagesphysicalpage macro. |
| 1066 |
\pgfutil@in@{on}{#1}% |
| 1067 |
\ifpgfutil@in@ |
| 1068 |
\pgf@mp@seplp#1\relax |
| 1069 |
\else |
| 1070 |
\pgf@clpn=#1\relax% |
| 1071 |
\pgf@cppn=\pgf@currentpage\relax% |
| 1072 |
\fi |
| 1073 |
% Make sure we have the box for this logical page. |
| 1074 |
\expandafter\ifx\csname pgfpages@box@\the\pgf@clpn\endcsname\relax% |
| 1075 |
\expandafter\newbox\csname pgfpages@box@\the\pgf@clpn\endcsname% |
| 1076 |
\pgf@elpsetcurrent{height}{\the\paperheight}% |
| 1077 |
\pgf@elpsetcurrent{width}{\the\paperwidth}% |
| 1078 |
\fi |
| 1079 |
% Now set the count \pgf@cpn so that it is the number of logical pages on this particular physical page. |
| 1080 |
\expandafter\ifx\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax |
| 1081 |
\expandafter\def\csname pgf@lpageson@\the\pgf@cppn\endcsname{1}% |
| 1082 |
\else |
| 1083 |
\expandafter\edef\csname pgf@lpageson@\the\pgf@cppn\endcsname{\number\numexpr\csname pgf@lpageson@\the\pgf@cppn\endcsname + 1\relax}% |
| 1084 |
\fi |
| 1085 |
\pgf@cpn=\numexpr\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax |
| 1086 |
\pgf@epsetcurrent{logicalpage}{\the\pgf@clpn}% |
| 1087 |
\pgfpages@processdefaults |
| 1088 |
\setkeys{pgfpages@page}{#2}% |
| 1089 |
\pgf@calculateresizes{height}% |
| 1090 |
\pgf@calculateresizes{width}% |
| 1091 |
\pgfsetupphysicalpagesizes% |
| 1092 |
} |
| 1093 |
|
| 1094 |
\def\pgf@mp@seplp#1on#2\relax{% |
| 1095 |
\pgf@cpn=#1\relax |
| 1096 |
\pgf@cppn=#2\relax |
| 1097 |
} |
| 1098 |
|
| 1099 |
% Set the current default physical page for the logical page options |
| 1100 |
\newcommand\pgfpagesphysicalpage[2]{% |
| 1101 |
\edef\pgf@currentpage{#1}% |
| 1102 |
\pgf@cppn=#1\relax |
| 1103 |
\setkeys{pgfpages@ppage}{#2}% |
| 1104 |
} |
| 1105 |
|
| 1106 |
% Set some defaults |
| 1107 |
\newcommand\pgfpagessetdefaults[1]{% |
| 1108 |
\def\pgf@defaults{#1}} |
| 1109 |
\def\pgf@defaults{} |
| 1110 |
|
| 1111 |
\def\pgfpages@processdefaults{% |
| 1112 |
\def\pgf@temp{\setkeys{pgfpages@page}}% |
| 1113 |
\expandafter\pgf@temp\expandafter{\pgf@defaults}% |
| 1114 |
} |
| 1115 |
|
| 1116 |
% Set and get options for a particular logical page on a particular physical page. |
| 1117 |
\def\pgf@epset#1#2#3#4{\expandafter\edef\csname pgfpages@p@#1@#2@#3\endcsname{#4}} |
| 1118 |
\def\pgf@pset#1#2#3#4{\expandafter\def\csname pgfpages@p@#1@#2@#3\endcsname{#4}} |
| 1119 |
\def\pgf@pget#1#2#3{\csname pgfpages@p@#1@#2@#3\endcsname} |
| 1120 |
\def\pgf@epsetcurrent#1#2{\pgf@epset{\the\pgf@cpn}{\the\pgf@cppn}{#1}{#2}} |
| 1121 |
\def\pgf@psetcurrent#1#2{\pgf@pset{\the\pgf@cpn}{\the\pgf@cppn}{#1}{#2}} |
| 1122 |
\def\pgf@pgetcurrent#1{\pgf@pget{\the\pgf@cpn}{\the\pgf@cppn}{#1}} |
| 1123 |
|
| 1124 |
% Set and get options for a particular logical page. |
| 1125 |
\def\pgf@elpset#1#2#3{\expandafter\edef\csname pgfpages@lp@#1@#2\endcsname{#3}} |
| 1126 |
\def\pgf@lpset#1#2#3{\expandafter\def\csname pgfpages@lp@#1@#2\endcsname{#3}} |
| 1127 |
\def\pgf@lpget#1#2{\csname pgfpages@lp@#1@#2\endcsname} |
| 1128 |
\def\pgf@elpsetcurrent#1#2{\pgf@elpset{\the\pgf@clpn}{#1}{#2}} |
| 1129 |
\def\pgf@lpsetcurrent#1#2{\pgf@lpset{\the\pgf@clpn}{#1}{#2}} |
| 1130 |
\def\pgf@lpgetcurrent#1{\pgf@lpget{\the\pgf@clpn}{#1}} |
| 1131 |
|
| 1132 |
% Set and get options for a particular physical page. |
| 1133 |
\def\pgf@eppset#1#2#3{\expandafter\edef\csname pgfpages@pp@#1@#2\endcsname{#3}} |
| 1134 |
\def\pgf@ppset#1#2#3{\expandafter\def\csname pgfpages@pp@#1@#2\endcsname{#3}} |
| 1135 |
\def\pgf@ppget#1#2{\csname pgfpages@pp@#1@#2\endcsname} |
| 1136 |
\def\pgf@eppsetcurrent#1#2{\pgf@eppset{\the\pgf@cppn}{#1}{#2}} |
| 1137 |
\def\pgf@ppsetcurrent#1#2{\pgf@ppset{\the\pgf@cppn}{#1}{#2}} |
| 1138 |
\def\pgf@ppgetcurrent#1{\pgf@ppget{\the\pgf@cppn}{#1}} |
| 1139 |
|
| 1140 |
\define@key{pgfpages@page}{skip code}{\pgf@psetcurrent{skipcode}{#1}} |
| 1141 |
\define@key{pgfpages@page}{scale}{\pgf@epsetcurrent{scale}{#1}} |
| 1142 |
\define@key{pgfpages@page}{xscale}{\pgf@epsetcurrent{xscale}{#1}} |
| 1143 |
\define@key{pgfpages@page}{yscale}{\pgf@epsetcurrent{yscale}{#1}} |
| 1144 |
\define@key{pgfpages@page}{original height}{\pgf@elpsetcurrent{height}{#1}} |
| 1145 |
\define@key{pgfpages@page}{original width}{\pgf@elpsetcurrent{width}{#1}} |
| 1146 |
\define@key{pgfpages@page}{resized height}{\pgf@epsetcurrent{reheight}{#1}} |
| 1147 |
\define@key{pgfpages@page}{resized width}{\pgf@epsetcurrent{rewidth}{#1}} |
| 1148 |
\define@key{pgfpages@page}{center}{\pgf@psetcurrent{center}{#1}} |
| 1149 |
\define@key{pgfpages@page}{rotation}{\pgf@epsetcurrent{rotation}{#1}} |
| 1150 |
\define@key{pgfpages@page}{copy from}{\pgf@elpsetcurrent{copy}{#1}} |
| 1151 |
\define@key{pgfpages@page}{border shrink}{\pgf@epsetcurrent{border}{#1}} |
| 1152 |
\define@key{pgfpages@page}{border code}{\pgf@psetcurrent{bordercode}{#1}} |
| 1153 |
\define@key{pgfpages@page}{corner width}{\pgf@psetcurrent{cornerwidth}{#1}} |
| 1154 |
|
| 1155 |
\define@key{pgfpages@ppage}{skip code}{\pgf@ppsetcurrent{skipcode}{#1}} |
| 1156 |
\define@key{pgfpages@ppage}{defaults}{\pgfpagessetdefaults{#1}} |
| 1157 |
|
| 1158 |
\def\pgf@calculateresizes#1{% |
| 1159 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @re#1\endcsname\relax% |
| 1160 |
\else% |
| 1161 |
\expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @re#1\endcsname\relax% |
| 1162 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @border\endcsname\relax% |
| 1163 |
\else% |
| 1164 |
\expandafter\pgfutil@tempdimb\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @border\endcsname\relax% |
| 1165 |
\advance\pgfutil@tempdima by-2\pgfutil@tempdimb\relax% |
| 1166 |
\fi% |
| 1167 |
\expandafter\pgfutil@tempdimb\csname pgfpages@lp@\the\pgf@clpn @#1\endcsname\relax% |
| 1168 |
\pgfutil@tempcnta=\pgfutil@tempdimb% |
| 1169 |
\divide\pgfutil@tempcnta by 65536\relax% |
| 1170 |
\ifnum\pgfutil@tempcnta=0\relax% |
| 1171 |
\pgfutil@tempcnta=1\relax% |
| 1172 |
\fi% |
| 1173 |
\divide\pgfutil@tempdima by\pgfutil@tempcnta\relax% |
| 1174 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname\relax% |
| 1175 |
\pgfutil@tempdimb=10000pt% |
| 1176 |
\else% |
| 1177 |
\expandafter\pgfutil@tempdimb\expandafter=\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname pt\relax% |
| 1178 |
\fi% |
| 1179 |
\ifdim\pgfutil@tempdima<\pgfutil@tempdimb% |
| 1180 |
\edef\pgf@temp{{scale}{\expandafter\Pgf@geT\the\pgfutil@tempdima}}% |
| 1181 |
\expandafter\pgf@psetcurrent\pgf@temp% |
| 1182 |
\fi% |
| 1183 |
\fi% |
| 1184 |
} |
| 1185 |
|
| 1186 |
|
| 1187 |
|
| 1188 |
% Shipout a physical page immediately |
| 1189 |
% |
| 1190 |
% Example: |
| 1191 |
% |
| 1192 |
% \pgfshipoutphysicalpage |
| 1193 |
|
| 1194 |
|
| 1195 |
\newcommand\pgfshipoutphysicalpage{% |
| 1196 |
\ifnum\pgf@logicalpages>0\relax% |
| 1197 |
\pgf@cppn=1\relax% |
| 1198 |
\loop% |
| 1199 |
\global\advance\pgfactualpage by 1\relax |
| 1200 |
\pgfpagesshiptrue |
| 1201 |
\csname pgfpages@pp@\the\pgf@cppn @skipcode\endcsname |
| 1202 |
\ifpgfpagesship |
| 1203 |
\pgfpages@buildshipoutbox% |
| 1204 |
\pgfpages@shipoutshipoutbox% |
| 1205 |
\fi |
| 1206 |
\ifnum\pgf@cppn<\pgf@physicalpages% |
| 1207 |
\advance \pgf@cppn by 1\relax |
| 1208 |
\repeat% |
| 1209 |
\pgfpages@performcopying% |
| 1210 |
\global\pgfphysicalpageemptytrue% |
| 1211 |
\global\pgf@holdingphysicalpagefalse% |
| 1212 |
\fi% |
| 1213 |
} |
| 1214 |
|
| 1215 |
\newbox\pgfpages@shipoutbox |
| 1216 |
|
| 1217 |
\def\pgfpages@buildshipoutbox{% |
| 1218 |
\setbox\pgfpages@shipoutbox=\vbox{{% |
| 1219 |
\set@typeset@protect% |
| 1220 |
\offinterlineskip% |
| 1221 |
\pgfsys@beginpicture% |
| 1222 |
\pgf@cpn=1\relax% |
| 1223 |
\loop% |
| 1224 |
\pgfpagesshiptrue |
| 1225 |
\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @skipcode\endcsname |
| 1226 |
\ifpgfpagesship |
| 1227 |
\pgf@clpn=\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @logicalpage\endcsname\relax% |
| 1228 |
\setbox0=\hbox to \csname pgfpages@lp@\the\pgf@clpn @width\endcsname{% |
| 1229 |
\hskip1in% |
| 1230 |
\vbox to \csname pgfpages@lp@\the\pgf@clpn @height\endcsname% |
| 1231 |
{\vskip1in\offinterlineskip \expandafter\copy\csname |
| 1232 |
pgfpages@box@\the\pgf@clpn\endcsname\vss}\hss}% |
| 1233 |
\pgfsys@beginscope% |
| 1234 |
% Translate lower left corner |
| 1235 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @center\endcsname\relax% |
| 1236 |
\else% |
| 1237 |
\pgflowlevel{\pgftransformshift{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @center\endcsname}}% |
| 1238 |
\fi% |
| 1239 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname\relax% |
| 1240 |
\else% |
| 1241 |
\pgflowlevel{\pgftransformscale{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname}}% |
| 1242 |
\fi% |
| 1243 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @xscale\endcsname\relax% |
| 1244 |
\else% |
| 1245 |
\pgflowlevel{\pgftransformxscale{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @xscale\endcsname}}% |
| 1246 |
\fi% |
| 1247 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @yscale\endcsname\relax% |
| 1248 |
\else% |
| 1249 |
\pgflowlevel{\pgftransformyscale{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @yscale\endcsname}}% |
| 1250 |
\fi% |
| 1251 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @rotation\endcsname\relax% |
| 1252 |
% \pgfscope% |
| 1253 |
\else% |
| 1254 |
\pgflowlevel{\pgftransformrotate{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @rotation\endcsname}}% |
| 1255 |
\fi% |
| 1256 |
\pgfutil@tempdima=\csname pgfpages@lp@\the\pgf@clpn @width\endcsname\relax% |
| 1257 |
\pgfutil@tempdimb=\csname pgfpages@lp@\the\pgf@clpn @height\endcsname\relax% |
| 1258 |
\pgflowlevel{\pgftransformshift{\pgfpoint{-.5\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}}% |
| 1259 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @bordercode\endcsname\relax% |
| 1260 |
\else% |
| 1261 |
\pgfpathmoveto{\pgfpointorigin}% |
| 1262 |
\pgfpathlineto{\pgfpoint{\wd0}{0pt}}% |
| 1263 |
\pgfpathlineto{\pgfpoint{\wd0}{\ht0}}% |
| 1264 |
\pgfpathlineto{\pgfpoint{0pt}{\ht0}}% |
| 1265 |
\pgfpathclose% |
| 1266 |
{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @bordercode\endcsname}% |
| 1267 |
\fi% |
| 1268 |
\expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @cornerwidth\endcsname\relax% |
| 1269 |
\else% |
| 1270 |
{ |
| 1271 |
\expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @cornerwidth\endcsname\relax% |
| 1272 |
\color{black} |
| 1273 |
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% |
| 1274 |
\pgfpathrectangle{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% |
| 1275 |
\pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% |
| 1276 |
\pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% |
| 1277 |
\pgfusepath{fill}% |
| 1278 |
\pgfpathmoveto{\pgfpoint{0pt}{\pgfutil@tempdima}}% |
| 1279 |
\pgfpathcurveto{\pgfpoint{0pt}{0.555\pgfutil@tempdima}}{\pgfpoint{.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{0pt}}% |
| 1280 |
\pgfpathlineto{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}}% |
| 1281 |
\pgfpathcurveto{\pgfpoint{\wd0-.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\wd0}{.555\pgfutil@tempdima}}{\pgfpoint{\wd0}{\pgfutil@tempdima}}% |
| 1282 |
\pgfpathlineto{\pgfpoint{\wd0}{\ht0-\pgfutil@tempdima}}% |
| 1283 |
\pgfpathcurveto{\pgfpoint{\wd0}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{\wd0-.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0}}% |
| 1284 |
\pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\ht0}}% |
| 1285 |
\pgfpathcurveto{\pgfpoint{.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{0pt}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}}% |
| 1286 |
\pgfpathclose |
| 1287 |
\pgfusepath{clip}% |
| 1288 |
\color{white}% |
| 1289 |
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\wd0}{\ht0}}% |
| 1290 |
\pgfusepath{fill}% |
| 1291 |
}% |
| 1292 |
\fi% |
| 1293 |
\ht0=0pt% |
| 1294 |
\wd0=0pt% |
| 1295 |
\dp0=0pt% |
| 1296 |
\pgfsys@hbox0% |
| 1297 |
% \endpgfscope% |
| 1298 |
\pgfsys@endscope% |
| 1299 |
\fi |
| 1300 |
\ifnum\pgf@cpn<\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax% |
| 1301 |
\advance \pgf@cpn by 1\relax% |
| 1302 |
\repeat% |
| 1303 |
\pgfsys@endpicture% |
| 1304 |
}}% |
| 1305 |
} |
| 1306 |
|
| 1307 |
|
| 1308 |
\def\pgfpages@shipoutshipoutbox{% |
| 1309 |
\begingroup |
| 1310 |
\let \protect \noexpand |
| 1311 |
\@resetactivechars |
| 1312 |
\global\let\@@if@newlist\if@newlist |
| 1313 |
\global\@newlistfalse |
| 1314 |
\@parboxrestore% |
| 1315 |
\pgfpages@originalshipout% |
| 1316 |
\vbox{\hbox{% |
| 1317 |
\hskip-1in% |
| 1318 |
\vbox to \pgfphysicalheight{% |
| 1319 |
\vss\box\pgfpages@shipoutbox% |
| 1320 |
\vskip1in% |
| 1321 |
}}}% |
| 1322 |
\endgroup% |
| 1323 |
} |
| 1324 |
|
| 1325 |
\def\pgfpages@performcopying{ |
| 1326 |
\pgf@clpn=1\relax% copy first |
| 1327 |
\loop% |
| 1328 |
\expandafter\ifx\csname pgfpages@lp@\the\pgf@clpn @copy\endcsname\relax |
| 1329 |
\else% |
| 1330 |
\edef\pgf@temp{\noexpand\global\noexpand\setbox\csname pgfpages@box@% |
| 1331 |
\the\pgf@clpn\endcsname=\noexpand\copy\csname pgfpages@box@\csname |
| 1332 |
pgfpages@lp@\the\pgf@clpn @copy\endcsname\endcsname}% |
| 1333 |
\pgf@temp% |
| 1334 |
\fi% |
| 1335 |
\ifnum\pgf@clpn<\pgf@logicalpages% |
| 1336 |
\advance \pgf@clpn by 1\relax% |
| 1337 |
\repeat% |
| 1338 |
\pgf@clpn=1\relax% then void |
| 1339 |
\loop% |
| 1340 |
\expandafter\ifx\csname pgfpages@lp@\the\pgf@clpn @copy\endcsname\relax |
| 1341 |
\expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@clpn\endcsname=\box\voidb@x% |
| 1342 |
\else% |
| 1343 |
\fi% |
| 1344 |
\ifnum\pgf@clpn<\pgf@logicalpages% |
| 1345 |
\advance \pgf@clpn by 1\relax% |
| 1346 |
\repeat% |
| 1347 |
} |
| 1348 |
|
| 1349 |
|
| 1350 |
|
| 1351 |
% Save original shipout commands |
| 1352 |
% |
| 1353 |
% Example: |
| 1354 |
% |
| 1355 |
% \pgfhookintoshipout |
| 1356 |
|
| 1357 |
\newcommand\pgfhookintoshipout{ |
| 1358 |
\let\pgfpages@originalshipout=\shipout |
| 1359 |
\let\shipout=\pgfpages@interceptshipout |
| 1360 |
} |
| 1361 |
|
| 1362 |
\def\pgfpages@interceptshipout{% |
| 1363 |
\ifnum\pgf@shipoutnextto>0\relax |
| 1364 |
\def\pgf@next{% |
| 1365 |
\expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname=\box\voidb@x% |
| 1366 |
\afterassignment\pgfpages@shipouttestnext% |
| 1367 |
\pgfpagesshipoutlogicalpage{\the\pgf@shipoutnextto}% |
| 1368 |
}% |
| 1369 |
\else% |
| 1370 |
\ifpgf@holdingphysicalpage% shipout physical page now |
| 1371 |
{\pgfshipoutphysicalpage}% |
| 1372 |
\fi% |
| 1373 |
\ifnum\pgf@logicalpages=0\relax |
| 1374 |
\def\pgf@next{\pgfpages@originalshipout}% |
| 1375 |
\else% |
| 1376 |
\def\pgf@next{% |
| 1377 |
\expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@currentshipout\endcsname=\box\voidb@x% |
| 1378 |
\afterassignment\pgfpages@shipouttest% |
| 1379 |
\pgfpagesshipoutlogicalpage{\the\pgf@currentshipout}% |
| 1380 |
}% |
| 1381 |
\fi% |
| 1382 |
\fi% |
| 1383 |
\pgf@next% |
| 1384 |
} |
| 1385 |
|
| 1386 |
\def\pgfpages@shipouttest{% |
| 1387 |
\ifvoid\csname pgfpages@box@\the\pgf@currentshipout\endcsname\relax% |
| 1388 |
\aftergroup\pgfpages@preparenextshipout% |
| 1389 |
\else% |
| 1390 |
\pgfpages@preparenextshipout% |
| 1391 |
\fi% |
| 1392 |
} |
| 1393 |
|
| 1394 |
\def\pgfpages@shipouttestnext{% |
| 1395 |
\ifvoid\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname\relax% |
| 1396 |
\aftergroup\pgfpages@preparenextshipout% |
| 1397 |
\else% |
| 1398 |
\pgfpages@preparenextshipout% |
| 1399 |
\fi% |
| 1400 |
} |
| 1401 |
|
| 1402 |
\def\pgfpages@preparenextshipout{% |
| 1403 |
\ifnum\pgf@shipoutnextto=0\relax% |
| 1404 |
\global\advance\pgf@currentshipout by 1\relax% |
| 1405 |
\else% |
| 1406 |
\global\pgf@shipoutnextto=0\relax% |
| 1407 |
\fi% |
| 1408 |
\ifnum\pgf@currentshipout>\pgf@lastshipout\relax% |
| 1409 |
\global\pgf@currentshipout=\pgf@firstshipout\relax% |
| 1410 |
\global\pgf@holdingphysicalpagetrue% |
| 1411 |
\fi% |
| 1412 |
} |
| 1413 |
|
| 1414 |
|
| 1415 |
|
| 1416 |
% Shipout a logical page |
| 1417 |
% |
| 1418 |
% #1 = logical page number |
| 1419 |
% |
| 1420 |
% The command should be followed by a box. This box will become the |
| 1421 |
% contents of the logical page. |
| 1422 |
% |
| 1423 |
% Example: |
| 1424 |
% |
| 1425 |
% \pgfpagesshipoutlogicalpage{0}\vbox{Hi!} |
| 1426 |
|
| 1427 |
\newcommand\pgfpagesshipoutlogicalpage[1]{% |
| 1428 |
\global\pgfphysicalpageemptyfalse% |
| 1429 |
\expandafter\global\expandafter\setbox\csname pgfpages@box@#1\endcsname=} |
| 1430 |
|
| 1431 |
|
| 1432 |
|
| 1433 |
% Finish current page and shipout next page to a specific logical page. |
| 1434 |
% |
| 1435 |
% #1 = logical page number |
| 1436 |
% |
| 1437 |
% When the current page has been typset, it will be become the given |
| 1438 |
% logical page. This command ``interrupts'' the normal order of |
| 1439 |
% logical pages. |
| 1440 |
% |
| 1441 |
% Example: |
| 1442 |
% |
| 1443 |
% \pgfpagesuselayout{two screens with optional second} |
| 1444 |
% |
| 1445 |
% Text for main page.\clearpage |
| 1446 |
% |
| 1447 |
% \pgfpagescurrentpagewillbelogicalpage{2} |
| 1448 |
% |
| 1449 |
% Text that goes to second page |
| 1450 |
% |
| 1451 |
% \clearpage |
| 1452 |
% |
| 1453 |
% Text for main page. |
| 1454 |
|
| 1455 |
\newcommand\pgfpagescurrentpagewillbelogicalpage[1]{% |
| 1456 |
\global\pgf@shipoutnextto=#1\relax% |
| 1457 |
} |
| 1458 |
|
| 1459 |
|
| 1460 |
% Setup the physical page sizes |
| 1461 |
% |
| 1462 |
% Example: |
| 1463 |
% |
| 1464 |
% \pgfsetupphysicalpagesizes |
| 1465 |
|
| 1466 |
\newcommand\pgfsetupphysicalpagesizes{% |
| 1467 |
\pgfsys@global@papersize{\the\pgfphysicalwidth}{\the\pgfphysicalheight}% |
| 1468 |
} |
| 1469 |
|
| 1470 |
% |
| 1471 |
% Start/End setup |
| 1472 |
% |
| 1473 |
\AtBeginDocument |
| 1474 |
{ |
| 1475 |
\pgfhookintoshipout |
| 1476 |
\pgfsetupphysicalpagesizes |
| 1477 |
} |
| 1478 |
\AtEndDocument |
| 1479 |
{ |
| 1480 |
\clearpage |
| 1481 |
\ifpgfphysicalpageempty |
| 1482 |
\else |
| 1483 |
\pgfshipoutphysicalpage |
| 1484 |
\fi |
| 1485 |
} |
| 1486 |
|