Debian Codegraph @

texmf-dist/tex/latex/geometry/geometry.sty

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