source: trunk/VUT/doc/SciReport/pdfpages.sty @ 277

Revision 277, 16.1 KB checked in by bittner, 19 years ago (diff)

changes in the structure: renamed tools to algorithms

RevLine 
[277]1%%
2%% This is file `pdfpages.sty',
3%% generated with the docstrip utility.
4%%
5%% The original source files were:
6%%
7%% pdfpages.dtx  (with options: `package')
8%%
9%% This is a pdfLaTeX package for including pages
10%% of external PDF documents.
11%%
12%% This file is part of the pdfpages package.
13%%
14%%
15%% \CharacterTable
16%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
17%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
18%%   Digits        \0\1\2\3\4\5\6\7\8\9
19%%   Exclamation   \!     Double quote  \"     Hash (number) \#
20%%   Dollar        \$     Percent       \%     Ampersand     \&
21%%   Acute accent  \'     Left paren    \(     Right paren   \)
22%%   Asterisk      \*     Plus          \+     Comma         \,
23%%   Minus         \-     Point         \.     Solidus       \/
24%%   Colon         \:     Semicolon     \;     Less than     \<
25%%   Equals        \=     Greater than  \>     Question mark \?
26%%   Commercial at \@     Left bracket  \[     Backslash     \\
27%%   Right bracket \]     Circumflex    \^     Underscore    \_
28%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
29%%   Right brace   \}     Tilde         \~}
30%%
31\NeedsTeXFormat{LaTeX2e}
32\ProvidesPackage{pdfpages}[2001/04/10 v0.1h4 Include pages of external PDF documents (AM)]
33\begingroup
34\@ifundefined{pdfoutput}
35    {\PackageError{pdfpages}
36            {You're either not using pdfLaTeX\MessageBreak
37             or have turn off PDF output.\MessageBreak
38             `pdfpages' works only with pdfLaTeX\MessageBreak
39             and PDF output}
40            {Use `pdflatex' instead of `latex'\MessageBreak
41             and set output to PDF (use: \pdfoutput = 1)!}
42     \expandafter\endinput
43    }{}
44\ifnum\pdfoutput=0
45    \PackageError{pdfpages}
46            {You don't produce PDF output, which\MessageBreak
47             is required for the `pdfpages' package}
48            {Set output to PDF. (use: \pdfoutput = 1)}
49    \expandafter\endinput
50\fi
51\endgroup
52\def\AM@ifdriverlater{\@ifl@ter{def}}
53\AtBeginDocument{%
54  \AM@ifdriverlater{pdftex}{2000/05/12}{}{%
55      \PackageError{pdfpages}{%
56           You have an old `pdftex.def'.\MessageBreak%
57           There is no multipage support\MessageBreak%
58           in `pdftex.def' < 0.02u.\MessageBreak%
59           Update your `pdftex.def'}
60           {Update your `pdftex.def'!}}
61  \AM@ifdriverlater{pdftex}{2000/09/14}{}{%
62      \PackageWarning{pdfpages}{%
63           You have an old `pdftex.def'.\MessageBreak%
64           There might be problems with\MessageBreak%
65           the `trim' and `clip' options.\MessageBreak%
66           Update your `pdftex.def'!\MessageBreak}}
67}% AtBeginDocument
68\RequirePackage{ifthen, graphicx, eso-pic, calc}
69\newcommand{\AM@draft}{false}
70\DeclareOption{draft}{\def\AM@draft{true}}
71\DeclareOption{final}{\def\AM@draft{false}}
72\ProcessOptions
73\newboolean{AM@openright}\setboolean{AM@openright}{false}
74\newboolean{AM@frame}\setboolean{AM@frame}{false}
75\newboolean{AM@landscape}\setboolean{AM@landscape}{false}
76\newboolean{AM@turn}\setboolean{AM@turn}{true}
77\newboolean{AM@thread}\setboolean{AM@thread}{false}
78\newboolean{AM@link}\setboolean{AM@link}{false}
79\newboolean{AM@linktodoc}\setboolean{AM@linktodoc}{false}
80\newboolean{AM@compatibility}\setboolean{AM@compatibility}{false}
81\newcommand{\AM@xoffset}{0pt}\newcommand{\AM@yoffset}{0pt}
82\newcommand{\AM@deltax}{0pt}\newcommand{\AM@deltay}{0pt}
83\newcommand{\AM@xpos}{0pt}\newcommand{\AM@ypos}{0pt}
84\newcommand{\AM@rotate}{0}
85\newcommand{\AM@lscape@roti}{0}\newcommand{\AM@lscape@rotii}{0}
86\newcommand{\AM@pagecommand}{\thispagestyle{empty}}
87\newcommand{\AM@fbox}{}\newcommand{\AM@ph}{}
88\newcommand{\AM@pagestemp}{1}
89\newcommand{\AM@page}{}
90\newcommand{\AM@pagei}{}\newcommand{\AM@pageii}{}
91\newcommand{\AM@pageiii}{}\newcommand{\AM@pageiv}{}
92\newcommand{\AM@@smallpage}{}\newcommand{\AM@smallpage}{\AM@@smallpage}
93\newcommand{\AM@firstpage}{1}\newcommand{\AM@lastpage}{1}
94\newcommand{\AM@nup}{1}
95\newcommand{\AM@linkname}{}
96\newcommand{\AM@threadname}{}
97\newcommand{\AM@linkfit}{fitr}
98\newcommand{\AM@linktodocfit}{/Fit}
99\newcommand{\AM@setunit}{\setlength{\unitlength}{1pt}}
100\newif\ifAM@thumbpdf
101\newif\ifAM@pdflscape
102\newcommand{\AM@setlscape}{}
103\AtBeginDocument{%
104  \@ifpackageloaded{thumbpdf}{\AM@thumbpdftrue}{\AM@thumbpdffalse}%
105  \@ifpackageloaded{pdflscape}{\AM@pdflscapetrue}{\AM@pdflscapefalse}%
106  \ifAM@thumbpdf
107    \ifAM@pdflscape
108      \def\AM@setlscape{\PLS@Rotate{90}}%
109    \else
110      \def\AM@setlscape{\pdfpageattr{/Rotate 90}\AM@thumbpdfwarning}\fi
111  \else
112    \def\AM@setlscape{\pdfpageattr{/Rotate 90}}\fi}
113\newif\ifAM@thumbpdfwarning
114\newcommand{\AM@thumbpdfwarning}{%
115  \ifAM@thumbpdfwarning\else\global\AM@thumbpdfwarningtrue
116  \PackageWarning{pdfpages}{%
117    You are using `thumbpdf.sty' but not\MessageBreak
118    `pdflscape.sty'. \MessageBreak
119    Please include `pdflscape.sty' in  your document\MessageBreak
120    to get a pleasant PDF document with thumbs.\MessageBreak}\fi}
121\newcommand*{\includepdfset}[1]{\setkeys{Gin}{#1}}
122\newcommand*{\includepdf}[2][]{%
123  \begingroup% setkey
124  \filename@parse{#2}
125  \@ifundefined{filename@ext}
126    {\def\AM@linkfilename{#2.pdf}}
127    {\def\AM@linkfilename{#2}}%
128  \def\AM@linkname{#2}%
129  \def\AM@threadname{#2}%
130  \setkeys{Gin}{draft=\AM@draft, #1}%
131  \ifthenelse{\boolean{AM@compatibility}}
132    {\def\AM@pagestemp{\AM@firstpage-\AM@lastpage}}{}%
133  \ifthenelse{\boolean{AM@frame}}
134         {\let\AM@fbox\fbox}{\let\AM@fbox\relax}%
135  \expandafter\AM@pagenumbers\expandafter{\AM@pagestemp}%
136  \ifthenelse{\boolean{AM@openright}}{\AM@openright}{}%
137  \AM@setphantom
138  \AM@filluppagelist
139  \setlength{\fboxsep}{0pt}%
140  \whiledo{\not\boolean{endofpagelist}}{%
141    \newpage
142    \ifthenelse{\boolean{AM@turn}}
143      {\ifthenelse{\boolean{AM@landscape}}
144         {\ifthenelse{\equal{1}{\AM@nup}}{\AM@setlscape}{}%
145          \ifthenelse{\equal{4}{\AM@nup}}{\AM@setlscape}{}}
146         {\ifthenelse{\equal{2}{\AM@nup}}{\AM@setlscape}{}}%
147      }{}%
148    \AM@getpages{\AM@nup}%
149      \ifthenelse{\equal{1}{\AM@nup}}{%
150         \def\AM@@smallpage{%
151           \includegraphics[page=\AM@page, angle=\AM@lscape@rotii,
152                            angle=\AM@rotate, #1]{#2}}%
153         \AddToShipoutPicture{\AM@setunit%
154           \let\AM@page\AM@pagei\AM@isphantom
155           \AM@output{0}{\AM@smallpage}}%
156        }{}%
157      \ifthenelse{\equal{2}{\AM@nup}}{%
158        \def\AM@@smallpage{%
159          \includegraphics[page=\AM@page, angle=90,
160                           angle=\AM@lscape@roti, angle=\AM@rotate,
161                           scale=.7071, #1]{#2}}%
162        \AddToShipoutPicture{\AM@setunit%
163          \ifthenelse{\boolean{AM@landscape}}
164            {\let\AM@page\AM@pagei\AM@isphantom
165             \AM@output{1}{\AM@smallpage}%
166             \let\AM@page\AM@pageii\AM@isphantom
167             \AM@output{2}{\AM@smallpage}}
168            {\let\AM@page\AM@pagei\AM@isphantom
169             \AM@output{2}{\AM@smallpage}%
170             \let\AM@page\AM@pageii\AM@isphantom
171             \AM@output{1}{\AM@smallpage}}}%
172      }{}%
173      \ifthenelse{\equal{4}{\AM@nup}}{%
174        \def\AM@@smallpage{%
175          \includegraphics[page=\AM@page, angle=\AM@lscape@rotii,
176                           angle=\AM@rotate, scale=.5, #1]{#2}}%
177        \AddToShipoutPicture{\AM@setunit%
178          \ifthenelse{\boolean{AM@landscape}}
179            {\let\AM@page\AM@pagei\AM@isphantom
180             \AM@output{5}{\AM@smallpage}%
181             \let\AM@page\AM@pageii\AM@isphantom
182             \AM@output{3}{\AM@smallpage}%
183             \let\AM@page\AM@pageiii\AM@isphantom
184             \AM@output{6}{\AM@smallpage}%
185             \let\AM@page\AM@pageiv\AM@isphantom
186             \AM@output{4}{\AM@smallpage}}
187            {\let\AM@page\AM@pagei\AM@isphantom
188             \AM@output{3}{\AM@smallpage}%
189             \let\AM@page\AM@pageii\AM@isphantom
190             \AM@output{4}{\AM@smallpage}%
191             \let\AM@page\AM@pageiii\AM@isphantom
192             \AM@output{5}{\AM@smallpage}%
193             \let\AM@page\AM@pageiv\AM@isphantom
194             \AM@output{6}{\AM@smallpage}}}%
195     }{}%
196    \AM@pagecommand
197    \hskip0pt
198    \newpage
199    \ifAM@pdflscape\PLS@Rotate{0}\fi
200    \ClearShipoutPicture
201  }% whiledo
202  \endgroup% setkey
203  \ClearShipoutPicture
204}% includepdf
205\newif\ifphantompage
206\newcommand{\AM@isphantom}{%
207  \expandafter\ifx\expandafter\\\AM@page\\%
208    \let\AM@page\AM@phantompage
209    \let\AM@ph\phantom
210    \phantompagefalse
211  \else
212    \let\AM@ph\relax
213    \phantompagetrue
214  \fi}
215\newcommand{\AM@hyper}{%
216  \ifphantompage
217  \ifthenelse{\boolean{AM@link}}{%
218    \pdfdest name {\AM@linkname.\AM@page}%
219             \AM@linkfit}{}%
220  \fi
221  \ifthenelse{\boolean{AM@linktodoc}}{%
222    \@tempcntb\AM@page\relax
223    \advance\@tempcntb by -1
224    \pdfannot width \wd\@tempboxa
225              height \ht\@tempboxa
226              depth \dp\@tempboxa
227              {/Subtype /Link /Border [0 0 0]
228               /A << /S /GoToR /F (\AM@linkfilename)
229                     /D [\the\@tempcntb \AM@linktodocfit]
230                     /NewWindow true >>}}{}%}%
231  \ifphantompage
232  \ifthenelse{\boolean{AM@thread}}{%
233      \pdfthread width \wd\@tempboxa
234                 height \ht\@tempboxa
235                 depth \dp\@tempboxa
236                 name {\AM@threadname}}{}%
237  \fi}%
238\newcommand{\AM@output}[2]{%
239  \setbox\@tempboxa=\hbox{\AM@fbox{#2}}%
240  \def\AM@add{+}%
241  \if@twoside\ifodd\value{page}\else\def\AM@add{-}\fi\fi
242  \ifcase#1 % nup=1
243    \def\AM@xpos{.5\paperwidth - .5\wd\@tempboxa \AM@add\AM@xoffset}%
244    \def\AM@ypos{.5\paperheight - .5\ht\@tempboxa - .5\dp\@tempboxa
245                 \AM@add\AM@yoffset}%
246  \or % nup=2
247    \def\AM@xpos{.5\paperwidth - .5\wd\@tempboxa \AM@add\AM@xoffset}%
248    \def\AM@ypos{.5\paperheight + \AM@deltay*\real{.5} + \AM@yoffset
249                 - .5\fboxrule}%
250  \or
251    \def\AM@xpos{.5\paperwidth - .5\wd\@tempboxa \AM@add\AM@xoffset}%
252    \def\AM@ypos{.5\paperheight - \ht\@tempboxa - \dp\@tempboxa
253                 - \AM@deltay*\real{.5} + \AM@yoffset + .5\fboxrule}%
254  \or % nup=4
255    \def\AM@xpos{.5\paperwidth - \wd\@tempboxa \AM@add\AM@xoffset
256                 + .5\fboxrule - \AM@deltax*\real{.5}}%
257    \def\AM@ypos{.5\paperheight + \AM@deltay*\real{.5} + \AM@yoffset
258                 - .5\fboxrule}%
259  \or
260    \def\AM@xpos{.5\paperwidth \AM@add\AM@xoffset
261                 - .5\fboxrule + \AM@deltax*\real{.5}}%
262    \def\AM@ypos{.5\paperheight + \AM@deltay*\real{.5} + \AM@yoffset
263                 - .5\fboxrule}%
264  \or
265    \def\AM@xpos{.5\paperwidth - \wd\@tempboxa \AM@add\AM@xoffset
266                 + .5\fboxrule - \AM@deltax*\real{.5}}%
267    \def\AM@ypos{.5\paperheight - \ht\@tempboxa - \dp\@tempboxa
268                 - \AM@deltay*\real{.5} + \AM@yoffset + .5\fboxrule}%
269  \or
270    \def\AM@xpos{.5\paperwidth \AM@add\AM@xoffset
271                 - .5\fboxrule + \AM@deltax*\real{.5}}%
272    \def\AM@ypos{.5\paperheight - \ht\@tempboxa - \dp\@tempboxa
273                 - \AM@deltay*\real{.5} + \AM@yoffset + .5\fboxrule}%
274  \fi
275  \setlength{\@tempdima}{\AM@xpos}%
276  \edef\AM@xpos{\strip@pt\@tempdima}%
277  \setlength{\@tempdima}{\AM@ypos}%
278  \edef\AM@ypos{\strip@pt\@tempdima}%
279  \put(\AM@xpos,\AM@ypos){%
280    \AM@ph{\raisebox{\dp\@tempboxa}{%
281      \AM@hyper
282      \box\@tempboxa}}}%
283} % AM@output
284\newcommand{\AM@pagelist}{}
285\newcommand{\saveAM@pagelist}{}
286\newboolean{endofpagelist}
287\newcommand{\AM@pagenumbers}{1}
288\def\AM@pagenumbers#1{%
289  \AM@@pagenumbers#1,\END
290  \let\saveAM@pagelist\AM@pagelist
291  \edef\AM@pagelist{\saveAM@pagelist\noexpand\END}%
292}
293\newcommand{\AM@@pagenumbers}{}
294\def\AM@@pagenumbers#1,#2{%
295  \AM@pagearea#1-\END
296  \ifx#2\END \def\AM@next{\relax}%
297    \else \def\AM@next{\AM@@pagenumbers #2}%
298  \fi
299  \AM@next
300}
301\newcommand{\AM@pagearea}{}
302\def\AM@pagearea#1-#2\END{%
303  \ifx\\#2\\%
304    \AM@addtopagelist{#1}%
305  \else
306    \AM@last#2
307    \@tempcnta=#1
308    \whiledo{\@tempcnta<\@tempcntb}{%
309      \AM@addtopagelist{\the\@tempcnta}%
310      \advance\@tempcnta by 1
311    }%
312  \fi}
313\newcommand{\AM@last}{}
314\def\AM@last#1-{%
315  \@tempcntb=#1 \advance\@tempcntb by 1
316  \def\lastpage{#1}%
317}
318\newcommand{\AM@addtopagelist}{}
319\def\AM@addtopagelist#1{%
320  \let\saveAM@pagelist\AM@pagelist
321  \edef\AM@pagelist{\saveAM@pagelist#1,}%
322}
323\newcommand{\AM@openright}{}
324\def\AM@openright{\expandafter\AM@@openright\AM@pagelist}
325\newcommand{\AM@@openright}{}
326\def\AM@@openright#1\END{%
327  \edef\AM@pagelist{,#1\noexpand\END}%
328}
329\newcommand{\AM@getpages}{}
330\def\AM@getpages#1{%
331  \ifcase#1
332    \or
333    \expandafter\AM@getipages\AM@pagelist \or
334    \expandafter\AM@getiipages\AM@pagelist \or\or
335    \expandafter\AM@getivpages\AM@pagelist \fi
336}
337
338\newcommand{\AM@getipages}{}
339\def\AM@getipages#1,#2\END{%
340  \def\AM@pagei{#1}%
341  %remove page from list
342  \def\AM@pagelist{#2\END}%
343  % checking end of list
344  \ifx\\#2\\\setboolean{endofpagelist}{true}\fi
345}
346\newcommand{\AM@getiipages}{}
347\def\AM@getiipages#1,#2,#3\END{%
348  \def\AM@pagei{#1}%
349  \def\AM@pageii{#2}%
350  %remove pages from list
351  \def\AM@pagelist{#3\END}%
352  % checking end of list
353  \ifx\\#3\\\setboolean{endofpagelist}{true}\fi
354}
355\newcommand{\AM@getivpages}{}
356\def\AM@getivpages#1,#2,#3,#4,#5\END{%
357  \def\AM@pagei{#1}%
358  \def\AM@pageii{#2}%
359  \def\AM@pageiii{#3}%
360  \def\AM@pageiv{#4}%
361  %remove pages from list
362  \def\AM@pagelist{#5\END}%
363  % checking end of list
364  \ifx\\#5\\\setboolean{endofpagelist}{true}\fi
365}
366\newcommand{\AM@countpagelist}{}
367\def\AM@countpagelist{%
368  \@tempcnta=0 \expandafter\AM@@countpagelist\AM@pagelist}
369\newcommand{\AM@@countpagelist}{}
370\def\AM@@countpagelist#1,#2{%
371  \ifx#2\END\def\AM@next{\relax}%
372    \else\def\AM@next{\AM@@countpagelist #2}%
373  \fi
374  \advance\@tempcnta by 1
375  \AM@next
376}
377\newcommand{\AM@filluppagelist}{}
378\def\AM@filluppagelist{%
379  \AM@countpagelist
380  \@tempcntb=\@tempcnta
381  \divide\@tempcntb by \AM@nup%
382  \multiply\@tempcntb by \AM@nup%
383  \advance\@tempcnta by -\@tempcntb
384  \ifnum\@tempcnta=0
385    \else
386      \advance\@tempcnta by -\AM@nup%
387      \multiply\@tempcnta by -1
388  \fi
389  \expandafter\AM@removeend\AM@pagelist
390  \whiledo{\@tempcnta > 0}{%
391    \let\saveAM@pagelist\AM@pagelist
392    \edef\AM@pagelist{\saveAM@pagelist ,}%
393    \advance\@tempcnta by -1
394  }%
395  \let\saveAM@pagelist\AM@pagelist
396  \edef\AM@pagelist{\saveAM@pagelist\noexpand\END}%
397}
398\newcommand{\AM@removeend}{}
399\def\AM@removeend#1\END{%
400  \let\saveAM@pagelist\AM@pagelist
401  \edef\AM@pagelist{#1}%
402}
403\newcommand{\AM@setphantom}{}
404\def\AM@setphantom{\expandafter\AM@@setphantom\AM@pagelist}
405\newcommand{\AM@@setphantom}{}
406\def\AM@@setphantom#1,#2\END{%
407  \ifx\\#1\\ \def\AM@next{\AM@@setphantom#2\END}%
408  \else
409    \edef\AM@phantompage{#1}%
410    \def\AM@next{\relax}%
411  \fi
412  \AM@next
413}
414\define@key{Gin}{pages}{\def\AM@pagestemp{#1}}
415\define@key{Gin}{nup}{\def\AM@nup{#1}}
416\define@key{Gin}{deltax}{\AM@parse@deltax#1 \\}
417\define@key{Gin}{deltay}{\AM@parse@deltay#1 \\}
418\define@key{Gin}{offset}{\AM@parse@offset#1 \\}
419\define@key{Gin}{frame}[true]{\setboolean{AM@frame}{#1}}
420\define@key{Gin}{openright}[true]{\setboolean{AM@openright}{#1}}
421\define@key{Gin}{pagecommand}{\renewcommand{\AM@pagecommand}{#1}}
422\define@key{Gin}{rotate}{\def\AM@rotate{#1}}
423\define@key{Gin}{landscape}[true]{\setboolean{AM@landscape}{#1}%
424                                  \def\AM@lscape@roti{-90}%
425                                  \def\AM@lscape@rotii{90}}
426\define@key{Gin}{turn}[true]{\setboolean{AM@turn}{#1}}
427\define@key{Gin}{firstpage}{\def\AM@firstpage{#1}%
428                            \setboolean{AM@compatibility}{true}}
429\define@key{Gin}{lastpage}{\def\AM@lastpage{#1}%
430                           \setboolean{AM@compatibility}{true}}
431\define@key{Gin}{thread}[true]{\setboolean{AM@thread}{#1}}
432\define@key{Gin}{threadname}{\def\AM@threadname{#1}}
433\define@key{Gin}{link}[true]{\setboolean{AM@link}{#1}}
434\define@key{Gin}{linkfit}{\def\AM@linkfit{#1}}
435\define@key{Gin}{linkname}{\def\AM@linkname{#1}}
436\define@key{Gin}{linktodoc}[true]{\setboolean{AM@linktodoc}{#1}}
437\define@key{Gin}{linktodocfit}{\def\AM@linktodocfit{#1}}
438\define@key{Gin}{linkfilename}{\pdfstringdef\AM@linkfilename{#1}}
439\def\AM@parse@deltax#1 #2\\{\AMGin@defaultbp\AM@deltax{#1}}
440\def\AM@parse@deltay#1 #2\\{\AMGin@defaultbp\AM@deltay{#1}}
441\def\AM@parse@offset#1 #2 #3\\{%
442  \AMGin@defaultbp\AM@xoffset{#1}%
443  \AMGin@defaultbp\AM@yoffset{#2}}
444\def\AMGin@defaultbp#1#2{%
445  \afterassignment\AMGin@def@bp\dimen@#2bp\relax{#1}{#2}}
446\def\AMGin@def@bp#1\relax#2#3{%
447   \if!#1!%
448     \def#2{#3bp}%
449    \else
450      \dimen@.99626\dimen@
451      \edef#2{\strip@pt\dimen@ bp}%
452    \fi}
453\endinput
454%%
455%% End of file `pdfpages.sty'.
Note: See TracBrowser for help on using the repository browser.