OSDN Git Service

Releases 20240514.0
[luatex-ja/luatexja.git] / src / patches / lltjp-geometry.sty
1 %
2 % lltjp-geometry.sty
3 %
4
5 \NeedsTeXFormat{LaTeX2e}
6 \ProvidesPackage{lltjp-geometry}[2021-10-24 Patch to geometry for LuaTeX-ja with vertical writing mode]
7 \RequirePackage{expl3}
8 \ifdefined\if@ltj@@geometry@tate\expandafter\endinput\fi
9 \newif\if@ltj@@geometry@tate
10 \newif\if@ltj@@geometry@forceoff
11 \@ltj@@geometry@tatefalse
12 \@ltj@@geometry@forceofffalse
13 \DeclareOption{force}{\@ltj@@geometry@tatetrue}
14 \DeclareOption{disable}{\@ltj@@geometry@forceofftrue}
15
16 \ProcessOptions\relax
17
18 \RequirePackage{ifluatex}
19 \ifluatex
20   \ifdefined\luatexjaLoaded\else
21     \PackageError{lltjp-geometry}{%
22           lltjp-geometry does not work without luatexja.
23         }{}
24 \fi
25 \else % pTeX
26 \def \AtBeginDvi #1{%
27   \global \setbox \@begindvibox
28     \vbox{\yoko\unvbox \@begindvibox #1}%
29 }
30 \fi
31
32 %============================================
33 \unless\ifdefined\ltj@ExecuteAfterPackage
34 \expandafter\newif\csname ifltj@ltfilehook@avail\endcsname
35 \@ifl@t@r\fmtversion{2020-10-01}{%
36   \@ifl@t@r\fmtversion{2020-10-02}{\ltj@ltfilehook@availtrue}
37     {%
38       \ifnum\patch@level<0\relax \ifnum\patch@level<-6 \ltj@ltfilehook@availtrue\fi
39       \else\ltj@ltfilehook@availtrue\fi
40     }%
41 }{}
42 \ifltj@ltfilehook@avail
43   %% \ltj@ExecuteBeforePackage <package><code>  and \ltj@ExecuteAfterPackage <package><code>
44   %% no-starred version: do nothing if the <package> is loaded
45   %% starred version: do <code> right away if the <package> is loaded
46   \def\ltj@ExecuteAfterPackage{\@ifstar\@@ltj@ExecuteAfterPackage@star\@@ltj@ExecuteAfterPackage}
47   \def\ltj@ExecuteBeforePackage{\@ifstar\@@ltj@ExecuteBeforePackage@star\@@ltj@ExecuteBeforePackage}
48   \@ifl@t@r\fmtversion{2021-11-15}{% 2021-11-15
49     \def\@@ltj@ExecuteAfterPackage@star#1{\AddToHook{package/#1/after}}
50     \def\@@ltj@ExecuteBeforePackage@star#1{\AddToHook{package/#1/before}}
51     \long\def\@@ltj@ExecuteAfterPackage#1#2{%
52       \@ifpackageloaded{#1}{}{\AddToHook{package/#1/after}{#2}}%
53     }
54     \long\def\@@ltj@ExecuteBeforePackage#1#2{%
55       \@ifpackageloaded{#1}{}{\AddToHook{package/#1/before}{#2}}%
56     }
57   }{
58     \def\@@ltj@ExecuteAfterPackage#1{\AddToHook{package/after/#1}}
59     \def\@@ltj@ExecuteBeforePackage#1{\AddToHook{package/before/#1}}
60     \long\def\@@ltj@ExecuteAfterPackage@star#1#2{%
61       \@ifpackageloaded{#1}{#2}{\@@ltj@ExecuteAfterPackage{#1}{#2}}%
62     }
63     \long\def\@@ltj@ExecuteBeforePackage@star#1#2{%
64       \@ifpackageloaded{#1}{#2}{\@@ltj@ExecuteBeforePackage{#1}{#2}}%
65     }
66   }
67 \else
68   \RequirePackage{filehook}
69   \let\ltj@ExecuteAfterPackage=\AtEndOfPackageFile
70   \let\ltj@ExecuteBeforePackage=\AtBeginOfPackageFile
71 \fi
72 \fi
73 %============================================
74
75 \RequirePackage{etoolbox}
76 \newif\ifGm@ltj@layoutswitch
77 \let\orig@PackageWarningNoLine=\PackageWarningNoLine
78 % define ifGm@swap@papersize if it is undefined
79 \expandafter\newif\csname ifGm@swap@papersize\endcsname
80
81 \ExplSyntaxOn
82 \ltj@ExecuteBeforePackage{geometry}{%
83   \edef\Gm@ltj@topskip{\the\topskip}
84   \edef\Gm@ltj@headsep{\the\headsep}
85   \edef\Gm@ltj@footskip{\the\footskip}
86 \bool_set_false:N \l_tmpa_bool
87 \ifluatex
88   \ifnum\ltjgetparameter{direction}=3 \bool_set_true:N \l_tmpa_bool \fi
89 \else
90   \@gobble\iftrue\csname iftdir\endcsname \bool_set_true:N \l_tmpa_bool \fi
91 \fi
92 \ifltj@ltfilehook@avail
93   \prop_map_inline:Nn \g__hook_begindocument_code_prop
94     { \tl_if_in:nnT {#2} {\tate} {\bool_set_true:N \l_tmpa_bool} }
95 \else
96   \tl_if_in:NnT \@begindocumenthook {\tate} {\bool_set_true:N \l_tmpa_bool}
97 \fi
98 \bool_if:NT \l_tmpa_bool {
99   \if@ltj@@geometry@forceoff
100     \@ltj@@geometry@tatefalse
101   \else
102     \@ltj@@geometry@tatetrue
103     \let\PackageWarningNoLine\@gobbletwo% 警告抑止
104   \fi
105 }
106 }
107 \ExplSyntaxOff
108 \ltj@ExecuteAfterPackage{geometry}{%
109 \let\PackageWarningNoLine=\orig@PackageWarningNoLine
110 \if@ltj@@geometry@tate
111   \let\PackageWarningNoLine=\orig@PackageWarningNoLine
112 %%% ここからパッチ開始
113
114 % TODO: 
115 %  * pTeX, LuaTeX ともに truedimen が正しく動作しない
116 %  * pTeX  resetpaper が正しく動作しない
117
118 % `h', `v' は「水平」「垂直」を意味するが:
119 % ユーザー側では「紙の物理的な水平方向」「物理的な垂直方向」を,
120 % しかしパッケージ内部処理では「字送り方向」「行送り方向」を表す.
121 % そのため,key-value interface 内で h, v の交換を行う必要がある.
122
123 % twoside 指定時は,lmargin は小口側,rmargin はノド側の余白を指す.
124 % また,bindingoffset 偶数ページを右に,奇数ページを左にずらす.
125 \define@key{Gm}{hdivide}{\Gm@parse@divide{#1}{lmargin}{height}{rmargin}}%
126
127 \define@key{Gm}{vscale}{\Gm@hbodytrue\edef\Gm@hscale{#1}}%
128 \define@key{Gm}{hscale}{\Gm@vbodytrue\edef\Gm@vscale{#1}}%
129 \define@key{Gm}{vdivide}{\Gm@parse@divide{#1}{tmargin}{width}{bmargin}}%
130 \define@key{Gm}{divide}{\Gm@parse@divide{#1}{tmargin}{width}{bmargin}%
131   \Gm@parse@divide{#1}{lmargin}{height}{rmargin}}%
132 \define@key{Gm}{vmargin}{\Gm@branch{#1}{tmargin}{bmargin}}%
133 \define@key{Gm}{hmargin}{\Gm@branch{#1}{lmargin}{rmargin}}%
134 \define@key{Gm}{margin}{\Gm@branch{#1}{tmargin}{lmargin}%
135   \Gm@branch{#1}{bmargin}{rmargin}}%
136 \define@key{Gm}{headsep}{\Gm@defbylen{ltj@headsep}{#1}}%
137 \define@key{Gm}{footskip}{\Gm@defbylen{ltj@footskip}{#1}}%
138 \let\KV@Gm@foot\KV@Gm@footskip
139 \define@key{Gm}{vmarginratio}{\edef\Gm@hmarginratio{#1}}%
140 \define@key{Gm}{hmarginratio}{\edef\Gm@vmarginratio{#1}}%
141 \define@key{Gm}{nohead}[true]{\Gm@doifelse{nohead}{#1}%
142   {\Gm@setlength\headheight\z@\Gm@defbylen{ltj@headsep}\z@}{}}%
143 \define@key{Gm}{nofoot}[true]{\Gm@doifelse{nofoot}{#1}%
144   {\Gm@defbylen{ltj@footskip}\z@}{}}%
145 \define@key{Gm}{noheadfoot}[true]{\Gm@doifelse{noheadfoot}{#1}%
146   {\Gm@setlength\headheight\z@\Gm@defbylen{ltj@headsep}\z@
147   \Gm@defbylen{ltj@footskip}\z@}{}}%
148 \define@key{Gm}{layoutwidth}{\Gm@layouttrue\Gm@setlength\Gm@layoutheight{#1}}%
149 \define@key{Gm}{layoutheight}{\Gm@layouttrue\Gm@setlength\Gm@layoutwidth{#1}}%
150 \define@key{Gm}{layoutsize}{\Gm@branch{#1}{layoutwidth}{layoutheight}}%
151 \define@key{Gm}{layout}{\Gm@layouttrue\@nameuse{Gm@#1}{Gm@layout}%
152   \Gm@setlength\@tempdima{\Gm@layoutheight}%
153   \Gm@setlength\Gm@layoutheight{\Gm@layoutwidth}%
154   \Gm@setlength\Gm@layoutwidth{\@tempdima}%
155 }%
156
157 % \@mparswitch は傍注の出力位置を左右ページで変えるスイッチだが,
158 % geometry.sty はこれを左右ページのレイアウトを変えるか否かの判定にも使っている.
159 % 縦組クラスの場合は \@mparswitch は常に偽でないとおかしなことになるので
160 % \@mparswitch -> \Gm@ltj@layoutswitch と名称変更する.
161
162 \let\Gm@ltj@layoutswitch\@mparswitch
163 \@mparswitchfalse
164 \define@key{Gm}{twoside}[true]{\Gm@doifelse{twoside}{#1}%
165   {\@twosidetrue\Gm@ltj@layoutswitchtrue}{\@twosidefalse\Gm@ltj@layoutswitchfalse}}%
166 \define@key{Gm}{asymmetric}[true]{\Gm@doifelse{asymmetric}{#1}%
167   {\@twosidetrue\Gm@ltj@layoutswitchfalse}{}}%
168
169 % includemp 指定時は,\headsep (if reversemp || twocolumn) や,
170 % \footskip (if !reversemp || twocolumn) を傍注幅だけ増加させる.
171
172 % h <-> v
173 \def\Gm@Dhratio{2:3}% = top:bottom default
174 \def\Gm@Dvratio{1:1}% = left:right default for oneside
175 \def\Gm@Dvratiotwo{3:2}% = inner:outer default for twoside.
176 \ifGm@swap@papersize
177   % geometry.sty ロード時に landscape オプションが指定されていた場合,
178   % それによって用紙サイズの縦横が入れ替わってしまっているので補正する.
179   \setlength\@tempdima{\paperwidth}%
180   \setlength\paperwidth{\paperheight}%
181   \setlength\paperheight{\@tempdima}%
182 \fi
183
184 % save length
185 \def\Gm@save{%
186   \Gm@savelength{paperwidth}%
187   \Gm@savelength{paperheight}%
188   \Gm@savelength{textwidth}%
189   \Gm@savelength{textheight}%
190   \Gm@savelength{evensidemargin}%
191   \Gm@savelength{oddsidemargin}%
192   \Gm@savelength{topmargin}%
193   \Gm@savelength{headheight}%
194   %\Gm@savelength{headsep}%
195   \Gm@savelength{topskip}%
196   %\Gm@savelength{footskip}%
197   \Gm@savelength{baselineskip}%
198   \Gm@savelength{marginparwidth}%
199   \Gm@savelength{marginparsep}%
200   \Gm@savelength{columnsep}%
201   \Gm@savelength{hoffset}%
202   \Gm@savelength{voffset}
203   \Gm@savelength{Gm@layoutwidth}%
204   \Gm@savelength{Gm@layoutheight}%
205   \Gm@savelength{Gm@layouthoffset}%
206   \Gm@savelength{Gm@layoutvoffset}%
207   \Gm@saveboolean{@twocolumn}%
208   \Gm@saveboolean{@twoside}%
209   \Gm@saveboolean{Gm@ltj@layoutswitch}%
210   \Gm@saveboolean{@reversemargin}}%
211
212 % frame
213 \ifluatex
214   \def\Gm@pageframe@cmd{\vb@xt@\z@}
215 \else
216   \def\Gm@pageframe@cmd{\vb@xt@\z@\bgroup\yoko\aftergroup\egroup}
217 \fi
218 \renewcommand*{\Gm@pageframes}{%
219   \Gm@pageframe@cmd{%
220    \ifGm@showcrop
221     \vb@xt@\z@{\vskip-1\Gm@truedimen in\vskip\Gm@layoutvoffset%
222      \hb@xt@\z@{\hskip-1\Gm@truedimen in\hskip\Gm@layouthoffset%
223       \vb@xt@\Gm@layoutwidth{%
224        \let\protect\relax
225        \hb@xt@\Gm@layoutheight{\Gm@cropmark(-1,1,-3,3)\hfil\Gm@cropmark(1,1,3,3)}%
226        \vfil
227        \hb@xt@\Gm@layoutheight{\Gm@cropmark(-1,-1,-3,-3)\hfil\Gm@cropmark(1,-1,3,-3)}}%
228      \hss}%
229     \vss}%
230    \fi%
231    \ifGm@showframe
232     \if@twoside
233      \ifodd\count\z@
234        \let\@themargin\oddsidemargin
235      \else
236        \let\@themargin\evensidemargin
237      \fi
238     \fi
239     \moveright\@themargin%
240     \vb@xt@\z@{%
241      \vskip\topmargin\vb@xt@\z@{\vss\Gm@hrule}%
242      \vskip\headheight\vb@xt@\z@{\vss\Gm@hruled}%
243      \vskip\headsep\vb@xt@\z@{\vss\Gm@hrule}%
244      \if@reversemargin\vb@xt@\z@{%
245        \vss\vb@xt@\z@{\vss\Gm@hrule}%
246        \vskip\marginparwidth\vb@xt@\z@{\vss\Gm@hrule}%
247        \vskip\marginparsep
248      }\fi
249      \hb@xt@\textwidth{\llap{\Gm@vrule}\hfil\Gm@vrule}%
250      \vb@xt@\z@{\vss\Gm@hruled}%
251      \unless\if@reversemargin\vb@xt@\z@{%
252        \vskip\marginparsep\vb@xt@\z@{\vss\Gm@hrule}%
253        \vskip\marginparwidth\vb@xt@\z@{\vss\Gm@hruled}\vss%
254      }\fi%
255      \vskip\footskip\vb@xt@\z@{\vss\Gm@hruled}%
256      \vss}%
257     \fi%
258   }}
259 \def\Gm@detall#1#2#3#4{%
260   \@tempcnta\z@
261   \if#1h
262     \let\Gm@mratio\Gm@hmarginratio
263     \edef\Gm@Dmratio{\Gm@Dhratio}%
264   \else
265     \let\Gm@mratio\Gm@vmarginratio
266     \edef\Gm@Dmratio{\if@twoside\Gm@Dvratiotwo\else\Gm@Dvratio\fi}%
267   \fi
268   \if#1h
269     \ifx\Gm@tmargin\@undefined\else\advance\@tempcnta4\relax\fi
270     \ifGm@hbody\advance\@tempcnta2\relax\fi
271     \ifx\Gm@bmargin\@undefined\else\advance\@tempcnta1\relax\fi
272     \Gm@cnth\@tempcnta
273   \else
274     \ifx\Gm@lmargin\@undefined\else\advance\@tempcnta4\relax\fi
275     \ifGm@vbody\advance\@tempcnta2\relax\fi
276     \ifx\Gm@rmargin\@undefined\else\advance\@tempcnta1\relax\fi
277     \Gm@cntv\@tempcnta
278   \fi
279   \ifcase\@tempcnta
280     \if#1h
281       \Gm@defbylen{width}{\Gm@Dhscale\Gm@layoutwidth}%
282     \else
283       \Gm@defbylen{height}{\Gm@Dvscale\Gm@layoutheight}%
284     \fi
285     \Gm@detiiandiii{#2}{#3}{#4}%
286   \or
287     \ifx\Gm@mratio\@undefined
288       \if#1h
289         \Gm@defbylen{width}{\Gm@Dhscale\Gm@layoutwidth}%
290       \else
291         \Gm@defbylen{height}{\Gm@Dvscale\Gm@layoutheight}%
292       \fi
293       \setlength\@tempdimc{\@nameuse{Gm@#4}}%
294       \Gm@detiiandiii{#2}{#3}{#4}%
295       \expandafter\let\csname Gm@#2\endcsname\@undefined
296       \Gm@defbylen{#4}{\@tempdimc}%
297     \else
298       \Gm@setbyratio[f]{#1}{#4}{#3}%
299     \fi
300     \Gm@detiv{#2}{#3}{#4}{#2}%
301   \or\Gm@detiiandiii{#2}{#3}{#4}%
302   \or\Gm@detiv{#2}{#2}{#4}{#3}%
303   \or
304     \ifx\Gm@mratio\@undefined
305       \if#1h
306         \Gm@defbylen{width}{\Gm@Dhscale\Gm@layoutwidth}%
307       \else
308         \Gm@defbylen{height}{\Gm@Dvscale\Gm@layoutheight}%
309       \fi
310       \setlength\@tempdimc{\@nameuse{Gm@#3}}%
311       \Gm@detiiandiii{#2}{#4}{#3}%
312       \expandafter\let\csname Gm@#2\endcsname\@undefined
313       \Gm@defbylen{#3}{\@tempdimc}%
314     \else
315       \Gm@setbyratio[b]{#1}{#3}{#4}%
316     \fi
317     \Gm@detiv{#2}{#3}{#4}{#2}%
318   \or\Gm@detiv{#2}{#3}{#4}{#2}%
319   \or\Gm@detiv{#2}{#2}{#3}{#4}%
320   \or\Gm@warning{Over-specification in `#1'-direction.%
321                   ^^J\@spaces `#2' (\@nameuse{Gm@#2}) is ignored}%
322     \Gm@detiv{#2}{#3}{#4}{#2}%
323   \else\fi}%
324 \def\Gm@clean{%
325   \ifnum\Gm@cnth<4\let\Gm@tmargin\@undefined\fi
326   \ifodd\Gm@cnth\else\let\Gm@bmargin\@undefined\fi
327   \ifnum\Gm@cntv<4\let\Gm@lmargin\@undefined\fi
328   \ifodd\Gm@cntv\else\let\Gm@rmargin\@undefined\fi
329   \ifGm@hbody\else
330     \let\Gm@hscale\@undefined
331     \let\Gm@width\@undefined
332     \let\Gm@textwidth\@undefined
333   \fi
334   \ifGm@vbody\else
335     \let\Gm@vscale\@undefined
336     \let\Gm@height\@undefined
337     \let\Gm@textheight\@undefined
338   \fi
339   }%
340 \def\Gm@adjustpaper{%
341   \ifdim\paperwidth>\p@\else
342     \PackageError{geometry}{%
343     \string\paperwidth\space(\the\paperwidth) too short}{%
344     Set a paper type (e.g., `a4paper').}%
345   \fi
346   \ifdim\paperheight>\p@\else
347     \PackageError{geometry}{%
348     \string\paperheight\space(\the\paperheight) too short}{%
349     Set a paper type (e.g., `a4paper').}%
350   \fi
351   \ifGm@swap@papersize
352     \setlength\@tempdima{\paperwidth}%
353     \setlength\paperwidth{\paperheight}%
354     \setlength\paperheight{\@tempdima}%
355   \fi
356   \ifGm@layout\else
357     \setlength\Gm@layoutwidth{\paperheight}%
358     \setlength\Gm@layoutheight{\paperwidth}%
359   \fi}%
360 \def\Gm@adjustbody{
361   \ifGm@hbody
362     \ifx\Gm@width\@undefined
363       \ifx\Gm@hscale\@undefined
364         \Gm@defbylen{width}{\Gm@Dhscale\Gm@layoutwidth}%
365       \else
366         \Gm@defbylen{width}{\Gm@hscale\Gm@layoutwidth}%
367       \fi
368     \fi
369     \ifx\Gm@textwidth\@undefined\else
370       \setlength\@tempdima{\Gm@textwidth}%
371       \ifGm@includemp
372         \advance\@tempdima\Gm@wd@mp
373       \fi
374       \ifGm@includehead
375         \addtolength\@tempdima{\headheight}%
376         \addtolength\@tempdima{\headsep}%
377       \fi
378       \ifGm@includefoot
379         \addtolength\@tempdima{\footskip}%
380       \fi
381       \edef\Gm@width{\the\@tempdima}%
382     \fi
383   \fi
384   \ifGm@vbody
385     \ifx\Gm@height\@undefined
386       \ifx\Gm@vscale\@undefined
387         \Gm@defbylen{height}{\Gm@Dvscale\Gm@layoutheight}%
388       \else
389         \Gm@defbylen{height}{\Gm@vscale\Gm@layoutheight}%
390       \fi
391     \fi
392     \setlength\topskip\Gm@ltj@topskip
393     \ifx\Gm@lines\@undefined\else
394       \@tempdima=\f@size\p@ \@tempdima=.5\@tempdima
395       \ifluatex
396         \advance\@tempdima\ltjgetparameter{talbaselineshift}%
397       \else
398         \advance\@tempdima\tbaselineshift
399       \fi
400       \ifdim\maxdepth<\@tempdima
401         \PackageWarningNoLine{lltjp-geometry}%
402           {\noexpand\maxdepth was changed from \the\maxdepth\space
403             to \the\@tempdima}
404         \maxdepth\@tempdima
405       \fi
406       \setbox\z@=\hbox{\tate% next \ifdim must be executed in tate dir.
407         \ifdim\topskip<\ht\tstrutbox
408           \@tempdima\topskip
409           \global\topskip\ht\tstrutbox
410           \PackageWarningNoLine{lltjp-geometry}%
411             {\noexpand\topskip was changed from \the\@tempdima\space
412               to \the\topskip}
413         \fi}%
414       \setlength\@tempdima{\baselineskip}%
415       \multiply\@tempdima\Gm@lines
416       \addtolength\@tempdima{\topskip}%
417       \addtolength\@tempdima{-\baselineskip}%
418       \edef\Gm@textheight{\the\@tempdima}%
419     \fi
420     \ifx\Gm@textheight\@undefined\else
421       \edef\Gm@height{\Gm@textheight}%
422     \fi
423   \fi}%
424
425 \def\Gm@adjustmp{%
426   \ifGm@includemp
427     \@tempdimb\marginparwidth
428     \advance\@tempdimb\marginparsep
429     \Gm@wd@mp\@tempdimb
430     \if@twocolumn
431       \Gm@wd@mp2\@tempdimb
432     \fi
433   \fi}%
434 \def\Gm@@process{%
435   \Gm@expandlengths
436   \Gm@adjustpaper
437   \addtolength\Gm@layoutheight{-\Gm@bindingoffset}%
438   \Gm@adjustmp
439   \Gm@adjustbody
440   \Gm@detall{h}{width}{tmargin}{bmargin}%
441   \Gm@detall{v}{height}{lmargin}{rmargin}%
442   \setlength\textwidth{\Gm@width}%
443   \setlength\textheight{\Gm@height}%
444   \setlength\headsep{\Gm@ltj@headsep}%
445   \setlength\footskip{\Gm@ltj@footskip}%
446   \setlength\topmargin{\Gm@tmargin}%
447   \setlength\oddsidemargin{\Gm@lmargin}%
448   \addtolength\oddsidemargin{-1\Gm@truedimen in}%
449   \ifGm@ltj@layoutswitch
450     \setlength\evensidemargin{\Gm@rmargin}%
451     \addtolength\evensidemargin{-1\Gm@truedimen in}%
452   \else
453     \evensidemargin\oddsidemargin
454   \fi
455   \advance\evensidemargin\Gm@bindingoffset
456   \addtolength\topmargin{-1\Gm@truedimen in}%
457   \ifGm@includehead
458     \addtolength\textwidth{-\headheight}%
459     \addtolength\textwidth{-\headsep}%
460   \else
461     \addtolength\topmargin{-\headheight}%
462     \addtolength\topmargin{-\headsep}%
463   \fi
464   \ifGm@includefoot
465     \addtolength\textwidth{-\footskip}%
466   \fi
467   \ifGm@includemp
468     \advance\textwidth-\Gm@wd@mp
469     \if@twocolumn
470       \advance\headsep.5\Gm@wd@mp
471       \advance\footskip.5\Gm@wd@mp
472     \else\if@reversemargin
473       \advance\headsep\Gm@wd@mp
474     \else
475       \advance\footskip\Gm@wd@mp
476     \fi\fi
477   \fi
478   \ifGm@heightrounded
479     \setlength\@tempdima{\textheight}%
480     \addtolength\@tempdima{-\topskip}%
481     \@tempcnta\@tempdima
482     \@tempcntb\baselineskip
483     \divide\@tempcnta\@tempcntb
484     \setlength\@tempdimb{\baselineskip}%
485     \multiply\@tempdimb\@tempcnta
486     \advance\@tempdima-\@tempdimb
487     \multiply\@tempdima\tw@
488     \ifdim\@tempdima>\baselineskip
489       \addtolength\@tempdimb{\baselineskip}%
490     \fi
491     \addtolength\@tempdimb{\topskip}%
492     \textheight\@tempdimb
493   \fi
494   \advance\oddsidemargin\Gm@layouthoffset%
495   \advance\evensidemargin\Gm@layouthoffset%
496   \advance\topmargin\Gm@layoutvoffset%
497   \addtolength\Gm@layoutheight{\Gm@bindingoffset}%
498 }% end of \Gm@@process
499 % log
500 \def\Gm@logcontent#1{%
501   *geometry* verbose mode - [ #1 ] result:^^J%
502   \ifGm@pass * pass: disregarded the geometry package!^^J%
503   \else
504   * driver: \if\Gm@driver<none>\else\Gm@driver\fi^^J%
505   * paper: \ifx\Gm@paper\@undefined<default>\else\Gm@paper\fi^^J%
506   * layout: \ifGm@layout<custom>\else<same size as paper>\fi^^J%
507   \ifGm@layout
508   * layout(width,height): (\the\Gm@layoutwidth,\the\Gm@layoutheight)^^J%
509   \fi
510   * layoutoffset:(h,v)=(\the\Gm@layouthoffset,\the\Gm@layoutvoffset)^^J%
511   \@ifundefined{Gm@lines}{}{* lines: \Gm@lines^^J}%
512   \@ifundefined{Gm@hmarginratio}{}{* hratio: \Gm@hmarginratio^^J}%
513   \@ifundefined{Gm@vmarginratio}{}{* vratio: \Gm@vmarginratio^^J}%
514   \ifdim\Gm@bindingoffset=\z@\else
515   * bindingoffset: \the\Gm@bindingoffset^^J\fi
516   * modes: %
517    \Gm@showbool{landscape}%
518    \Gm@showbool{includehead}%
519    \Gm@showbool{includefoot}%
520    \Gm@showbool{includemp}%
521    \if@twoside twoside\space\fi%
522    \ifGm@ltj@layoutswitch\else\if@twoside asymmetric\space\fi\fi%
523    \Gm@showbool{heightrounded}%
524    \ifx\Gm@truedimen\@empty\else truedimen\space\fi%
525    \Gm@showbool{showframe}%
526    \Gm@showbool{showcrop}%
527   ^^J%
528   * h-part:(L,W,R)=(\Gm@lmargin, \Gm@height, \Gm@rmargin)^^J%
529   * v-part:(T,H,B)=(\Gm@tmargin, \Gm@width, \Gm@bmargin)^^J%
530   \fi
531   \Gm@showdim{\paperwidth}%
532   \Gm@showdim{\paperheight}%
533   \Gm@showdim{\textwidth}%
534   \Gm@showdim{\textheight}%
535   \Gm@showdim{\oddsidemargin}%
536   \Gm@showdim{\evensidemargin}%
537   \Gm@showdim{\topmargin}%
538   \Gm@showdim{\headheight}%
539   \Gm@showdim{\headsep}%
540   \Gm@showdim{\topskip}%
541   \Gm@showdim{\footskip}%
542   \Gm@showdim{\marginparwidth}%
543   \Gm@showdim{\marginparsep}%
544   \Gm@showdim{\columnsep}%
545   * \string\skip\string\footins=\the\skip\footins^^J%
546   \Gm@showdim{\hoffset}%
547   \Gm@showdim{\voffset}%
548   \Gm@showdim{\mag}%
549   * \string\@twocolumn\if@twocolumn true\else false\fi^^J%
550   * \string\@twoside\if@twoside true\else false\fi^^J%
551   * \string\@mparswitch\if@mparswitch true\else false\fi^^J%
552   * \string\@reversemargin\if@reversemargin true\else false\fi^^J%
553   * (1in=72.27pt=25.4mm, 1cm=28.453pt)^^J}%
554
555
556 \Gm@initall
557 \Gm@processconfig
558 \ProcessOptionsKV[c]{Gm}%
559 \Gm@setdefaultpaper
560 \ProcessOptionsKV[p]{Gm}%
561 \Gm@process
562
563 %%% 終了
564 \fi}
565 \endinput