paper/geometry.sty
author Eugen Sawin <sawine@me73.com>
Tue, 29 Mar 2011 13:29:50 +0200
changeset 12 eade6d42212a
permissions -rw-r--r--
Hopefully final.
     1 %%
     2 %% This is file `geometry.sty',
     3 %% generated with the docstrip utility.
     4 %%
     5 %% The original source files were:
     6 %%
     7 %% geometry.dtx  (with options: `package')
     8 %% 
     9 %% Copyright (C) 1996-2010
    10 %% by Hideo Umeki <latexgeometry@gmail.com>
    11 %% 
    12 %% This work may be distributed and/or modified under the conditions of
    13 %% the LaTeX Project Public License, either version 1.3c of this license
    14 %% or (at your option) any later version. The latest version of this
    15 %% license is in
    16 %%    http://www.latex-project.org/lppl.txt
    17 %% and version 1.3c or later is part of all distributions of LaTeX
    18 %% version 2005/12/01 or later.
    19 %% 
    20 %% This work is "maintained" (as per the LPPL maintenance status)
    21 %% by Hideo Umeki.
    22 %% 
    23 %% This work consists of the files geometry.dtx and
    24 %% the derived files: geometry.{sty,ins,drv}, geometry-samples.tex.
    25 %% 
    26 \NeedsTeXFormat{LaTeX2e}
    27 \ProvidesPackage{geometry}
    28   [2010/03/13 v5.3 Page Geometry]
    29 \RequirePackage{keyval}%
    30 \RequirePackage{ifpdf}%
    31 %\RequirePackage{ifvtex}%
    32 \newif\ifGm@verbose
    33 \newif\ifGm@landscape
    34 \newif\ifGm@swap@papersize\Gm@swap@papersizefalse
    35 \newif\ifGm@includehead
    36 \newif\ifGm@includefoot
    37 \newif\ifGm@includemp
    38 \newif\ifGm@hbody
    39 \newif\ifGm@vbody
    40 \newif\ifGm@heightrounded
    41 \newif\ifGm@showframe
    42 \newif\ifGm@showcrop
    43 \newif\ifGm@pass\Gm@passfalse
    44 \newif\ifGm@resetpaper
    45 \newif\ifGm@layout
    46 \newif\ifGm@newgm
    47 \newcount\Gm@cnth
    48 \newcount\Gm@cntv
    49 \newcount\c@Gm@tempcnt
    50 \newdimen\Gm@bindingoffset
    51 \newdimen\Gm@wd@mp
    52 \newdimen\Gm@odd@mp
    53 \newdimen\Gm@even@mp
    54 \newdimen\Gm@layoutwidth
    55 \newdimen\Gm@layoutheight
    56 \newdimen\Gm@layouthoffset
    57 \newdimen\Gm@layoutvoffset
    58 \newtoks\Gm@dimlist
    59 \def\Gm@warning#1{\PackageWarningNoLine{geometry}{#1}}%
    60 \def\ifGm@preamble#1{%
    61   \ifGm@newgm
    62    \Gm@warning{`#1': not available in `\string\newgeometry'; skipped}%
    63   \else
    64     \expandafter\@firstofone
    65   \fi}%
    66 \def\Gm@Dhratio{1:1}% = left:right default for oneside
    67 \def\Gm@Dhratiotwo{2:3}% = inner:outer default for twoside.
    68 \def\Gm@Dvratio{2:3}% = top:bottom default
    69 \def\Gm@Dhscale{0.7}%
    70 \def\Gm@Dvscale{0.7}%
    71 \def\Gm@dvips{dvips}%
    72 \def\Gm@dvipdfm{dvipdfm}%
    73 \def\Gm@pdftex{pdftex}%
    74 \def\Gm@xetex{xetex}%
    75 \def\Gm@vtex{vtex}%
    76 \def\Gm@true{true}%
    77 \def\Gm@false{false}%
    78 \edef\Gm@orgpw{\the\paperwidth}%
    79 \edef\Gm@orgph{\the\paperheight}%
    80 \def\Gm@savelength#1{%
    81   \g@addto@macro\Gm@restore{\expandafter\noexpand\expandafter\csname
    82   #1\endcsname\expandafter=\expandafter\the\csname #1\endcsname\relax}}
    83 \def\Gm@saveboolean#1{%
    84   \csname if#1\endcsname
    85     \g@addto@macro\Gm@restore{\expandafter\noexpand\csname #1true\endcsname}%
    86   \else
    87     \g@addto@macro\Gm@restore{\expandafter\noexpand\csname #1false\endcsname}%
    88   \fi}%
    89 \def\Gm@restore{}%
    90 \def\Gm@save{%
    91   \Gm@savelength{paperwidth}%
    92   \Gm@savelength{paperheight}%
    93   \Gm@savelength{textwidth}%
    94   \Gm@savelength{textheight}%
    95   \Gm@savelength{evensidemargin}%
    96   \Gm@savelength{oddsidemargin}%
    97   \Gm@savelength{topmargin}%
    98   \Gm@savelength{headheight}%
    99   \Gm@savelength{headsep}%
   100   \Gm@savelength{topskip}%
   101   \Gm@savelength{footskip}%
   102   \Gm@savelength{baselineskip}%
   103   \Gm@savelength{marginparwidth}%
   104   \Gm@savelength{marginparsep}%
   105   \Gm@savelength{columnsep}%
   106   \Gm@savelength{hoffset}%
   107   \Gm@savelength{voffset}
   108   \Gm@savelength{Gm@layouthoffset}%
   109   \Gm@savelength{Gm@layoutvoffset}%
   110   \Gm@saveboolean{@twocolumn}%
   111   \Gm@saveboolean{@twoside}%
   112   \Gm@saveboolean{@mparswitch}%
   113   \Gm@saveboolean{@reversemargin}}%
   114 \def\Gm@initnewgm{%
   115   \Gm@dimlist={}
   116   \Gm@hbodyfalse
   117   \Gm@vbodyfalse
   118   \Gm@heightroundedfalse
   119   \Gm@includeheadfalse
   120   \Gm@includefootfalse
   121   \Gm@includempfalse
   122   \let\Gm@width\@undefined
   123   \let\Gm@height\@undefined
   124   \let\Gm@textwidth\@undefined
   125   \let\Gm@textheight\@undefined
   126   \let\Gm@lines\@undefined
   127   \let\Gm@hscale\@undefined
   128   \let\Gm@vscale\@undefined
   129   \let\Gm@hmarginratio\@undefined
   130   \let\Gm@vmarginratio\@undefined
   131   \let\Gm@lmargin\@undefined
   132   \let\Gm@rmargin\@undefined
   133   \let\Gm@tmargin\@undefined
   134   \let\Gm@bmargin\@undefined
   135   \Gm@layoutfalse
   136   \Gm@layouthoffset\z@
   137   \Gm@layoutvoffset\z@
   138   \Gm@bindingoffset\z@}%
   139 \def\Gm@initall{%
   140   \let\Gm@driver\@empty
   141   \let\Gm@truedimen\@empty
   142   \let\Gm@paper\@undefined
   143   \Gm@resetpaperfalse
   144   \Gm@landscapefalse
   145   \Gm@verbosefalse
   146   \Gm@showframefalse
   147   \Gm@showcropfalse
   148   \Gm@newgmfalse
   149   \Gm@initnewgm}%
   150 \def\Gm@setdriver#1{%
   151   \expandafter\let\expandafter\Gm@driver\csname Gm@#1\endcsname}%
   152 \def\Gm@unsetdriver#1{%
   153   \expandafter\ifx\csname Gm@#1\endcsname\Gm@driver\let\Gm@driver\@empty\fi}%
   154 \def\Gm@setbool{\@dblarg\Gm@@setbool}%
   155 \def\Gm@setboolrev{\@dblarg\Gm@@setboolrev}%
   156 \def\Gm@@setbool[#1]#2#3{\Gm@doif{#1}{#3}{\csname Gm@#2\Gm@bool\endcsname}}%
   157 \def\Gm@@setboolrev[#1]#2#3{\Gm@doifelse{#1}{#3}%
   158   {\csname Gm@#2\Gm@false\endcsname}{\csname Gm@#2\Gm@true\endcsname}}%
   159 \def\Gm@doif#1#2#3{%
   160   \lowercase{\def\Gm@bool{#2}}%
   161   \ifx\Gm@bool\@empty
   162     \let\Gm@bool\Gm@true
   163   \fi
   164   \ifx\Gm@bool\Gm@true
   165   \else
   166     \ifx\Gm@bool\Gm@false
   167     \else
   168       \let\Gm@bool\relax
   169     \fi
   170   \fi
   171   \ifx\Gm@bool\relax
   172     \Gm@warning{`#1' should be set to `true' or `false'}%
   173   \else
   174     #3
   175   \fi}%
   176 \def\Gm@doifelse#1#2#3#4{%
   177   \Gm@doif{#1}{#2}{\ifx\Gm@bool\Gm@true #3\else #4\fi}}%
   178 \def\Gm@reverse#1{%
   179   \csname ifGm@#1\endcsname
   180   \csname Gm@#1false\endcsname\else\csname Gm@#1true\endcsname\fi}%
   181 \def\Gm@defbylen#1#2{%
   182   \setlength\@tempdima{#2}%
   183   \expandafter\edef\csname Gm@#1\endcsname{\the\@tempdima}}%
   184 \def\Gm@defbycnt#1#2{%
   185   \setcounter{Gm@tempcnt}{#2}%
   186   \expandafter\edef\csname Gm@#1\endcsname{\the\value{Gm@tempcnt}}}%
   187 \def\Gm@sep@ratio#1:#2{\@tempcnta=#1\@tempcntb=#2}%
   188 \def\Gm@setbyratio[#1]#2#3#4{% determine #4 by ratio
   189   \expandafter\Gm@sep@ratio\Gm@mratio\relax
   190   \if#1b
   191     \edef\@@tempa{\the\@tempcnta}%
   192     \@tempcnta=\@tempcntb
   193     \@tempcntb=\@@tempa\relax
   194   \fi
   195   \expandafter\setlength\expandafter\@tempdimb\expandafter
   196     {\csname Gm@#3\endcsname}%
   197   \ifnum\@tempcntb>\z@
   198     \multiply\@tempdimb\@tempcnta
   199     \divide\@tempdimb\@tempcntb
   200   \fi
   201   \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdimb}}%
   202 \def\Gm@detiv#1#2#3#4{% determine #4.
   203   \expandafter\setlength\expandafter\@tempdima\expandafter
   204     {\csname Gm@layout#1\endcsname}%
   205   \expandafter\setlength\expandafter\@tempdimb\expandafter
   206     {\csname Gm@#2\endcsname}%
   207   \addtolength\@tempdima{-\@tempdimb}%
   208   \expandafter\setlength\expandafter\@tempdimb\expandafter
   209     {\csname Gm@#3\endcsname}%
   210   \addtolength\@tempdima{-\@tempdimb}%
   211   \ifdim\@tempdima<\z@
   212     \Gm@warning{`#4' results in NEGATIVE (\the\@tempdima).%
   213     ^^J\@spaces `#2' or `#3' should be shortened in length}%
   214   \fi
   215   \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdima}}%
   216 \def\Gm@detiiandiii#1#2#3{% determine #2 and #3.
   217   \expandafter\setlength\expandafter\@tempdima\expandafter
   218     {\csname Gm@layout#1\endcsname}%
   219   \expandafter\setlength\expandafter\@tempdimb\expandafter
   220     {\csname Gm@#1\endcsname}%
   221   \addtolength\@tempdima{-\@tempdimb}%
   222   \ifdim\@tempdima<\z@
   223     \Gm@warning{`#2' and `#3' result in NEGATIVE (\the\@tempdima).%
   224                   ^^J\@spaces `#1' should be shortened in length}%
   225   \fi
   226   \ifx\Gm@mratio\@undefined
   227     \expandafter\Gm@sep@ratio\Gm@Dmratio\relax
   228   \else
   229     \expandafter\Gm@sep@ratio\Gm@mratio\relax
   230     \ifnum\@tempcntb>\z@\else
   231       \Gm@warning{margin ratio a:b should be non-zero; default used}%
   232       \expandafter\Gm@sep@ratio\Gm@Dmratio\relax
   233     \fi
   234   \fi
   235   \@tempdimb=\@tempdima
   236   \advance\@tempcntb\@tempcnta
   237   \divide\@tempdima\@tempcntb
   238   \multiply\@tempdima\@tempcnta
   239   \advance\@tempdimb-\@tempdima
   240   \expandafter\edef\csname Gm@#2\endcsname{\the\@tempdima}%
   241   \expandafter\edef\csname Gm@#3\endcsname{\the\@tempdimb}}%
   242 \def\Gm@detall#1#2#3#4{%
   243   \@tempcnta\z@
   244   \if#1h
   245     \let\Gm@mratio\Gm@hmarginratio
   246     \edef\Gm@Dmratio{\if@twoside\Gm@Dhratiotwo\else\Gm@Dhratio\fi}%
   247   \else
   248     \let\Gm@mratio\Gm@vmarginratio
   249     \edef\Gm@Dmratio{\Gm@Dvratio}%
   250   \fi
   251   \if#1h
   252     \ifx\Gm@lmargin\@undefined\else\advance\@tempcnta4\relax\fi
   253     \ifGm@hbody\advance\@tempcnta2\relax\fi
   254     \ifx\Gm@rmargin\@undefined\else\advance\@tempcnta1\relax\fi
   255     \Gm@cnth\@tempcnta
   256   \else
   257     \ifx\Gm@tmargin\@undefined\else\advance\@tempcnta4\relax\fi
   258     \ifGm@vbody\advance\@tempcnta2\relax\fi
   259     \ifx\Gm@bmargin\@undefined\else\advance\@tempcnta1\relax\fi
   260     \Gm@cntv\@tempcnta
   261   \fi
   262   \ifcase\@tempcnta
   263     \if#1h
   264       \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
   265     \else
   266       \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
   267     \fi
   268     \Gm@detiiandiii{#2}{#3}{#4}%
   269   \or
   270     \ifx\Gm@mratio\@undefined
   271       \if#1h
   272         \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
   273       \else
   274         \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
   275       \fi
   276       \setlength\@tempdimc{\@nameuse{Gm@#4}}%
   277       \Gm@detiiandiii{#2}{#3}{#4}%
   278       \expandafter\let\csname Gm@#2\endcsname\@undefined
   279       \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdimc}%
   280     \else
   281       \Gm@setbyratio[f]{#1}{#4}{#3}%
   282     \fi
   283     \Gm@detiv{#2}{#3}{#4}{#2}%
   284   \or\Gm@detiiandiii{#2}{#3}{#4}%
   285   \or\Gm@detiv{#2}{#2}{#4}{#3}%
   286   \or
   287     \ifx\Gm@mratio\@undefined
   288       \if#1h
   289         \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
   290       \else
   291         \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
   292       \fi
   293       \setlength\@tempdimc{\@nameuse{Gm@#3}}%
   294       \Gm@detiiandiii{#2}{#4}{#3}%
   295       \expandafter\let\csname Gm@#2\endcsname\@undefined
   296       \expandafter\edef\csname Gm@#3\endcsname{\the\@tempdimc}%
   297     \else
   298       \Gm@setbyratio[b]{#1}{#3}{#4}%
   299     \fi
   300     \Gm@detiv{#2}{#3}{#4}{#2}%
   301   \or\Gm@detiv{#2}{#3}{#4}{#2}%
   302   \or\Gm@detiv{#2}{#2}{#3}{#4}%
   303   \or\Gm@warning{Over-specification in `#1'-direction.%
   304                   ^^J\@spaces `#2' (\@nameuse{Gm@#2}) is ignored}%
   305     \Gm@detiv{#2}{#3}{#4}{#2}%
   306   \else\fi}%
   307 \def\Gm@clean{%
   308   \ifnum\Gm@cnth<4\let\Gm@lmargin\@undefined\fi
   309   \ifodd\Gm@cnth\else\let\Gm@rmargin\@undefined\fi
   310   \ifnum\Gm@cntv<4\let\Gm@tmargin\@undefined\fi
   311   \ifodd\Gm@cntv\else\let\Gm@bmargin\@undefined\fi
   312   \ifGm@hbody\else
   313     \let\Gm@hscale\@undefined
   314     \let\Gm@width\@undefined
   315     \let\Gm@textwidth\@undefined
   316   \fi
   317   \ifGm@vbody\else
   318     \let\Gm@vscale\@undefined
   319     \let\Gm@height\@undefined
   320     \let\Gm@textheight\@undefined
   321   \fi
   322   }%
   323 \def\Gm@parse@divide#1#2#3#4{%
   324   \def\Gm@star{*}%
   325   \@tempcnta\z@
   326   \@for\Gm@tmp:=#1\do{%
   327     \expandafter\KV@@sp@def\expandafter\Gm@frag\expandafter{\Gm@tmp}%
   328     \edef\Gm@value{\Gm@frag}%
   329     \ifcase\@tempcnta\relax\edef\Gm@key{#2}%
   330       \or\edef\Gm@key{#3}%
   331       \else\edef\Gm@key{#4}%
   332     \fi
   333     \@nameuse{Gm@set\Gm@key false}%
   334     \ifx\empty\Gm@value\else
   335     \ifx\Gm@star\Gm@value\else
   336       \setkeys{Gm}{\Gm@key=\Gm@value}%
   337     \fi\fi
   338     \advance\@tempcnta\@ne}%
   339   \let\Gm@star\relax}%
   340 \def\Gm@branch#1#2#3{%
   341   \@tempcnta\z@
   342   \@for\Gm@tmp:=#1\do{%
   343     \KV@@sp@def\Gm@frag{\Gm@tmp}%
   344     \edef\Gm@value{\Gm@frag}%
   345     \ifcase\@tempcnta\relax% cnta == 0
   346       \setkeys{Gm}{#2=\Gm@value}%
   347     \or% cnta == 1
   348       \setkeys{Gm}{#3=\Gm@value}%
   349     \else\fi
   350     \advance\@tempcnta\@ne}%
   351   \ifnum\@tempcnta=\@ne
   352     \setkeys{Gm}{#3=\Gm@value}%
   353   \fi}%
   354 \def\Gm@magtooffset{%
   355   \@tempdima=\mag\Gm@truedimen sp%
   356   \@tempdimb=1\Gm@truedimen in%
   357   \divide\@tempdimb\@tempdima
   358   \multiply\@tempdimb\@m
   359   \addtolength{\hoffset}{1\Gm@truedimen in}%
   360   \addtolength{\voffset}{1\Gm@truedimen in}%
   361   \addtolength{\hoffset}{-\the\@tempdimb}%
   362   \addtolength{\voffset}{-\the\@tempdimb}}%
   363 \def\Gm@setlength#1#2{%
   364   \let\Gm@len=\relax\let\Gm@td=\relax
   365   \edef\addtolist{\noexpand\Gm@dimlist=%
   366   {\the\Gm@dimlist \Gm@len{#1}{#2}}}\addtolist}%
   367 \def\Gm@expandlengths{%
   368   \def\Gm@td{\Gm@truedimen}%
   369   \def\Gm@len##1##2{\setlength{##1}{##2}}%
   370   \the\Gm@dimlist}%
   371 \def\Gm@setsize#1(#2,#3)#4{%
   372   \let\Gm@td\relax
   373   \expandafter\Gm@setlength\csname #1width\endcsname{#2\Gm@td #4}%
   374   \expandafter\Gm@setlength\csname #1height\endcsname{#3\Gm@td #4}%
   375   \ifGm@landscape\Gm@swap@papersizetrue\else\Gm@swap@papersizefalse\fi}%
   376 \def\Gm@setpaper@ifpre#1{%
   377   \ifGm@preamble{#1}{\def\Gm@paper{#1}\@nameuse{Gm@#1}{paper}}}%
   378 \@namedef{Gm@a0paper}#1{\Gm@setsize{#1}(841,1189){mm}}% ISO A0
   379 \@namedef{Gm@a1paper}#1{\Gm@setsize{#1}(594,841){mm}}% ISO A1
   380 \@namedef{Gm@a2paper}#1{\Gm@setsize{#1}(420,594){mm}}% ISO A2
   381 \@namedef{Gm@a3paper}#1{\Gm@setsize{#1}(297,420){mm}}% ISO A3
   382 \@namedef{Gm@a4paper}#1{\Gm@setsize{#1}(210,297){mm}}% ISO A4
   383 \@namedef{Gm@a5paper}#1{\Gm@setsize{#1}(148,210){mm}}% ISO A5
   384 \@namedef{Gm@a6paper}#1{\Gm@setsize{#1}(105,148){mm}}% ISO A6
   385 \@namedef{Gm@b0paper}#1{\Gm@setsize{#1}(1000,1414){mm}}% ISO B0
   386 \@namedef{Gm@b1paper}#1{\Gm@setsize{#1}(707,1000){mm}}% ISO B1
   387 \@namedef{Gm@b2paper}#1{\Gm@setsize{#1}(500,707){mm}}% ISO B2
   388 \@namedef{Gm@b3paper}#1{\Gm@setsize{#1}(353,500){mm}}% ISO B3
   389 \@namedef{Gm@b4paper}#1{\Gm@setsize{#1}(250,353){mm}}% ISO B4
   390 \@namedef{Gm@b5paper}#1{\Gm@setsize{#1}(176,250){mm}}% ISO B5
   391 \@namedef{Gm@b6paper}#1{\Gm@setsize{#1}(125,176){mm}}% ISO B6
   392 \@namedef{Gm@b0j}#1{\Gm@setsize{#1}(1030,1456){mm}}% JIS B0
   393 \@namedef{Gm@b1j}#1{\Gm@setsize{#1}(728,1030){mm}}% JIS B1
   394 \@namedef{Gm@b2j}#1{\Gm@setsize{#1}(515,728){mm}}% JIS B2
   395 \@namedef{Gm@b3j}#1{\Gm@setsize{#1}(364,515){mm}}% JIS B3
   396 \@namedef{Gm@b4j}#1{\Gm@setsize{#1}(257,364){mm}}% JIS B4
   397 \@namedef{Gm@b5j}#1{\Gm@setsize{#1}(182,257){mm}}% JIS B5
   398 \@namedef{Gm@b6j}#1{\Gm@setsize{#1}(128,182){mm}}% JIS B6
   399 \@namedef{Gm@ansiapaper}#1{\Gm@setsize{#1}(8.5,11){in}}%
   400 \@namedef{Gm@ansibpaper}#1{\Gm@setsize{#1}(11,17){in}}%
   401 \@namedef{Gm@ansicpaper}#1{\Gm@setsize{#1}(17,22){in}}%
   402 \@namedef{Gm@ansidpaper}#1{\Gm@setsize{#1}(22,34){in}}%
   403 \@namedef{Gm@ansiepaper}#1{\Gm@setsize{#1}(34,44){in}}%
   404 \@namedef{Gm@letterpaper}#1{\Gm@setsize{#1}(8.5,11){in}}%
   405 \@namedef{Gm@legalpaper}#1{\Gm@setsize{#1}(8.5,14){in}}%
   406 \@namedef{Gm@executivepaper}#1{\Gm@setsize{#1}(7.25,10.5){in}}%
   407 \@namedef{Gm@screen}#1{\Gm@setsize{#1}(225,180){mm}}%
   408 \define@key{Gm}{paper}{\setkeys{Gm}{#1}}%
   409 \let\KV@Gm@papername\KV@Gm@paper
   410 \define@key{Gm}{a0paper}[true]{\Gm@setpaper@ifpre{a0paper}}%
   411 \define@key{Gm}{a1paper}[true]{\Gm@setpaper@ifpre{a1paper}}%
   412 \define@key{Gm}{a2paper}[true]{\Gm@setpaper@ifpre{a2paper}}%
   413 \define@key{Gm}{a3paper}[true]{\Gm@setpaper@ifpre{a3paper}}%
   414 \define@key{Gm}{a4paper}[true]{\Gm@setpaper@ifpre{a4paper}}%
   415 \define@key{Gm}{a5paper}[true]{\Gm@setpaper@ifpre{a5paper}}%
   416 \define@key{Gm}{a6paper}[true]{\Gm@setpaper@ifpre{a6paper}}%
   417 \define@key{Gm}{b0paper}[true]{\Gm@setpaper@ifpre{b0paper}}%
   418 \define@key{Gm}{b1paper}[true]{\Gm@setpaper@ifpre{b1paper}}%
   419 \define@key{Gm}{b2paper}[true]{\Gm@setpaper@ifpre{b2paper}}%
   420 \define@key{Gm}{b3paper}[true]{\Gm@setpaper@ifpre{b3paper}}%
   421 \define@key{Gm}{b4paper}[true]{\Gm@setpaper@ifpre{b4paper}}%
   422 \define@key{Gm}{b5paper}[true]{\Gm@setpaper@ifpre{b5paper}}%
   423 \define@key{Gm}{b6paper}[true]{\Gm@setpaper@ifpre{b6paper}}%
   424 \define@key{Gm}{b0j}[true]{\Gm@setpaper@ifpre{b0j}}%
   425 \define@key{Gm}{b1j}[true]{\Gm@setpaper@ifpre{b1j}}%
   426 \define@key{Gm}{b2j}[true]{\Gm@setpaper@ifpre{b2j}}%
   427 \define@key{Gm}{b3j}[true]{\Gm@setpaper@ifpre{b3j}}%
   428 \define@key{Gm}{b4j}[true]{\Gm@setpaper@ifpre{b4j}}%
   429 \define@key{Gm}{b5j}[true]{\Gm@setpaper@ifpre{b5j}}%
   430 \define@key{Gm}{b6j}[true]{\Gm@setpaper@ifpre{b6j}}%
   431 \define@key{Gm}{ansiapaper}[true]{\Gm@setpaper@ifpre{ansiapaper}}%
   432 \define@key{Gm}{ansibpaper}[true]{\Gm@setpaper@ifpre{ansibpaper}}%
   433 \define@key{Gm}{ansicpaper}[true]{\Gm@setpaper@ifpre{ansicpaper}}%
   434 \define@key{Gm}{ansidpaper}[true]{\Gm@setpaper@ifpre{ansidpaper}}%
   435 \define@key{Gm}{ansiepaper}[true]{\Gm@setpaper@ifpre{ansiepaper}}%
   436 \define@key{Gm}{letterpaper}[true]{\Gm@setpaper@ifpre{letterpaper}}%
   437 \define@key{Gm}{legalpaper}[true]{\Gm@setpaper@ifpre{legalpaper}}%
   438 \define@key{Gm}{executivepaper}[true]{\Gm@setpaper@ifpre{executivepaper}}%
   439 \define@key{Gm}{screen}[true]{\Gm@setpaper@ifpre{screen}}%
   440 \define@key{Gm}{paperwidth}{\ifGm@preamble{paperwidth}{%
   441   \Gm@setlength\paperwidth{#1}}}%
   442 \define@key{Gm}{paperheight}{\ifGm@preamble{paperheight}{%
   443   \Gm@setlength\paperheight{#1}}}%
   444 \define@key{Gm}{papersize}{\ifGm@preamble{papersize}{%
   445   \Gm@branch{#1}{paperwidth}{paperheight}}}%
   446 \define@key{Gm}{layout}{\Gm@layouttrue\@nameuse{Gm@#1}{Gm@layout}}%
   447 \let\KV@Gm@layoutname\KV@Gm@layout
   448 \define@key{Gm}{layoutwidth}{\Gm@layouttrue\Gm@setlength\Gm@layoutwidth{#1}}%
   449 \define@key{Gm}{layoutheight}{\Gm@layouttrue\Gm@setlength\Gm@layoutheight{#1}}%
   450 \define@key{Gm}{layoutsize}{\Gm@branch{#1}{layoutwidth}{layoutheight}}%
   451 \define@key{Gm}{landscape}[true]{\ifGm@preamble{landscape}{%
   452   \Gm@doifelse{landscape}{#1}%
   453   {\ifGm@landscape\else\Gm@landscapetrue\Gm@reverse{swap@papersize}\fi}%
   454   {\ifGm@landscape\Gm@landscapefalse\Gm@reverse{swap@papersize}\fi}}}%
   455 \define@key{Gm}{portrait}[true]{\ifGm@preamble{portrait}{%
   456   \Gm@doifelse{portrait}{#1}%
   457   {\ifGm@landscape\Gm@landscapefalse\Gm@reverse{swap@papersize}\fi}%
   458   {\ifGm@landscape\else\Gm@landscapetrue\Gm@reverse{swap@papersize}\fi}}}%
   459 \define@key{Gm}{hscale}{\Gm@hbodytrue\edef\Gm@hscale{#1}}%
   460 \define@key{Gm}{vscale}{\Gm@vbodytrue\edef\Gm@vscale{#1}}%
   461 \define@key{Gm}{scale}{\Gm@branch{#1}{hscale}{vscale}}%
   462 \define@key{Gm}{width}{\Gm@hbodytrue\Gm@defbylen{width}{#1}}%
   463 \define@key{Gm}{height}{\Gm@vbodytrue\Gm@defbylen{height}{#1}}%
   464 \define@key{Gm}{total}{\Gm@branch{#1}{width}{height}}%
   465 \let\KV@Gm@totalwidth\KV@Gm@width
   466 \let\KV@Gm@totalheight\KV@Gm@height
   467 \define@key{Gm}{textwidth}{\Gm@hbodytrue\Gm@defbylen{textwidth}{#1}}%
   468 \define@key{Gm}{textheight}{\Gm@vbodytrue\Gm@defbylen{textheight}{#1}}%
   469 \define@key{Gm}{text}{\Gm@branch{#1}{textwidth}{textheight}}%
   470 \let\KV@Gm@body\KV@Gm@text
   471 \define@key{Gm}{lines}{\Gm@vbodytrue\Gm@defbycnt{lines}{#1}}%
   472 \define@key{Gm}{includehead}[true]{\Gm@setbool{includehead}{#1}}%
   473 \define@key{Gm}{includefoot}[true]{\Gm@setbool{includefoot}{#1}}%
   474 \define@key{Gm}{includeheadfoot}[true]{\Gm@doifelse{includeheadfoot}{#1}%
   475   {\Gm@includeheadtrue\Gm@includefoottrue}%
   476   {\Gm@includeheadfalse\Gm@includefootfalse}}%
   477 \define@key{Gm}{includemp}[true]{\Gm@setbool{includemp}{#1}}%
   478 \define@key{Gm}{includeall}[true]{\Gm@doifelse{includeall}{#1}%
   479   {\Gm@includeheadtrue\Gm@includefoottrue\Gm@includemptrue}%
   480   {\Gm@includeheadfalse\Gm@includefootfalse\Gm@includempfalse}}%
   481 \define@key{Gm}{ignorehead}[true]{%
   482   \Gm@setboolrev[ignorehead]{includehead}{#1}}%
   483 \define@key{Gm}{ignorefoot}[true]{%
   484   \Gm@setboolrev[ignorefoot]{includefoot}{#1}}%
   485 \define@key{Gm}{ignoreheadfoot}[true]{\Gm@doifelse{ignoreheadfoot}{#1}%
   486   {\Gm@includeheadfalse\Gm@includefootfalse}%
   487   {\Gm@includeheadtrue\Gm@includefoottrue}}%
   488 \define@key{Gm}{ignoremp}[true]{%
   489   \Gm@setboolrev[ignoremp]{includemp}{#1}}%
   490 \define@key{Gm}{ignoreall}[true]{\Gm@doifelse{ignoreall}{#1}%
   491   {\Gm@includeheadfalse\Gm@includefootfalse\Gm@includempfalse}%
   492   {\Gm@includeheadtrue\Gm@includefoottrue\Gm@includemptrue}}%
   493 \define@key{Gm}{heightrounded}[true]{\Gm@setbool{heightrounded}{#1}}%
   494 \define@key{Gm}{hdivide}{\Gm@parse@divide{#1}{lmargin}{width}{rmargin}}%
   495 \define@key{Gm}{vdivide}{\Gm@parse@divide{#1}{tmargin}{height}{bmargin}}%
   496 \define@key{Gm}{divide}{\Gm@parse@divide{#1}{lmargin}{width}{rmargin}%
   497   \Gm@parse@divide{#1}{tmargin}{height}{bmargin}}%
   498 \define@key{Gm}{lmargin}{\Gm@defbylen{lmargin}{#1}}%
   499 \define@key{Gm}{rmargin}{\Gm@defbylen{rmargin}{#1}}%
   500 \let\KV@Gm@left\KV@Gm@lmargin
   501 \let\KV@Gm@inner\KV@Gm@lmargin
   502 \let\KV@Gm@innermargin\KV@Gm@lmargin
   503 \let\KV@Gm@right\KV@Gm@rmargin
   504 \let\KV@Gm@outer\KV@Gm@rmargin
   505 \let\KV@Gm@outermargin\KV@Gm@rmargin
   506 \define@key{Gm}{tmargin}{\Gm@defbylen{tmargin}{#1}}%
   507 \define@key{Gm}{bmargin}{\Gm@defbylen{bmargin}{#1}}%
   508 \let\KV@Gm@top\KV@Gm@tmargin
   509 \let\KV@Gm@bottom\KV@Gm@bmargin
   510 \define@key{Gm}{hmargin}{\Gm@branch{#1}{lmargin}{rmargin}}%
   511 \define@key{Gm}{vmargin}{\Gm@branch{#1}{tmargin}{bmargin}}%
   512 \define@key{Gm}{margin}{\Gm@branch{#1}{lmargin}{tmargin}%
   513   \Gm@branch{#1}{rmargin}{bmargin}}%
   514 \define@key{Gm}{hmarginratio}{\edef\Gm@hmarginratio{#1}}%
   515 \define@key{Gm}{vmarginratio}{\edef\Gm@vmarginratio{#1}}%
   516 \define@key{Gm}{marginratio}{\Gm@branch{#1}{hmarginratio}{vmarginratio}}%
   517 \let\KV@Gm@hratio\KV@Gm@hmarginratio
   518 \let\KV@Gm@vratio\KV@Gm@vmarginratio
   519 \let\KV@Gm@ratio\KV@Gm@marginratio
   520 \define@key{Gm}{hcentering}[true]{\Gm@doifelse{hcentering}{#1}%
   521   {\def\Gm@hmarginratio{1:1}}{}}%
   522 \define@key{Gm}{vcentering}[true]{\Gm@doifelse{vcentering}{#1}%
   523   {\def\Gm@vmarginratio{1:1}}{}}%
   524 \define@key{Gm}{centering}[true]{\Gm@doifelse{centering}{#1}%
   525   {\def\Gm@hmarginratio{1:1}\def\Gm@vmarginratio{1:1}}{}}%
   526 \define@key{Gm}{twoside}[true]{\Gm@doifelse{twoside}{#1}%
   527   {\@twosidetrue\@mparswitchtrue}{\@twosidefalse\@mparswitchfalse}}%
   528 \define@key{Gm}{asymmetric}[true]{\Gm@doifelse{asymmetric}{#1}%
   529   {\@twosidetrue\@mparswitchfalse}{}}%
   530 \define@key{Gm}{bindingoffset}{\Gm@setlength\Gm@bindingoffset{#1}}%
   531 \define@key{Gm}{headheight}{\Gm@setlength\headheight{#1}}%
   532 \define@key{Gm}{headsep}{\Gm@setlength\headsep{#1}}%
   533 \define@key{Gm}{footskip}{\Gm@setlength\footskip{#1}}%
   534 \let\KV@Gm@head\KV@Gm@headheight
   535 \let\KV@Gm@foot\KV@Gm@footskip
   536 \define@key{Gm}{nohead}[true]{\Gm@doifelse{nohead}{#1}%
   537   {\Gm@setlength\headheight\z@\Gm@setlength\headsep\z@}{}}%
   538 \define@key{Gm}{nofoot}[true]{\Gm@doifelse{nofoot}{#1}%
   539   {\Gm@setlength\footskip\z@}{}}%
   540 \define@key{Gm}{noheadfoot}[true]{\Gm@doifelse{noheadfoot}{#1}%
   541   {\Gm@setlength\headheight\z@\Gm@setlength\headsep
   542   \z@\Gm@setlength\footskip\z@}{}}%
   543 \define@key{Gm}{footnotesep}{\Gm@setlength{\skip\footins}{#1}}%
   544 \define@key{Gm}{marginparwidth}{\Gm@setlength\marginparwidth{#1}}%
   545 \let\KV@Gm@marginpar\KV@Gm@marginparwidth
   546 \define@key{Gm}{marginparsep}{\Gm@setlength\marginparsep{#1}}%
   547 \define@key{Gm}{nomarginpar}[true]{\Gm@doifelse{nomarginpar}{#1}%
   548   {\Gm@setlength\marginparwidth\z@\Gm@setlength\marginparsep\z@}{}}%
   549 \define@key{Gm}{columnsep}{\Gm@setlength\columnsep{#1}}%
   550 \define@key{Gm}{hoffset}{\Gm@setlength\hoffset{#1}}%
   551 \define@key{Gm}{voffset}{\Gm@setlength\voffset{#1}}%
   552 \define@key{Gm}{offset}{\Gm@branch{#1}{hoffset}{voffset}}%
   553 \define@key{Gm}{layouthoffset}{\Gm@setlength\Gm@layouthoffset{#1}}%
   554 \define@key{Gm}{layoutvoffset}{\Gm@setlength\Gm@layoutvoffset{#1}}%
   555 \define@key{Gm}{layoutoffset}{\Gm@branch{#1}{layouthoffset}{layoutvoffset}}%
   556 \define@key{Gm}{twocolumn}[true]{%
   557   \Gm@doif{twocolumn}{#1}{\csname @twocolumn\Gm@bool\endcsname}}%
   558 \define@key{Gm}{onecolumn}[true]{%
   559   \Gm@doifelse{onecolumn}{#1}{\@twocolumnfalse}{\@twocolumntrue}}%
   560 \define@key{Gm}{reversemp}[true]{%
   561   \Gm@doif{reversemp}{#1}{\csname @reversemargin\Gm@bool\endcsname}}%
   562 \define@key{Gm}{reversemarginpar}[true]{%
   563   \Gm@doif{reversemarginpar}{#1}{\csname @reversemargin\Gm@bool\endcsname}}%
   564 \define@key{Gm}{driver}{\ifGm@preamble{driver}{%
   565   \edef\@@tempa{#1}\edef\@@auto{auto}\edef\@@none{none}%
   566   \ifx\@@tempa\@empty\let\Gm@driver\relax\else
   567   \ifx\@@tempa\@@none\let\Gm@driver\relax\else
   568   \ifx\@@tempa\@@auto\let\Gm@driver\@empty\else
   569   \setkeys{Gm}{#1}\fi\fi\fi\let\@@auto\relax\let\@@none\relax}}%
   570 \define@key{Gm}{dvips}[true]{\ifGm@preamble{dvips}{%
   571   \Gm@doifelse{dvips}{#1}{\Gm@setdriver{dvips}}{\Gm@unsetdriver{dvips}}}}%
   572 \define@key{Gm}{dvipdfm}[true]{\ifGm@preamble{dvipdfm}{%
   573   \Gm@doifelse{dvipdfm}{#1}{\Gm@setdriver{dvipdfm}}{\Gm@unsetdriver{dvipdfm}}}}%
   574 \define@key{Gm}{pdftex}[true]{\ifGm@preamble{pdftex}{%
   575   \Gm@doifelse{pdftex}{#1}{\Gm@setdriver{pdftex}}{\Gm@unsetdriver{pdftex}}}}%
   576 \define@key{Gm}{xetex}[true]{\ifGm@preamble{xetex}{%
   577   \Gm@doifelse{xetex}{#1}{\Gm@setdriver{xetex}}{\Gm@unsetdriver{xetex}}}}%
   578 \define@key{Gm}{vtex}[true]{\ifGm@preamble{vtex}{%
   579   \Gm@doifelse{vtex}{#1}{\Gm@setdriver{vtex}}{\Gm@unsetdriver{vtex}}}}%
   580 \define@key{Gm}{verbose}[true]{\ifGm@preamble{verbose}{\Gm@setbool{verbose}{#1}}}%
   581 \define@key{Gm}{reset}[true]{\ifGm@preamble{reset}{%
   582   \Gm@doifelse{reset}{#1}{\Gm@restore@org\Gm@initall
   583   \ProcessOptionsKV[c]{Gm}\Gm@setdefaultpaper}{}}}%
   584 \define@key{Gm}{resetpaper}[true]{\ifGm@preamble{resetpaper}{%
   585   \Gm@setbool{resetpaper}{#1}}}%
   586 \define@key{Gm}{mag}{\ifGm@preamble{mag}{\mag=#1}}%
   587 \define@key{Gm}{truedimen}[true]{\ifGm@preamble{truedimen}{%
   588   \Gm@doifelse{truedimen}{#1}{\let\Gm@truedimen\Gm@true}%
   589   {\let\Gm@truedimen\@empty}}}%
   590 \define@key{Gm}{pass}[true]{\ifGm@preamble{pass}{\Gm@setbool{pass}{#1}}}%
   591 \define@key{Gm}{showframe}[true]{\Gm@setbool{showframe}{#1}}%
   592 \define@key{Gm}{showcrop}[true]{\Gm@setbool{showcrop}{#1}}%
   593 \def\Gm@setdefaultpaper{%
   594   \ifx\Gm@paper\@undefined
   595     \Gm@setsize{paper}(\strip@pt\paperwidth,\strip@pt\paperheight){pt}%
   596     \Gm@setsize{Gm@layout}(\strip@pt\paperwidth,\strip@pt\paperheight){pt}%
   597     \Gm@swap@papersizefalse
   598   \fi}%
   599 \def\Gm@adjustpaper{%
   600   \ifdim\paperwidth>\p@\else
   601     \PackageError{geometry}{%
   602     \string\paperwidth\space(\the\paperwidth) too short}{%
   603     Set a paper type (e.g., `a4paper').}%
   604   \fi
   605   \ifdim\paperheight>\p@\else
   606     \PackageError{geometry}{%
   607     \string\paperheight\space(\the\paperheight) too short}{%
   608     Set a paper type (e.g., `a4paper').}%
   609   \fi
   610   \ifGm@swap@papersize
   611     \setlength\@tempdima{\paperwidth}%
   612     \setlength\paperwidth{\paperheight}%
   613     \setlength\paperheight{\@tempdima}%
   614   \fi
   615   \ifGm@layout\else
   616     \let\Gm@layoutwidth\paperwidth
   617     \let\Gm@layoutheight\paperheight
   618   \fi}%
   619 \def\Gm@checkmp{%
   620   \ifGm@includemp\else
   621     \@tempcnta\z@\@tempcntb\@ne
   622     \if@twocolumn
   623       \@tempcnta\@ne
   624     \else
   625       \if@reversemargin
   626         \@tempcnta\@ne\@tempcntb\z@
   627       \fi
   628     \fi
   629     \@tempdima\marginparwidth
   630     \advance\@tempdima\marginparsep
   631     \ifnum\@tempcnta=\@ne
   632       \@tempdimc\@tempdima
   633       \setlength\@tempdimb{\Gm@lmargin}%
   634       \advance\@tempdimc-\@tempdimb
   635       \ifdim\@tempdimc>\z@
   636         \Gm@warning{The marginal notes overrun the paper edge.^^J
   637         \@spaces Add \the\@tempdimc\space and more to the left margin}%
   638       \fi
   639     \fi
   640     \ifnum\@tempcntb=\@ne
   641       \@tempdimc\@tempdima
   642       \setlength\@tempdimb{\Gm@rmargin}%
   643       \advance\@tempdimc-\@tempdimb
   644       \ifdim\@tempdimc>\z@
   645         \Gm@warning{The marginal notes overrun the paper.^^J
   646         \@spaces Add \the\@tempdimc\space and more to the right margin}%
   647       \fi
   648     \fi
   649   \fi}%
   650 \def\Gm@adjustmp{%
   651   \ifGm@includemp
   652     \@tempdimb\marginparwidth
   653     \advance\@tempdimb\marginparsep
   654     \Gm@wd@mp\@tempdimb
   655     \Gm@odd@mp\z@
   656     \Gm@even@mp\z@
   657     \if@twocolumn
   658       \Gm@wd@mp2\@tempdimb
   659       \Gm@odd@mp\@tempdimb
   660       \Gm@even@mp\@tempdimb
   661     \else
   662       \if@reversemargin
   663         \Gm@odd@mp\@tempdimb
   664         \if@mparswitch\else
   665           \Gm@even@mp\@tempdimb
   666         \fi
   667       \else
   668         \if@mparswitch
   669           \Gm@even@mp\@tempdimb
   670         \fi
   671       \fi
   672     \fi
   673   \fi}%
   674 \def\Gm@adjustbody{
   675   \ifGm@hbody
   676     \ifx\Gm@width\@undefined
   677       \ifx\Gm@hscale\@undefined
   678         \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
   679       \else
   680         \edef\Gm@width{\Gm@hscale\Gm@layoutwidth}%
   681       \fi
   682     \fi
   683     \ifx\Gm@textwidth\@undefined\else
   684       \setlength\@tempdima{\Gm@textwidth}%
   685       \ifGm@includemp
   686         \advance\@tempdima\Gm@wd@mp
   687       \fi
   688       \edef\Gm@width{\the\@tempdima}%
   689     \fi
   690   \fi
   691   \ifGm@vbody
   692     \ifx\Gm@height\@undefined
   693       \ifx\Gm@vscale\@undefined
   694         \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
   695       \else
   696         \edef\Gm@height{\Gm@vscale\Gm@layoutheight}%
   697       \fi
   698     \fi
   699     \ifx\Gm@lines\@undefined\else
   700       \ifdim\topskip<\ht\strutbox
   701         \setlength\@tempdima{\topskip}%
   702         \setlength\topskip{\ht\strutbox}%
   703         \Gm@warning{\noexpand\topskip was changed from \the\@tempdima\space
   704         to \the\topskip}%
   705       \fi
   706       \setlength\@tempdima{\baselineskip}%
   707       \multiply\@tempdima\Gm@lines
   708       \addtolength\@tempdima{\topskip}%
   709       \addtolength\@tempdima{-\baselineskip}%
   710       \edef\Gm@textheight{\the\@tempdima}%
   711     \fi
   712     \ifx\Gm@textheight\@undefined\else
   713       \setlength\@tempdima{\Gm@textheight}%
   714       \ifGm@includehead
   715         \addtolength\@tempdima{\headheight}%
   716         \addtolength\@tempdima{\headsep}%
   717       \fi
   718       \ifGm@includefoot
   719         \addtolength\@tempdima{\footskip}%
   720       \fi
   721       \edef\Gm@height{\the\@tempdima}%
   722     \fi
   723   \fi}%
   724 \def\Gm@process{%
   725   \ifGm@pass
   726     \Gm@restore@org
   727   \else
   728     \Gm@@process
   729   \fi}%
   730 \def\Gm@@process{%
   731   \Gm@expandlengths
   732   \Gm@adjustpaper
   733   \addtolength\Gm@layoutwidth{-\Gm@bindingoffset}%
   734   \Gm@adjustmp
   735   \Gm@adjustbody
   736   \Gm@detall{h}{width}{lmargin}{rmargin}%
   737   \Gm@detall{v}{height}{tmargin}{bmargin}%
   738   \setlength\textwidth{\Gm@width}%
   739   \setlength\textheight{\Gm@height}%
   740   \setlength\topmargin{\Gm@tmargin}%
   741   \setlength\oddsidemargin{\Gm@lmargin}%
   742   \addtolength\oddsidemargin{-1\Gm@truedimen in}%
   743   \ifGm@includemp
   744     \advance\textwidth-\Gm@wd@mp
   745     \advance\oddsidemargin\Gm@odd@mp
   746   \fi
   747   \if@mparswitch
   748     \setlength\evensidemargin{\Gm@rmargin}%
   749     \addtolength\evensidemargin{-1\Gm@truedimen in}%
   750     \ifGm@includemp
   751       \advance\evensidemargin\Gm@even@mp
   752     \fi
   753   \else
   754     \evensidemargin\oddsidemargin
   755   \fi
   756   \advance\oddsidemargin\Gm@bindingoffset
   757   \addtolength\topmargin{-1\Gm@truedimen in}%
   758   \ifGm@includehead
   759     \addtolength\textheight{-\headheight}%
   760     \addtolength\textheight{-\headsep}%
   761   \else
   762     \addtolength\topmargin{-\headheight}%
   763     \addtolength\topmargin{-\headsep}%
   764   \fi
   765   \ifGm@includefoot
   766     \addtolength\textheight{-\footskip}%
   767   \fi
   768   \ifGm@heightrounded
   769     \setlength\@tempdima{\textheight}%
   770     \addtolength\@tempdima{-\topskip}%
   771     \@tempcnta\@tempdima
   772     \@tempcntb\baselineskip
   773     \divide\@tempcnta\@tempcntb
   774     \setlength\@tempdimb{\baselineskip}%
   775     \multiply\@tempdimb\@tempcnta
   776     \advance\@tempdima-\@tempdimb
   777     \multiply\@tempdima\tw@
   778     \ifdim\@tempdima>\baselineskip
   779       \addtolength\@tempdimb{\baselineskip}%
   780     \fi
   781     \addtolength\@tempdimb{\topskip}%
   782     \textheight\@tempdimb
   783   \fi
   784   \advance\oddsidemargin\Gm@layouthoffset%
   785   \advance\evensidemargin\Gm@layouthoffset%
   786   \advance\topmargin\Gm@layoutvoffset%
   787   \addtolength\Gm@layoutwidth{\Gm@bindingoffset}%
   788   }% end of \Gm@@process
   789 \def\Gm@detectdriver{%
   790   \ifx\Gm@driver\@empty
   791     \typeout{*geometry* driver: auto-detecting}%
   792     \ifpdf
   793       \Gm@setdriver{pdftex}%
   794     \else
   795       \Gm@setdriver{dvips}%
   796     \fi
   797     %\ifvtex
   798      % \Gm@setdriver{vtex}%
   799     %\fi
   800     \@ifundefined{XeTeXversion}{}{\Gm@setdriver{xetex}}%
   801   \else
   802     \ifx\Gm@driver\Gm@xetex %%
   803       \@ifundefined{XeTeXversion}{\Gm@warning{%
   804             Wrong driver setting: `xetex'; trying `pdftex' driver}%
   805             \Gm@setdriver{pdftex}}{}%
   806     \fi
   807     \ifx\Gm@driver\Gm@vtex
   808       %\ifvtex\else
   809        % \Gm@warning{Wrong driver setting: `vtex'; trying `dvips' driver}%
   810         %\Gm@setdriver{dvips}%
   811       %\fi
   812     \fi
   813   \fi
   814   \ifx\Gm@driver\relax
   815     \typeout{*geometry* detected driver: <none>}%
   816   \else
   817     \typeout{*geometry* detected driver: \Gm@driver}%
   818   \fi}%
   819 \def\Gm@showparams#1{%
   820   \ifGm@pass\else
   821    \setlength\@tempdima{\Gm@width}\edef\Gm@width{\the\@tempdima}%
   822    \setlength\@tempdima{\Gm@height}\edef\Gm@height{\the\@tempdima}%
   823   \fi
   824   \ifGm@verbose\expandafter\typeout\else\expandafter\wlog\fi
   825   {\Gm@logcontent{#1}}}%
   826 \def\Gm@showdim#1{* \string#1=\the#1^^J}%
   827 \def\Gm@showbool#1{\@nameuse{ifGm@#1}#1\space\fi}%
   828 \def\Gm@logcontent#1{%
   829   *geometry* verbose mode - [ #1 ] result:^^J%
   830   \ifGm@pass * pass (ignores the geometry layout)^^J%
   831   \else
   832   * driver: \if\Gm@driver\relax <none>\else\Gm@driver\fi^^J%
   833   * paper: \ifx\Gm@paper\@undefined\the\paperwidth,
   834     \the\paperheight\space(class default)\else\Gm@paper\fi^^J%
   835   * layout: \ifGm@layout \the\Gm@layoutwidth, \the\Gm@layoutheight
   836   \else\ifx\Gm@paper\@undefined\the\paperwidth,
   837      \the\paperheight\else\Gm@paper\fi\fi^^J%
   838   \@ifundefined{Gm@lines}{}{* lines: \Gm@lines^^J}%
   839   \@ifundefined{Gm@hmarginratio}{}{* hratio: \Gm@hmarginratio^^J}%
   840   \@ifundefined{Gm@vmarginratio}{}{* vratio: \Gm@vmarginratio^^J}%
   841   \ifdim\Gm@bindingoffset=\z@\else
   842   * bindingoffset: \the\Gm@bindingoffset^^J\fi
   843   * switch(es): %
   844    \Gm@showbool{landscape}%
   845    \Gm@showbool{includehead}%
   846    \Gm@showbool{includefoot}%
   847    \Gm@showbool{includemp}%
   848    \if@twoside twoside\space\fi%
   849    \if@mparswitch\else\if@twoside asymmetric\space\fi\fi%
   850    \Gm@showbool{heightrounded}%
   851    \ifx\Gm@truedimen\@empty\else truedimen\space\fi%
   852   ^^J%
   853   * h-part:(L,W,R)=(\Gm@lmargin, \Gm@width, \Gm@rmargin)^^J%
   854   * v-part:(T,H,B)=(\Gm@tmargin, \Gm@height, \Gm@bmargin)^^J%
   855   \fi
   856   \Gm@showdim{\paperwidth}%
   857   \Gm@showdim{\paperheight}%
   858   \Gm@showdim{\textwidth}%
   859   \Gm@showdim{\textheight}%
   860   \Gm@showdim{\oddsidemargin}%
   861   \Gm@showdim{\evensidemargin}%
   862   \Gm@showdim{\topmargin}%
   863   \Gm@showdim{\headheight}%
   864   \Gm@showdim{\headsep}%
   865   \Gm@showdim{\footskip}%
   866   \Gm@showdim{\marginparwidth}%
   867   \Gm@showdim{\marginparsep}%
   868   \Gm@showdim{\columnsep}%
   869   * \string\skip\string\footins=\the\skip\footins^^J%
   870   \Gm@showdim{\hoffset}%
   871   \Gm@showdim{\voffset}%
   872   \Gm@showdim{\mag}%
   873   * \string\@twocolumn\if@twocolumn true\else false\fi^^J%
   874   * \string\@twoside\if@twoside true\else false\fi^^J%
   875   * \string\@mparswitch\if@mparswitch true\else false\fi^^J%
   876   * \string\@reversemargin\if@reversemargin true\else false\fi^^J%
   877   * (1in=72.27pt, 1cm=28.453pt)^^J}%
   878 \def\Gm@cropmark(#1,#2,#3,#4){%
   879   \begin{picture}(0,0)
   880     \setlength\unitlength{1truemm}\thinlines
   881     \put(0,0){\line(#1,#2){5}}
   882     \put(0,0){\line(#3,#4){5}}
   883   \end{picture}}%
   884 \newcommand*{\Gm@vrules@mpi}{%
   885   \hb@xt@\@tempdima{\llap{\vrule height\textheight}\ignorespaces
   886   \hskip \textwidth\vrule height\textheight\hskip \marginparsep
   887   \llap{\vrule height\textheight}\hfil\vrule height\textheight}}%
   888 \newcommand*{\Gm@vrules@mpii}{%
   889   \hb@xt@\@tempdima{\hskip-\marginparwidth\hskip-\marginparsep
   890   \llap{\vrule height\textheight}\ignorespaces
   891   \hskip \marginparwidth\rlap{\vrule height\textheight}\hskip \marginparsep
   892   \llap{\vrule height\textheight}\hskip\textwidth\rlap{\vrule height\textheight}\hss}}%
   893 \providecommand*\vb@xt@{\vbox to}%
   894 \newcommand*{\Gm@pageframes}{%
   895   \vb@xt@\z@{\baselineskip\z@skip\lineskip\z@skip\lineskiplimit\z@%
   896    \ifGm@showcrop
   897     \vb@xt@\z@{\vskip-1\Gm@truedimen in\vskip\Gm@layoutvoffset%
   898      \hb@xt@\z@{\hskip-1\Gm@truedimen in\hskip\Gm@layouthoffset%
   899       \vb@xt@\Gm@layoutheight{%
   900        \let\protect\relax
   901        \hb@xt@\Gm@layoutwidth{\Gm@cropmark(1,0,0,-1)\hfil\Gm@cropmark(-1,0,0,-1)}%
   902        \vfil
   903        \hb@xt@\Gm@layoutwidth{\Gm@cropmark(1,0,0,1)\hfil\Gm@cropmark(-1,0,0,1)}}%
   904      \hss}%
   905     \vss}%
   906    \fi%
   907    \ifGm@showframe
   908     \if@twoside
   909      \ifodd\count\z@
   910        \let\@themargin\oddsidemargin
   911      \else
   912        \let\@themargin\evensidemargin
   913      \fi
   914     \fi
   915     \moveright\@themargin%
   916     \vb@xt@\z@{%
   917      \vskip\topmargin\vb@xt@\z@{\vss\hrule width\textwidth}%
   918      \vskip\headheight\vb@xt@\z@{\vss\hrule width\textwidth}%
   919      \vskip\headsep\vb@xt@\z@{\vss\hrule width\textwidth}
   920      \@tempdima\textwidth
   921      \advance\@tempdima by \marginparsep
   922      \advance\@tempdima by \marginparwidth
   923      \if@mparswitch
   924       \ifodd\count\z@
   925        \Gm@vrules@mpi
   926       \else
   927        \Gm@vrules@mpii
   928       \fi
   929      \else
   930       \Gm@vrules@mpi
   931      \fi
   932      \vb@xt@\z@{\vss\hrule width\textwidth}%
   933      \vskip\footskip\vb@xt@\z@{\vss\hrule width\textwidth}%
   934      \vss}%
   935     \fi%
   936   }}%
   937 \let\Gm@shipout\shipout
   938 \newcommand*{\gm@shipi}{%
   939   \ifvoid\@cclv\expandafter\aftergroup\fi\gm@shipii}%
   940 \newcommand*\gm@shipii{%
   941   \ifvoid\@cclv
   942     \Gm@shipout\box\@cclv
   943   \else
   944     \ifGm@showframe
   945       \Gm@shipout\vbox{\Gm@pageframes\ifvbox\@cclv\unvbox\else\box\fi\@cclv}%
   946     \else\ifGm@showcrop
   947       \Gm@shipout\vbox{\Gm@pageframes\ifvbox\@cclv\unvbox\else\box\fi\@cclv}%
   948     \else
   949       \Gm@shipout\box\@cclv
   950     \fi\fi
   951   \fi}
   952 \def\ProcessOptionsKV{\@ifnextchar[%]
   953   {\@ProcessOptionsKV}{\@ProcessOptionsKV[]}}%
   954 \def\@ProcessOptionsKV[#1]#2{%
   955   \let\@tempa\@empty
   956   \@tempcnta\z@
   957   \if#1p\@tempcnta\@ne\else\if#1c\@tempcnta\tw@\fi\fi
   958   \ifodd\@tempcnta
   959    \edef\@tempa{\@ptionlist{\@currname.\@currext}}%
   960   \else
   961     \@for\CurrentOption:=\@classoptionslist\do{%
   962       \@ifundefined{KV@#2@\CurrentOption}%
   963       {}{\edef\@tempa{\@tempa,\CurrentOption,}}}%
   964     \ifnum\@tempcnta=\z@
   965       \edef\@tempa{\@tempa,\@ptionlist{\@currname.\@currext}}%
   966     \fi
   967   \fi
   968   \edef\@tempa{\noexpand\setkeys{#2}{\@tempa}}%
   969   \@tempa
   970   \AtEndOfPackage{\let\@unprocessedoptions\relax}}%
   971 \def\Gm@setkeys{\setkeys{Gm}}%
   972 \def\Gm@processconfig{%
   973   \let\Gm@origExecuteOptions\ExecuteOptions
   974   \let\ExecuteOptions\Gm@setkeys
   975   \InputIfFileExists{geometry.cfg}{}{}
   976   \let\ExecuteOptions\Gm@origExecuteOptions}%
   977 \Gm@save
   978 \edef\Gm@restore@org{\Gm@restore}%
   979 \Gm@initall
   980 \Gm@processconfig
   981 \ProcessOptionsKV[c]{Gm}%
   982 \Gm@setdefaultpaper
   983 \ProcessOptionsKV[p]{Gm}%
   984 \Gm@process
   985 \AtBeginDocument{%
   986   \Gm@savelength{paperwidth}%
   987   \Gm@savelength{paperheight}%
   988   \edef\Gm@restore@org{\Gm@restore}%
   989   \ifGm@resetpaper
   990     \edef\Gm@pw{\Gm@orgpw}%
   991     \edef\Gm@ph{\Gm@orgph}%
   992   \else
   993     \edef\Gm@pw{\the\paperwidth}%
   994     \edef\Gm@ph{\the\paperheight}%
   995   \fi
   996   \ifGm@pass\else
   997     \ifnum\mag=\@m\else
   998       \Gm@magtooffset
   999       \divide\paperwidth\@m
  1000       \multiply\paperwidth\the\mag
  1001       \divide\paperheight\@m
  1002       \multiply\paperheight\the\mag
  1003     \fi
  1004   \fi
  1005   \Gm@detectdriver
  1006   \ifx\Gm@driver\Gm@xetex
  1007     \@ifundefined{pdfpagewidth}{}{%
  1008       \setlength\pdfpagewidth{\Gm@pw}%
  1009       \setlength\pdfpageheight{\Gm@ph}}%
  1010     \ifnum\mag=\@m\else
  1011       \ifx\Gm@truedimen\Gm@true
  1012         \setlength\paperwidth{\Gm@pw}%
  1013         \setlength\paperheight{\Gm@ph}%
  1014       \fi
  1015     \fi
  1016   \fi
  1017   \ifx\Gm@driver\Gm@pdftex
  1018     \@ifundefined{pdfpagewidth}{}{%
  1019       \setlength\pdfpagewidth{\Gm@pw}%
  1020       \setlength\pdfpageheight{\Gm@ph}}%
  1021     \ifnum\mag=\@m\else
  1022       \@tempdima=\mag sp%
  1023       \@ifundefined{pdfhorigin}{}{%
  1024         \divide\pdfhorigin\@tempdima
  1025         \multiply\pdfhorigin\@m
  1026         \divide\pdfvorigin\@tempdima
  1027         \multiply\pdfvorigin\@m}%
  1028       \ifx\Gm@truedimen\Gm@true
  1029         \setlength\paperwidth{\Gm@pw}%
  1030         \setlength\paperheight{\Gm@ph}%
  1031       \fi
  1032     \fi
  1033   \fi
  1034   \ifx\Gm@driver\Gm@vtex
  1035     \@ifundefined{mediawidth}{}{%
  1036       \mediawidth=\paperwidth
  1037       \mediaheight=\paperheight}%
  1038     %\ifvtexdvi
  1039      % \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
  1040     %\fi
  1041   \fi
  1042   \ifx\Gm@driver\Gm@dvips
  1043     \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
  1044     \ifx\Gm@driver\Gm@dvips\ifGm@landscape
  1045       \AtBeginDvi{\special{! /landplus90 true store}}%
  1046     \fi\fi
  1047   \else\ifx\Gm@driver\Gm@dvipdfm
  1048     \ifcase\ifx\AtBeginShipoutFirst\relax\@ne\else
  1049         \ifx\AtBeginShipoutFirst\@undefined\@ne\else\z@\fi\fi
  1050       \AtBeginShipoutFirst{\special{papersize=\the\paperwidth,\the\paperheight}}%
  1051     \or
  1052       \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
  1053     \fi
  1054   \fi\fi
  1055   \ifGm@showframe
  1056     \renewcommand*{\shipout}{\afterassignment\gm@shipi\setbox\@cclv=}
  1057   \else\ifGm@showcrop
  1058     \renewcommand*{\shipout}{\afterassignment\gm@shipi\setbox\@cclv=}
  1059   \fi\fi
  1060   \Gm@save
  1061   \edef\Gm@restore@pkg{\Gm@restore}%
  1062   \ifGm@verbose\ifGm@pass\else\Gm@checkmp\fi\fi
  1063   \Gm@showparams{preamble}%
  1064   \let\Gm@pw\relax
  1065   \let\Gm@ph\relax
  1066   }% end of \AtBeginDocument
  1067 \newcommand{\geometry}[1]{%
  1068   \Gm@clean
  1069   \setkeys{Gm}{#1}%
  1070   \Gm@process}%
  1071 \@onlypreamble\geometry
  1072 \DeclareRobustCommand\Gm@changelayout{%
  1073   \setlength{\@colht}{\textheight}
  1074   \setlength{\@colroom}{\textheight}%
  1075   \setlength{\vsize}{\textheight}
  1076   \setlength{\columnwidth}{\textwidth}%
  1077   \if@twocolumn%
  1078     \advance\columnwidth-\columnsep
  1079     \divide\columnwidth\tw@%
  1080     \@firstcolumntrue%
  1081   \fi%
  1082   \setlength{\hsize}{\columnwidth}%
  1083   \setlength{\linewidth}{\hsize}}%
  1084 \newcommand\newgeometry[1]{%
  1085   \clearpage
  1086   \Gm@restore@org
  1087   \Gm@initnewgm
  1088   \Gm@newgmtrue
  1089   \setkeys{Gm}{#1}%
  1090   \Gm@newgmfalse
  1091   \Gm@process
  1092   \ifnum\mag=\@m\else\Gm@magtooffset\fi
  1093   \Gm@changelayout
  1094   \Gm@showparams{newgeometry}}%
  1095 \newcommand\restoregeometry{%
  1096   \clearpage
  1097   \Gm@restore@pkg
  1098   \Gm@changelayout}%
  1099 \newcommand*\savegeometry[1]{%
  1100   \Gm@save
  1101   \expandafter\edef\csname Gm@restore@@#1\endcsname{\Gm@restore}}%
  1102 \newcommand*\loadgeometry[1]{%
  1103   \clearpage
  1104   \@ifundefined{Gm@restore@@#1}{%
  1105     \PackageError{geometry}{%
  1106     \string\loadgeometry : name `#1' undefined}{%
  1107     The name `#1' should be predefined with \string\savegeometry}%
  1108   }{\@nameuse{Gm@restore@@#1}%
  1109   \Gm@changelayout}}%
  1110 \endinput
  1111 %%
  1112 %% End of file `geometry.sty'.