diff options
author | Karl Berry <karl@freefriends.org> | 2010-02-15 00:56:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-02-15 00:56:11 +0000 |
commit | 4ccbc52dab3e0854855023d871eb57c855e1edad (patch) | |
tree | 65831a8e18a974a62d45d3621dd08410eeb68631 /Master/texmf-dist/tex/latex/geometry | |
parent | ff198a8364721065d384ac0d68d26082b530c670 (diff) |
geometry 5.0 (13feb10)
git-svn-id: svn://tug.org/texlive/trunk@17014 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/geometry')
-rw-r--r-- | Master/texmf-dist/tex/latex/geometry/geometry.sty | 986 |
1 files changed, 562 insertions, 424 deletions
diff --git a/Master/texmf-dist/tex/latex/geometry/geometry.sty b/Master/texmf-dist/tex/latex/geometry/geometry.sty index 458354d1de7..575a4df14f8 100644 --- a/Master/texmf-dist/tex/latex/geometry/geometry.sty +++ b/Master/texmf-dist/tex/latex/geometry/geometry.sty @@ -6,7 +6,8 @@ %% %% geometry.dtx (with options: `package') %% -%% Copyright (C) 1996-2002, 2008 by Hideo Umeki <latexgeometry@gmail.com> +%% Copyright (C) 1996-2010 +%% by Hideo Umeki <latexgeometry@gmail.com> %% %% This work may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3c of this license @@ -24,12 +25,13 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{geometry} - [2008/12/21 v4.2 Page Geometry] + [2010/02/12 v5.0 Page Geometry] \RequirePackage{keyval}% \RequirePackage{ifpdf}% \RequirePackage{ifvtex}% \newif\ifGm@verbose \newif\ifGm@landscape +\newif\ifGm@swap@papersize\Gm@swap@papersizefalse \newif\ifGm@includehead \newif\ifGm@includefoot \newif\ifGm@includemp @@ -37,10 +39,11 @@ \newif\ifGm@vbody \newif\ifGm@heightrounded \newif\ifGm@showframe -\newif\ifGm@compatii -\newif\ifGm@sworient\Gm@sworientfalse +\newif\ifGm@showcrop \newif\ifGm@pass\Gm@passfalse \newif\ifGm@resetpaper +\newif\ifGm@layout +\newif\ifGm@newgm \newcount\Gm@cnth \newcount\Gm@cntv \newcount\c@Gm@tempcnt @@ -48,88 +51,111 @@ \newdimen\Gm@wd@mp \newdimen\Gm@odd@mp \newdimen\Gm@even@mp +\newdimen\Gm@layoutwidth +\newdimen\Gm@layoutheight +\newdimen\Gm@layouthoffset +\newdimen\Gm@layoutvoffset \newtoks\Gm@dimlist \def\Gm@warning#1{\PackageWarningNoLine{geometry}{#1}}% -\@onlypreamble\Gm@warning +\def\ifGm@preamble#1{% + \ifGm@newgm + \Gm@warning{`#1': not available in `\string\newgeometry'; skipped}% + \else + \expandafter\@firstofone + \fi}% \def\Gm@Dhratio{1:1}% = left:right default for oneside \def\Gm@Dhratiotwo{2:3}% = inner:outer default for twoside. \def\Gm@Dvratio{2:3}% = top:bottom default -\@onlypreamble\Gm@Dhratio -\@onlypreamble\Gm@Dhratiotwo -\@onlypreamble\Gm@Dvratio \def\Gm@Dhscale{0.7}% \def\Gm@Dvscale{0.7}% -\@onlypreamble\Gm@Dhscale -\@onlypreamble\Gm@Dvscale \def\Gm@dvips{dvips}% \def\Gm@dvipdfm{dvipdfm}% \def\Gm@pdftex{pdftex}% +\def\Gm@xetex{xetex}% \def\Gm@vtex{vtex}% -\@onlypreamble\Gm@dvips -\@onlypreamble\Gm@dvipdfm -\@onlypreamble\Gm@pdftex -\@onlypreamble\Gm@vtex \def\Gm@true{true}% \def\Gm@false{false}% \edef\Gm@orgpw{\the\paperwidth}% \edef\Gm@orgph{\the\paperheight}% -\edef\Gm@dorg{% - \noexpand\setlength{\paperwidth}{\the\paperwidth}% - \noexpand\setlength{\paperheight}{\the\paperheight}% - \noexpand\setlength{\textheight}{\the\textheight}% - \noexpand\setlength{\textwidth}{\the\textwidth}% - \noexpand\setlength{\oddsidemargin}{\the\oddsidemargin}% - \noexpand\setlength{\evensidemargin}{\the\evensidemargin}% - \noexpand\setlength{\topmargin}{\the\topmargin}% - \noexpand\setlength{\headsep}{\the\headsep}% - \noexpand\setlength{\headheight}{\the\headheight}% - \noexpand\setlength{\footskip}{\the\footskip}% - \noexpand\setlength{\marginparwidth}{\the\marginparwidth}% - \noexpand\setlength{\marginparsep}{\the\marginparsep}% - \noexpand\setlength{\columnsep}{\the\columnsep}% - \noexpand\setlength{\skip\footins}{\the\skip\footins}% - \noexpand\setlength{\hoffset}{\the\hoffset}% - \noexpand\setlength{\voffset}{\the\voffset}% - \expandafter\noexpand\csname @twocolumn\if@twocolumn - \Gm@true\else\Gm@false\fi\endcsname - \expandafter\noexpand\csname @twoside\if@twoside - \Gm@true\else\Gm@false\fi\endcsname - \expandafter\noexpand\csname @mparswitch\if@mparswitch - \Gm@true\else\Gm@false\fi\endcsname - \expandafter\noexpand\csname @reversemargin\if@reversemargin - \Gm@true\else\Gm@false\fi\endcsname - \noexpand\mag=\the\mag}% -\@onlypreamble\Gm@dorg -\def\Gm@init{% - \Gm@hbodyfalse\Gm@vbodyfalse - \Gm@includeheadfalse\Gm@includefootfalse\Gm@includempfalse - \Gm@landscapefalse\Gm@compatiifalse\Gm@heightroundedfalse - \Gm@verbosefalse\Gm@showframefalse\Gm@resetpaperfalse +\def\Gm@savelength#1{% + \edef\@@tmp{\expandafter\the\csname #1\endcsname}% + \g@addto@macro\Gm@restore{\expandafter\noexpand\expandafter\csname + #1\endcsname\expandafter=\expandafter\the\csname #1\endcsname\relax}} +\def\Gm@saveboolean#1{% + \csname if#1\endcsname + \g@addto@macro\Gm@restore{\expandafter\noexpand\csname #1true\endcsname}% + \else + \g@addto@macro\Gm@restore{\expandafter\noexpand\csname #1false\endcsname}% + \fi}% +\def\Gm@restore{}% +\def\Gm@save{% + \Gm@savelength{paperwidth}% + \Gm@savelength{paperheight}% + \Gm@savelength{textwidth}% + \Gm@savelength{textheight}% + \Gm@savelength{evensidemargin}% + \Gm@savelength{oddsidemargin}% + \Gm@savelength{topmargin}% + \Gm@savelength{headheight}% + \Gm@savelength{headsep}% + \Gm@savelength{topskip}% + \Gm@savelength{footskip}% + \Gm@savelength{baselineskip}% + \Gm@savelength{marginparwidth}% + \Gm@savelength{marginparsep}% + \Gm@savelength{columnsep}% + \Gm@savelength{hoffset}% + \Gm@savelength{voffset} + \Gm@savelength{Gm@layouthoffset}% + \Gm@savelength{Gm@layoutvoffset}% + \Gm@saveboolean{@twocolumn}% + \Gm@saveboolean{@twoside}% + \Gm@saveboolean{@mparswitch}% + \Gm@saveboolean{@reversemargin}}% +\def\Gm@initnewgm{% + \Gm@dimlist={} + \Gm@hbodyfalse + \Gm@vbodyfalse + \Gm@heightroundedfalse + \Gm@includeheadfalse + \Gm@includefootfalse + \Gm@includempfalse + \let\Gm@width\@undefined + \let\Gm@height\@undefined + \let\Gm@textwidth\@undefined + \let\Gm@textheight\@undefined + \let\Gm@hscale\@undefined + \let\Gm@vscale\@undefined + \let\Gm@hmarginratio\@undefined + \let\Gm@vmarginratio\@undefined + \let\Gm@lmargin\@undefined + \let\Gm@rmargin\@undefined + \let\Gm@tmargin\@undefined + \let\Gm@bmargin\@undefined + \Gm@layoutfalse + \Gm@layouthoffset\z@ + \Gm@layoutvoffset\z@ + \Gm@bindingoffset\z@}% +\def\Gm@initall{% + \let\Gm@driver\@empty + \let\Gm@truedimen\@empty \let\Gm@paper\@undefined - \let\Gm@width\@undefined\let\Gm@height\@undefined - \let\Gm@textwidth\@undefined\let\Gm@textheight\@undefined - \let\Gm@hscale\@undefined\let\Gm@vscale\@undefined - \let\Gm@hmarginratio\@undefined\let\Gm@vmarginratio\@undefined - \let\Gm@lmargin\@undefined\let\Gm@rmargin\@undefined - \let\Gm@tmargin\@undefined\let\Gm@bmargin\@undefined - \let\Gm@driver\@empty\let\Gm@truedimen\@empty - \Gm@bindingoffset\z@\Gm@dimlist={}}% -\@onlypreamble\Gm@init + \Gm@resetpaperfalse + \Gm@landscapefalse + \Gm@verbosefalse + \Gm@showframefalse + \Gm@showcropfalse + \Gm@newgmfalse + \Gm@initnewgm}% \def\Gm@setdriver#1{% \expandafter\let\expandafter\Gm@driver\csname Gm@#1\endcsname}% \def\Gm@unsetdriver#1{% - \expandafter\ifx\csname Gm@#1\endcsname\Gm@driver - \let\Gm@driver\@empty - \fi}% + \expandafter\ifx\csname Gm@#1\endcsname\Gm@driver\let\Gm@driver\@empty\fi}% \def\Gm@setbool{\@dblarg\Gm@@setbool}% \def\Gm@setboolrev{\@dblarg\Gm@@setboolrev}% \def\Gm@@setbool[#1]#2#3{\Gm@doif{#1}{#3}{\csname Gm@#2\Gm@bool\endcsname}}% \def\Gm@@setboolrev[#1]#2#3{\Gm@doifelse{#1}{#3}% {\csname Gm@#2\Gm@false\endcsname}{\csname Gm@#2\Gm@true\endcsname}}% -\@onlypreamble\Gm@setbool -\@onlypreamble\Gm@setboolrev -\@onlypreamble\Gm@@setbool -\@onlypreamble\Gm@@setboolrev \def\Gm@doif#1#2#3{% \lowercase{\def\Gm@bool{#2}}% \ifx\Gm@bool\@empty @@ -149,24 +175,16 @@ \fi}% \def\Gm@doifelse#1#2#3#4{% \Gm@doif{#1}{#2}{\ifx\Gm@bool\Gm@true #3\else #4\fi}}% -\@onlypreamble\Gm@doif -\@onlypreamble\Gm@doifelse \def\Gm@reverse#1{% \csname ifGm@#1\endcsname \csname Gm@#1false\endcsname\else\csname Gm@#1true\endcsname\fi}% -\@onlypreamble\Gm@reverse -\def\Gm@checkbool#1{#1: \csname ifGm@#1\endcsname true\else --\fi^^J}% -\@onlypreamble\Gm@checkbool \def\Gm@defbylen#1#2{% \setlength\@tempdima{#2}% \expandafter\edef\csname Gm@#1\endcsname{\the\@tempdima}}% \def\Gm@defbycnt#1#2{% \setcounter{Gm@tempcnt}{#2}% \expandafter\edef\csname Gm@#1\endcsname{\the\value{Gm@tempcnt}}}% -\@onlypreamble\Gm@defbylen -\@onlypreamble\Gm@defbycnt \def\Gm@sep@ratio#1:#2{\@tempcnta=#1\@tempcntb=#2}% -\@onlypreamble\Gm@set@ratio \def\Gm@setbyratio[#1]#2#3#4{% determine #4 by ratio \expandafter\Gm@sep@ratio\Gm@mratio\relax \if#1b @@ -181,10 +199,9 @@ \divide\@tempdimb\@tempcntb \fi \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdimb}}% -\@onlypreamble\Gm@setbyratio \def\Gm@detiv#1#2#3#4{% determine #4. \expandafter\setlength\expandafter\@tempdima\expandafter - {\csname paper#1\endcsname}% + {\csname Gm@layout#1\endcsname}% \expandafter\setlength\expandafter\@tempdimb\expandafter {\csname Gm@#2\endcsname}% \addtolength\@tempdima{-\@tempdimb}% @@ -196,10 +213,9 @@ ^^J\@spaces `#2' or `#3' should be shortened in length}% \fi \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdima}}% -\@onlypreamble\Gm@detiv \def\Gm@detiiandiii#1#2#3{% determine #2 and #3. \expandafter\setlength\expandafter\@tempdima\expandafter - {\csname paper#1\endcsname}% + {\csname Gm@layout#1\endcsname}% \expandafter\setlength\expandafter\@tempdimb\expandafter {\csname Gm@#1\endcsname}% \addtolength\@tempdima{-\@tempdimb}% @@ -208,27 +224,30 @@ ^^J\@spaces `#1' should be shortened in length}% \fi \ifx\Gm@mratio\@undefined - \divide\@tempdima\tw@ - \@tempdimb=\@tempdima + \expandafter\Gm@sep@ratio\Gm@Dmratio\relax \else - \@tempdimb=\@tempdima \expandafter\Gm@sep@ratio\Gm@mratio\relax - \advance\@tempcntb\@tempcnta - \ifnum\@tempcntb>\z@ - \divide\@tempdima\@tempcntb - \multiply\@tempdima\@tempcnta - \advance\@tempdimb-\@tempdima - \else - \divide\@tempdima\tw@ - \@tempdimb=\@tempdima + \ifnum\@tempcntb>\z@\else + \Gm@warning{margin ratio a:b should be non-zero; default used}% + \expandafter\Gm@sep@ratio\Gm@Dmratio\relax \fi \fi + \@tempdimb=\@tempdima + \advance\@tempcntb\@tempcnta + \divide\@tempdima\@tempcntb + \multiply\@tempdima\@tempcnta + \advance\@tempdimb-\@tempdima \expandafter\edef\csname Gm@#2\endcsname{\the\@tempdima}% \expandafter\edef\csname Gm@#3\endcsname{\the\@tempdimb}}% -\@onlypreamble\Gm@detiiandiii \def\Gm@detall#1#2#3#4{% \@tempcnta\z@ - \edef\Gm@mratio{\@nameuse{Gm@#1marginratio}}% + \if#1h + \let\Gm@mratio\Gm@hmarginratio + \edef\Gm@Dmratio{\if@twoside\Gm@Dhratiotwo\else\Gm@Dhratio\fi}% + \else + \let\Gm@mratio\Gm@vmarginratio + \edef\Gm@Dmratio{\Gm@Dvratio}% + \fi \if#1h \ifx\Gm@lmargin\@undefined\else\advance\@tempcnta4\relax\fi \ifGm@hbody\advance\@tempcnta2\relax\fi @@ -242,22 +261,49 @@ \fi \ifcase\@tempcnta \if#1h - \edef\Gm@width{\Gm@Dhscale\paperwidth}% + \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}% \else - \edef\Gm@height{\Gm@Dvscale\paperheight}% + \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}% \fi \Gm@detiiandiii{#2}{#3}{#4}% - \or\Gm@setbyratio[f]{#1}{#4}{#3}\Gm@detiv{#2}{#3}{#4}{#2}% + \or + \ifx\Gm@mratio\@undefined + \if#1h + \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}% + \else + \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}% + \fi + \setlength\@tempdimc{\@nameuse{Gm@#4}}% + \Gm@detiiandiii{#2}{#3}{#4}% + \expandafter\let\csname Gm@#2\endcsname\@undefined + \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdimc}% + \else + \Gm@setbyratio[f]{#1}{#4}{#3}% + \fi + \Gm@detiv{#2}{#3}{#4}{#2}% \or\Gm@detiiandiii{#2}{#3}{#4}% \or\Gm@detiv{#2}{#2}{#4}{#3}% - \or\Gm@setbyratio[b]{#1}{#3}{#4}\Gm@detiv{#2}{#3}{#4}{#2}% + \or + \ifx\Gm@mratio\@undefined + \if#1h + \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}% + \else + \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}% + \fi + \setlength\@tempdimc{\@nameuse{Gm@#3}}% + \Gm@detiiandiii{#2}{#4}{#3}% + \expandafter\let\csname Gm@#2\endcsname\@undefined + \expandafter\edef\csname Gm@#3\endcsname{\the\@tempdimc}% + \else + \Gm@setbyratio[b]{#1}{#3}{#4}% + \fi + \Gm@detiv{#2}{#3}{#4}{#2}% \or\Gm@detiv{#2}{#3}{#4}{#2}% \or\Gm@detiv{#2}{#2}{#3}{#4}% \or\Gm@warning{Over-specification in `#1'-direction.% ^^J\@spaces `#2' (\@nameuse{Gm@#2}) is ignored}% \Gm@detiv{#2}{#3}{#4}{#2}% \else\fi}% -\@onlypreamble\Gm@detall \def\Gm@clean{% \ifnum\Gm@cnth<4\let\Gm@lmargin\@undefined\fi \ifodd\Gm@cnth\else\let\Gm@rmargin\@undefined\fi @@ -273,16 +319,7 @@ \let\Gm@height\@undefined \let\Gm@textheight\@undefined \fi - \if@twoside - \ifx\Gm@hmarginratio\Gm@Dhratiotwo - \let\Gm@hmarginratio\@undefined - \fi - \else - \ifx\Gm@hmarginratio\Gm@Dhratio - \let\Gm@hmarginratio\@undefined - \fi - \fi}% -\@onlypreamble\Gm@clean + }% \def\Gm@parse@divide#1#2#3#4{% \def\Gm@star{*}% \@tempcnta\z@ @@ -300,7 +337,6 @@ \fi\fi \advance\@tempcnta\@ne}% \let\Gm@star\relax}% -\@onlypreamble\Gm@parse@divide \def\Gm@branch#1#2#3{% \@tempcnta\z@ \@for\Gm@tmp:=#1\do{% @@ -315,7 +351,6 @@ \ifnum\@tempcnta=\@ne \setkeys{Gm}{#3=\Gm@value}% \fi}% -\@onlypreamble\Gm@branch \def\Gm@magtooffset{% \@tempdima=\mag\Gm@truedimen sp% \@tempdimb=1\Gm@truedimen in% @@ -325,85 +360,102 @@ \addtolength{\voffset}{1\Gm@truedimen in}% \addtolength{\hoffset}{-\the\@tempdimb}% \addtolength{\voffset}{-\the\@tempdimb}}% -\@onlypreamble\Gm@magtooffset -\def\Gm@setafter#1#2{% +\def\Gm@setlength#1#2{% \let\Gm@len=\relax\let\Gm@td=\relax \edef\addtolist{\noexpand\Gm@dimlist=% {\the\Gm@dimlist \Gm@len{#1}{#2}}}\addtolist}% -\@onlypreamble\Gm@setafter -\def\Gm@processdimlist{% +\def\Gm@expandlengths{% \def\Gm@td{\Gm@truedimen}% \def\Gm@len##1##2{\setlength{##1}{##2}}% \the\Gm@dimlist}% -\@onlypreamble\Gm@processdimlist -\def\Gm@setpaper(#1,#2)#3{% +\def\Gm@setsize#1(#2,#3)#4{% \let\Gm@td\relax - \Gm@setafter\paperwidth{#1\Gm@td #3}% - \Gm@setafter\paperheight{#2\Gm@td #3}% - \ifGm@landscape\Gm@sworienttrue\else\Gm@sworientfalse\fi}% -\@onlypreamble\Gm@setpaper -\def\Gm@chpaper{\@nameuse{Gm@\Gm@paper}}% -\@onlypreamble\Gm@chpaper -\@namedef{Gm@a0paper}{\Gm@setpaper(841,1189){mm}}% -\@namedef{Gm@a1paper}{\Gm@setpaper(594,841){mm}}% -\@namedef{Gm@a2paper}{\Gm@setpaper(420,594){mm}}% -\@namedef{Gm@a3paper}{\Gm@setpaper(297,420){mm}}% -\@namedef{Gm@a4paper}{\Gm@setpaper(210,297){mm}}% -\@namedef{Gm@a5paper}{\Gm@setpaper(148,210){mm}}% -\@namedef{Gm@a6paper}{\Gm@setpaper(105,148){mm}}% -\@namedef{Gm@b0paper}{\Gm@setpaper(1000,1414){mm}}% -\@namedef{Gm@b1paper}{\Gm@setpaper(707,1000){mm}}% -\@namedef{Gm@b2paper}{\Gm@setpaper(500,707){mm}}% -\@namedef{Gm@b3paper}{\Gm@setpaper(353,500){mm}}% -\@namedef{Gm@b4paper}{\Gm@setpaper(250,353){mm}}% -\@namedef{Gm@b5paper}{\Gm@setpaper(176,250){mm}}% -\@namedef{Gm@b6paper}{\Gm@setpaper(125,176){mm}}% -\@namedef{Gm@ansiapaper}{\Gm@setpaper(8.5,11){in}}% -\@namedef{Gm@ansibpaper}{\Gm@setpaper(11,17){in}}% -\@namedef{Gm@ansicpaper}{\Gm@setpaper(17,22){in}}% -\@namedef{Gm@ansidpaper}{\Gm@setpaper(22,34){in}}% -\@namedef{Gm@ansiepaper}{\Gm@setpaper(34,44){in}}% -\@namedef{Gm@letterpaper}{\Gm@setpaper(8.5,11){in}}% -\@namedef{Gm@legalpaper}{\Gm@setpaper(8.5,14){in}}% -\@namedef{Gm@executivepaper}{\Gm@setpaper(7.25,10.5){in}}% -\@namedef{Gm@screen}{\Gm@setpaper(225,180){mm}}% + \expandafter\Gm@setlength\csname #1width\endcsname{#2\Gm@td #4}% + \expandafter\Gm@setlength\csname #1height\endcsname{#3\Gm@td #4}% + \ifGm@landscape\Gm@swap@papersizetrue\else\Gm@swap@papersizefalse\fi}% +\def\Gm@setpaper@ifpre#1{% + \ifGm@preamble{#1}{\def\Gm@paper{#1}\@nameuse{Gm@#1}{paper}}}% +\@namedef{Gm@a0paper}#1{\Gm@setsize{#1}(841,1189){mm}}% ISO A0 +\@namedef{Gm@a1paper}#1{\Gm@setsize{#1}(594,841){mm}}% ISO A1 +\@namedef{Gm@a2paper}#1{\Gm@setsize{#1}(420,594){mm}}% ISO A2 +\@namedef{Gm@a3paper}#1{\Gm@setsize{#1}(297,420){mm}}% ISO A3 +\@namedef{Gm@a4paper}#1{\Gm@setsize{#1}(210,297){mm}}% ISO A4 +\@namedef{Gm@a5paper}#1{\Gm@setsize{#1}(148,210){mm}}% ISO A5 +\@namedef{Gm@a6paper}#1{\Gm@setsize{#1}(105,148){mm}}% ISO A6 +\@namedef{Gm@b0paper}#1{\Gm@setsize{#1}(1000,1414){mm}}% ISO B0 +\@namedef{Gm@b1paper}#1{\Gm@setsize{#1}(707,1000){mm}}% ISO B1 +\@namedef{Gm@b2paper}#1{\Gm@setsize{#1}(500,707){mm}}% ISO B2 +\@namedef{Gm@b3paper}#1{\Gm@setsize{#1}(353,500){mm}}% ISO B3 +\@namedef{Gm@b4paper}#1{\Gm@setsize{#1}(250,353){mm}}% ISO B4 +\@namedef{Gm@b5paper}#1{\Gm@setsize{#1}(176,250){mm}}% ISO B5 +\@namedef{Gm@b6paper}#1{\Gm@setsize{#1}(125,176){mm}}% ISO B6 +\@namedef{Gm@b0j}#1{\Gm@setsize{#1}(1030,1456){mm}}% JIS B0 +\@namedef{Gm@b1j}#1{\Gm@setsize{#1}(728,1030){mm}}% JIS B1 +\@namedef{Gm@b2j}#1{\Gm@setsize{#1}(515,728){mm}}% JIS B2 +\@namedef{Gm@b3j}#1{\Gm@setsize{#1}(364,515){mm}}% JIS B3 +\@namedef{Gm@b4j}#1{\Gm@setsize{#1}(257,364){mm}}% JIS B4 +\@namedef{Gm@b5j}#1{\Gm@setsize{#1}(182,257){mm}}% JIS B5 +\@namedef{Gm@b6j}#1{\Gm@setsize{#1}(128,182){mm}}% JIS B6 +\@namedef{Gm@ansiapaper}#1{\Gm@setsize{#1}(8.5,11){in}}% +\@namedef{Gm@ansibpaper}#1{\Gm@setsize{#1}(11,17){in}}% +\@namedef{Gm@ansicpaper}#1{\Gm@setsize{#1}(17,22){in}}% +\@namedef{Gm@ansidpaper}#1{\Gm@setsize{#1}(22,34){in}}% +\@namedef{Gm@ansiepaper}#1{\Gm@setsize{#1}(34,44){in}}% +\@namedef{Gm@letterpaper}#1{\Gm@setsize{#1}(8.5,11){in}}% +\@namedef{Gm@legalpaper}#1{\Gm@setsize{#1}(8.5,14){in}}% +\@namedef{Gm@executivepaper}#1{\Gm@setsize{#1}(7.25,10.5){in}}% +\@namedef{Gm@screen}#1{\Gm@setsize{#1}(225,180){mm}}% \define@key{Gm}{paper}{\setkeys{Gm}{#1}}% \let\KV@Gm@papername\KV@Gm@paper -\define@key{Gm}{a0paper}[true]{\def\Gm@paper{a0paper}\Gm@chpaper}% -\define@key{Gm}{a1paper}[true]{\def\Gm@paper{a1paper}\Gm@chpaper}% -\define@key{Gm}{a2paper}[true]{\def\Gm@paper{a2paper}\Gm@chpaper}% -\define@key{Gm}{a3paper}[true]{\def\Gm@paper{a3paper}\Gm@chpaper}% -\define@key{Gm}{a4paper}[true]{\def\Gm@paper{a4paper}\Gm@chpaper}% -\define@key{Gm}{a5paper}[true]{\def\Gm@paper{a5paper}\Gm@chpaper}% -\define@key{Gm}{a6paper}[true]{\def\Gm@paper{a6paper}\Gm@chpaper}% -\define@key{Gm}{b0paper}[true]{\def\Gm@paper{b0paper}\Gm@chpaper}% -\define@key{Gm}{b1paper}[true]{\def\Gm@paper{b1paper}\Gm@chpaper}% -\define@key{Gm}{b2paper}[true]{\def\Gm@paper{b2paper}\Gm@chpaper}% -\define@key{Gm}{b3paper}[true]{\def\Gm@paper{b3paper}\Gm@chpaper}% -\define@key{Gm}{b4paper}[true]{\def\Gm@paper{b4paper}\Gm@chpaper}% -\define@key{Gm}{b5paper}[true]{\def\Gm@paper{b5paper}\Gm@chpaper}% -\define@key{Gm}{b6paper}[true]{\def\Gm@paper{b6paper}\Gm@chpaper}% -\define@key{Gm}{ansiapaper}[true]{\def\Gm@paper{ansiapaper}\Gm@chpaper}% -\define@key{Gm}{ansibpaper}[true]{\def\Gm@paper{ansibpaper}\Gm@chpaper}% -\define@key{Gm}{ansicpaper}[true]{\def\Gm@paper{ansicpaper}\Gm@chpaper}% -\define@key{Gm}{ansidpaper}[true]{\def\Gm@paper{ansidpaper}\Gm@chpaper}% -\define@key{Gm}{ansiepaper}[true]{\def\Gm@paper{ansiepaper}\Gm@chpaper}% -\define@key{Gm}{letterpaper}[true]{\def\Gm@paper{letterpaper}\Gm@chpaper}% -\define@key{Gm}{legalpaper}[true]{\def\Gm@paper{legalpaper}\Gm@chpaper}% -\define@key{Gm}{executivepaper}[true]{\def\Gm@paper{executivepaper}% - \Gm@chpaper}% -\define@key{Gm}{screen}[true]{\def\Gm@paper{screen}\Gm@chpaper}% -\define@key{Gm}{paperwidth}{% - \Gm@setafter\paperwidth{#1}\def\Gm@paper{user defined}}% -\define@key{Gm}{paperheight}{% - \Gm@setafter\paperheight{#1}\def\Gm@paper{user defined}}% -\define@key{Gm}{papersize}{\Gm@branch{#1}{paperwidth}{paperheight}}% -\define@key{Gm}{landscape}[true]{\Gm@doifelse{landscape}{#1}% - {\ifGm@landscape\else\Gm@landscapetrue\Gm@reverse{sworient}\fi}% - {\ifGm@landscape\Gm@landscapefalse\Gm@reverse{sworient}\fi}}% -\define@key{Gm}{portrait}[true]{\Gm@doifelse{portrait}{#1}% - {\ifGm@landscape\Gm@landscapefalse\Gm@reverse{sworient}\fi}% - {\ifGm@landscape\else\Gm@landscapetrue\Gm@reverse{sworient}\fi}}% +\define@key{Gm}{a0paper}[true]{\Gm@setpaper@ifpre{a0paper}}% +\define@key{Gm}{a1paper}[true]{\Gm@setpaper@ifpre{a1paper}}% +\define@key{Gm}{a2paper}[true]{\Gm@setpaper@ifpre{a2paper}}% +\define@key{Gm}{a3paper}[true]{\Gm@setpaper@ifpre{a3paper}}% +\define@key{Gm}{a4paper}[true]{\Gm@setpaper@ifpre{a4paper}}% +\define@key{Gm}{a5paper}[true]{\Gm@setpaper@ifpre{a5paper}}% +\define@key{Gm}{a6paper}[true]{\Gm@setpaper@ifpre{a6paper}}% +\define@key{Gm}{b0paper}[true]{\Gm@setpaper@ifpre{b0paper}}% +\define@key{Gm}{b1paper}[true]{\Gm@setpaper@ifpre{b1paper}}% +\define@key{Gm}{b2paper}[true]{\Gm@setpaper@ifpre{b2paper}}% +\define@key{Gm}{b3paper}[true]{\Gm@setpaper@ifpre{b3paper}}% +\define@key{Gm}{b4paper}[true]{\Gm@setpaper@ifpre{b4paper}}% +\define@key{Gm}{b5paper}[true]{\Gm@setpaper@ifpre{b5paper}}% +\define@key{Gm}{b6paper}[true]{\Gm@setpaper@ifpre{b6paper}}% +\define@key{Gm}{b0j}[true]{\Gm@setpaper@ifpre{b0j}}% +\define@key{Gm}{b1j}[true]{\Gm@setpaper@ifpre{b1j}}% +\define@key{Gm}{b2j}[true]{\Gm@setpaper@ifpre{b2j}}% +\define@key{Gm}{b3j}[true]{\Gm@setpaper@ifpre{b3j}}% +\define@key{Gm}{b4j}[true]{\Gm@setpaper@ifpre{b4j}}% +\define@key{Gm}{b5j}[true]{\Gm@setpaper@ifpre{b5j}}% +\define@key{Gm}{b6j}[true]{\Gm@setpaper@ifpre{b6j}}% +\define@key{Gm}{ansiapaper}[true]{\Gm@setpaper@ifpre{ansiapaper}}% +\define@key{Gm}{ansibpaper}[true]{\Gm@setpaper@ifpre{ansibpaper}}% +\define@key{Gm}{ansicpaper}[true]{\Gm@setpaper@ifpre{ansicpaper}}% +\define@key{Gm}{ansidpaper}[true]{\Gm@setpaper@ifpre{ansidpaper}}% +\define@key{Gm}{ansiepaper}[true]{\Gm@setpaper@ifpre{ansiepaper}}% +\define@key{Gm}{letterpaper}[true]{\Gm@setpaper@ifpre{letterpaper}}% +\define@key{Gm}{legalpaper}[true]{\Gm@setpaper@ifpre{legalpaper}}% +\define@key{Gm}{executivepaper}[true]{\Gm@setpaper@ifpre{executivepaper}}% +\define@key{Gm}{screen}[true]{\Gm@setpaper@ifpre{screen}}% +\define@key{Gm}{paperwidth}{\ifGm@preamble{paperwidth}{% + \Gm@setlength\paperwidth{#1}}}% +\define@key{Gm}{paperheight}{\ifGm@preamble{paperheight}{% + \Gm@setlength\paperheight{#1}}}% +\define@key{Gm}{papersize}{\ifGm@preamble{papersize}{% + \Gm@branch{#1}{paperwidth}{paperheight}}}% +\define@key{Gm}{layout}{\Gm@layouttrue\@nameuse{Gm@#1}{Gm@layout}}% +\let\KV@Gm@layoutname\KV@Gm@layout +\define@key{Gm}{layoutwidth}{\Gm@layouttrue\Gm@setlength\Gm@layoutwidth{#1}}% +\define@key{Gm}{layoutheight}{\Gm@layouttrue\Gm@setlength\Gm@layoutheight{#1}}% +\define@key{Gm}{layoutsize}{\Gm@branch{#1}{layoutwidth}{layoutheight}}% +\define@key{Gm}{landscape}[true]{\ifGm@preamble{landscape}{% + \Gm@doifelse{landscape}{#1}% + {\ifGm@landscape\else\Gm@landscapetrue\Gm@reverse{swap@papersize}\fi}% + {\ifGm@landscape\Gm@landscapefalse\Gm@reverse{swap@papersize}\fi}}}% +\define@key{Gm}{portrait}[true]{\ifGm@preamble{portrait}{% + \Gm@doifelse{portrait}{#1}% + {\ifGm@landscape\Gm@landscapefalse\Gm@reverse{swap@papersize}\fi}% + {\ifGm@landscape\else\Gm@landscapetrue\Gm@reverse{swap@papersize}\fi}}}% \define@key{Gm}{hscale}{\Gm@hbodytrue\edef\Gm@hscale{#1}}% \define@key{Gm}{vscale}{\Gm@vbodytrue\edef\Gm@vscale{#1}}% \define@key{Gm}{scale}{\Gm@branch{#1}{hscale}{vscale}}% @@ -475,84 +527,92 @@ {\@twosidetrue\@mparswitchtrue}{\@twosidefalse\@mparswitchfalse}}% \define@key{Gm}{asymmetric}[true]{\Gm@doifelse{asymmetric}{#1}% {\@twosidetrue\@mparswitchfalse}{}}% -\define@key{Gm}{bindingoffset}{\Gm@setafter\Gm@bindingoffset{#1}}% -\define@key{Gm}{headheight}{\Gm@setafter\headheight{#1}}% -\define@key{Gm}{headsep}{\Gm@setafter\headsep{#1}}% -\define@key{Gm}{footskip}{\Gm@setafter\footskip{#1}}% +\define@key{Gm}{bindingoffset}{\Gm@setlength\Gm@bindingoffset{#1}}% +\define@key{Gm}{headheight}{\Gm@setlength\headheight{#1}}% +\define@key{Gm}{headsep}{\Gm@setlength\headsep{#1}}% +\define@key{Gm}{footskip}{\Gm@setlength\footskip{#1}}% \let\KV@Gm@head\KV@Gm@headheight \let\KV@Gm@foot\KV@Gm@footskip \define@key{Gm}{nohead}[true]{\Gm@doifelse{nohead}{#1}% - {\Gm@setafter\headheight\z@\Gm@setafter\headsep\z@}{}}% + {\Gm@setlength\headheight\z@\Gm@setlength\headsep\z@}{}}% \define@key{Gm}{nofoot}[true]{\Gm@doifelse{nofoot}{#1}% - {\Gm@setafter\footskip\z@}{}}% + {\Gm@setlength\footskip\z@}{}}% \define@key{Gm}{noheadfoot}[true]{\Gm@doifelse{noheadfoot}{#1}% - {\Gm@setafter\headheight\z@\Gm@setafter\headsep - \z@\Gm@setafter\footskip\z@}{}}% -\define@key{Gm}{footnotesep}{\Gm@setafter{\skip\footins}{#1}}% -\define@key{Gm}{marginparwidth}{\ifGm@compatii\Gm@includemptrue\fi - \Gm@setafter\marginparwidth{#1}}% + {\Gm@setlength\headheight\z@\Gm@setlength\headsep + \z@\Gm@setlength\footskip\z@}{}}% +\define@key{Gm}{footnotesep}{\Gm@setlength{\skip\footins}{#1}}% +\define@key{Gm}{marginparwidth}{\Gm@setlength\marginparwidth{#1}}% \let\KV@Gm@marginpar\KV@Gm@marginparwidth -\define@key{Gm}{marginparsep}{\ifGm@compatii\Gm@includemptrue\fi - \Gm@setafter\marginparsep{#1}}% +\define@key{Gm}{marginparsep}{\Gm@setlength\marginparsep{#1}}% \define@key{Gm}{nomarginpar}[true]{\Gm@doifelse{nomarginpar}{#1}% - {\Gm@setafter\marginparwidth\z@\Gm@setafter\marginparsep\z@}{}}% -\define@key{Gm}{columnsep}{\Gm@setafter\columnsep{#1}}% -\define@key{Gm}{hoffset}{\Gm@setafter\hoffset{#1}}% -\define@key{Gm}{voffset}{\Gm@setafter\voffset{#1}}% + {\Gm@setlength\marginparwidth\z@\Gm@setlength\marginparsep\z@}{}}% +\define@key{Gm}{columnsep}{\Gm@setlength\columnsep{#1}}% +\define@key{Gm}{hoffset}{\Gm@setlength\hoffset{#1}}% +\define@key{Gm}{voffset}{\Gm@setlength\voffset{#1}}% \define@key{Gm}{offset}{\Gm@branch{#1}{hoffset}{voffset}}% +\define@key{Gm}{layouthoffset}{\Gm@setlength\Gm@layouthoffset{#1}}% +\define@key{Gm}{layoutvoffset}{\Gm@setlength\Gm@layoutvoffset{#1}}% +\define@key{Gm}{layoutoffset}{\Gm@branch{#1}{layouthoffset}{layoutvoffset}}% \define@key{Gm}{twocolumn}[true]{% \Gm@doif{twocolumn}{#1}{\csname @twocolumn\Gm@bool\endcsname}}% \define@key{Gm}{reversemp}[true]{% \Gm@doif{reversemp}{#1}{\csname @reversemargin\Gm@bool\endcsname}}% \define@key{Gm}{reversemarginpar}[true]{% \Gm@doif{reversemarginpar}{#1}{\csname @reversemargin\Gm@bool\endcsname}}% -\define@key{Gm}{driver}{\edef\@@tempa{#1}\edef\@@auto{auto}\edef\@@none{none}% +\define@key{Gm}{driver}{\ifGm@preamble{driver}{% + \edef\@@tempa{#1}\edef\@@auto{auto}\edef\@@none{none}% \ifx\@@tempa\@empty\let\Gm@driver\relax\else \ifx\@@tempa\@@none\let\Gm@driver\relax\else \ifx\@@tempa\@@auto\let\Gm@driver\@empty\else - \setkeys{Gm}{#1}\fi\fi\fi\let\@@auto\relax\let\@@none\relax}% -\define@key{Gm}{dvips}[true]{% - \Gm@doifelse{dvips}{#1}{\Gm@setdriver{dvips}}{\Gm@unsetdriver{dvips}}}% -\define@key{Gm}{dvipdfm}[true]{% - \Gm@doifelse{dvipdfm}{#1}{\Gm@setdriver{dvipdfm}}{\Gm@unsetdriver{dvipdfm}}}% -\define@key{Gm}{pdftex}[true]{% - \Gm@doifelse{pdftex}{#1}{\Gm@setdriver{pdftex}}{\Gm@unsetdriver{pdftex}}}% -\define@key{Gm}{vtex}[true]{% - \Gm@doifelse{vtex}{#1}{\Gm@setdriver{vtex}}{\Gm@unsetdriver{vtex}}}% -\define@key{Gm}{verbose}[true]{\Gm@setbool{verbose}{#1}}% -\define@key{Gm}{reset}[true]{\Gm@doifelse{reset}{#1}% - {\Gm@init\Gm@dorg\ProcessOptionsKV[c]{Gm}\Gm@setdefaultpaper}{}}% -\define@key{Gm}{resetpaper}[true]{\Gm@setbool{resetpaper}{#1}}% -\define@key{Gm}{mag}{\mag=#1}% -\define@key{Gm}{truedimen}[true]{\Gm@doifelse{truedimen}{#1}% - {\let\Gm@truedimen\Gm@true}{\let\Gm@truedimen\@empty}}% -\define@key{Gm}{pass}[true]{\Gm@setbool{pass}{#1}}% + \setkeys{Gm}{#1}\fi\fi\fi\let\@@auto\relax\let\@@none\relax}}% +\define@key{Gm}{dvips}[true]{\ifGm@preamble{dvips}{% + \Gm@doifelse{dvips}{#1}{\Gm@setdriver{dvips}}{\Gm@unsetdriver{dvips}}}}% +\define@key{Gm}{dvipdfm}[true]{\ifGm@preamble{dvipdfm}{% + \Gm@doifelse{dvipdfm}{#1}{\Gm@setdriver{dvipdfm}}{\Gm@unsetdriver{dvipdfm}}}}% +\define@key{Gm}{pdftex}[true]{\ifGm@preamble{pdftex}{% + \Gm@doifelse{pdftex}{#1}{\Gm@setdriver{pdftex}}{\Gm@unsetdriver{pdftex}}}}% +\define@key{Gm}{xetex}[true]{\ifGm@preamble{xetex}{% + \Gm@doifelse{xetex}{#1}{\Gm@setdriver{xetex}}{\Gm@unsetdriver{xetex}}}}% +\define@key{Gm}{vtex}[true]{\ifGm@preamble{vtex}{% + \Gm@doifelse{vtex}{#1}{\Gm@setdriver{vtex}}{\Gm@unsetdriver{vtex}}}}% +\define@key{Gm}{verbose}[true]{\ifGm@preamble{verbose}{\Gm@setbool{verbose}{#1}}}% +\define@key{Gm}{reset}[true]{\ifGm@preamble{reset}{% + \Gm@doifelse{reset}{#1}{\Gm@restore@org\Gm@initall + \ProcessOptionsKV[c]{Gm}\Gm@setdefaultpaper}{}}}% +\define@key{Gm}{resetpaper}[true]{\ifGm@preamble{resetpaper}{% + \Gm@setbool{resetpaper}{#1}}}% +\define@key{Gm}{mag}{\ifGm@preamble{mag}{\mag=#1}}% +\define@key{Gm}{truedimen}[true]{\ifGm@preamble{truedimen}{% + \Gm@doifelse{truedimen}{#1}{\let\Gm@truedimen\Gm@true}% + {\let\Gm@truedimen\@empty}}}% +\define@key{Gm}{pass}[true]{\ifGm@preamble{truedimen}{\Gm@setbool{pass}{#1}}}% \define@key{Gm}{showframe}[true]{\Gm@setbool{showframe}{#1}}% -\define@key{Gm}{compat2}[true]{% - \Gm@doifelse{compat2}{#1}{\Gm@compatiitrue - \setkeys{Gm}{scale={0.8,0.9},centering,includeheadfoot}}{}}% -\define@key{Gm}{twosideshift}{% - \ifGm@compatii\@twosidetrue\@mparswitchtrue\Gm@defbylen{twosideshift}{#1}% - \else\Gm@warning{`twosideshift' is obsolete}% - \fi}% +\define@key{Gm}{showcrop}[true]{\Gm@setbool{showcrop}{#1}}% \def\Gm@setdefaultpaper{% \ifx\Gm@paper\@undefined - \Gm@setpaper(\strip@pt\paperwidth,\strip@pt\paperheight){pt}% - \Gm@sworientfalse + \Gm@setsize{paper}(\strip@pt\paperwidth,\strip@pt\paperheight){pt}% + \Gm@setsize{Gm@layout}(\strip@pt\paperwidth,\strip@pt\paperheight){pt}% + \Gm@swap@papersizefalse \fi}% -\@onlypreamble\Gm@setdefaultpaper -\def\Gm@checkpaper{% +\def\Gm@adjustpaper{% \ifdim\paperwidth>\p@\else \PackageError{geometry}{% - You must set \string\paperwidth\space properly}{% - Set your paper type (e.g., `a4paper' for A4) as a class option^^J% - or as a geometry package option.}% + \string\paperwidth\space(\the\paperwidth) too short}{% + Set a paper type (e.g., `a4paper').}% \fi \ifdim\paperheight>\p@\else \PackageError{geometry}{% - You must set \string\paperheight\space properly}{% - Set your paper type (e.g., `a4paper' for A4) as a class option^^J% - or as a geometry package option.}% + \string\paperheight\space(\the\paperheight) too short}{% + Set a paper type (e.g., `a4paper').}% + \fi + \ifGm@swap@papersize + \setlength\@tempdima{\paperwidth}% + \setlength\paperwidth{\paperheight}% + \setlength\paperheight{\@tempdima}% + \fi + \ifGm@layout\else + \let\Gm@layoutwidth\paperwidth + \let\Gm@layoutheight\paperheight \fi}% \def\Gm@checkmp{% \ifGm@includemp\else @@ -571,7 +631,7 @@ \setlength\@tempdimb{\Gm@lmargin}% \advance\@tempdimc-\@tempdimb \ifdim\@tempdimc>\z@ - \Gm@warning{The marginal notes would fall off the page.^^J + \Gm@warning{The marginal notes overrun the paper edge.^^J \@spaces Add \the\@tempdimc\space and more to the left margin}% \fi \fi @@ -580,96 +640,42 @@ \setlength\@tempdimb{\Gm@rmargin}% \advance\@tempdimc-\@tempdimb \ifdim\@tempdimc>\z@ - \Gm@warning{The marginal notes would fall off the page.^^J + \Gm@warning{The marginal notes overrun the paper.^^J \@spaces Add \the\@tempdimc\space and more to the right margin}% \fi \fi \fi}% -\@onlypreamble\Gm@checkmp -\def\Gm@checkdrivers{% - \ifx\Gm@driver\@empty - \typeout{*geometry auto-detecting driver*}% - \ifpdf - \Gm@setdriver{pdftex}% - \else - \Gm@setdriver{dvips}% - \fi - \@ifundefined{XeTeXrevision}{}{\Gm@setdriver{pdftex}}% - \ifvtex - \Gm@setdriver{vtex}% - \fi - \else - \ifx\Gm@driver\Gm@pdftex - \ifpdf\else - \@ifundefined{XeTeXrevision}{\Gm@warning{% - Wrong driver setting: `pdftex'; using default driver}% - \Gm@setdriver{dvips}}{}% - \fi - \fi - \ifx\Gm@driver\Gm@vtex - \ifvtex\else - \Gm@warning{Wrong driver setting: `vtex'; using default driver}% - \Gm@setdriver{dvips}% - \fi - \fi - \fi}% -\@onlypreamble\Gm@checkdrivers -\def\Gm@mpfix{% - \@tempdimb\marginparwidth - \advance\@tempdimb\marginparsep - \Gm@wd@mp\@tempdimb - \Gm@odd@mp\z@ - \Gm@even@mp\z@ - \if@twocolumn - \Gm@wd@mp2\@tempdimb - \Gm@odd@mp\@tempdimb - \Gm@even@mp\@tempdimb - \else - \if@reversemargin +\def\Gm@adjustmp{% + \ifGm@includemp + \@tempdimb\marginparwidth + \advance\@tempdimb\marginparsep + \Gm@wd@mp\@tempdimb + \Gm@odd@mp\z@ + \Gm@even@mp\z@ + \if@twocolumn + \Gm@wd@mp2\@tempdimb \Gm@odd@mp\@tempdimb - \if@mparswitch\else - \Gm@even@mp\@tempdimb - \fi + \Gm@even@mp\@tempdimb \else - \if@mparswitch - \Gm@even@mp\@tempdimb + \if@reversemargin + \Gm@odd@mp\@tempdimb + \if@mparswitch\else + \Gm@even@mp\@tempdimb + \fi + \else + \if@mparswitch + \Gm@even@mp\@tempdimb + \fi \fi \fi \fi}% -\@onlypreamble\Gm@mpfix -\def\Gm@process{% - \ifGm@pass - \Gm@dorg - \else - \Gm@processdimlist - \ifx\Gm@hmarginratio\@undefined - \if@twoside - \edef\Gm@hmarginratio{\Gm@Dhratiotwo}% - \else - \edef\Gm@hmarginratio{\Gm@Dhratio}% - \fi - \fi - \ifx\Gm@vmarginratio\@undefined - \edef\Gm@vmarginratio{\Gm@Dvratio}% - \fi - \Gm@checkpaper - \ifGm@sworient - \setlength\@tempdima{\paperwidth}% - \setlength\paperwidth{\paperheight}% - \setlength\paperheight{\@tempdima}% - \Gm@setpaper(\strip@pt\paperwidth,\strip@pt\paperheight){pt}% - \Gm@sworientfalse - \fi - \addtolength\paperwidth{-\Gm@bindingoffset}% - \ifGm@includemp - \Gm@mpfix - \fi +\def\Gm@adjustbody{ \ifGm@hbody \ifx\Gm@width\@undefined \ifx\Gm@hscale\@undefined - \edef\Gm@width{\Gm@Dhscale\paperwidth}% + \edef\Gm@width{\Gm@Dhscale\Gm@layoutwidth}% \else - \edef\Gm@width{\Gm@hscale\paperwidth}% + \edef\Gm@width{\Gm@hscale\Gm@layoutwidth}% \fi \fi \ifx\Gm@textwidth\@undefined\else @@ -683,9 +689,9 @@ \ifGm@vbody \ifx\Gm@height\@undefined \ifx\Gm@vscale\@undefined - \edef\Gm@height{\Gm@Dvscale\paperheight}% + \edef\Gm@height{\Gm@Dvscale\Gm@layoutheight}% \else - \edef\Gm@height{\Gm@vscale\paperheight}% + \edef\Gm@height{\Gm@vscale\Gm@layoutheight}% \fi \fi \ifx\Gm@lines\@undefined\else @@ -712,7 +718,19 @@ \fi \edef\Gm@height{\the\@tempdima}% \fi - \fi + \fi}% +\def\Gm@process{% + \ifGm@pass + \Gm@restore@org + \else + \Gm@@process + \fi}% +\def\Gm@@process{% + \Gm@expandlengths + \Gm@adjustpaper + \addtolength\Gm@layoutwidth{-\Gm@bindingoffset}% + \Gm@adjustmp + \Gm@adjustbody \Gm@detall{h}{width}{lmargin}{rmargin}% \Gm@detall{v}{height}{tmargin}{bmargin}% \setlength\textwidth{\Gm@width}% @@ -730,13 +748,6 @@ \ifGm@includemp \advance\evensidemargin\Gm@even@mp \fi - \ifGm@compatii - \ifx\Gm@twosideshift\@undefined - \def\Gm@twosideshift{20\Gm@truedimen pt}% - \fi - \addtolength\oddsidemargin{\Gm@twosideshift}% - \addtolength\evensidemargin{-\Gm@twosideshift}% - \fi \else \evensidemargin\oddsidemargin \fi @@ -768,61 +779,168 @@ \addtolength\@tempdimb{\topskip}% \textheight\@tempdimb \fi - \addtolength\paperwidth{\Gm@bindingoffset}% - \fi}% -\@onlypreamble\Gm@process -\def\Gm@showparams{% - -------------------- Geometry parameters^^J% - \ifGm@pass - 'pass' is specified!! (disables the geometry layouter)^^J% + \advance\oddsidemargin\Gm@layouthoffset% + \advance\evensidemargin\Gm@layouthoffset% + \advance\topmargin\Gm@layoutvoffset% + \addtolength\Gm@layoutwidth{\Gm@bindingoffset}% + }% end of \Gm@@process +\def\Gm@detectdriver{% + \ifx\Gm@driver\@empty + \typeout{*geometry* driver: auto-detecting}% + \ifpdf + \Gm@setdriver{pdftex}% + \else + \Gm@setdriver{dvips}% + \fi + \ifvtex + \Gm@setdriver{vtex}% + \fi + \@ifundefined{XeTeXversion}{}{\Gm@setdriver{xetex}}% \else - paper: \ifx\Gm@paper\@undefined class default\else\Gm@paper\fi^^J% - \Gm@checkbool{landscape}% - twocolumn: \if@twocolumn\Gm@true\else--\fi^^J% - twoside: \if@twoside\Gm@true\else--\fi^^J% - asymmetric: \if@mparswitch --\else\if@twoside\Gm@true\else --\fi\fi^^J% - h-parts: \Gm@lmargin, \Gm@width, \Gm@rmargin% - \ifnum\Gm@cnth=\z@\space(default)\fi^^J% - v-parts: \Gm@tmargin, \Gm@height, \Gm@bmargin% - \ifnum\Gm@cntv=\z@\space(default)\fi^^J% - hmarginratio: \ifnum\Gm@cnth<5 \ifnum\Gm@cnth=3--\else% - \Gm@hmarginratio\fi\else--\fi^^J% - vmarginratio: \ifnum\Gm@cntv<5 \ifnum\Gm@cntv=3--\else% - \Gm@vmarginratio\fi\else--\fi^^J% - lines: \@ifundefined{Gm@lines}{--}{\Gm@lines}^^J% - \Gm@checkbool{heightrounded}% - bindingoffset: \the\Gm@bindingoffset^^J% - truedimen: \ifx\Gm@truedimen\@empty --\else\Gm@true\fi^^J% - \Gm@checkbool{includehead}% - \Gm@checkbool{includefoot}% - \Gm@checkbool{includemp}% - driver: \if\Gm@driver\relax --\else\Gm@driver\fi^^J% + \ifx\Gm@driver\Gm@xetex %% + \@ifundefined{XeTeXversion}{\Gm@warning{% + Wrong driver setting: `xetex'; trying `pdftex' driver}% + \Gm@setdriver{pdftex}}{}% + \fi + \ifx\Gm@driver\Gm@vtex + \ifvtex\else + \Gm@warning{Wrong driver setting: `vtex'; trying `dvips' driver}% + \Gm@setdriver{dvips}% + \fi + \fi + \fi + \ifx\Gm@driver\relax + \typeout{*geometry* detected driver: <none>}% + \else + \typeout{*geometry* detected driver: \Gm@driver}% + \fi}% +\def\Gm@showparams#1{% + \ifGm@verbose\expandafter\typeout\else\expandafter\wlog\fi + {\Gm@logcontent{#1}}}% +\def\Gm@showbool#1{\@nameuse{ifGm@#1}#1\space\fi}% +\def\Gm@showdim#1{*gm \string#1=\the#1^^J}% +\def\Gm@logcontent#1{% + *geometry* verbose: parameters #1^^J% + \ifGm@pass *gm: pass (ignores the geometry layout)^^J% + \else + \if\Gm@driver\relax *gm driver: <none>^^J\else *gm driver: \Gm@driver^^J\fi + \ifx\Gm@paper\@undefined *gm paper: \the\paperwidth, \the\paperheight^^J% + \else *gm paper: \Gm@paper^^J\fi + \ifGm@layout *gm layout: \the\Gm@layoutwidth, \the\Gm@layoutheight^^J% + \else *gm layout: (same as paper)^^J\fi + \@ifundefined{Gm@lines}{}{*gm lines: \Gm@lines^^J}% + \@ifundefined{Gm@hmarginratio}{}{*gm hratio: \Gm@hmarginratio^^J}% + \@ifundefined{Gm@vmarginratio}{}{*gm vratio: \Gm@vmarginratio^^J}% + \ifdim\Gm@bindingoffset=\z@\else *gm bindingoffset: \the\Gm@bindingoffset^^J\fi + *gm L,W,R: \Gm@lmargin, \Gm@width, \Gm@rmargin^^J% + *gm T,H,B: \Gm@tmargin, \Gm@height, \Gm@bmargin^^J% + *gm switch-on: % + \Gm@showbool{landscape}% + \Gm@showbool{includehead}% + \Gm@showbool{includefoot}% + \Gm@showbool{includemp}% + \if@twoside twoside\space\fi% + \if@mparswitch\else\if@twoside asymmetric\space\fi\fi% + \Gm@showbool{heightrounded}% + \ifx\Gm@truedimen\@empty\else *gm truedimen\space\fi% + ^^J% \fi - -------------------- Page layout dimensions and switches^^J% - \string\paperwidth\space\space\the\paperwidth^^J% - \string\paperheight\space\the\paperheight^^J% - \string\textwidth\space\space\the\textwidth^^J% - \string\textheight\space\the\textheight^^J% - \string\oddsidemargin\space\space\the\oddsidemargin^^J% - \string\evensidemargin\space\the\evensidemargin^^J% - \string\topmargin\space\space\the\topmargin^^J% - \string\headheight\space\the\headheight^^J% - \string\headsep\@spaces\the\headsep^^J% - \string\footskip\space\space\space\the\footskip^^J% - \string\marginparwidth\space\the\marginparwidth^^J% - \string\marginparsep\space\space\space\the\marginparsep^^J% - \string\columnsep\space\space\the\columnsep^^J% - \string\skip\string\footins\space\space\the\skip\footins^^J% - \string\hoffset\space\the\hoffset^^J% - \string\voffset\space\the\voffset^^J% - \string\mag\space\the\mag^^J% - \if@twocolumn\string\@twocolumntrue\space\fi% - \if@twoside\string\@twosidetrue\space\fi% - \if@mparswitch\string\@mparswitchtrue\space\fi% - \if@reversemargin\string\@reversemargintrue\space\fi^^J% - (1in=72.27pt, 1cm=28.45pt)^^J% - -----------------------}% -\@onlypreamble\Gm@showparams + \Gm@showdim{\paperwidth}% + \Gm@showdim{\paperheight}% + \Gm@showdim{\textwidth}% + \Gm@showdim{\textheight}% + \Gm@showdim{\oddsidemargin}% + \Gm@showdim{\evensidemargin}% + \Gm@showdim{\topmargin}% + \Gm@showdim{\headheight}% + \Gm@showdim{\headsep}% + \Gm@showdim{\footskip}% + \Gm@showdim{\marginparwidth}% + \Gm@showdim{\marginparsep}% + \Gm@showdim{\columnsep}% + *gm \string\skip\string\footins=\the\skip\footins^^J% + \Gm@showdim{\hoffset}% + \Gm@showdim{\voffset}% + \Gm@showdim{\mag}% + \if@twocolumn *gm\space\string\@twocolumntrue^^J\fi% + \if@twoside *gm\space\string\@twosidetrue^^J\fi% + \if@mparswitch *gm\space\string\@mparswitchtrue^^J\fi% + \if@reversemargin *gm\space\string\@reversemargintrue^^J\fi% + *gm (1in=72.27pt, 1cm=28.4528pt)}% +\def\Gm@cropmark(#1,#2,#3,#4){% + \begin{picture}(0,0) + \setlength\unitlength{1truemm}\thinlines + \put(0,0){\line(#1,#2){5}} + \put(0,0){\line(#3,#4){5}} + \end{picture}}% +\newcommand*{\Gm@vrules@mpi}{% + \hb@xt@\@tempdima{\llap{\vrule height\textheight}\ignorespaces + \hskip \textwidth\vrule height\textheight\hskip \marginparsep + \llap{\vrule height\textheight}\hfil\vrule height\textheight}}% +\newcommand*{\Gm@vrules@mpii}{% + \hb@xt@\@tempdima{\hskip-\marginparwidth\hskip-\marginparsep + \llap{\vrule height\textheight}\ignorespaces + \hskip \marginparwidth\rlap{\vrule height\textheight}\hskip \marginparsep + \llap{\vrule height\textheight}\hskip\textwidth\rlap{\vrule height\textheight}\hss}}% +\providecommand*\vb@xt@{\vbox to}% +\newcommand*{\Gm@pageframes}{% + \vb@xt@\z@{\baselineskip\z@skip\lineskip\z@skip\lineskiplimit\z@% + \ifGm@showcrop + \vb@xt@\z@{\vskip-1\Gm@truedimen in\vskip\Gm@layoutvoffset% + \hb@xt@\z@{\hskip-1\Gm@truedimen in\hskip\Gm@layouthoffset% + \vb@xt@\Gm@layoutheight{% + \let\protect\relax + \hb@xt@\Gm@layoutwidth{\Gm@cropmark(1,0,0,-1)\hfil\Gm@cropmark(-1,0,0,-1)}% + \vfil + \hb@xt@\Gm@layoutwidth{\Gm@cropmark(1,0,0,1)\hfil\Gm@cropmark(-1,0,0,1)}}% + \hss}% + \vss}% + \fi% + \ifGm@showframe + \if@twoside + \ifodd\count\z@ + \let\@themargin\oddsidemargin + \else + \let\@themargin\evensidemargin + \fi + \fi + \moveright\@themargin% + \vb@xt@\z@{% + \vskip\topmargin\vb@xt@\z@{\vss\hrule width\textwidth}% + \vskip\headheight\vb@xt@\z@{\vss\hrule width\textwidth}% + \vskip\headsep\vb@xt@\z@{\vss\hrule width\textwidth} + \@tempdima\textwidth + \advance\@tempdima by \marginparsep + \advance\@tempdima by \marginparwidth + \if@mparswitch + \ifodd\count\z@ + \Gm@vrules@mpi + \else + \Gm@vrules@mpii + \fi + \else + \Gm@vrules@mpi + \fi + \vb@xt@\z@{\vss\hrule width\textwidth}% + \vskip\footskip\vb@xt@\z@{\vss\hrule width\textwidth}% + \vss}% + \fi% + }}% +\let\Gm@shipout\shipout +\newcommand*{\gm@shipi}{% + \ifvoid\@cclv\expandafter\aftergroup\fi\gm@shipii}% +\newcommand*\gm@shipii{% + \ifvoid\@cclv + \Gm@shipout\box\@cclv + \else + \ifGm@showframe + \Gm@shipout\vbox{\Gm@pageframes\ifvbox\@cclv\unvbox\else\box\fi\@cclv}% + \else\ifGm@showcrop + \Gm@shipout\vbox{\Gm@pageframes\ifvbox\@cclv\unvbox\else\box\fi\@cclv}% + \else + \Gm@shipout\box\@cclv + \fi\fi + \fi} \def\ProcessOptionsKV{\@ifnextchar[%] {\@ProcessOptionsKV}{\@ProcessOptionsKV[]}}% \def\@ProcessOptionsKV[#1]#2{% @@ -842,17 +960,18 @@ \edef\@tempa{\noexpand\setkeys{#2}{\@tempa}}% \@tempa \AtEndOfPackage{\let\@unprocessedoptions\relax}}% -\@onlypreamble\ProcessOptionsKV -\@onlypreamble\@ProcessOptionsKV -\Gm@init +\def\Gm@setkeys{\setkeys{Gm}}% +\def\Gm@processconfig{% + \let\Gm@origExecuteOptions\ExecuteOptions + \let\ExecuteOptions\Gm@setkeys + \InputIfFileExists{geometry.cfg}{}{} + \let\ExecuteOptions\Gm@origExecuteOptions}% +\Gm@save +\edef\Gm@restore@org{\Gm@restore}% +\Gm@initall +\Gm@processconfig \ProcessOptionsKV[c]{Gm}% \Gm@setdefaultpaper -\def\Gm@setkeys{\setkeys{Gm}}% -\@onlypreamble\Gm@setkeys -\let\Gm@origExecuteOptions\ExecuteOptions -\let\ExecuteOptions\Gm@setkeys -\InputIfFileExists{geometry.cfg}{}{}% -\let\ExecuteOptions\Gm@origExecuteOptions \ProcessOptionsKV[p]{Gm}% \Gm@process \AtBeginDocument{% @@ -872,21 +991,29 @@ \multiply\paperheight\the\mag \fi \fi - \Gm@checkdrivers - \ifx\Gm@driver\relax - \typeout{*geometry detected driver: <none>*}% - \else - \typeout{*geometry detected driver: \Gm@driver*}% + \Gm@detectdriver + \ifx\Gm@driver\Gm@xetex + \@ifundefined{pdfpagewidth}{}{% + \setlength\pdfpagewidth{\Gm@pw}% + \setlength\pdfpageheight{\Gm@ph}}% + \ifnum\mag=\@m\else + \ifx\Gm@truedimen\Gm@true + \setlength\paperwidth{\Gm@pw}% + \setlength\paperheight{\Gm@ph}% + \fi + \fi \fi \ifx\Gm@driver\Gm@pdftex - \setlength\pdfpagewidth{\Gm@pw}% - \setlength\pdfpageheight{\Gm@ph}% + \@ifundefined{pdfpagewidth}{}{% + \setlength\pdfpagewidth{\Gm@pw}% + \setlength\pdfpageheight{\Gm@ph}}% \ifnum\mag=\@m\else \@tempdima=\mag sp% - \divide\pdfhorigin\@tempdima - \multiply\pdfhorigin\@m - \divide\pdfvorigin\@tempdima - \multiply\pdfvorigin\@m + \@ifundefined{pdfhorigin}{}{% + \divide\pdfhorigin\@tempdima + \multiply\pdfhorigin\@m + \divide\pdfvorigin\@tempdima + \multiply\pdfvorigin\@m}% \ifx\Gm@truedimen\Gm@true \setlength\paperwidth{\Gm@pw}% \setlength\paperheight{\Gm@ph}% @@ -894,8 +1021,9 @@ \fi \fi \ifx\Gm@driver\Gm@vtex - \mediawidth=\paperwidth - \mediaheight=\paperheight + \@ifundefined{mediawidth}{}{% + \mediawidth=\paperwidth + \mediaheight=\paperheight}% \ifvtexdvi \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}% \fi @@ -914,46 +1042,56 @@ \fi \fi\fi \ifGm@showframe - \AtBeginDvi{% - \moveright\@themargin% - \vbox to\z@{\baselineskip\z@skip\lineskip\z@skip\lineskiplimit\z@% - \vskip\topmargin\vbox to\z@{\vss\hrule width\textwidth}% - \vskip\headheight\vbox to\z@{\vss\hrule width\textwidth}% - \vskip\headsep\vbox to\z@{\vss\hrule width\textwidth}% - \hbox to\textwidth{\llap{\vrule height\textheight}\hfil% - \vrule height\textheight}% - \vbox to\z@{\vss\hrule width\textwidth}% - \vskip\footskip\vbox to\z@{\vss\hrule width\textwidth}% - \vss}}% - \AtBeginDvi{% - \vbox to\z@{\baselineskip\z@skip\lineskip\z@skip\lineskiplimit\z@% - \vskip-1\Gm@truedimen in\rlap{\hskip-1\Gm@truedimen in% - \vbox to\z@{\vbox to\z@{\vss\hrule width\paperwidth}% - \hbox to \paperwidth{\llap{\vrule height\paperheight}\hfil% - \vrule height\paperheight}% - \vbox to\z@{\vss\hrule width\paperwidth}% - \vss}}\vss}}% - \fi + \renewcommand*{\shipout}{\afterassignment\gm@shipi\setbox\@cclv=} + \else\ifGm@showcrop + \renewcommand*{\shipout}{\afterassignment\gm@shipi\setbox\@cclv=} + \fi\fi + \Gm@save + \edef\Gm@restore@pkg{\Gm@restore}% \ifGm@verbose\ifGm@pass\else\Gm@checkmp\fi\fi - \ifGm@verbose\expandafter\typeout\else\expandafter\wlog\fi - {\Gm@showparams}% - \let\Gm@cnth\relax - \let\Gm@cntv\relax - \let\c@Gm@tempcnt\relax - \let\Gm@bindingoffset\relax - \let\Gm@wd@mp\relax - \let\Gm@odd@mp\relax - \let\Gm@even@mp\relax - \let\Gm@orgpw\relax - \let\Gm@orgph\relax - \let\Gm@pw\relax - \let\Gm@ph\relax - \let\Gm@dimlist\relax}% -\def\geometry#1{% + \setlength\@tempdima{\Gm@width}\edef\Gm@width{\the\@tempdima}% + \setlength\@tempdima{\Gm@height}\edef\Gm@height{\the\@tempdima}% + \Gm@showparams{in the preamble}% + }% end of \AtBeginDocument +\newcommand{\geometry}[1]{% \Gm@clean \setkeys{Gm}{#1}% \Gm@process}% \@onlypreamble\geometry +\DeclareRobustCommand\Gm@changelayout{% + \setlength{\@colht}{\textheight}\setlength{\@colroom}{\textheight}% + \setlength{\vsize}{\textheight}\setlength{\columnwidth}{\textwidth}% + \if@twocolumn% + \advance\columnwidth-\columnsep \divide\columnwidth\tw@% + \@firstcolumntrue% + \fi% + \setlength{\hsize}{\columnwidth}% + \setlength{\linewidth}{\hsize}}% +\newcommand\newgeometry[1]{% + \clearpage + \Gm@restore@org + \Gm@initnewgm + \Gm@newgmtrue + \setkeys{Gm}{#1}% + \Gm@newgmfalse + \Gm@process + \Gm@changelayout + \Gm@showparams{by \string\newgeometry}}% +\newcommand\restoregeometry{% + \clearpage + \Gm@restore@pkg + \Gm@changelayout}% +\newcommand*\savegeometry[1]{% + \Gm@save + \expandafter\edef\csname Gm@restore@@#1\endcsname{\Gm@restore}}% +\newcommand*\loadgeometry[1]{% + \clearpage + \@ifundefined{Gm@restore@@#1}{% + \PackageError{geometry}{% + \string\loadgeometry : name `#1' undefined}{% + The name `#1' should be predefined with \string\savegeometry}% + }{\@nameuse{Gm@restore@@#1}% + \Gm@changelayout}}% \endinput %% %% End of file `geometry.sty'. |