diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:52:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:52:24 +0000 |
commit | 16b64696d398d8d52f59c053e91078bed894ac86 (patch) | |
tree | 0bcc8e9bfe315c2e6504df997f5ab63c3be1d31a /Master | |
parent | 4dba39261e79016273de3205cf595d844a48f105 (diff) |
booklet
git-svn-id: svn://tug.org/texlive/trunk@720 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/latex/booklet/bkltprnt.sty | 268 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/booklet/booklet.sty | 82 |
2 files changed, 350 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/booklet/bkltprnt.sty b/Master/texmf-dist/tex/latex/booklet/bkltprnt.sty new file mode 100644 index 00000000000..749ccc7f7ac --- /dev/null +++ b/Master/texmf-dist/tex/latex/booklet/bkltprnt.sty @@ -0,0 +1,268 @@ +%% +%% This is file `bkltprnt.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% booklet.dtx (with options: `prnt') +%% +%% ----------------------------------------------------------------- +%% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net +%% Copyright 2000 --- 2005 Peter R. Wilson +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status "author-maintained". +%% +%% This work consists of the files listed in the README file. +%% ----------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bkltprnt}[2005/03/23 v0.7 support for booklet printing] + +\newdimen\@targetwidth +\newdimen\@targetheight +\newdimen\@sourcewidth +\newdimen\@sourceheight + +\newif\if@leftpage + \@leftpagetrue +\newbox\@leftpage +\newbox\@rightpage +\newcount\@physicalpage + +\multiply\maxdeadcycles by 40\relax + +\newcount\bookletpage + \bookletpage=0 +\newcount\leftpagenumber +\newcount\rightpagenumber + +\newcommand*{\twoupp@geboxes}{% + \advance\bookletpage\@ne + \expandafter\newbox\csname bookletbox\the\bookletpage\endcsname + \ifnum \bookletpage < \c@signature + \twoupp@geboxes + \fi} +\AtBeginDocument{\twoupp@geboxes\bookletpage=\z@} + +{\catcode`\p=12\catcode`\t=12\gdef\@@inv@@mag#1pt#2{\def#2{#1}}} +\def\target#1#2#3{% + \mag #1\relax + \@targetwidth=1000pt + \divide\@targetwidth by #1\relax + \expandafter\@@inv@@mag\the\@targetwidth\inv@targetmag + \@targetwidth=#2\relax + \@targetwidth=\inv@targetmag\@targetwidth + \@targetheight=#3\relax + \@targetheight=\inv@targetmag\@targetheight} + +\def\source#1#2#3{% + \@sourcewidth=1000pt + \divide\@sourcewidth by #1\relax + \expandafter\@@inv@@mag\the\@sourcewidth\inv@sourcemag + \@sourcewidth=#2\relax + \@sourcewidth=\inv@sourcemag\@sourcewidth + \@sourceheight=#3\relax + \@sourceheight=\inv@sourcemag\@sourceheight} + +\renewcommand*{\setpdftargetpages}{% + \ifprintoption + \setlength{\pdfpageheight}{\@targetheight}% + \setlength{\pdfpagewidth}{\@targetwidth}% + \let\fixpdflayout\relax + \fi} +\renewcommand*{\setdvipstargetpages}{% + \ifprintoption + \AtBeginDvi{\special{papersize=\the\@targetwidth,\the\@targetheight}}% + \let\fixdvipslayout\relax + \fi} + +\def\targetBooklet{% + \def\ship@@@leftpage{\save@booklet\@leftpage}% + \def\ship@@@rightpage{\save@booklet\@rightpage}% + \@leftpagefalse} +\targetBooklet + +\def\targettopbottom{% + \def\make@@halfpage{\make@@halftopbottom}% + \def\make@fullpage{\make@fulltopbottom}% + \sidebysidefalse} + +\DeclareOption{four}{\setcounter{signature}{4}} +\DeclareOption{eight}{\setcounter{signature}{8}} +\DeclareOption{sixteen}{\setcounter{signature}{16}} +\DeclareOption{thirtytwo}{\setcounter{signature}{32}} +\DeclareOption{twouparticle}{\twouparticle} +\DeclareOption{landscape}{\twouplandscape} +\DeclareOption{largetypeblock}{\twoupplain} +\DeclareOption{1to1}{\twouponetoone} + +\expandafter\let\csname &normal@shipout\endcsname\shipout +\def\shipout{% + \if@leftpage + \global\@leftpagefalse + \def\next{\afterassignment\ship@leftpage\global\setbox\@leftpage=}% + \else + \global\@leftpagetrue + \def\next{\afterassignment\ship@rightpage\global\setbox\@rightpage=}% + \fi + \next} + +\def\ship@leftpage{% + \ifvoid\@leftpage\aftergroup\ship@@leftpage\else\ship@@leftpage\fi} +\def\ship@rightpage{% + \ifvoid\@rightpage\aftergroup\ship@@rightpage\else\ship@@rightpage\fi} + +\def\ship@@leftpage{\make@halfpage\@leftpage\ship@@@leftpage} +\def\ship@@rightpage{\make@halfpage\@rightpage\ship@@@rightpage} + +\def\make@halfpage#1{% + \dp#1=\z@ + \setbox#1=\vbox to\@sourceheight{% + \vskip \inv@sourcemag in + \vskip \voffset + \hbox to\@sourcewidth{\hskip\inv@sourcemag in\hskip\hoffset\box#1\hss}% + \vss}% + \make@@halfpage#1} + +\def\make@@halfsidebyside#1{% + \global\setbox#1=\vbox to\@targetheight{\vss + \hbox to.5\@targetwidth{\hss\box#1\hss}\vss}} +\def\make@@halfpage{\make@@halfsidebyside} + +\def\make@@halftopbottom#1{% + \global\setbox#1=\vbox to.5\@targetheight{\vss + \hbox to\@targetwidth{\hss\box#1\hss}\vss}} + +\def\ship@twoup{% + \begingroup + \voffset=-\inv@targetmag in + \hoffset=\voffset + \global\advance\@physicalpage by 1 + \count\z@=\@physicalpage + \csname &normal@shipout\endcsname\make@fullpage + \endgroup} + +\def\make@fullsidebyside{% + \hbox{\box\@leftpage\pagesep@sidebyside\box\@rightpage}} +\def\make@fulltopbottom{% + \vbox{\offinterlineskip\box\@leftpage\pagesep@topbottom\box\@rightpage}} + +\def\make@fullpage{\make@fullsidebyside} + +\def\pagesep@sidebyside{% + \begingroup + \advance\pageseplength by \pagesepoffset + \pagesepwidth=\inv@targetmag\pagesepwidth + \kern -.5\pagesepwidth + \vrule height \inv@targetmag\pageseplength + depth -\inv@targetmag\pagesepoffset + width \pagesepwidth + \kern -.5\pagesepwidth + \endgroup} +\def\pagesep@topbottom{% + \begingroup + \pagesepwidth=\inv@targetmag\pagesepwidth + \vskip -.5\pagesepwidth + \moveright\inv@targetmag\pagesepoffset\hbox{% + \vrule height\pagesepwidth width\inv@targetmag\pageseplength}% + \vskip -.5\pagesepwidth + \endgroup} + +\begingroup +\let\newbox\relax +\gdef\save@booklet#1{% + \begingroup + \globaldefs=1 + \ifnum\c@sigcount=\z@\bookletpage=0\fi + \advance\bookletpage by 1 + \addtocounter{sigcount}{1} +%%%% \expandafter\newbox\csname bookletbox\the\bookletpage\endcsname + \expandafter\setbox\csname bookletbox\the\bookletpage\endcsname\box#1% + \endgroup + \ifnum\c@sigcount=\c@signature %%% PW + \twoup@eject% + \setcounter{sigcount}{0}% + \fi} +\endgroup + +\def\make@bookletpage#1{% + \setbox\ifodd#1\@rightpage\else\@leftpage\fi=% + \expandafter\box\csname bookletbox\the#1\endcsname} + +\def\booklet@loop{% + \count\z@\rightpagenumber + \make@bookletpage\leftpagenumber + \make@bookletpage\rightpagenumber + \ship@twoup + \Booklet@@loop +} + +\def\Booklet@@loop{% + \advance\rightpagenumber by 1 + \advance\leftpagenumber by -1 + \ifnum\leftpagenumber<\rightpagenumber\else\expandafter\booklet@loop\fi} + +\def\twoupemptypage{\shipout\hbox{}} + +\def\twoup@eject{ + \leftpagenumber\bookletpage + \advance\leftpagenumber by 3 + \divide\leftpagenumber by 4 + \multiply\leftpagenumber by 4 + \rightpagenumber=1 + \ifnum\leftpagenumber>\bookletpage + \setbox\@leftpage\hbox{}% + \make@@halfpage\@leftpage + \loop + \setbox\@rightpage\copy\@leftpage + \save@booklet\@rightpage + \ifnum\leftpagenumber>\bookletpage + \repeat + \fi + \booklet@loop} + +\begingroup +\catcode`\>=9\relax +>>\gdef\twoupclearpage{\clearpage\twoup@eject} +>>\expandafter\@temptokena\expandafter{\enddocument} +>>\xdef\enddocument{\noexpand\twoupclearpage\the\@temptokena} +\endgroup + +\def\TwoupWrites{% + \let\TwoupSaved@write\write + \let\TwoupSaved@read\read + \let\TwoupSaved@openout\openout + \let\TwoupSaved@closeout\closeout + \def\write{\TwoupSaved@write-1{}\immediate\TwoupSaved@write}% + \def\read{\TwoupSaved@write-1{}\immediate\TwoupSaved@read}% + \def\openout{\TwoupSaved@write-1{}\immediate\TwoupSaved@openout}% + \def\closeout{\TwoupSaved@write-1{}\immediate\TwoupSaved@closeout}% + \let\TwoupWrites\relax} + +\def\twouparticle{\target{\magstepminus1}{\paperheight}{\paperwidth}} +\def\twoupplain{\target{\magstepminus2}{\paperheight}{\paperwidth}} +\def\twouplandscape{\target{\magstepminus2}{\paperwidth}{\paperheight}% + \targettopbottom} +\def\twouponetoone{\target{\magstep0}{\paperheight}{\paperwidth}} + +\source{\magstep0}{\paperwidth}{\paperheight} +\pagesepwidth 0pt +\pageseplength 6.5in +\pagesepoffset 1in +\TwoupWrites + +\ExecuteOptions{twouparticle,thirtytwo} +\ProcessOptions + +\endinput +%% +%% End of file `bkltprnt.sty'. diff --git a/Master/texmf-dist/tex/latex/booklet/booklet.sty b/Master/texmf-dist/tex/latex/booklet/booklet.sty new file mode 100644 index 00000000000..67d71a0f7bf --- /dev/null +++ b/Master/texmf-dist/tex/latex/booklet/booklet.sty @@ -0,0 +1,82 @@ +%% +%% This is file `booklet.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% booklet.dtx (with options: `usc') +%% +%% ----------------------------------------------------------------- +%% Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net +%% Copyright 2000 --- 2005 Peter R. Wilson +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status "author-maintained". +%% +%% This work consists of the files listed in the README file. +%% ----------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{booklet}[2005/03/23 v0.7 booklet printing] + +\newcommand*{\twoup@end}{\endinput} + +\newdimen\pageseplength +\newdimen\pagesepwidth +\newdimen\pagesepoffset + +\newif\ifsidebyside + \sidebysidetrue + +\newif\ifuselandscape + \uselandscapefalse +\newif\ifprintoption + \printoptionfalse + +\newcounter{signature} +\newcounter{sigcount} + \setcounter{sigcount}{0} +\newcommand*{\pagespersignature}[1]{\setcounter{signature}{#1}} + \pagespersignature{32} + +\def\magstepminus#1{% + \ifcase#1 \@m\or 833\or 694\or 579\or 482\or 401\fi\relax} + +\newcommand*{\target}[3]{} +\newcommand*{\source}[3]{} +\newcommand*{\setpdftargetpages}{} +\newcommand*{\setdvipstargetpages}{} + +\newcommand*{\targettopbottom}{} + +\newcommand*{\twoupemptypage}{} +\newcommand*{\twoupclearpage}{} + +\newcommand*{\checkforlandscape}{% + \ifx\ifuselandscape\ifprintoption + \uselandscapefalse\else\uselandscapetrue\fi} + +\DeclareOption{print}{\printoptiontrue\def\twoup@end{}} +\DeclareOption{noprint}{\printoptionfalse\def\twoup@end{\endinput}} +\DeclareOption{landscape}{\uselandscapetrue} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{bkltprnt}} +\ProcessOptions\relax +\ifuselandscape + \PassOptionsToPackage{landscape}{bkltprnt} +\fi + +\twoup@end + +\RequirePackage{bkltprnt} + +\endinput +%% +%% End of file `booklet.sty'. |