Corrections.
2 %% This is file `geometry.sty',
3 %% generated with the docstrip utility.
5 %% The original source files were:
7 %% geometry.dtx (with options: `package')
9 %% Copyright (C) 1996-2010
10 %% by Hideo Umeki <latexgeometry@gmail.com>
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
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.
20 %% This work is "maintained" (as per the LPPL maintenance status)
23 %% This work consists of the files geometry.dtx and
24 %% the derived files: geometry.{sty,ins,drv}, geometry-samples.tex.
26 \NeedsTeXFormat{LaTeX2e}
27 \ProvidesPackage{geometry}
28 [2010/03/13 v5.3 Page Geometry]
29 \RequirePackage{keyval}%
30 \RequirePackage{ifpdf}%
31 %\RequirePackage{ifvtex}%
34 \newif\ifGm@swap@papersize\Gm@swap@papersizefalse
35 \newif\ifGm@includehead
36 \newif\ifGm@includefoot
40 \newif\ifGm@heightrounded
43 \newif\ifGm@pass\Gm@passfalse
44 \newif\ifGm@resetpaper
49 \newcount\c@Gm@tempcnt
50 \newdimen\Gm@bindingoffset
54 \newdimen\Gm@layoutwidth
55 \newdimen\Gm@layoutheight
56 \newdimen\Gm@layouthoffset
57 \newdimen\Gm@layoutvoffset
59 \def\Gm@warning#1{\PackageWarningNoLine{geometry}{#1}}%
60 \def\ifGm@preamble#1{%
62 \Gm@warning{`#1': not available in `\string\newgeometry'; skipped}%
64 \expandafter\@firstofone
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
72 \def\Gm@dvipdfm{dvipdfm}%
73 \def\Gm@pdftex{pdftex}%
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}%
87 \g@addto@macro\Gm@restore{\expandafter\noexpand\csname #1false\endcsname}%
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}}%
118 \Gm@heightroundedfalse
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
138 \Gm@bindingoffset\z@}%
140 \let\Gm@driver\@empty
141 \let\Gm@truedimen\@empty
142 \let\Gm@paper\@undefined
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}}%
160 \lowercase{\def\Gm@bool{#2}}%
166 \ifx\Gm@bool\Gm@false
172 \Gm@warning{`#1' should be set to `true' or `false'}%
176 \def\Gm@doifelse#1#2#3#4{%
177 \Gm@doif{#1}{#2}{\ifx\Gm@bool\Gm@true #3\else #4\fi}}%
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
191 \edef\@@tempa{\the\@tempcnta}%
192 \@tempcnta=\@tempcntb
193 \@tempcntb=\@@tempa\relax
195 \expandafter\setlength\expandafter\@tempdimb\expandafter
196 {\csname Gm@#3\endcsname}%
198 \multiply\@tempdimb\@tempcnta
199 \divide\@tempdimb\@tempcntb
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}%
212 \Gm@warning{`#4' results in NEGATIVE (\the\@tempdima).%
213 ^^J\@spaces `#2' or `#3' should be shortened in length}%
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}%
223 \Gm@warning{`#2' and `#3' result in NEGATIVE (\the\@tempdima).%
224 ^^J\@spaces `#1' should be shortened in length}%
226 \ifx\Gm@mratio\@undefined
227 \expandafter\Gm@sep@ratio\Gm@Dmratio\relax
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
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{%
245 \let\Gm@mratio\Gm@hmarginratio
246 \edef\Gm@Dmratio{\if@twoside\Gm@Dhratiotwo\else\Gm@Dhratio\fi}%
248 \let\Gm@mratio\Gm@vmarginratio
249 \edef\Gm@Dmratio{\Gm@Dvratio}%
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
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
264 \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
266 \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
268 \Gm@detiiandiii{#2}{#3}{#4}%
270 \ifx\Gm@mratio\@undefined
272 \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
274 \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
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}%
281 \Gm@setbyratio[f]{#1}{#4}{#3}%
283 \Gm@detiv{#2}{#3}{#4}{#2}%
284 \or\Gm@detiiandiii{#2}{#3}{#4}%
285 \or\Gm@detiv{#2}{#2}{#4}{#3}%
287 \ifx\Gm@mratio\@undefined
289 \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
291 \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
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}%
298 \Gm@setbyratio[b]{#1}{#3}{#4}%
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}%
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
313 \let\Gm@hscale\@undefined
314 \let\Gm@width\@undefined
315 \let\Gm@textwidth\@undefined
318 \let\Gm@vscale\@undefined
319 \let\Gm@height\@undefined
320 \let\Gm@textheight\@undefined
323 \def\Gm@parse@divide#1#2#3#4{%
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}%
331 \else\edef\Gm@key{#4}%
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}%
338 \advance\@tempcnta\@ne}%
340 \def\Gm@branch#1#2#3{%
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}%
348 \setkeys{Gm}{#3=\Gm@value}%
350 \advance\@tempcnta\@ne}%
351 \ifnum\@tempcnta=\@ne
352 \setkeys{Gm}{#3=\Gm@value}%
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}}%
371 \def\Gm@setsize#1(#2,#3)#4{%
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
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').}%
605 \ifdim\paperheight>\p@\else
606 \PackageError{geometry}{%
607 \string\paperheight\space(\the\paperheight) too short}{%
608 Set a paper type (e.g., `a4paper').}%
611 \setlength\@tempdima{\paperwidth}%
612 \setlength\paperwidth{\paperheight}%
613 \setlength\paperheight{\@tempdima}%
616 \let\Gm@layoutwidth\paperwidth
617 \let\Gm@layoutheight\paperheight
621 \@tempcnta\z@\@tempcntb\@ne
626 \@tempcnta\@ne\@tempcntb\z@
629 \@tempdima\marginparwidth
630 \advance\@tempdima\marginparsep
631 \ifnum\@tempcnta=\@ne
633 \setlength\@tempdimb{\Gm@lmargin}%
634 \advance\@tempdimc-\@tempdimb
636 \Gm@warning{The marginal notes overrun the paper edge.^^J
637 \@spaces Add \the\@tempdimc\space and more to the left margin}%
640 \ifnum\@tempcntb=\@ne
642 \setlength\@tempdimb{\Gm@rmargin}%
643 \advance\@tempdimc-\@tempdimb
645 \Gm@warning{The marginal notes overrun the paper.^^J
646 \@spaces Add \the\@tempdimc\space and more to the right margin}%
652 \@tempdimb\marginparwidth
653 \advance\@tempdimb\marginparsep
660 \Gm@even@mp\@tempdimb
665 \Gm@even@mp\@tempdimb
669 \Gm@even@mp\@tempdimb
676 \ifx\Gm@width\@undefined
677 \ifx\Gm@hscale\@undefined
678 \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}%
680 \edef\Gm@width{\Gm@hscale\Gm@layoutwidth}%
683 \ifx\Gm@textwidth\@undefined\else
684 \setlength\@tempdima{\Gm@textwidth}%
686 \advance\@tempdima\Gm@wd@mp
688 \edef\Gm@width{\the\@tempdima}%
692 \ifx\Gm@height\@undefined
693 \ifx\Gm@vscale\@undefined
694 \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}%
696 \edef\Gm@height{\Gm@vscale\Gm@layoutheight}%
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
706 \setlength\@tempdima{\baselineskip}%
707 \multiply\@tempdima\Gm@lines
708 \addtolength\@tempdima{\topskip}%
709 \addtolength\@tempdima{-\baselineskip}%
710 \edef\Gm@textheight{\the\@tempdima}%
712 \ifx\Gm@textheight\@undefined\else
713 \setlength\@tempdima{\Gm@textheight}%
715 \addtolength\@tempdima{\headheight}%
716 \addtolength\@tempdima{\headsep}%
719 \addtolength\@tempdima{\footskip}%
721 \edef\Gm@height{\the\@tempdima}%
733 \addtolength\Gm@layoutwidth{-\Gm@bindingoffset}%
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}%
744 \advance\textwidth-\Gm@wd@mp
745 \advance\oddsidemargin\Gm@odd@mp
748 \setlength\evensidemargin{\Gm@rmargin}%
749 \addtolength\evensidemargin{-1\Gm@truedimen in}%
751 \advance\evensidemargin\Gm@even@mp
754 \evensidemargin\oddsidemargin
756 \advance\oddsidemargin\Gm@bindingoffset
757 \addtolength\topmargin{-1\Gm@truedimen in}%
759 \addtolength\textheight{-\headheight}%
760 \addtolength\textheight{-\headsep}%
762 \addtolength\topmargin{-\headheight}%
763 \addtolength\topmargin{-\headsep}%
766 \addtolength\textheight{-\footskip}%
769 \setlength\@tempdima{\textheight}%
770 \addtolength\@tempdima{-\topskip}%
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}%
781 \addtolength\@tempdimb{\topskip}%
782 \textheight\@tempdimb
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}%
793 \Gm@setdriver{pdftex}%
795 \Gm@setdriver{dvips}%
798 % \Gm@setdriver{vtex}%
800 \@ifundefined{XeTeXversion}{}{\Gm@setdriver{xetex}}%
802 \ifx\Gm@driver\Gm@xetex %%
803 \@ifundefined{XeTeXversion}{\Gm@warning{%
804 Wrong driver setting: `xetex'; trying `pdftex' driver}%
805 \Gm@setdriver{pdftex}}{}%
807 \ifx\Gm@driver\Gm@vtex
809 % \Gm@warning{Wrong driver setting: `vtex'; trying `dvips' driver}%
810 %\Gm@setdriver{dvips}%
815 \typeout{*geometry* detected driver: <none>}%
817 \typeout{*geometry* detected driver: \Gm@driver}%
819 \def\Gm@showparams#1{%
821 \setlength\@tempdima{\Gm@width}\edef\Gm@width{\the\@tempdima}%
822 \setlength\@tempdima{\Gm@height}\edef\Gm@height{\the\@tempdima}%
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%
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
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%
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%
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}%
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){%
880 \setlength\unitlength{1truemm}\thinlines
881 \put(0,0){\line(#1,#2){5}}
882 \put(0,0){\line(#3,#4){5}}
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@%
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{%
901 \hb@xt@\Gm@layoutwidth{\Gm@cropmark(1,0,0,-1)\hfil\Gm@cropmark(-1,0,0,-1)}%
903 \hb@xt@\Gm@layoutwidth{\Gm@cropmark(1,0,0,1)\hfil\Gm@cropmark(-1,0,0,1)}}%
910 \let\@themargin\oddsidemargin
912 \let\@themargin\evensidemargin
915 \moveright\@themargin%
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}
921 \advance\@tempdima by \marginparsep
922 \advance\@tempdima by \marginparwidth
932 \vb@xt@\z@{\vss\hrule width\textwidth}%
933 \vskip\footskip\vb@xt@\z@{\vss\hrule width\textwidth}%
937 \let\Gm@shipout\shipout
938 \newcommand*{\gm@shipi}{%
939 \ifvoid\@cclv\expandafter\aftergroup\fi\gm@shipii}%
940 \newcommand*\gm@shipii{%
942 \Gm@shipout\box\@cclv
945 \Gm@shipout\vbox{\Gm@pageframes\ifvbox\@cclv\unvbox\else\box\fi\@cclv}%
947 \Gm@shipout\vbox{\Gm@pageframes\ifvbox\@cclv\unvbox\else\box\fi\@cclv}%
949 \Gm@shipout\box\@cclv
952 \def\ProcessOptionsKV{\@ifnextchar[%]
953 {\@ProcessOptionsKV}{\@ProcessOptionsKV[]}}%
954 \def\@ProcessOptionsKV[#1]#2{%
957 \if#1p\@tempcnta\@ne\else\if#1c\@tempcnta\tw@\fi\fi
959 \edef\@tempa{\@ptionlist{\@currname.\@currext}}%
961 \@for\CurrentOption:=\@classoptionslist\do{%
962 \@ifundefined{KV@#2@\CurrentOption}%
963 {}{\edef\@tempa{\@tempa,\CurrentOption,}}}%
965 \edef\@tempa{\@tempa,\@ptionlist{\@currname.\@currext}}%
968 \edef\@tempa{\noexpand\setkeys{#2}{\@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}%
978 \edef\Gm@restore@org{\Gm@restore}%
981 \ProcessOptionsKV[c]{Gm}%
983 \ProcessOptionsKV[p]{Gm}%
986 \Gm@savelength{paperwidth}%
987 \Gm@savelength{paperheight}%
988 \edef\Gm@restore@org{\Gm@restore}%
990 \edef\Gm@pw{\Gm@orgpw}%
991 \edef\Gm@ph{\Gm@orgph}%
993 \edef\Gm@pw{\the\paperwidth}%
994 \edef\Gm@ph{\the\paperheight}%
999 \divide\paperwidth\@m
1000 \multiply\paperwidth\the\mag
1001 \divide\paperheight\@m
1002 \multiply\paperheight\the\mag
1006 \ifx\Gm@driver\Gm@xetex
1007 \@ifundefined{pdfpagewidth}{}{%
1008 \setlength\pdfpagewidth{\Gm@pw}%
1009 \setlength\pdfpageheight{\Gm@ph}}%
1011 \ifx\Gm@truedimen\Gm@true
1012 \setlength\paperwidth{\Gm@pw}%
1013 \setlength\paperheight{\Gm@ph}%
1017 \ifx\Gm@driver\Gm@pdftex
1018 \@ifundefined{pdfpagewidth}{}{%
1019 \setlength\pdfpagewidth{\Gm@pw}%
1020 \setlength\pdfpageheight{\Gm@ph}}%
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}%
1034 \ifx\Gm@driver\Gm@vtex
1035 \@ifundefined{mediawidth}{}{%
1036 \mediawidth=\paperwidth
1037 \mediaheight=\paperheight}%
1039 % \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
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}}%
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}}%
1052 \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
1056 \renewcommand*{\shipout}{\afterassignment\gm@shipi\setbox\@cclv=}
1058 \renewcommand*{\shipout}{\afterassignment\gm@shipi\setbox\@cclv=}
1061 \edef\Gm@restore@pkg{\Gm@restore}%
1062 \ifGm@verbose\ifGm@pass\else\Gm@checkmp\fi\fi
1063 \Gm@showparams{preamble}%
1066 }% end of \AtBeginDocument
1067 \newcommand{\geometry}[1]{%
1071 \@onlypreamble\geometry
1072 \DeclareRobustCommand\Gm@changelayout{%
1073 \setlength{\@colht}{\textheight}
1074 \setlength{\@colroom}{\textheight}%
1075 \setlength{\vsize}{\textheight}
1076 \setlength{\columnwidth}{\textwidth}%
1078 \advance\columnwidth-\columnsep
1079 \divide\columnwidth\tw@%
1082 \setlength{\hsize}{\columnwidth}%
1083 \setlength{\linewidth}{\hsize}}%
1084 \newcommand\newgeometry[1]{%
1092 \ifnum\mag=\@m\else\Gm@magtooffset\fi
1094 \Gm@showparams{newgeometry}}%
1095 \newcommand\restoregeometry{%
1099 \newcommand*\savegeometry[1]{%
1101 \expandafter\edef\csname Gm@restore@@#1\endcsname{\Gm@restore}}%
1102 \newcommand*\loadgeometry[1]{%
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}%
1112 %% End of file `geometry.sty'.