%%
%% This is file `pdfpages.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pdfpages.dtx  (with options: `package')
%% 
%% This is a package for PDFLaTeX, which makes it
%% easy to insert pages of external PDF documents.
%% 
%% This file is part of the pdfpages package.
%% 
%% Copyright (C) 2001 2002 Andreas MATTHIAS.
%% 
%% This program may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%%
%% Please send error reports and suggestions for improvements to
%%   Andreas MATTHIAS <amat@kabsi.at>.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pdfpages}
   [2002/12/14 v0.2l Insert pages of external PDF documents (AM)]
\def\AM@version{0.2l}
\newif\ifAM@pkg@draft \AM@pkg@draftfalse
\newif\ifAM@pkg@survey \AM@pkg@surveyfalse
\DeclareOption{draft}{\AM@pkg@drafttrue}
\DeclareOption{final}{\AM@pkg@draftfalse}
\DeclareOption{enable-survey}{\AM@pkg@surveytrue}
\DeclareOption{disable-survey}{\AM@pkg@surveyfalse}
\ProcessOptions
\begingroup
\@ifundefined{pdfoutput}
   {\PackageError{pdfpages}
            {You're either not using pdfLaTeX\MessageBreak
             or have turn off PDF output.\MessageBreak
             `pdfpages' only works with pdfLaTeX\MessageBreak
             and PDF output}
            {Use `pdflatex' instead of `latex'\MessageBreak
             and set output to PDF (use: \pdfoutput = 1)!}
    \endinput}
   {\ifnum\pdfoutput=\z@
      \PackageError{pdfpages}
            {You don't produce PDF output, which\MessageBreak
             is required for the `pdfpages' package}
            {Set output to PDF. (use: \pdfoutput = 1)}
      \expandafter\endinput
    \fi}
\endgroup
\RequirePackage{ifthen, graphicx, calc, eso-pic}
\ifAM@pkg@survey \RequirePackage{count1to}\fi
\def\AM@ifdriverlater{\@ifl@ter{def}}
\AM@ifdriverlater{pdftex}{2000/05/12}{}{%
    \PackageError{pdfpages}{%
         You have an old `pdftex.def'.\MessageBreak%
         There is no multipage support\MessageBreak%
         in `pdftex.def' < 0.02u.\MessageBreak%
         Update your `pdftex.def'}
         {Update your `pdftex.def'!}}
\AM@ifdriverlater{pdftex}{2000/09/14}{}{%
    \PackageWarning{pdfpages}{%
         You have an old `pdftex.def'.\MessageBreak%
         There might be problems with\MessageBreak%
         the `trim' and `clip' options.\MessageBreak%
         Update your `pdftex.def'!\MessageBreak}}
\def\AM@ifdriverlater{\@ifl@ter{sty}}
\AM@ifdriverlater{eso-pic}{2001/07/20}
  {\def\AM@AddToShipoutPicture{\AddToShipoutPicture*}%
   \def\AM@ClearShipoutPicture{\relax}}
  {\def\AM@AddToShipoutPicture{\AddToShipoutPicture}%
   \def\AM@ClearShipoutPicture{\ClearShipoutPicture}}
\newif\ifAM@openright\AM@openrightfalse
\newif\ifAM@frame\AM@framefalse
\newif\ifAM@landscape\AM@landscapefalse
\newif\ifAM@turn\AM@turntrue
\newif\ifAM@thread\AM@threadfalse
\newif\ifAM@link\AM@linkfalse
\newif\ifAM@linktodoc\AM@linktodocfalse
\newif\ifAM@survey\AM@surveyfalse
\newif\ifAM@surveynolink\AM@surveynolinkfalse
\newif\ifAM@output\AM@outputtrue
\newif\ifAM@column\AM@columnfalse
\newif\ifAM@columnstrict\AM@columnstrictfalse
\newif\ifAM@noautoscale\AM@noautoscalefalse
\newif\ifAM@fitpaper\AM@fitpaperfalse
\newif\ifAM@doublepages\AM@doublepagesfalse
\newif\ifAM@linkfilename\AM@linkfilenamefalse
\newif\ifAM@signature\AM@signaturefalse
\newif\ifAM@sigrotate\AM@sigrotatefalse
\newif\ifAM@newwindow\AM@newwindowtrue
\newcommand*{\AM@pagestemp}{1}
\newcommand*{\AM@pagecommand}{\thispagestyle{empty}}
\newcommand*{\AM@lscape@rot}{0}
\newcommand*{\AM@threadname}{}\newcommand*{\AM@linkname}{}
\newcommand*{\AM@linkname@option}{}
\newcommand*{\AM@linkfit}{fitr}\newcommand*{\AM@linktodocfit}{/Fit}
\newcommand*{\threadinfodict}{}
\newcommand*{\AM@toclist}{}\newcommand*{\AM@loflist}{}
\newcommand*{\AM@signature}{}
\newcommand*{\AM@ARBug@hook}{}
\newcommand*{\AM@xrprefix}{}
\newif\ifAM@thumbpdf
\newif\ifAM@pdflscape
\newcommand*{\AM@setlscape}{}
\AtBeginDocument{%
  \@ifpackageloaded{thumbpdf}{\AM@thumbpdftrue}{\AM@thumbpdffalse}%
  \@ifpackageloaded{pdflscape}{\AM@pdflscapetrue}{\AM@pdflscapefalse}%
  \ifAM@thumbpdf
    \ifAM@pdflscape
      \def\AM@setlscape{\PLS@Rotate{90}}%
    \else
      \def\AM@setlscape{\pdfpageattr{/Rotate 90}\AM@thumbpdfwarning}%
    \fi
  \else
    \def\AM@setlscape{\pdfpageattr{/Rotate 90}}%
  \fi}
\newif\ifAM@thumbpdfwarning
\newcommand*{\AM@thumbpdfwarning}{%
  \ifAM@thumbpdfwarning\else\global\AM@thumbpdfwarningtrue
  \PackageWarning{pdfpages}{%
    You are using `thumbpdf.sty' but not\MessageBreak
    `pdflscape.sty'. \MessageBreak
    Please insert `pdflscape.sty' in  your document\MessageBreak
    to get a pleasant PDF document with thumbs.\MessageBreak}\fi}
\newif\ifAM@integer
\newcommand{\AM@checkinteger}{}
\def\AM@checkinteger#1{%
  \ifcat _\ifnum9<1#1_\else A\fi
    \AM@integertrue
  \else
    \AM@integerfalse
  \fi
}
\newcommand*{\includepdfset}[1]{%
  \AM@split@options{pdfpages}{#1}%
  \edef\AM@temp{{pdfpages}{\the\@temptokena}}%
  \expandafter\setkeys\AM@temp
}
\newcommand*{\includepdf}[2][]{%
  \begingroup
  \c@totalnumber=0%
  \AM@split@options{pdfpages}{#1}%
  \edef\AM@temp{{pdfpages}{\the\@temptokena}}%
  \expandafter\setkeys\AM@temp
  \ifthenelse{\boolean{AM@pkg@draft} \and \boolean{AM@survey}}
    {\def\AM@currentdocname{}%
     \renewcommand\includegraphics[2][]{%
        Survey/Draft}%
    }
    {\IfFileExists{#2}{\edef\AM@currentdocname{#2}}
       {\IfFileExists{#2.pdf}{\edef\AM@currentdocname{#2.pdf}}
          {\PackageError{pdfpages}{Cannot find file `#2'}{}}}%
     \def\AM@threadname{\AM@currentdocname}%
    }
  \ifAM@survey
    \def\AM@pagestemp{}
    \@tempcnta=0
    \def\foo{%
      \@ifundefined{r@\AM@xrprefix pdfpages@page\the\@tempcnta}
         {\let\foo\relax}
         {\expandafter\ifx\expandafter\\\AM@pagestemp\\
             \edef\AM@pagestemp{%
                  \AM@pageref{\AM@xrprefix pdfpages@page\the\@tempcnta}}
          \else
            \edef\AM@pagestemp{\AM@pagestemp,%
                  \AM@pageref{\AM@xrprefix pdfpages@page\the\@tempcnta}}
          \fi
          \advance\@tempcnta 1\relax
         }
      \foo
    }
    \foo
    \expandafter\ifx\expandafter\\\AM@pagestemp\\
      \def\AM@pagestemp{1}
    \fi
  \fi
  \ifAM@output
    \expandafter\AM@readlist\expandafter{\AM@pagestemp}%
    \AM@output{#1}%
  \fi
  \AM@CheckAtEnd
  \endgroup
  \AM@ClearShipoutPicture
}
\newcommand*{\includepdfmerge}[2][]{%
  \begingroup
  \c@totalnumber=0%
  \def\AM@currentdocname{}%
  \AM@readlist{#2}%
  \AM@split@options{pdfpages}{#1}%
  \edef\AM@temp{{pdfpages}{\the\@temptokena}}%
  \expandafter\setkeys\AM@temp
  \AM@output{#1}%
  \AM@CheckAtEnd
  \endgroup
  \AM@ClearShipoutPicture
}
\newcommand{\AM@CheckAtEnd}{%
  \ifx\@empty\AM@toclist\else
    \PackageWarning{pdfpages}{%
         There's something wrong with the entries\MessageBreak
         of `addtotoc'. Not all entries were\MessageBreak
         processed. Check `addtotoc'}%
  \fi
  \ifx\@empty\AM@loflist\else
    \PackageWarning{pdfpages}{%
         There's something wrong with the entries\MessageBreak
         of `addtolist'. Not all entries were\MessageBreak
         processed. Check `addtolist'}%
  \fi
}
\newcommand{\AM@output}[1]{%
  \@ifundefined{AM@xnup}
    {\def\AM@xnup{\@ne}\def\AM@ynup{\@ne}%
     \def\AM@xnupminusi{\z@}\def\AM@ynupminusi{\z@}}{}%
  \@ifundefined{AM@deltax}
    {\def\AM@deltax{-\fboxrule}\def\AM@deltay{-\fboxrule}}{}%
  \@ifundefined{AM@xoffset}
    {\def\AM@xoffset{\z@}\def\AM@yoffset{\z@}}{}%
  \def\AM@xpos{\z@}\def\AM@ypos{\z@}%
  \ifAM@pkg@draft \setkeys{Gin}{draft=true}%
  \else \setkeys{Gin}{draft=false}%
  \fi
  \ifthenelse{\boolean{AM@landscape}}
    {\def\AM@lscape@rot{90}%
     \@ifundefined{AM@shortnupsyntax}{}
       {\let\AM@temp\AM@xnup
        \let\AM@xnup\AM@ynup
        \let\AM@ynup\AM@temp}%
    }{}%
  \AM@setphantom
  \ifthenelse{\boolean{AM@openright}}
         {\AM@openright}{}%
  \ifx\AM@signature\@empty\AM@filluppagelist
  \else\AM@prepare@signature\AM@signaturetrue\AM@turnfalse\fi
  \@tempcnta=\AM@xnup\relax \advance\@tempcnta\m@ne
  \edef\AM@xnupminusi{\the\@tempcnta}%
  \@tempcnta=\AM@ynup\relax \advance\@tempcnta\m@ne
  \edef\AM@ynupminusi{\the\@tempcnta}%
  \ifthenelse{\boolean{AM@column}%
              \and\not\boolean{AM@columnstrict}}
         {\AM@getlastn{\AM@doclist}{\AM@nup}%
          \edef\AM@lastndocs{\AM@lastnitems}%
          \AM@getlastn{\AM@pagelist}{\AM@nup}%
          \edef\AM@lastnpages{\AM@lastnitems}%
          \AM@resort
          \AM@count{\AM@pagelist}%
          \expandafter\ifx\expandafter\\\AM@pagelist\\%
            \edef\AM@pagelist{\AM@resortedpagelist}%
            \edef\AM@doclist{\AM@resorteddoclist}%
          \else
            \edef\AM@pagelist{\AM@pagelist,\AM@resortedpagelist}%
            \edef\AM@doclist{\AM@doclist,\AM@resorteddoclist}%
          \fi}{}%
  \ifthenelse{\boolean{AM@frame}}
         {\let\AM@fbox\fbox}
         {\let\AM@fbox\relax
          \setlength{\fboxrule}{\z@}}%
  \ifthenelse{\boolean{AM@column}}
         {\def\AM@xnupi{\@ne}
          \def\AM@ynupi{\z@}}
         {\def\AM@xnupi{\z@}
          \def\AM@ynupi{\@ne}}%
  \setlength{\fboxsep}{\z@}%
    \AM@readfirst{\AM@pagelist}%
    \edef\AM@page{\the\toks@}%
    \AM@readfirst{\AM@doclist}%
    \edef\AM@docname{\the\toks@}%
    \newpage
    \ifAM@noautoscale
      \def\AM@scale{1}%
    \else
      \AM@isphantom
      \AM@split@options{Gin@noscale}{#1}%
      \setbox\@tempboxa=\hbox{%
        \expandafter\includegraphics\expandafter[\the\@temptokena,
           page=\AM@page, angle=\AM@lscape@rot]{\AM@docname}}%
    \ifthenelse{\boolean{AM@fitpaper}}
      {\setlength{\paperwidth}{\the\wd\@tempboxa}%
       \setlength{\paperheight}{\the\ht\@tempboxa}%
       \setlength{\pdfpagewidth}{\the\wd\@tempboxa}%
       \setlength{\pdfpageheight}{\the\ht\@tempboxa}%
       \@ifundefined{stockwidth}{}{%
         \setlength{\stockwidth}{\paperwidth}%
         \setlength{\stockheight}{\paperheight}%
         \setlength{\trimtop}{0pt}%
         \setlength{\trimedge}{0pt}}%
      }{}%
      \def\AM@xscale{%
        (\paperwidth - \tw@\fboxrule*\AM@xnup
         - \AM@deltax * \AM@xnupminusi) /
        (\AM@xnup * \real{\strip@pt\wd\@tempboxa})
      }%
      \setlength{\@tempdima}{\AM@xscale}%
      \edef\AM@xscale{\strip@pt\@tempdima}%
      \setlength{\@tempdimb}{\ht\@tempboxa + \dp\@tempboxa}%
      \def\AM@yscale{
        (\paperheight - \tw@\fboxrule*\AM@ynup
         - \AM@deltay *\AM@ynupminusi) /
        (\AM@ynup * \real{\strip@pt\@tempdimb})
      }%
      \setlength{\@tempdima}{\AM@yscale}%
      \edef\AM@yscale{\strip@pt\@tempdima}%
      \@tempdima=\AM@xscale\p@
      \@tempdimb=\AM@yscale\p@
      \ifdim\@tempdima<\@tempdimb
        \let\AM@scale\AM@xscale
      \else
        \let\AM@scale\AM@yscale
      \fi
    \fi
    \let\AM@filelist@save\@filelist
    \AM@split@options{Gin}{#1}%
    \setbox\@tempboxa=\hbox{%
      \expandafter\includegraphics\expandafter[\the\@temptokena,
                       page=\AM@page, scale=\AM@scale,
                       angle=\AM@lscape@rot]{\AM@docname}}%
    \let\@filelist\AM@filelist@save
    \setlength{\@tempdimb}{\ht\@tempboxa + \dp\@tempboxa}%
    \def\AM@xmargin{%
      (\paperwidth - (\wd\@tempboxa+\tw@\fboxrule)*\AM@xnup
       - \AM@deltax * \AM@xnupminusi) * \real{.5}%
    }%
    \def\AM@ymargin{%
      (\paperheight - (\@tempdimb+\tw@\fboxrule)*\AM@ynup
       - \AM@deltay * \AM@ynupminusi) * \real{.5}%
    }%
    \setlength{\@tempdima}{\AM@xmargin}%
    \edef\AM@xmargin{\the\@tempdima}%
    \setlength{\@tempdima}{\AM@ymargin}%
    \edef\AM@ymargin{\the\@tempdima}%
    \ifthenelse{\boolean{AM@landscape}}
         {\edef\AM@temp{\AM@xnup}
          \edef\AM@xnup{\AM@ynup}
          \edef\AM@ynup{\AM@temp}}
         {}%
    \ifAM@signature
      \ifAM@landscape\AM@sigrotatefalse\else\AM@sigrotatetrue\fi
    \fi
  \setboolean{AM@endoflist}{false}%
  \whiledo{\not\boolean{AM@endoflist}}{%
    \AM@getfirst{\AM@pagelist}%
      \edef\AM@page{\the\toks@}%
      \AM@isphantom
      \@tempcnta=\AM@page\relax
      \advance\@tempcnta\m@ne
      \edef\AM@page@linktodoc{\the\@tempcnta}%
    \AM@getfirst{\AM@doclist}%
      \edef\AM@docname{\the\toks@}%
      \ifAM@linkfilename
      \else
        \let\AM@linkfilename\AM@docname
      \fi
      \ifx\@empty\AM@linkname@option \edef\AM@linkname{\the\toks@}
      \else \edef\AM@linkname{\AM@linkname@option} \fi
    \ifthenelse{\boolean{AM@column}}
      {\@tempcnta=\AM@ynupi\relax
       \@tempcntb=\AM@ynup\relax
       \advance\@tempcnta\@ne
       \ifnum\@tempcnta>\@tempcntb
         \@tempcnta=\@ne
         \@tempcntb=\AM@xnupi\relax
         \advance\@tempcntb\@ne
         \edef\AM@xnupi{\the\@tempcntb}%
       \fi
       \edef\AM@ynupi{\the\@tempcnta}%
       \@tempcnta=\AM@xnupi\relax
       \@tempcntb=\AM@xnup\relax
       \ifnum\@tempcnta>\@tempcntb
         \def\AM@xnupi{\@ne}%
       \fi
      }
      {\@tempcnta=\AM@xnupi\relax
       \@tempcntb=\AM@xnup\relax
       \advance\@tempcnta\@ne
       \ifnum\@tempcnta>\@tempcntb
         \@tempcnta=\@ne
         \@tempcntb=\AM@ynupi\relax
         \advance\@tempcntb\@ne
         \edef\AM@ynupi{\the\@tempcntb}%
       \fi
       \edef\AM@xnupi{\the\@tempcnta}%

       \@tempcnta=\AM@ynupi\relax
       \@tempcntb=\AM@ynup\relax
       \ifnum\@tempcnta>\@tempcntb
         \def\AM@ynupi{\@ne}%
       \fi
      }%
    \def\AM@add{+}%
    \if@twoside\ifodd\c@page\else\def\AM@add{-}\fi\fi
    \setlength{\@tempdimb}{\ht\@tempboxa + \dp\@tempboxa}%
    \ifthenelse{\boolean{AM@landscape}}
      {\def\AM@xpos{%
         \AM@xmargin \AM@add\AM@xoffset +
         (\wd\@tempboxa + \AM@deltax + \tw@\fboxrule)*(\AM@ynupi - 1)
       }%
       \def\AM@ypos{%
         \AM@ymargin + \AM@yoffset +
         (\@tempdimb + \AM@deltay + \tw@\fboxrule)*(\AM@xnupi - 1)
       }%
      }
      {\def\AM@xpos{%
         \AM@xmargin \AM@add\AM@xoffset +
         (\wd\@tempboxa + \AM@deltax + \tw@\fboxrule)*(\AM@xnupi - 1)
       }%
       \def\AM@ypos{%
         \AM@ymargin + \AM@yoffset +
         (\@tempdimb + \AM@deltay + \tw@\fboxrule)*(\AM@ynup-\AM@ynupi)
       }%
      }%
    \setlength{\@tempdima}{\AM@xpos}%
    \edef\AM@xpos{\strip@pt\@tempdima}%
    \setlength{\@tempdima}{\AM@ypos}%
    \edef\AM@ypos{\strip@pt\@tempdima}%
    \setlength{\fboxsep}{\z@}%
    \ifAM@phantompage
      \def\AM@shippage{}%
    \else
      \AM@split@options{Gin}{#1}%
      \edef\AM@shippage{%
        \noexpand\put(\AM@xpos,\AM@ypos){%
        \noexpand\raisebox{\dp\@tempboxa}{%
        \AM@hyper\noexpand\AM@fbox{%
          \noexpand\AM@ARBug@hook
          \noexpand\includegraphics[\the\@temptokena,
                    page=\AM@page,scale=\AM@scale,
                    \ifAM@sigrotate angle=180\fi,
                    angle=\AM@lscape@rot]{\AM@docname}}}}%
      }%
    \fi
    \AM@AddToShipoutPicture{\setlength{\unitlength}{\p@}%
      \global\let\AM@filelist@save\@filelist}%
    \expandafter\AM@AddToShipoutPicture\expandafter{%
      \AM@shippage
      \global\let\@filelist\AM@filelist@save
    }%
    \AM@toclof{\AM@page}%
    \ifnum\AM@xnupi=\AM@xnup\relax
      \ifnum\AM@ynupi=\AM@ynup\relax
        \begingroup\AM@pagecommand\endgroup
        \hskip\z@
        \ifthenelse{\boolean{AM@turn}}
          {\ifthenelse{\boolean{AM@landscape}}
             {\AM@setlscape}{}}
          {}%
        \newpage
        \ifAM@pdflscape\PLS@Rotate{0}\fi
        \AM@ClearShipoutPicture
        \ifAM@signature
          \ifAM@sigrotate\AM@sigrotatefalse\else\AM@sigrotatetrue\fi
        \fi
      \fi
    \fi
  }% whiledo
}% AM@output
\newif\ifAM@defaultone
\newcommand*{\AM@readlist}[1]{%
  \AM@defaultonefalse
  \def\AM@pagelist{}%
  \def\AM@doclist{}%
  \AM@readlisti#1,\END,
  \ifAM@defaultone\AM@append{1}\fi
  \edef\AM@doclist{\expandafter\@gobble\AM@doclist}%
  \edef\AM@pagelist{\expandafter\@gobble\AM@pagelist}%
}
\newcommand{\AM@readlisti}{}
\def\AM@readlisti#1,{%
  \def\AM@temp{#1}%
  \ifx\END#1
  \else
    \AM@checkrange#1-\END
    \expandafter\AM@readlisti
  \fi
}
\newcommand{\AM@checkrange}{}
\def\AM@checkrange#1-#2\END{%
  \edef\AM@tempi{\AM@trim@space{#1}}%
  \ifx\\#2\\%
    \AM@checkinteger{\AM@tempi}%
    \ifAM@integer\AM@append{\AM@tempi}%
    \else
      \expandafter\ifx\expandafter\\\AM@tempi\\\AM@append{}%
      \else\AM@setnewdocname{\AM@tempi}\fi
    \fi
  \else
    \expandafter\ifx\expandafter\\\AM@tempi\\%
      \@tempcnta=1\relax
      \AM@checklast#2\END
    \else
      \AM@checkinteger{\AM@tempi}%
      \ifAM@integer
        \@tempcnta=\AM@tempi\relax
        \AM@checklast#2\END
      \else
        \AM@setnewdocname{\AM@temp}%
      \fi
    \fi
  \fi
}
\newcommand{\AM@checklast}{}
\def\AM@checklast#1-\END{%
  \edef\AM@tempii{\AM@trim@space{#1}}%
  \expandafter\ifx\expandafter\\\AM@tempii\\
    \pdfximage{\AM@currentdocname}%
    \@tempcntb=\the\pdflastximagepages\relax
    \advance\@tempcntb\@ne
    \whiledo{\@tempcnta<\@tempcntb}{%
      \AM@append{\the\@tempcnta}%
      \advance\@tempcnta\@ne
    }%
  \else
    \AM@checkinteger{\AM@tempii}%
    \ifAM@integer
      \@tempcntb=\AM@tempii\relax
      \advance\@tempcntb\@ne
      \whiledo{\@tempcnta<\@tempcntb}{%
        \AM@append{\the\@tempcnta}%
        \advance\@tempcnta\@ne
      }%
    \else
      \AM@setnewdocname{\AM@temp}%
    \fi
  \fi
}
\newcommand{\AM@setnewdocname}[1]{%
  \ifAM@defaultone
    \AM@append{1}%
  \fi
  \edef\AM@temp{\AM@trim@space{#1}}%
  \IfFileExists{\AM@temp}{\edef\AM@currentdocname{\AM@temp}}
    {\IfFileExists{\AM@temp.pdf}{\edef\AM@currentdocname{\AM@temp.pdf}}
       {\PackageError{pdfpages}{Cannot find file `\AM@temp'}{}}}%
  \AM@defaultonetrue
}
\newcommand{\AM@append}[1]{%
  \edef\AM@doclist{\AM@doclist,\AM@currentdocname}%
  \edef\AM@pagelist{\AM@pagelist,#1}%
  \ifAM@doublepages
    \edef\AM@doclist{\AM@doclist,\AM@currentdocname}%
    \edef\AM@pagelist{\AM@pagelist,#1}%
  \fi
  \AM@defaultonefalse
}
\newif\ifAM@endoflist\AM@endoflistfalse
\newcommand{\AM@getfirst}{}
\def\AM@getfirst#1{\expandafter\AM@getfirsti#1,\END#1\END}
\newcommand{\AM@getfirsti}{}
\def\AM@getfirsti#1,#2\END#3\END{%
  \edef#3{#2}%
  \ifx\\#2\\%
    \setboolean{AM@endoflist}{true}%
    \def#3{}%
  \else
    \edef#3{\AM@getfirstii#2\END}%
  \fi
  \toks@{#1}%
}
\newcommand{\AM@getfirstii}{}
\def\AM@getfirstii#1,\END{#1}
\newcommand{\AM@readfirst}{}
\newcommand{\AM@readfirsti}{}
\def\AM@readfirst#1{\expandafter\AM@readfirsti#1,\END}
\def\AM@readfirsti#1,#2\END{\toks@{#1}}
\newcommand{\AM@getlast}{}
\def\AM@getlast#1{%
  \let\AM@temp\relax
  \expandafter\AM@getlasti#1,\END
  \@ifundefined{AM@temp}{\def#1{}}{\edef#1{\AM@temp}}%
}
\def\AM@ReturnAfterFi#1\fi{\fi#1}
\newcommand{\AM@getlasti}{}
\def\AM@getlasti#1,#2\END{%
  \ifx\\#2\\%
    \def\AM@lastitem{#1}%
  \else
    \@ifundefined{AM@temp}
      {\edef\AM@temp{#1}}
      {\edef\AM@temp{\AM@temp,#1}}%
    \AM@ReturnAfterFi{\AM@getlasti#2\END}%
  \fi
}
\newcommand{\AM@getlastn}{}
\def\AM@getlastn#1#2{%
  \let\AM@templist\relax
  \@tempcnta=\z@
  \loop
  \ifnum\@tempcnta<#2
    \AM@getlast{#1}%
    \@ifundefined{AM@templist}
      {\edef\AM@templist{\AM@lastitem}}
      {\edef\AM@templist{\AM@lastitem,\AM@templist}}%
    \advance\@tempcnta\@ne
  \repeat
  \edef\AM@lastnitems{\AM@templist}%
}
\newif\ifAM@again\AM@againtrue
\newcommand{\AM@count}{}
\def\AM@count#1{%
  \edef\AM@templist{#1}%
  \loop
    \AM@getlast{\AM@templist}%
    \expandafter\ifx\expandafter\\\AM@lastitem\\%
    \else
      \AM@againfalse
      \expandafter\ifx\expandafter\\\AM@templist\\%
        \edef\AM@templist{\AM@lastitem}%
      \else
        \edef\AM@templist{\AM@templist,\AM@lastitem}%
      \fi
      \@tempcnta=\z@
      \expandafter\AM@counti\AM@templist,\END,
    \fi
  \ifAM@again
  \repeat
}
\newcommand{\AM@counti}{}
\def\AM@counti#1,{%
  \ifx\END#1
  \else
    \advance\@tempcnta\@ne
    \expandafter\AM@counti
  \fi
}
\newif\ifAM@resort@end\AM@resort@endfalse
\newcommand{\AM@resort}{}
\def\AM@resort{%
  \def\AM@resortedpagelist{}%
  \def\AM@resorteddoclist{}%
  \def\AM@xnupi{\@ne}%
  \def\AM@ynupi{\@ne}%
  \AM@count{\AM@lastnpages}%
  \def\AM@xnuplast{%
    \the\@tempcnta - (\the\@tempcnta / \AM@xnup * \AM@xnup) + 1}%
  \def\AM@ynuplast{1 + (\the\@tempcnta / \AM@xnup)}%
  \setlength{\@tempdima}{\p@*(\AM@xnuplast)}%
  \edef\AM@xnuplast{\strip@pt\@tempdima}%
  \setlength{\@tempdima}{\p@*(\AM@ynuplast)}%
  \edef\AM@ynuplast{\strip@pt\@tempdima}%
  \whiledo{\not\boolean{AM@resort@end}}{%
    \@tempcnta=\AM@ynupi\relax
    \@tempcntb=\AM@ynuplast\relax
    \ifnum\@tempcnta=\@tempcntb
        \@tempcnta=\AM@xnupi\relax
        \@tempcntb=\AM@xnuplast\relax
        \ifnum\@tempcnta<\@tempcntb
          \AM@getfirst{\AM@lastndocs}%
          \edef\AM@firstdocitem{\the\toks@}%
          \AM@getfirst{\AM@lastnpages}%
          \edef\AM@resortedpagelist{\AM@resortedpagelist,\the\toks@}%
          \edef\AM@resorteddoclist{%
            \AM@resorteddoclist,\AM@firstdocitem}%
        \else
          \edef\AM@resortedpagelist{\AM@resortedpagelist,}%
          \edef\AM@resorteddoclist{\AM@resorteddoclist,\AM@phantomdoc}%
        \fi
    \else
      \ifnum\@tempcnta<\@tempcntb
        \AM@getfirst{\AM@lastndocs}%
        \edef\AM@firstdocitem{\the\toks@}%
        \AM@getfirst{\AM@lastnpages}%
        \edef\AM@resortedpagelist{\AM@resortedpagelist,\the\toks@}%
        \edef\AM@resorteddoclist{\AM@resorteddoclist,\AM@firstdocitem}%
      \else
        \edef\AM@resortedpagelist{\AM@resortedpagelist,}%
        \edef\AM@resorteddoclist{\AM@resorteddoclist,\AM@phantomdoc}%
      \fi
    \fi
    \@tempcnta=\AM@ynupi\relax
    \advance\@tempcnta\@ne
    \edef\AM@ynupi{\the\@tempcnta}%
    \@tempcntb=\AM@ynup\relax
    \ifnum\@tempcnta>\@tempcntb
      \@tempcntb=\AM@xnupi\relax
      \advance\@tempcntb\@ne
      \edef\AM@xnupi{\the\@tempcntb}%
      \def\AM@ynupi{\@ne}%
      \@tempcnta=\AM@xnup\relax
      \ifnum\@tempcntb>\@tempcnta
        \setboolean{AM@resort@end}{true}%
      \fi
    \fi
  }%
  \edef\AM@resortedpagelist{\expandafter\@gobble\AM@resortedpagelist}%
  \edef\AM@resorteddoclist{\expandafter\@gobble\AM@resorteddoclist}%
}
\newif\ifAM@scale
\newcommand{\AM@remove@scale}{}
\def\AM@remove@scale#1{%
  \def\AM@options{}%
  \AM@remove@scalei#1,\END,
}
\newcommand{\AM@remove@scalei}{}
\def\AM@remove@scalei#1,{%
  \ifx\END#1
  \else
    \AM@scalefalse
    \AM@remove@scaleii#1=\END
    \ifAM@scale
    \else
      \ifx\empty\AM@options
        \edef\AM@options{#1}%
      \else
        \toks@\expandafter{\AM@options,#1}%
        \edef\AM@options{\the\toks@}%
      \fi
    \fi
    \expandafter\AM@remove@scalei
  \fi
}
\newcommand{\AM@remove@scaleii}{}
\def\AM@remove@scaleii#1=#2\END{%
  \ifx\\#2\\%
  \else
    \def\AM@temp{#1}%
    \edef\AM@temp{\AM@trim@space{\AM@temp}}%
    \ifthenelse{\equal{scale}{\AM@temp}}{\AM@scaletrue}{}%
  \fi
}
\newif\ifAM@pdfpages@options
\newif\ifAM@scale
\newcommand{\AM@split@options}{}
\def\AM@split@options#1#2{%
  \def\AM@param{#1}%
  \@temptokena{}%
  \AM@split@optionsi#2,\END,
}
\def\AM@split@optionsi#1,{%
  \ifx\END#1
  \else
    \AM@pdfpages@optionsfalse \AM@scalefalse
    \AM@split@optionsii#1=\END
    \ifthenelse{\equal{\AM@param}{pdfpages}}
      {\ifAM@pdfpages@options
          \@temptokena\expandafter{\the\@temptokena,#1}%
       \fi}{}%
    \ifthenelse{\equal{\AM@param}{Gin}}
      {\ifAM@pdfpages@options\else
         \@temptokena\expandafter{\the\@temptokena,#1}%
       \fi}{}%
    \ifthenelse{\equal{\AM@param}{Gin@noscale}}
      {\ifAM@pdfpages@options\else
         \ifAM@scale\else
           \@temptokena\expandafter{\the\@temptokena,#1}%
         \fi
       \fi}{}%
    \expandafter\AM@split@optionsi
  \fi
}
\newcommand{\AM@split@optionsii}{}
\def\AM@split@optionsii#1=#2\END{%
  \edef\AM@temp{\AM@trim@space{#1}}%
  \ifthenelse{\equal{pages}{\AM@temp}\or
              \equal{nup}{\AM@temp}\or
              \equal{deltax}{\AM@temp}\or
              \equal{deltay}{\AM@temp}\or
              \equal{delta}{\AM@temp}\or
              \equal{offset}{\AM@temp}\or
              \equal{frame}{\AM@temp}\or
              \equal{openright}{\AM@temp}\or
              \equal{pagecommand}{\AM@temp}\or
              \equal{landscape}{\AM@temp}\or
              \equal{turn}{\AM@temp}\or
              \equal{column}{\AM@temp}\or
              \equal{columnstrict}{\AM@temp}\or
              \equal{noautoscale}{\AM@temp}\or
              \equal{thread}{\AM@temp}\or
              \equal{threadname}{\AM@temp}\or
              \equal{link}{\AM@temp}\or
              \equal{linkfit}{\AM@temp}\or
              \equal{linkname}{\AM@temp}\or
              \equal{linktodoc}{\AM@temp}\or
              \equal{linktodocfit}{\AM@temp}\or
              \equal{linkfilename}{\AM@temp}\or
              \equal{survey}{\AM@temp}\or
              \equal{survey-nolink}{\AM@temp}\or
              \equal{output}{\AM@temp}\or
              \equal{xr-prefix}{\AM@temp}\or
              \equal{fitpaper}{\AM@temp}\or
              \equal{addtotoc}{\AM@temp}\or
              \equal{addtolist}{\AM@temp}\or
              \equal{doublepages}{\AM@temp}\or
              \equal{signature}{\AM@temp}}{\AM@pdfpages@optionstrue}{}%
  \ifthenelse{\equal{scale}{\AM@temp}}{\AM@scaletrue}{}%
}
\newcommand{\AM@trim@space}{}\newcommand{\AM@trim@spacei}{}
\newcommand{\AM@trim@spaceii}{}
\def\AM@trim@space#1{%
  \expandafter\AM@trim@spacei\expandafter{\ifdim\z@=0pt#1}\fi}
\def\AM@trim@spacei#1{\AM@trim@spaceii#1 \END}
\def\AM@trim@spaceii#1 #2\END{#1}
\def\AM@trim@leadingspace#1{\ifdim\z@=0pt#1\fi}
\newif\ifAM@phantompage
\newcommand*{\AM@isphantom}{%
  \expandafter\ifx\expandafter\\\AM@page\\%
    \let\AM@page\AM@phantompage
    \let\AM@ph\phantom
    \AM@phantompagetrue
  \else
    \let\AM@ph\relax
    \AM@phantompagefalse
  \fi
}
\newcommand{\AM@hyper}{%
  \ifAM@link
    \pdfdest name {\AM@linkname.\AM@page} \AM@linkfit%
  \fi
  \ifAM@survey \ifAM@surveynolink\else
    \pdfannot width \wd\@tempboxa
              height \ht\@tempboxa
              depth \dp\@tempboxa
              {/Subtype /Link /Border [0 0 0]
               /A << /S /GoTo
                     /D [\AM@page@linktodoc \AM@linktodocfit] >>}%
  \fi \fi
  \ifAM@linktodoc
    \pdfannot width \wd\@tempboxa
              height \ht\@tempboxa
              depth \dp\@tempboxa
              {/Subtype /Link /Border [0 0 0]
               /A << /S /GoToR
                     /F (\AM@linkfilename)
                     /D [\AM@page@linktodoc \AM@linktodocfit]
                     \ifAM@newwindow/NewWindow true\fi >>}%
  \fi
  \ifAM@thread
      \pdfthread width \wd\@tempboxa
                 height \ht\@tempboxa
                 depth \dp\@tempboxa
                 attr {\threadinfodict}%
                 name {\AM@threadname}%
  \fi
}
\newcommand{\AM@openright}{}
\def\AM@openright{%
  \edef\AM@pagelist{,\AM@pagelist}%
  \edef\AM@doclist{\AM@phantomdoc,\AM@doclist}%
}
\newcommand{\AM@countpagelist}{}
\def\AM@countpagelist{%
  \@tempcnta=\z@
  \expandafter\AM@countpagelisti\AM@pagelist,\END,
}
\newcommand{\AM@countpagelisti}{}
\def\AM@countpagelisti#1,{%
  \ifx\END#1
  \else
    \advance\@tempcnta\@ne
    \expandafter\AM@countpagelisti
  \fi
}
\newcommand{\AM@filluppagelist}{}
\def\AM@filluppagelist{%
  \@tempcnta=\AM@xnup\relax
  \@tempcntb=\AM@ynup\relax
  \multiply\@tempcnta\@tempcntb
  \edef\AM@nup{\the\@tempcnta}%
  \AM@countpagelist
  \@tempcntb=\@tempcnta
  \divide\@tempcntb\AM@nup
  \multiply\@tempcntb\AM@nup
  \advance\@tempcnta-\@tempcntb
  \ifnum\@tempcnta=\z@
    \else
      \advance\@tempcnta-\AM@nup
      \multiply\@tempcnta\m@ne
  \fi
  \whiledo{\@tempcnta > \z@}{%
    \let\saveAM@pagelist\AM@pagelist
    \edef\AM@pagelist{\saveAM@pagelist,}%
    \advance\@tempcnta\m@ne
    \let\saveAM@doclist\AM@doclist
    \edef\AM@doclist{\saveAM@doclist,\AM@phantomdoc}%
  }%
}
\newcommand{\AM@prepare@signature}{}
\def\AM@prepare@signature{%
  \def\AM@newpagelist{}%
  \def\AM@newdoclist{}%
  \@tempcnta=\AM@signature\relax
  \divide\@tempcnta by 4
  \multiply\@tempcnta by 4
  \ifnum\@tempcnta=0\@tempcnta=4\fi
  \edef\AM@signature{\the\@tempcnta}%
  \AM@countpagelist
  \count@=\@tempcnta
  \@tempcntb=\AM@signature\relax
  \divide\count@\@tempcntb
  \multiply\count@\@tempcntb
  \advance\@tempcnta-\count@
  \ifnum\@tempcnta=0 \@tempcntb=0
  \else\advance\@tempcntb-\@tempcnta
  \fi
  \whiledo{\@tempcntb>\z@}{%
    \edef\AM@pagelist{\AM@pagelist,}%
    \edef\AM@doclist{\AM@doclist,\AM@phantomdoc}%
    \advance\@tempcntb\m@ne
  }%
  \def\AM@sort{%
    \def\AM@sigpagelist{}%
    \def\AM@sigdoclist{}%
    \@tempcntb=\AM@signature\relax
    \AM@getlastn{\AM@pagelist}{\@tempcntb}%
    \edef\AM@lastnpages{\AM@lastnitems}%
    \AM@getlastn{\AM@doclist}{\@tempcntb}%
    \edef\AM@lastndocs{\AM@lastnitems}%
    \@tempcnta=0
    \def\AM@first{%
      \AM@getfirst{\AM@lastnpages}%
      \edef\AM@sigpagelist{\AM@sigpagelist,\the\toks@}%
      \AM@getfirst{\AM@lastndocs}%
      \edef\AM@sigdoclist{\AM@sigdoclist,\the\toks@}%
    }%
    \def\AM@last{%
      \AM@getlast{\AM@lastnpages}%
      \edef\AM@sigpagelist{\AM@sigpagelist,\AM@lastitem}%
      \AM@getlast{\AM@lastndocs}%
      \edef\AM@sigdoclist{\AM@sigdoclist,\AM@lastitem}%
    }%
    \whiledo{\@tempcnta<\@tempcntb}{%
      \ifAM@landscape
        \AM@last\AM@first\AM@last\AM@first
      \else
        \AM@first\AM@last\AM@first\AM@last
      \fi
      \advance\@tempcnta by 4
    }%
    \edef\AM@newpagelist{\AM@sigpagelist\AM@newpagelist}%
    \edef\AM@newdoclist{\AM@sigdoclist\AM@newdoclist}%
    \ifx\AM@pagelist\@empty
    \else\expandafter\AM@sort
    \fi
  }%
  \AM@sort
  \edef\AM@pagelist{\expandafter\@gobble\AM@newpagelist}%
  \edef\AM@doclist{\expandafter\@gobble\AM@newdoclist}%
  \ifdim\pdfpagewidth<\pdfpageheight
    \def\AM@xnup{\@ne}\def\AM@ynup{\tw@}%
  \else
    \def\AM@xnup{\tw@}\def\AM@ynup{\@ne}%
  \fi
}
\newcommand*{\AM@setphantom}{%
  \expandafter\AM@setphantompage\AM@pagelist,\END,
  \expandafter\AM@setphantomdoc\AM@doclist,\END
}
\newcommand{\AM@setphantompage}{}
\def\AM@setphantompage#1,{%
  \def\AM@gobble##1\END,{}%
  \ifx\\#1\\%
    \expandafter\AM@setphantompage
  \else
    \def\AM@phantompage{#1}%
    \expandafter\AM@gobble
  \fi
}
\newcommand{\AM@setphantomdoc}{}
\def\AM@setphantomdoc#1,#2\END{\edef\AM@phantomdoc{#1}}
\newcommand{\AM@addtotoc@hook}{\relax}
\newcommand{\AM@addtotoc}{}
\def\AM@addtotoc{%
  \begingroup
  \def\@seccntformat##1{}\def\@makechapterhead##1{}%
  \def\@endpart{}\def\partname{}%
  \def\autodot{}% KOMA classes
  \let\AM@addcontentsline\addcontentsline
  \def\addcontentsline##1##2##3{%
    \AM@addcontentsline{##1}{##2}{##3}%
    \def\thepart{}}%
  \AM@addtotoc@hook
  \edef\AM@temp{{\AM@toc@section}{\AM@toc@level}%
           {\z@}{\z@}{\z@}{}[\the\AM@toc@title]{}}%
  \edef\AM@tempi{\noexpand\csname @\AM@toc@section\noexpand\endcsname%
                 [\the\AM@toc@title]{}}%
  \@ifundefined{@\AM@toc@section}
    {\expandafter\@sect\AM@temp
     \hskip\z@\par\vskip-\parskip\vskip-\baselineskip\hskip\z@}
    {\AM@tempi}%
  \xdef\@currentlabel{\@currentlabel}%
  \label{\AM@toc@label}%
  \endgroup
}
\newcommand{\AM@parse@toclist}{}
\def\AM@parse@toclist{%
  \ifx\AM@toclist\empty \def\AM@toc@page{0}%
  \else \expandafter\AM@parse@toclisti\AM@toclist\END
  \fi
}
\newtoks\AM@toc@title
\newcommand{\AM@parse@toclisti}{}
\def\AM@parse@toclisti#1,#2,#3,#4,#5,#6\END{%
  \def\AM@toc@page{\AM@trim@space{#1}}%
  \def\AM@toc@section{\AM@trim@space{#2}}%
  \def\AM@toc@level{\AM@trim@space{#3}}%
  \AM@toc@title\expandafter{\ifdim\z@=0pt#4}\fi
  \def\AM@toc@label{\AM@trim@space{#5}}%
  \AM@checkinteger{\AM@toc@page}%
  \ifAM@integer\else
    \PackageError{pdfpages}
         {Missing number.\MessageBreak
          Page number in option `addtotoc' is not a number}
         {See the pdfpages manual for explanation.}%
   \fi
}
\newcommand{\AM@rm@from@toclist}{}
\def\AM@rm@from@toclist{%
    \expandafter\AM@rm@from@toclisti\AM@toclist\END
}
\newcommand{\AM@rm@from@toclisti}{}
\def\AM@rm@from@toclisti#1,#2,#3,#4,#5,#6\END{%
  \def\AM@toclist{#6}%
}
\newcommand{\AM@addtolist@hook}{\relax}
\newcommand{\AM@addtolist}{}
\def\AM@addtolist{
  \def\@captype{\AM@lof@list}%
  \long\def\@makecaption##1##2{}%
  \let\@fs@capt\relax% float.sty
  \caption{\AM@lof@heading}%
  \AM@addtolist@hook
  \@ifundefined{hyper@@anchor}{}{%
    \@ifundefined{float@caption}{%
      \hyper@@anchor{\@currentHref}{\relax}%
  }{}}%
  \label{\AM@lof@label}%
  \vskip-\baselineskip
}
\newcommand{\AM@parse@loflist}{}
\def\AM@parse@loflist{%
  \ifx\AM@loflist\empty \def\AM@lof@page{0}%
  \else \expandafter\AM@parse@loflisti\AM@loflist\END
  \fi
}
\newcommand{\AM@parse@loflisti}{}
\def\AM@parse@loflisti#1,#2,#3,#4,#5\END{%
  \def\AM@lof@page{\AM@trim@space{#1}}%
  \def\AM@lof@list{\AM@trim@space{#2}}%
  \def\AM@lof@heading{#3}%
  \def\AM@lof@label{\AM@trim@space{#4}}%
  \AM@checkinteger{\AM@lof@page}%
  \ifAM@integer\else
    \PackageError{pdfpages}
         {Missing number.\MessageBreak
          Page number in option `addtolist' is not a number}
         {See the pdfpages manual for explanation.}%
  \fi
}
\newcommand{\AM@rm@fromloflist}{}
\def\AM@rm@from@loflist{%
    \expandafter\AM@rm@from@loflisti\AM@loflist\END
}
\newcommand{\AM@rm@from@loflisti}{}
\def\AM@rm@from@loflisti#1,#2,#3,#4,#5\END{%
  \def\AM@loflist{#5}%
}
\newcommand{\AM@toclof}{}
\def\AM@toclof#1{%
  \AM@parse@toclist
  \whiledo{#1=\AM@toc@page}{%
    \ifx\AM@toclist\empty
    \else
      \AM@addtotoc
      \AM@rm@from@toclist
      \def\AM@toc@page{0}%
      \AM@parse@toclist
    \fi
  }%
  \AM@parse@loflist
  \whiledo{#1=\AM@lof@page}{%
    \ifx\AM@loflist\empty
    \else
      \AM@addtolist
      \AM@rm@from@loflist
      \def\AM@lof@page{0}%
      \AM@parse@loflist
    \fi
  }%
}
\ifAM@pkg@survey
  \newcommand{\AddToSurvey}{%
      \protected@write\@auxout{\let\AM@abs@page\relax}
         {\string\newlabel{\AM@xrprefix pdfpages@page\the\c@AM@survey}%
            {{}{\AM@abs@page}}}%
      \stepcounter{AM@survey}%
  }
  \let\r@TotalPages\undefined
\else
  \newcommand{\AddToSurvey}{}
\fi
\newcounter{AM@survey}
\def\AM@abs@page{\the\count1}
\newcommand{\AM@pageref}{}
\newcommand{\AM@@pageref}{}
\newcommand{\AM@secondarg}{}
\def\AM@pageref#1{\expandafter\AM@@pageref\csname r@#1\endcsname}
\def\AM@@pageref#1{\expandafter\AM@secondarg#1\@nil}
\def\AM@secondarg#1#2#3\@nil{#2}
\define@key{pdfpages}{pages}{\def\AM@pagestemp{#1}}
\define@key{pdfpages}{nup}{\AM@parse@nup#1x\END}
\define@key{pdfpages}{deltax}{\AM@parse@deltax#1 \\}
\define@key{pdfpages}{deltay}{\AM@parse@deltay#1 \\}
\define@key{pdfpages}{delta}{\AM@parse@delta#1 \\}
\define@key{pdfpages}{offset}{\AM@parse@offset#1 \\}
\define@key{pdfpages}{frame}[true]{\setboolean{AM@frame}{#1}}
\define@key{pdfpages}{openright}[true]{\setboolean{AM@openright}{#1}}
\define@key{pdfpages}{pagecommand}{\def\AM@pagecommand{#1}}
\define@key{pdfpages}{landscape}[true]{\setboolean{AM@landscape}{#1}}
\define@key{pdfpages}{turn}[true]{\setboolean{AM@turn}{#1}}
\define@key{pdfpages}{column}[true]{\setboolean{AM@column}{#1}}
\define@key{pdfpages}{columnstrict}[true]%
                     {\setboolean{AM@columnstrict}{#1}}
\define@key{pdfpages}{noautoscale}[true]%
                     {\setboolean{AM@noautoscale}{#1}}
\define@key{pdfpages}{thread}[true]{\setboolean{AM@thread}{#1}}
\define@key{pdfpages}{threadname}{\def\AM@threadname{#1}}
\define@key{pdfpages}{link}[true]{\setboolean{AM@link}{#1}}
\define@key{pdfpages}{linkfit}{\def\AM@linkfit{#1}}
\define@key{pdfpages}{linkname}{\def\AM@linkname@option{#1}}
\define@key{pdfpages}{linktodoc}[true]{\setboolean{AM@linktodoc}{#1}}
\define@key{pdfpages}{linktodocfit}{\def\AM@linktodocfit{#1}}
\define@key{pdfpages}{linkfilename}{\pdfstringdef\AM@linkfilename{#1}%
                               \AM@linkfilenametrue}
\define@key{pdfpages}{survey}[true]{%
                      \ifAM@pkg@survey\setboolean{AM@survey}{#1}%
                      \else\AM@outputfalse\fi}
\define@key{pdfpages}{survey-nolink}[true]{%
                      \ifAM@pkg@survey\setboolean{AM@surveynolink}{#1}%
                                      \setboolean{AM@survey}{#1}
                      \else\AM@outputfalse\fi}
\define@key{pdfpages}{xr-prefix}{\def\AM@xrprefix{#1}}
\define@key{pdfpages}{fitpaper}[true]{\setboolean{AM@fitpaper}{#1}}
\define@key{pdfpages}{addtotoc}{\def\AM@toclist{#1,}}
\define@key{pdfpages}{addtolist}{\def\AM@loflist{#1,}}
\define@key{pdfpages}{doublepages}[true]%
                     {\setboolean{AM@doublepages}{#1}}
\define@key{pdfpages}{signature}{\def\AM@signature{#1}}
\newcommand{\AM@parse@nup}{}
\def\AM@parse@nup#1x#2\END{%
  \ifx\\#2\\%
    \def\AM@shortnupsyntax{}%
    \def\AM@xnup{\@ne}%
    \def\AM@ynup{\@ne}%
    \ifnum#1=\tw@
      \def\AM@xnup{\tw@}%
      \def\AM@ynup{\@ne}%
    \fi
    \ifnum#1=4
      \def\AM@xnup{\tw@}%
      \def\AM@ynup{\tw@}%
    \fi
  \else
    \def\AM@xnup{#1}%
    \AM@parse@nupi#2%
  \fi
}
\def\AM@parse@nupi#1x{\def\AM@ynup{#1}}
\def\AM@parse@deltax#1 #2\\{\AMGin@defaultbp\AM@deltax{#1}}
\def\AM@parse@deltay#1 #2\\{\AMGin@defaultbp\AM@deltay{#1}}
\def\AM@parse@delta#1 #2 #3\\{%
  \AMGin@defaultbp\AM@deltax{#1}%
  \AMGin@defaultbp\AM@deltay{#2}}
\def\AM@parse@offset#1 #2 #3\\{%
  \AMGin@defaultbp\AM@xoffset{#1}%
  \AMGin@defaultbp\AM@yoffset{#2}}
\def\AMGin@defaultbp#1#2{%
  \afterassignment\AMGin@def@bp\dimen@#2bp\relax{#1}{#2}}
\def\AMGin@def@bp#1\relax#2#3{%
   \if!#1!%
     \def#2{#3bp}%
    \else
      \dimen@.99626\dimen@
      \edef#2{\strip@pt\dimen@ bp}%
    \fi
}
\InputIfFileExists{pdfpages.fix}{%
  \PackageInfo{pdfpages}{Loading patch file `pdfpages.fix'}}{}
\endinput
%%
%% End of file `pdfpages.sty'.
