diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-22 22:28:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-22 22:28:57 +0000 |
commit | cfcc1904be1dc1c098dda94f10feaa4b498bbc0e (patch) | |
tree | 6b8b73fe1c439ad63c9be59d595d1bab11f11350 /Master/texmf-dist/doc/generic/olsak-misc/booklet.tex | |
parent | 3aa6801ea6246674434ec13776081b49f271f226 (diff) |
olsak-misc (21jun16)
git-svn-id: svn://tug.org/texlive/trunk@41526 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/olsak-misc/booklet.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/olsak-misc/booklet.tex | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/olsak-misc/booklet.tex b/Master/texmf-dist/doc/generic/olsak-misc/booklet.tex new file mode 100644 index 00000000000..1afeede5d98 --- /dev/null +++ b/Master/texmf-dist/doc/generic/olsak-misc/booklet.tex @@ -0,0 +1,38 @@ +% booklet.tex ... re-orders PDF pages and collets them for booklet printing + +% This macro is used as an example in the book +% Petr Olsak: Typograficky system TeX, pages 102, 103. + +% Usage: change the first definition \def\document{your-document} +% without PDF extension and process: pdftex booklet. +% Then use duplex printing over the short side. + +\ifx\document\undefined + \def\document {navrh-rozpoctu} % Name of processed document without suffix +\fi +\nopagenumbers % we need no pagenumbers +\pdfpagewidth=297mm \pdfpageheight=210mm % sheet = format A4 landscape +\pdfhorigin=0pt \pdfvorigin=0pt % Knuth's origin-point shifted +\def\pageswidth{width.5\pdfpagewidth} % page width = 1/2 of sheet width + +\pdfximage \pageswidth {\document.pdf} % First page is read in order to +\mathchardef\firstpage=\pdflastximage % detect \pdflastximagepages + +\def\putpage#1{% put the page number #1 into sheet + \ifnum#1>\pdflastximagepages \hbox{\vrule\pageswidth}\else % empty page + \ifnum#1=1 \pdfrefximage\firstpage % first page + \else \pdfximage \pageswidth page#1 {\document.pdf}% % normal page + \pdfrefximage\pdflastximage + \fi\fi} + +\newcount\aL \newcount\aR \newcount\bL \newcount\bR +\aL=\pdflastximagepages +\advance\aL by3 \divide\aL by4 \multiply\aL by4 % rounding to 4N up +\aR=1 \bL=2 \bR=\aL \advance\bR by-1 % little calculations +\loop + \hbox{\putpage\aL \putpage\aR}\vfil\break % faceside of the sheet + \hbox{\putpage\bL \putpage\bR}\vfil\break % underside of the sheet + \advance\aR by2 \advance\aL by-2 + \advance\bR by-2 \advance\bL by2 + \ifnum \aL>\aR \repeat +\end |