diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/pgfmorepages/README | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.pdf | bin | 0 -> 61834 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.tex | 390 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pgfmorepages/pgfmorepages.sty | 1513 |
4 files changed, 1917 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/pgfmorepages/README b/Master/texmf-dist/doc/latex/pgfmorepages/README new file mode 100644 index 00000000000..a11c2db77bd --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfmorepages/README @@ -0,0 +1,14 @@ +---------------------------------------------------------------- +pgfmorepages --- LaTeX functions for manipulating multiple pages +E-mail: loopspace@mathforge.org +Released jointly under the LaTeX Project Public License v1.3c (or +later) and under the GNU Public License. + +See http://www.latex-project.org/lppl.txt +and https://www.gnu.org/licenses/gpl.html +---------------------------------------------------------------- + +This package replaces and extends the pgfpages sub-package of the PGF +system. It provides the capability to arrange multiple "logical" +pages on multiple "physical" pages, for example as for arranging pages +to make booklets. diff --git a/Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.pdf b/Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.pdf Binary files differnew file mode 100644 index 00000000000..5c275b419f4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.pdf diff --git a/Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.tex b/Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.tex new file mode 100644 index 00000000000..0eb4b69dc59 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfmorepages/pgfmorepages.tex @@ -0,0 +1,390 @@ +\documentclass{ltxdoc} + +\usepackage{tikz} +\usetikzlibrary{positioning} +\usepackage{pgfmorepages} +\usepackage{fancyvrb} + +\GetFileInfo{pgfmorepages.sty} + +\title{PGF \emph{more} Pages} +\author{Andrew Stacey \\ \texttt{loopspace@mathforge.org}} +\date{\fileversion\ from \filedate} + +\begin{document} + +\maketitle + +\section{Introduction} + +The \Verb+pgfmorepages+ package is a drop-in replacement for the \Verb+pgfpages+ package which comes with TikZ/PGF. +As it is a drop-in replacement, it \emph{ought} to be fully backwards compatible with \Verb+pgfpages+. + +\Verb+pgfpages+ allows you the ability to place several pages of your document (hereafter \emph{logical pages}) onto one page of the output (hereafter \emph{physical pages}). +\Verb+pgfmorepages+ adds extra features, the primary one being that whereas \Verb+pgfpages+ is ``many to one'', \Verb+pgfmorepages+ is ``many to many''. +That is, while \Verb+pgfpages+ works one physical page at a time then \Verb+pgfmorepages+ can juggle several logical pages onto several physical pages. + +As an example of its capability, the layout \Verb+4 on 2, book format+ places four logical pages onto two physical pages so that when folded it forms a booklet. +The layout is therefore: + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(4\)}; +\node at (1,0) {\(1\)}; +\node at (3,0) {\(2\)}; +\node at (4,0) {\(3\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + +This requires knowing all four logical pages before the first physical page is output. + +\section{Usage} + +In your preamble: + +\begin{verbatim} +\usepackage{pgfmorepages} +\end{verbatim} + +\subsection{Layouts} + +The original \Verb+pgfpages+ defined the following layouts: + +\begin{itemize} +\item \Verb+rounded corners+ +\item \Verb+resize to+ +\item \Verb+two screens with lagging second+ +\item \Verb+two screens with optional second+ +\item \Verb+2 on 1+ +\item \Verb+4 on 1+ +\item \Verb+6 on 1+ +\item \Verb+8 on 1+ +\item \Verb+16 on 1+ +\end{itemize} + +The \Verb+pgfmorepages+ defines some extra layouts, which require the following command in your preamble: +% +\begin{verbatim} +\pgfmorepagesloadextralayouts +\end{verbatim} + +\begin{itemize} +\item \Verb+4 on 2, odd then even+ + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(1\)}; +\node at (1,0) {\(3\)}; +\node at (3,0) {\(2\)}; +\node at (4,0) {\(4\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + +\item \Verb+4 on 2, even then odd+ + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(2\)}; +\node at (1,0) {\(4\)}; +\node at (3,0) {\(1\)}; +\node at (4,0) {\(3\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + +\item \Verb+4 on 2, book format+ + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(4\)}; +\node at (1,0) {\(1\)}; +\node at (3,0) {\(2\)}; +\node at (4,0) {\(3\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + +\item \Verb+8 on 4, book format+ + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(8\)}; +\node at (1,0) {\(1\)}; +\node at (3,0) {\(2\)}; +\node at (4,0) {\(7\)}; +\node at (6,0) {\(6\)}; +\node at (7,0) {\(3\)}; +\node at (9,0) {\(4\)}; +\node at (10,0) {\(5\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (6,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (7,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (9,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (10,0) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + +\item \Verb+8 on 4, book format, reverse second, single sided+ + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(8\)}; +\node at (1,0) {\(1\)}; +\node at (3,0) {\(6\)}; +\node at (4,0) {\(3\)}; +\node[rotate=180] at (6,0) {\(5\)}; +\node[rotate=180] at (7,0) {\(4\)}; +\node[rotate=180] at (9,0) {\(7\)}; +\node[rotate=180] at (10,0) {\(2\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (6,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (7,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (9,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (10,0) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + + +\item \Verb+5 index cards+ +\item \Verb+repeated 2-up+ + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(1\)}; +\node at (1,0) {\(1\)}; +\node at (3,0) {\(2\)}; +\node at (4,0) {\(2\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + +\item \Verb+repeated 4-up+ + +\begin{center} +\begin{tikzpicture} +\node at (0,0) {\(1\)}; +\node at (1,0) {\(1\)}; +\node at (0,1.4) {\(1\)}; +\node at (1,1.4) {\(1\)}; +\node at (3,0) {\(2\)}; +\node at (4,0) {\(2\)}; +\node at (3,1.4) {\(2\)}; +\node at (4,1.4) {\(2\)}; +\draw (-.5,-.7) rectangle (.5,.7); +\draw (1,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,0) +(-.5,-.7) rectangle +(.5,.7); +\draw (0,1.4) +(-.5,-.7) rectangle +(.5,.7); +\draw (1,1.4) +(-.5,-.7) rectangle +(.5,.7); +\draw (3,1.4) +(-.5,-.7) rectangle +(.5,.7); +\draw (4,1.4) +(-.5,-.7) rectangle +(.5,.7); +\end{tikzpicture} +\end{center} + + +\item \Verb+1 on 1+ + +This is a layout that ``resets'' the mechanism back to one logical page on one physical page. +It still uses the mechanics of the \Verb+pgfmorepages+ package so is not quite the same as removing it altogether, but is effectively the same. + +\item \Verb+discard+ + +This layout discards all its pages. +Useful to remove pages from a document without changing the source file too much. + +\end{itemize} + +To use a layout, use the command: +% +\begin{verbatim} +\pgfpagesuselayout{<layout name>}[<optional arguments>] +\end{verbatim} + + + +\subsection{Options} + +The optional arguments are a superset of the ones that \Verb+pgfpages+ allows. + +\begin{itemize} +\item \Verb+physical paper width+ +\item \Verb+physical paper height+ +\item \Verb+a0paper+ +\item \Verb+a1paper+ +\item \Verb+a2paper+ +\item \Verb+a3paper+ +\item \Verb+a4paper+ +\item \Verb+a5paper+ +\item \Verb+a6paper+ +\item \Verb+letterpaper+ +\item \Verb+legalpaper+ +\item \Verb+executivepaper+ +\item \Verb+landscape+ +\item \Verb+border shrink+ +\item \Verb+border code+ +\item \Verb+corner width+ +\item \Verb+odd numbered pages right+ +\item \Verb+second right+ +\item \Verb+second left+ +\item \Verb+second top+ +\item \Verb+second bottom+ +\end{itemize} + +The only additional option is \Verb+border code+ which, if the layout does anything with it, is designed for passing a command to the layout for the border path. +The intention of this is that sometimes it is useful to draw the page border when designing a document but you might want to disable it for the final version. +This makes it easy to switch between those (providing the layout supports it). + +\subsection{Changing Layout} + +The documentation for \Verb+pgfpages+ states that it is possible to change layout mid-document. +This turns out not to be correct for \Verb+pgfpages+ as it doesn't reset everything correctly. +\Verb+pgfmorepages+ fixes this\footnote{Or tries to -- I keep discovering new options that I haven't reset properly.}. +It is best practice to use a \Verb+\newpage+ or \Verb+\clearpage+ before doing so. +The layout \Verb+1 on 1+ is useful here as it sets the layout back to one logical page on one physical page. + +\section{Defining a New Layout} + +The best way to define a new layout is to start with one of the predefined ones and modify it. +To that end, here is an example layout with comments. + +\begin{verbatim} + % Set the name of the layout +\pgfpagesdeclarelayout{4 on 2, book format}% +{% + % Unless overridden, this layout uses the same paper size + % but rotated so that two logical pages fit naturally on + % one physical page + \edef\pgfpageoptionheight{\the\paperwidth} + \edef\pgfpageoptionwidth{\the\paperheight} + % Defaults for the border + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} + % Start with the first page of the document + \def\pgfpageoptionfirstshipout{1} +}% +{% + % These are the settings for the physical pages + \pgfpagesphysicalpageoptions + {% + % Each set consists of 4 logical and 2 physical pages + logical pages=4,% + physical pages=2,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth,% + current logical shipout=\pgfpageoptionfirstshipout% + } + % These are the settings for the logical pages. + % These hold for all the logical pages. + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + % Our arrangement is different for two portrait pages + % on one landscape as opposed to two landscape on + % one portrait. + % This is for two portrait on one landscape + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + % There are several ways to declare which logical page + % goes on which physical page. This command sets the + % physical page for the following logical pages. The + % second argument is any options to be set for that + % physical page. + \pgfpagesphysicalpage{1}{} + % Our fourth logical page goes on the first physical page + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + % The second and third logical pages go on the second + % physical page. + \pgfpagesphysicalpage{2}{} + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + % The first logical page goes back on the first physical page. + \pgfpagesphysicalpage{1}{} + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \else + % These are essentially the same as above, except with + % two landscape pages on one portrait, so the pages + % are in different locations. + % stack on top of one another + \pgfpagesphysicalpage{1}{} + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpagesphysicalpage{2}{} + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpagesphysicalpage{2}{} + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \fi +} +\end{verbatim} + +\end{document} diff --git a/Master/texmf-dist/tex/latex/pgfmorepages/pgfmorepages.sty b/Master/texmf-dist/tex/latex/pgfmorepages/pgfmorepages.sty new file mode 100644 index 00000000000..8d3ea8fda83 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgfmorepages/pgfmorepages.sty @@ -0,0 +1,1513 @@ +% Original code copyright 2006 by Till Tantau +% Extension copyright 2012-2019 by Andrew Stacey +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesPackage{pgfmorepages}[2019/03/22 v1.00 multiple page manipulation] + +\@ifpackageloaded{pgfpages}{% + \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.} +}{} + + +\RequirePackage{pgfcore,calc} + +\newcount\pgf@logicalpages +\newcount\pgf@physicalpages +\newcount\pgf@firstshipout +\newcount\pgf@lastshipout +\newcount\pgf@currentshipout +\newcount\pgf@cpn +\newcount\pgf@clpn +\newcount\pgf@cppn +\newcount\pgfactualpage +\newcount\pgf@shipoutnextto +\newdimen\pgfphysicalheight +\newdimen\pgfphysicalwidth +\newif\ifpgfpagesship + +\pgf@shipoutnextto=0\relax +\pgf@logicalpages=0\relax +\pgf@physicalpages=1\relax +\pgf@firstshipout=1\relax +\pgf@lastshipout=1\relax +\pgf@currentshipout=1\relax +\pgfphysicalheight=\paperheight +\pgfphysicalwidth=\paperwidth +\pgfactualpage=0 +\def\pgf@currentpage{1} + +\newif\ifpgfphysicalpageempty +\newif\ifpgf@holdingphysicalpage + +\pgfphysicalpageemptytrue +\pgf@holdingphysicalpagefalse + +% Define a layout +% +% #1 = layout name +% #2 = code before options have been set +% #2 = code after options have been set +% +% Example: +% +% \pgfpagesdeclarelayout{resize to}{ +% \pgfpagesphysicalpageoptions{logical pages=1,physical height=\pgfpageoptionheight,physical width=\pgfpageoptionwidth} +% \pgfpageslogicalpageoptions{1}{resized width=\pgfphysicalwidth,% +% resized height=\pgfphysicalheight,center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}}} + +\let\pgfpages@layouts=\pgfutil@gobble + +\newcommand\pgfpagesdeclarelayout[3]{% + \pgfutil@ifundefined{pgfpages@layout@#1}{% + \expandafter\def\expandafter\pgfpages@layouts\expandafter{\pgfpages@layouts, #1} + \expandafter\newcommand\csname pgfpages@layoutbefore@#1\endcsname{#2} + \expandafter\newcommand\csname pgfpages@layout@#1\endcsname{#3} + }{% + \PackageWarning{pgfmorepages}{Layout #1 already defined}% + }} + + +% Use a layout +% +% #1 = layout name +% #2 = options +% +% Example: +% +% \pgfpagesuselayout{resize to}[a4paper] + +\def\pgfpagesuselayout#1{\pgfutil@ifnextchar[{\pgf@pagelayout{#1}}{\pgf@pagelayout{#1}[]}} +\def\pgf@pagelayout#1[#2]{ + \pgfutil@ifundefined{pgfpages@layout@#1}{ + \PackageError{pgfmorepages}{Page layout `#1' undefined. Currently defined layouts are: \pgfpages@layouts \pgfmorepages@extramessage}{} + } + { + \pgfpages@reset + \csname pgfpages@layoutbefore@#1\endcsname + \setkeys{pgfpagesuselayoutoption}{#2} + \csname pgfpages@layout@#1\endcsname + } +} + +\def\pgfpages@reset{ +\pgfshipoutphysicalpage +\pgfphysicalheight=\paperheight +\pgfphysicalwidth=\paperwidth + \pgf@cppn=1\relax% + \loop% + \expandafter\let\csname pgfpages@lp@\the\pgf@cppn @skipcode\endcsname\relax + \expandafter\let\csname pgfpages@lp@\the\pgf@cppn @height\endcsname\relax + \expandafter\let\csname pgfpages@lp@\the\pgf@cppn @width\endcsname\relax + \expandafter\let\csname pgfpages@lp@\the\pgf@cppn @copy\endcsname\relax + \expandafter\let\csname pgf@lpageson@\the\pgf@cppn\endcsname=\relax + \advance \pgf@cppn by 1\relax% + \expandafter\unless\expandafter\ifx\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax% + \repeat% + \pgf@clpn=1\relax% + \loop% + \expandafter\let\csname pgfpages@pp@\the\pgf@clpn @skipcode\endcsname\relax + \expandafter\let\csname pgfpages@box@\the\pgf@clpn\endcsname=\relax + \advance \pgf@clpn by 1\relax% + \expandafter\unless\expandafter\ifx\csname pgfpages@box@\the\pgf@clpn\endcsname\relax% + \repeat% + \pgf@cppn=1\relax% + \pgf@clpn=1\relax% + \loop% + \loop% + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @reheight\endcsname\relax + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @rewidth\endcsname\relax + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @border\endcsname\relax + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @bordercode\endcsname\relax + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @center\endcsname\relax + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @cornerwidth\endcsname\relax + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @scale\endcsname\relax% + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @xscale\endcsname\relax% + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @yscale\endcsname\relax% + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @rotation\endcsname\relax% + \expandafter\let\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @skipcode\endcsname\relax% + \advance\pgf@clpn by 1\relax + \expandafter\unless\expandafter\ifx\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @reheight\endcsname\relax + \repeat + \pgf@clpn=1\relax% + \advance\pgf@cppn by 1\relax + \expandafter\unless\expandafter\ifx\csname pgfpages@p@\the\pgf@clpn @\the\pgf@cppn @reheight\endcsname\relax + \repeat +} + +% Predefined options + +\define@key{pgfpagesuselayoutoption}{physical paper width}% +{\def\pgfpageoptionwidth{#1}} + +\define@key{pgfpagesuselayoutoption}{physical paper height}% +{\def\pgfpageoptionheight{#1}} + +\define@key{pgfpagesuselayoutoption}{a0paper}[]% +{\def\pgfpageoptionheight{1189mm} \def\pgfpageoptionwidth{841mm}} + +\define@key{pgfpagesuselayoutoption}{a1paper}[]% +{\def\pgfpageoptionheight{841mm} \def\pgfpageoptionwidth{594mm}} + +\define@key{pgfpagesuselayoutoption}{a2paper}[]% +{\def\pgfpageoptionheight{594mm} \def\pgfpageoptionwidth{420mm}} + +\define@key{pgfpagesuselayoutoption}{a3paper}[]% +{\def\pgfpageoptionheight{420mm} \def\pgfpageoptionwidth{297mm}} + +\define@key{pgfpagesuselayoutoption}{a4paper}[]% +{\def\pgfpageoptionheight{297mm} \def\pgfpageoptionwidth{210mm}} + +\define@key{pgfpagesuselayoutoption}{a5paper}[]% +{\def\pgfpageoptionheight{210mm} \def\pgfpageoptionwidth{148mm}} + +\define@key{pgfpagesuselayoutoption}{a6paper}[]% +{\def\pgfpageoptionheight{148mm} \def\pgfpageoptionwidth{105mm}} + +\define@key{pgfpagesuselayoutoption}{letterpaper}[]% +{\def\pgfpageoptionheight{11in} \def\pgfpageoptionwidth{8.5in}} + +\define@key{pgfpagesuselayoutoption}{legalpaper}[]% +{\def\pgfpageoptionheight{14in} \def\pgfpageoptionwidth{8.5in}} + +\define@key{pgfpagesuselayoutoption}{executivepaper}[]% +{\def\pgfpageoptionheight{10.5in}\def\pgfpageoptionwidth{7.25in}} + +\define@key{pgfpagesuselayoutoption}{landscape}[]% +{ + \let\pgf@temp=\pgfpageoptionwidth + \let\pgfpageoptionwidth=\pgfpageoptionheight + \let\pgfpageoptionheight=\pgf@temp +} + +\define@key{pgfpagesuselayoutoption}{border shrink}% +{\def\pgfpageoptionborder{#1}} + +\define@key{pgfpagesuselayoutoption}{border code}% +{\def\pgfpageoptionbordercode{#1}} + +\define@key{pgfpagesuselayoutoption}{corner width}% +{\def\pgfpageoptioncornerwidth{#1}} + +\define@key{pgfpagesuselayoutoption}{odd numbered pages right}[]% +{\def\pgfpageoptionfirstshipout{2}} + +\define@key{pgfpagesuselayoutoption}{second right}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{\paperheight}% + \def\pgfpageoptiontwowidth{2\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second left}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{1.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{\paperheight}% + \def\pgfpageoptiontwowidth{2\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second top}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% + \def\pgfpageoptiontwoheight{2\paperheight}% + \def\pgfpageoptiontwowidth{\paperwidth}% +} + +\define@key{pgfpagesuselayoutoption}{second bottom}[]% +{% + \def\pgfpageoptionfirstcenter{\pgfpoint{.5\paperwidth}{1.5\paperheight}}% + \def\pgfpageoptionsecondcenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}% + \def\pgfpageoptiontwoheight{2\paperheight}% + \def\pgfpageoptiontwowidth{\paperwidth}% +} + + + +% Predefined layouts + +\pgfpagesdeclarelayout{rounded corners} +{ + \def\pgfpageoptioncornerwidth{10pt} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=1 + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight},% + corner width=\pgfpageoptioncornerwidth% + }% +} + +\pgfpagesdeclarelayout{resize to} +{ + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=1,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \pgfpageslogicalpageoptions{1} + {% + resized width=\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + border shrink=\pgfpageoptionborder,% + center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% +} + +\pgfpagesdeclarelayout{two screens with lagging second} +{} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptiontwoheight,% + physical width=\pgfpageoptiontwowidth,% + last logical shipout=1,% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpageoptionfirstcenter,% + }% + \pgfpageslogicalpageoptions{2} + {% + center=\pgfpageoptionsecondcenter,% + copy from=1% + }% +} + +\pgfpagesdeclarelayout{two screens with optional second} +{} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptiontwoheight,% + physical width=\pgfpageoptiontwowidth,% + last logical shipout=1% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \pgfpageslogicalpageoptions{1} + {% + center=\pgfpageoptionfirstcenter,% + }% + \pgfpageslogicalpageoptions{2} + {% + center=\pgfpageoptionsecondcenter,% + copy from=2% + }% +} + +\pgfpagesdeclarelayout{2 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} + \def\pgfpageoptionfirstshipout{1} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=2,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth,% + current logical shipout=\pgfpageoptionfirstshipout% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{4 on 1} +{ + \edef\pgfpageoptionheight{\the\paperheight} + \edef\pgfpageoptionwidth{\the\paperwidth} + \edef\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=4,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% +} + +\pgfpagesdeclarelayout{6 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=6,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.167\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.833\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.833\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.167\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{8 on 1} +{ + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=8,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \fi +} + + +\pgfpagesdeclarelayout{16 on 1} +{ + \edef\pgfpageoptionheight{\the\paperheight} + \edef\pgfpageoptionwidth{\the\paperwidth} + \edef\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} +} +{ + \pgfpagesphysicalpageoptions + {% + logical pages=16,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.875\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{5} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{6} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{7} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{8} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.625\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{9} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{10} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{11} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{12} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.375\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{13} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.125\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{14} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.375\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{15} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.625\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{16} + {% + border shrink=\pgfpageoptionborder,% + resized width=.25\pgfphysicalwidth,% + resized height=.25\pgfphysicalheight,% + center=\pgfpoint{.875\pgfphysicalwidth}{.125\pgfphysicalheight}% + }% +} + +\pgfpagesdeclarelayout{4 on 2, odd then even}% +{% + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} + \def\pgfpageoptionfirstshipout{1} +}% +{% + \pgfpagesphysicalpageoptions + {% + logical pages=4,% + physical pages=2,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth,% + current logical shipout=\pgfpageoptionfirstshipout% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpagesphysicalpage{1}{} + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpagesphysicalpage{2}{} + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpagesphysicalpage{1}{} + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpagesphysicalpage{2}{} + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \fi +} + +\pgfpagesdeclarelayout{4 on 2, even then odd}% +{% + \edef\pgfpageoptionheight{\the\paperwidth} % landscaped by default + \edef\pgfpageoptionwidth{\the\paperheight} + \def\pgfpageoptionborder{0pt} + \def\pgfpageoptionbordercode{} + \def\pgfpageoptionfirstshipout{1} +}% +{% + \pgfpagesphysicalpageoptions + {% + logical pages=4,% + physical pages=2,% + physical height=\pgfpageoptionheight,% + physical width=\pgfpageoptionwidth,% + current logical shipout=\pgfpageoptionfirstshipout% + } + \pgfpagessetdefaults{% + border code=\pgfpageoptionbordercode + } + \ifdim\paperheight>\paperwidth\relax + % put side-by-side + \pgfpagesphysicalpage{2}{} + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpagesphysicalpage{1}{} + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=.5\pgfphysicalwidth,% + resized height=\pgfphysicalheight,% + center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}% + }% + \else + % stack on top of one another + \pgfpagesphysicalpage{2}{} + \pgfpageslogicalpageoptions{1} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{3} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \pgfpagesphysicalpage{1}{} + \pgfpageslogicalpageoptions{2} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}% + }% + \pgfpageslogicalpageoptions{4} + {% + border shrink=\pgfpageoptionborder,% + resized width=\pgfphysicalwidth,% + resized height=.5\pgfphysicalheight,% + center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}% + }% + \fi +} + +% Load more layouts + +\def\pgfmorepages@extramessage{. Extra layouts can be loaded with the command \string\pgfmorepagesloadextralayouts} +\newcommand\pgfmorepagesloadextralayouts{% + \input{pgfmorepageslayouts.code.tex}% + \def\pgfmorepages@extramessage{}% +} + +% Change/set main option +% +% #1 = options +% +% Options: +% +% logical pages = number of logical pages per physical page +% logical shipouts = number of shipouts needed to fill a physical page +% (may be less than the number of logical pages, +% if some logical pages are calculated +% automatically) +% current logical shipout = number of logical shipout that will come +% next. +% +% Example: +% +% \pgfpagesphysicalpageoptions{logical pages=2,logical shipouts=1} + +\newcommand\pgfpagesphysicalpageoptions[1]{% + \pgf@lastshipout=0\relax% + \pgf@currentshipout=0\relax% + \setkeys{pgfpages@main}{#1}% + \ifnum\pgf@lastshipout=0\relax%not set + \pgf@lastshipout=\pgf@logicalpages% + \fi% + \ifnum\pgf@currentshipout=0\relax%not set + \pgf@currentshipout=\pgf@firstshipout% + \fi% +} + +\define@key{pgfpages@main}{logical pages}{\pgf@logicalpages=#1\relax} +\define@key{pgfpages@main}{physical pages}{\pgf@physicalpages=#1\relax} +\define@key{pgfpages@main}{first logical shipout}{\pgf@firstshipout=#1\relax} +\define@key{pgfpages@main}{last logical shipout}{\pgf@lastshipout=#1\relax} +\define@key{pgfpages@main}{current logical shipout}{\pgf@currentshipout=#1\relax} +\define@key{pgfpages@main}{physical height}{\pgfphysicalheight=#1\relax} +\define@key{pgfpages@main}{physical width}{\pgfphysicalwidth=#1\relax} + + + +% Setup/change parameters of a logical page. You must call this +% macro for each logical page. +% +% #1 = logical page number +% #2 = options +% +% Options: +% +% original height = height of the logical page (\paperheight at point of +% first invocation by default) +% original width = width of the logical page (\paperwidth by default) +% resized height = height of the logical page after resizing +% resized width = width of the logical page after resizing +% border shrink = length that is subtracted from resized height and +% resized width +% border code = pgf commands to be used for drawing a border (a +% path with the border set will already have been +% set) +% rounded corners = clip the frame against a rectangle of the size of +% the frame with corners of the given radius +% scale = factor by which the page is enlarged/shrunk +% center = center of the logical page in the physical page +% rotation = degree by which the page is rotated around its center +% xscale = scale only x-axis (use -1 to flip along y-axis) +% yscale = scale only y-axis (use -1 to flip along x-axis) +% copy from = copy the contents from this logical page of the +% previous physical page, if no contents is specified +% +% If more than one of the three options ``resized height'', ``resized +% width'' and ``scale'' are given, the smallest resulting scaling +% wins. +% +% Example: +% +% \pgfpageslogicalpageoptions{1}{scale=0.5,center=\pgfpoint{0cm}{2cm}} +% \pgfpageslogicalpageoptions{1 on 2}{scale=0.5,center=\pgfpoint{0cm}{2cm}} + +\newcommand\pgfpageslogicalpageoptions[2]{% +% First step is to work out which physical page and which logical page we're dealing with. +% 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''. +% Or we could set the physical page beforehand via the \pgfpagesphysicalpage macro. + \pgfutil@in@{on}{#1}% + \ifpgfutil@in@ + \pgf@mp@seplp#1\relax + \else + \pgf@clpn=#1\relax% + \pgf@cppn=\pgf@currentpage\relax% + \fi +% Make sure we have the box for this logical page. + \expandafter\ifx\csname pgfpages@box@\the\pgf@clpn\endcsname\relax% + \expandafter\newbox\csname pgfpages@box@\the\pgf@clpn\endcsname% +\pgf@elpsetcurrent{height}{\the\paperheight}% +\pgf@elpsetcurrent{width}{\the\paperwidth}% +\fi +% Now set the count \pgf@cpn so that it is the number of logical pages on this particular physical page. + \expandafter\ifx\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax +\expandafter\def\csname pgf@lpageson@\the\pgf@cppn\endcsname{1}% +\else +\expandafter\edef\csname pgf@lpageson@\the\pgf@cppn\endcsname{\number\numexpr\csname pgf@lpageson@\the\pgf@cppn\endcsname + 1\relax}% +\fi + \pgf@cpn=\numexpr\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax +\pgf@epsetcurrent{logicalpage}{\the\pgf@clpn}% +\pgfpages@processdefaults + \setkeys{pgfpages@page}{#2}% + \pgf@calculateresizes{height}% + \pgf@calculateresizes{width}% + \pgfsetupphysicalpagesizes% +} + +\def\pgf@mp@seplp#1on#2\relax{% + \pgf@cpn=#1\relax + \pgf@cppn=#2\relax +} + +% Set the current default physical page for the logical page options +\newcommand\pgfpagesphysicalpage[2]{% + \edef\pgf@currentpage{#1}% + \pgf@cppn=#1\relax + \setkeys{pgfpages@ppage}{#2}% +} + +% Set some defaults +\newcommand\pgfpagessetdefaults[1]{% + \def\pgf@defaults{#1}} +\def\pgf@defaults{} + +\def\pgfpages@processdefaults{% + \def\pgf@temp{\setkeys{pgfpages@page}}% + \expandafter\pgf@temp\expandafter{\pgf@defaults}% +} + +% Set and get options for a particular logical page on a particular physical page. +\def\pgf@epset#1#2#3#4{\expandafter\edef\csname pgfpages@p@#1@#2@#3\endcsname{#4}} +\def\pgf@pset#1#2#3#4{\expandafter\def\csname pgfpages@p@#1@#2@#3\endcsname{#4}} +\def\pgf@pget#1#2#3{\csname pgfpages@p@#1@#2@#3\endcsname} +\def\pgf@epsetcurrent#1#2{\pgf@epset{\the\pgf@cpn}{\the\pgf@cppn}{#1}{#2}} +\def\pgf@psetcurrent#1#2{\pgf@pset{\the\pgf@cpn}{\the\pgf@cppn}{#1}{#2}} +\def\pgf@pgetcurrent#1{\pgf@pget{\the\pgf@cpn}{\the\pgf@cppn}{#1}} + +% Set and get options for a particular logical page. +\def\pgf@elpset#1#2#3{\expandafter\edef\csname pgfpages@lp@#1@#2\endcsname{#3}} +\def\pgf@lpset#1#2#3{\expandafter\def\csname pgfpages@lp@#1@#2\endcsname{#3}} +\def\pgf@lpget#1#2{\csname pgfpages@lp@#1@#2\endcsname} +\def\pgf@elpsetcurrent#1#2{\pgf@elpset{\the\pgf@clpn}{#1}{#2}} +\def\pgf@lpsetcurrent#1#2{\pgf@lpset{\the\pgf@clpn}{#1}{#2}} +\def\pgf@lpgetcurrent#1{\pgf@lpget{\the\pgf@clpn}{#1}} + +% Set and get options for a particular physical page. +\def\pgf@eppset#1#2#3{\expandafter\edef\csname pgfpages@pp@#1@#2\endcsname{#3}} +\def\pgf@ppset#1#2#3{\expandafter\def\csname pgfpages@pp@#1@#2\endcsname{#3}} +\def\pgf@ppget#1#2{\csname pgfpages@pp@#1@#2\endcsname} +\def\pgf@eppsetcurrent#1#2{\pgf@eppset{\the\pgf@cppn}{#1}{#2}} +\def\pgf@ppsetcurrent#1#2{\pgf@ppset{\the\pgf@cppn}{#1}{#2}} +\def\pgf@ppgetcurrent#1{\pgf@ppget{\the\pgf@cppn}{#1}} + +\define@key{pgfpages@page}{skip code}{\pgf@psetcurrent{skipcode}{#1}} +\define@key{pgfpages@page}{scale}{\pgf@epsetcurrent{scale}{#1}} +\define@key{pgfpages@page}{xscale}{\pgf@epsetcurrent{xscale}{#1}} +\define@key{pgfpages@page}{yscale}{\pgf@epsetcurrent{yscale}{#1}} +\define@key{pgfpages@page}{original height}{\pgf@elpsetcurrent{height}{#1}} +\define@key{pgfpages@page}{original width}{\pgf@elpsetcurrent{width}{#1}} +\define@key{pgfpages@page}{resized height}{\pgf@epsetcurrent{reheight}{#1}} +\define@key{pgfpages@page}{resized width}{\pgf@epsetcurrent{rewidth}{#1}} +\define@key{pgfpages@page}{center}{\pgf@psetcurrent{center}{#1}} +\define@key{pgfpages@page}{rotation}{\pgf@epsetcurrent{rotation}{#1}} +\define@key{pgfpages@page}{copy from}{\pgf@elpsetcurrent{copy}{#1}} +\define@key{pgfpages@page}{border shrink}{\pgf@epsetcurrent{border}{#1}} +\define@key{pgfpages@page}{border code}{\pgf@psetcurrent{bordercode}{#1}} +\define@key{pgfpages@page}{corner width}{\pgf@psetcurrent{cornerwidth}{#1}} + +\define@key{pgfpages@ppage}{skip code}{\pgf@ppsetcurrent{skipcode}{#1}} +\define@key{pgfpages@ppage}{defaults}{\pgfpagessetdefaults{#1}} + +\def\pgf@calculateresizes#1{% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @re#1\endcsname\relax% + \else% + \expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @re#1\endcsname\relax% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @border\endcsname\relax% + \else% + \expandafter\pgfutil@tempdimb\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @border\endcsname\relax% + \advance\pgfutil@tempdima by-2\pgfutil@tempdimb\relax% + \fi% + \expandafter\pgfutil@tempdimb\csname pgfpages@lp@\the\pgf@clpn @#1\endcsname\relax% + \pgfutil@tempcnta=\pgfutil@tempdimb% + \divide\pgfutil@tempcnta by 65536\relax% + \ifnum\pgfutil@tempcnta=0\relax% + \pgfutil@tempcnta=1\relax% + \fi% + \divide\pgfutil@tempdima by\pgfutil@tempcnta\relax% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname\relax% + \pgfutil@tempdimb=10000pt% + \else% + \expandafter\pgfutil@tempdimb\expandafter=\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname pt\relax% + \fi% + \ifdim\pgfutil@tempdima<\pgfutil@tempdimb% + \edef\pgf@temp{{scale}{\expandafter\Pgf@geT\the\pgfutil@tempdima}}% + \expandafter\pgf@psetcurrent\pgf@temp% + \fi% + \fi% +} + + + +% Shipout a physical page immediately +% +% Example: +% +% \pgfshipoutphysicalpage + + +\newcommand\pgfshipoutphysicalpage{% + \ifnum\pgf@logicalpages>0\relax% + \pgf@cppn=1\relax% + \loop% + \global\advance\pgfactualpage by 1\relax + \pgfpagesshiptrue + \csname pgfpages@pp@\the\pgf@cppn @skipcode\endcsname + \ifpgfpagesship + \pgfpages@buildshipoutbox% + \pgfpages@shipoutshipoutbox% + \fi + \ifnum\pgf@cppn<\pgf@physicalpages% + \advance \pgf@cppn by 1\relax + \repeat% + \pgfpages@performcopying% + \global\pgfphysicalpageemptytrue% + \global\pgf@holdingphysicalpagefalse% + \fi% +} + +\newbox\pgfpages@shipoutbox + +\def\pgfpages@buildshipoutbox{% + \setbox\pgfpages@shipoutbox=\vbox{{% + \set@typeset@protect% + \offinterlineskip% + \pgfsys@beginpicture% + \pgf@cpn=1\relax% + \loop% + \pgfpagesshiptrue + \csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @skipcode\endcsname +\ifpgfpagesship +\pgf@clpn=\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @logicalpage\endcsname\relax% + \setbox0=\hbox to \csname pgfpages@lp@\the\pgf@clpn @width\endcsname{% + \hskip1in% + \vbox to \csname pgfpages@lp@\the\pgf@clpn @height\endcsname% + {\vskip1in\offinterlineskip \expandafter\copy\csname + pgfpages@box@\the\pgf@clpn\endcsname\vss}\hss}% + \pgfsys@beginscope% + % Translate lower left corner + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @center\endcsname\relax% + \else% + \pgflowlevel{\pgftransformshift{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @center\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformscale{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @scale\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @xscale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformxscale{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @xscale\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @yscale\endcsname\relax% + \else% + \pgflowlevel{\pgftransformyscale{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @yscale\endcsname}}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @rotation\endcsname\relax% +% \pgfscope% + \else% + \pgflowlevel{\pgftransformrotate{\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @rotation\endcsname}}% + \fi% + \pgfutil@tempdima=\csname pgfpages@lp@\the\pgf@clpn @width\endcsname\relax% + \pgfutil@tempdimb=\csname pgfpages@lp@\the\pgf@clpn @height\endcsname\relax% + \pgflowlevel{\pgftransformshift{\pgfpoint{-.5\pgfutil@tempdima}{-.5\pgfutil@tempdimb}}}% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @bordercode\endcsname\relax% + \else% + \pgfpathmoveto{\pgfpointorigin}% + \pgfpathlineto{\pgfpoint{\wd0}{0pt}}% + \pgfpathlineto{\pgfpoint{\wd0}{\ht0}}% + \pgfpathlineto{\pgfpoint{0pt}{\ht0}}% + \pgfpathclose% + {\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @bordercode\endcsname}% + \fi% + \expandafter\ifx\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @cornerwidth\endcsname\relax% + \else% + { + \expandafter\pgfutil@tempdima\csname pgfpages@p@\the\pgf@cpn @\the\pgf@cppn @cornerwidth\endcsname\relax% + \color{black} + \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfpathrectangle{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0-\pgfutil@tempdima}}{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdima}}% + \pgfusepath{fill}% + \pgfpathmoveto{\pgfpoint{0pt}{\pgfutil@tempdima}}% + \pgfpathcurveto{\pgfpoint{0pt}{0.555\pgfutil@tempdima}}{\pgfpoint{.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\pgfutil@tempdima}{0pt}}% + \pgfpathlineto{\pgfpoint{\wd0-\pgfutil@tempdima}{0pt}}% + \pgfpathcurveto{\pgfpoint{\wd0-.555\pgfutil@tempdima}{0pt}}{\pgfpoint{\wd0}{.555\pgfutil@tempdima}}{\pgfpoint{\wd0}{\pgfutil@tempdima}}% + \pgfpathlineto{\pgfpoint{\wd0}{\ht0-\pgfutil@tempdima}}% + \pgfpathcurveto{\pgfpoint{\wd0}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{\wd0-.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{\wd0-\pgfutil@tempdima}{\ht0}}% + \pgfpathlineto{\pgfpoint{\pgfutil@tempdima}{\ht0}}% + \pgfpathcurveto{\pgfpoint{.555\pgfutil@tempdima}{\ht0}}{\pgfpoint{0pt}{\ht0-.555\pgfutil@tempdima}}{\pgfpoint{0pt}{\ht0-\pgfutil@tempdima}}% + \pgfpathclose + \pgfusepath{clip}% + \color{white}% + \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\wd0}{\ht0}}% + \pgfusepath{fill}% + }% + \fi% + \ht0=0pt% + \wd0=0pt% + \dp0=0pt% + \pgfsys@hbox0% +% \endpgfscope% + \pgfsys@endscope% + \fi + \ifnum\pgf@cpn<\csname pgf@lpageson@\the\pgf@cppn\endcsname\relax% + \advance \pgf@cpn by 1\relax% + \repeat% + \pgfsys@endpicture% + }}% +} + + +\def\pgfpages@shipoutshipoutbox{% + \begingroup + \let \protect \noexpand + \@resetactivechars + \global\let\@@if@newlist\if@newlist + \global\@newlistfalse + \@parboxrestore% + \pgfpages@originalshipout% + \vbox{\hbox{% + \hskip-1in% + \vbox to \pgfphysicalheight{% + \vss\box\pgfpages@shipoutbox% + \vskip1in% + }}}% + \endgroup% +} + +\def\pgfpages@performcopying{ + \pgf@clpn=1\relax% copy first + \loop% + \expandafter\ifx\csname pgfpages@lp@\the\pgf@clpn @copy\endcsname\relax + \else% + \edef\pgf@temp{\noexpand\global\noexpand\setbox\csname pgfpages@box@% + \the\pgf@clpn\endcsname=\noexpand\copy\csname pgfpages@box@\csname + pgfpages@lp@\the\pgf@clpn @copy\endcsname\endcsname}% + \pgf@temp% + \fi% + \ifnum\pgf@clpn<\pgf@logicalpages% + \advance \pgf@clpn by 1\relax% + \repeat% + \pgf@clpn=1\relax% then void + \loop% + \expandafter\ifx\csname pgfpages@lp@\the\pgf@clpn @copy\endcsname\relax + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@clpn\endcsname=\box\voidb@x% + \else% + \fi% + \ifnum\pgf@clpn<\pgf@logicalpages% + \advance \pgf@clpn by 1\relax% + \repeat% +} + + + +% Save original shipout commands +% +% Example: +% +% \pgfhookintoshipout + +\newcommand\pgfhookintoshipout{ + \let\pgfpages@originalshipout=\shipout + \let\shipout=\pgfpages@interceptshipout +} + +\def\pgfpages@interceptshipout{% + \ifnum\pgf@shipoutnextto>0\relax + \def\pgf@next{% + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname=\box\voidb@x% + \afterassignment\pgfpages@shipouttestnext% + \pgfpagesshipoutlogicalpage{\the\pgf@shipoutnextto}% + }% + \else% + \ifpgf@holdingphysicalpage% shipout physical page now + {\pgfshipoutphysicalpage}% + \fi% + \ifnum\pgf@logicalpages=0\relax + \def\pgf@next{\pgfpages@originalshipout}% + \else% + \def\pgf@next{% + \expandafter\global\expandafter\setbox\csname pgfpages@box@\the\pgf@currentshipout\endcsname=\box\voidb@x% + \afterassignment\pgfpages@shipouttest% + \pgfpagesshipoutlogicalpage{\the\pgf@currentshipout}% + }% + \fi% + \fi% + \pgf@next% +} + +\def\pgfpages@shipouttest{% + \ifvoid\csname pgfpages@box@\the\pgf@currentshipout\endcsname\relax% + \aftergroup\pgfpages@preparenextshipout% + \else% + \pgfpages@preparenextshipout% + \fi% +} + +\def\pgfpages@shipouttestnext{% + \ifvoid\csname pgfpages@box@\the\pgf@shipoutnextto\endcsname\relax% + \aftergroup\pgfpages@preparenextshipout% + \else% + \pgfpages@preparenextshipout% + \fi% +} + +\def\pgfpages@preparenextshipout{% + \ifnum\pgf@shipoutnextto=0\relax% + \global\advance\pgf@currentshipout by 1\relax% + \else% + \global\pgf@shipoutnextto=0\relax% + \fi% + \ifnum\pgf@currentshipout>\pgf@lastshipout\relax% + \global\pgf@currentshipout=\pgf@firstshipout\relax% + \global\pgf@holdingphysicalpagetrue% + \fi% +} + + + +% Shipout a logical page +% +% #1 = logical page number +% +% The command should be followed by a box. This box will become the +% contents of the logical page. +% +% Example: +% +% \pgfpagesshipoutlogicalpage{0}\vbox{Hi!} + +\newcommand\pgfpagesshipoutlogicalpage[1]{% + \global\pgfphysicalpageemptyfalse% + \expandafter\global\expandafter\setbox\csname pgfpages@box@#1\endcsname=} + + + +% Finish current page and shipout next page to a specific logical page. +% +% #1 = logical page number +% +% When the current page has been typset, it will be become the given +% logical page. This command ``interrupts'' the normal order of +% logical pages. +% +% Example: +% +% \pgfpagesuselayout{two screens with optional second} +% +% Text for main page.\clearpage +% +% \pgfpagescurrentpagewillbelogicalpage{2} +% +% Text that goes to second page +% +% \clearpage +% +% Text for main page. + +\newcommand\pgfpagescurrentpagewillbelogicalpage[1]{% + \global\pgf@shipoutnextto=#1\relax% +} + + +% Setup the physical page sizes +% +% Example: +% +% \pgfsetupphysicalpagesizes + +\newcommand\pgfsetupphysicalpagesizes{% + % The following code was send to me by Rolf Niepraschk + \ifx\Gin@driver\pgfutil@empty\else% + \filename@parse{\Gin@driver}\@tempswafalse% + \def\reserved@a{dvips}% + \ifx\filename@base\reserved@a\@tempswatrue\fi% + \def\reserved@a{dvipdfm}% + \ifx\filename@base\reserved@a\@tempswatrue\fi% + \if@tempswa% + \AtBeginDvi{% + \special{papersize=\the\pgfphysicalwidth,\the\pgfphysicalheight}}% + \fi% + \def\reserved@a{pdftex}% + \ifx\filename@base\reserved@a + \pdfpagewidth\pgfphysicalwidth\pdfpageheight\pgfphysicalheight% + \fi% + \def\reserved@a{vtex}% + \ifx\filename@base\reserved@a + \mediawidth\pgfphysicalwidth\mediaheight\pgfphysicalheight% + \fi% + \def\reserved@a{luatex}% + \ifx\filename@base\reserved@a + \pagewidth\pgfphysicalwidth\pageheight\pgfphysicalheight% + \fi% + \fi +} + + +% +% Start/End setup +% +\AtBeginDocument +{ + \pgfhookintoshipout + \pgfsetupphysicalpagesizes +} +\AtEndDocument +{ + \clearpage + \ifpgfphysicalpageempty + \else + \pgfshipoutphysicalpage + \fi +} + |