% \iffalse meta-comment %% File: geometry.dtx Copyright (C) 1996-2002 Hideo Umeki %% (hideo.umeki@toshiba.co.jp) %% %% This package may be distributed under the terms of the LaTeX %% Project Public License, as described in lppl.txt in the base %% LaTeX distribution, either version 1.2 or (at your option) %% any later version. %% % %\NeedsTeXFormat{LaTeX2e}% %\ProvidesPackage{geometry}[2002/07/08 v3.2 Page Geometry] %\ProvidesFile{geometry.drv} %\ProvidesFile{manual.drv} % [Geometry documentation driver file] % [Geometry manual driver file (A4 PDF)] %<*driver|manual> \documentclass{ltxdoc} \usepackage{times} \def\ttdefault{cmtt} %\usepackage[colorlinks, linkcolor=blue, % pdftitle={Geometry Manual}, pdfauthor={Hideo Umeki}]{hyperref} \usepackage[ hmargin={4cm,1.5cm},top=1.5cm, marginpar=3.5cm % ,a4paper,pdftex, hmargin=3cm, top=2cm ]{geometry} %\OnlyDescription %%\OnlyDescription \begin{document} \GetFileInfo{geometry.sty} \title{The \textsf{geometry} package} \author{Hideo UMEKI\\\texttt{hideo.umeki@toshiba.co.jp}} \date{\filedate~~\fileversion{}} \maketitle \DocInput{geometry.dtx} \end{document} % % \fi % % \CheckSum{2369} % % \def\OpenB{{\ttfamily\char`\{}} % \def\Comma{{\ttfamily\char`,}} % \def\CloseB{{\ttfamily\char`\}}} % \newcommand\argii[2]{\OpenB\meta{#1}\Comma\meta{#2}\CloseB} % \newcommand\argiii[3]{\OpenB\meta{#1}\Comma\meta{#2}\Comma\meta{#3}\CloseB} % \newcommand\vargii[2]{\OpenB#1\Comma#2\CloseB} % \newcommand\vargiii[3]{\OpenB#1\Comma#2\Comma#3\CloseB} % \newcommand\OR{\ \strut\vrule width .4pt\ } % \newcommand\gpart[1]{\textsl{#1}} % \newcommand\glen[1]{\textsf{#1}} % \newcommand\New[1]{\llap{$^{\star#1\:}$}} % \newcommand\Mod[1]{\llap{$^{\dagger#1\:}$}} % \newenvironment{key}[2]{\expandafter\macro\expandafter{`#2'}}{\endmacro} % \newenvironment{Options}% % {\begin{list}{}{% % \renewcommand{\makelabel}[1]{\texttt{##1}\hfil}% % \setlength{\itemsep}{-.5\parsep} % \settowidth{\labelwidth}{\texttt{xxxxxxxxxxx\space}}% % \setlength{\leftmargin}{\labelwidth}% % \addtolength{\leftmargin}{\labelsep}}% % \raggedright} % {\end{list}} % % \MakeShortVerb{|} % % \begin{abstract} % This package provides a flexible and complete user interface to page % dimensions. You can specify them by using intuitive parameters to get % your desired page layout. For example, if you want to set margins % (the left, right, top and bottom margins) to 2cm from each edge of % the paper, what you need is just |\usepackage[margin=2cm]{geometry}|. % \end{abstract} % % \newif\ifmulticols % \IfFileExists{multicol.sty}{\multicolstrue}{} % \ifmulticols % \addtocontents{toc}{% % \protect\setlength{\columnsep}{3pc}% % \protect\begin{multicols}{2}} % \fi % {\parskip 0pt % \tableofcontents % } % % \section{Preface to Version 3} % % The \textsf{geometry} package becomes even more flexible and powerful with % the release of version 3. This new release contains major changes and % enhancements in user interface, calculation schemes and the default settings % of the page dimensions. % \begin{itemize} % \item \textbf{New default layout.}\par % The `automatic' centering is no longer default layout. Instead of % centering, the idea of margin ratio and common values for default settings % are introduced: the ratio of left (inner) margin to right (outer) margin % is set 1:1 (2:3 for twoside), and the ratio of top to bottom is set 2:3. % The margin ratios can be specified by newly introduced options, % e.g. |marginratio| (see Section~\ref{sec:completion} and \ref{sec:margin} % for the detail). In addition, the spaces for the head and foot of the % page are disregarded in calculating the placement of the text area by % default. Furthermore the default |scale| of the type area is set to % |0.7| with 70\% of the width and height of the paper. % If you want to use the old default layout of version 2.3 or earlier, % add |compat2| as a first option, e.g., % |\usepackage[compat2,left=1.5in]{geometry}|, which sets % the old default options % \texttt{[scale=\{0.8,0.9\}, centering, includeheadfoot]} and allows % the subsequent options to behave as if they are used in the old version. % See also Section~\ref{sec:default} for the detail of the default layout. % % \item \textbf{Option |twosideshift| is obsoleted.} \par % |twoside| and other geometry options can substitute for it. % A new option |bindingoffset| might be also helpful to control margins for % oneside/twoside. For the detail, see Section~\ref{sec:margin}. % % \item \textbf{Option |includemp| becomes independent of |marginparwidth| % and |marginparsep|.} \par % In the previous version, |marginparwidth| or |marginparsep| % automatically set |includemp=true|. Now if you want |includemp| mode, % |includemp| should be set explicitly. % % \item \textbf{Options |nohead|, |nofoot| and |noheadfoot| become % order-dependent and overwritable} \par % In the previous version, these options was order-independent: % |nohead,headsep=10pt| resulted in just |nohead| (\cs{headsep}|=0pt|, % \cs{headheight}|=0pt|), for example. But now they are overwritable % by subsequent options. The above case results in \cs{headheight}|=0pt| % and \cs{headsep}|=10pt|. % % \item \textbf{A complete set of options |ignore*| and |include*| for % head, foot and marginpar.}\par % The previous version has only |includemp|, which denotes that the width % of marginpar is included in the total body width. % Now |ignore|\{|head|, |foot|, |headfoot|, |mp|, |all|\} and % |include|\{|head|, |foot|, |headfoot|, |all|\} are newly added. % If one of these |ignore*| is set, the corresponding space(s) are % disregarded in auto-completion calculation. % In version 3, |ignoreall| is set by default. So if you need to include % the spaces for the head, foot and marginpar, the corresponding |include*| % should be set explicitly. In addition, unlike the previous version, % neither |reversemp|, |marginparwidth| nor |marginparsep| sets |includemp| % automatically. % % \item \textbf{New option |lines|.}\par % The option enables users to specify \cs{textheight} by the number of % lines included in \cs{textheight}, e.g., |lines=20|. % % \item \textbf{New option |heightrounded|.}\par % The option rounds \cs{textheight} to \textit{n}-times (\textit{n}: % an integer) of \cs{baselineskip} plus \cs{topskip} to avoid ``underfull % vbox'' in some cases. % % \item \textbf{New option |screen|.}\par % To make presentation with PC and video projector, geometry option % |screen,centering| with `slide' documentclass would be the best choice. % % \item \textbf{New option |asymmetric|.}\par % The option implements a twosided layout in which margins are not swapped % on alternate pages and the marginal notes stay always on the same side. % % \item \textbf{New option |showframe|.}\par % The option displays visible frames for the text area and page, and lines % for the head and foot to check layout in detail. Therefore |showframe.sty| % is excluded from the \textsf{geometry} package distribution. % % \item \textbf{New option |pass|.}\par % The option disables auto-layout and all of the geometry settings except % |verbose| and |showframe|. It can be used for checking out the page % layout of the documentclass, other packages and manual settings % without \textsf{geometry}. % \end{itemize} % See the text for the detail. All the new and modified options in this % release are marked with `$\star3$' and `$\dagger3$' respectively. % % \section{Introduction} % % To set dimensions for page layout in \LaTeX\ is not straightforward. % You need to adjust several \LaTeX{} native dimensions to place a text area % where you want % If you want to center the text area in the paper you use, for example, % you have to specify native dimensions as follows: % \begin{quote} % |\usepackage{calc}|\\ % |\setlength\textwidth{7in}|\\ % |\setlength\textheight{10in}|\\ % |\setlength\oddsidemargin{(\paperwidth-\textwidth)/2 - 1in}|\\ % |\setlength\topmargin{(\paperheight-\textheight|\\ % | -\headheight-\headsep-\footskip)/2 - 1in}|. % \end{quote} % Without package \textsl{calc}, the above example would need % more tedious settings. Package \textsf{geometry} provides an easy % way to set page layout parameters. In this case, what you have to do % is just % \begin{quote} % |\usepackage[text={7in,10in},centering]{geometry}|. % \end{quote} % Besides centering problem, setting margins from each edge of the paper is % also troublesome. But \textsf{geometry} also make it easy. % If you want to set each margin 1.5in, you can go % \begin{quote} % |\usepackage[margin=1.5in]{geometry}| % \end{quote} % In both cases, the unspecified dimensions are automatically determined. % The package will be also useful when you have to set page layout obeying % the following strict instructions: for example, % \begin{quote}\slshape % The total allowable width of the text area is 6.5 inches wide by 8.75 % inches high. The top margin on each page should be 1.2 inches from % the top edge of the page. The left margin should be 0.9 inch from % the left edge. The footer with page number should be at the bottom % of the text area. % \end{quote} % In this case, using \textsf{geometry} you can go % \begin{quote} % |\usepackage[total={6.5in,8.75in},|\\ % | top=1.2in, left=0.9in, includefoot]{geometry}|. % \end{quote} % % Setting a text area on the paper in document preparation system has some % analogy to placing a window on the background in the window system. % The name `geometry' comes from the |-geometry| option used for specifying % a size and location of a window in X Window System. % % \section{Page Geometry} % \subsection{Layout Dimensions} % To realize a straightforward setting for page layout, the following page % structure is introduced: A paper contains a total body (printable area) % and margins. The total body consists of a body (text area) with optional % a header, a footer and marginal notes (marginpar). There are four margins: % the left, right, top and bottom margins. For twosided documents, horizontal % margins should be called the inner and outer margins. % \begin{quote} % \begin{tabular}{rcl} % \gpart{paper}&:&\gpart{total body} and % \gpart{margins}\\ % \gpart{total body}&:&\gpart{body} (text area)\quad % (optional \gpart{head}, \gpart{foot} and \gpart{marginpar})\\ % \gpart{margins}&:&\gpart{left}(\gpart{inner}), % \gpart{right}(\gpart{outer}), \gpart{top} and \gpart{bottom} % \end{tabular} % \end{quote} % Each margin is measured from the corresponding edge of a paper. % For example, left margin (inner margin) means a horizontal distance % between the left (inner) edge of the paper and that of the total body. % Therefore the left and top margins defined in \textsf{geometry} % are different from the native dimensions \cs{leftmargin} % and \cs{topmargin}. % The size of a body (text area) can be modified by \cs{textwidth} and % \cs{textheight}. % % The layout parts and the corresponding dimension names used in this % package are showed schematically in Figure~\ref{fig:layout}. % \begin{figure} % \centering\small % {\unitlength=.65pt % \begin{picture}(450,250)(0,-10) % \put(20,0){\framebox(170,230){}} % \put(20,235){\makebox(170,230)[br]{\gpart{paper}}} % \put(40,30){\framebox(120,170){}} % \put(40,30){\makebox(120,165)[tr]{\gpart{total body}~}} % \put(45,30){\makebox(0,170)[l]{|height|}} % \put(50,35){\makebox(120,0)[bc]{|width|}} % \put(50,-20){\makebox(120,0)[bc]{|paperwidth|}} % \put(10,45){\makebox(0,170)[r]{|paperheight|}} % \put(90,200){\makebox(0,30)[lc]{|top|}} % \put(90,0){\makebox(0,30)[lc]{|bottom|}} % \put(10,70){\makebox(0,0)[r]{|left|}} % \put(10,55){\makebox(0,0)[r]{(|inner|)}} % \put(200,70){\makebox(0,0)[l]{|right|}} % \put(200,55){\makebox(0,0)[l]{(|outer|)}} % \put(80,230){\vector(0,-1){30}}\put(80,30){\vector(0,-1){30}} % \put(80,200){\vector(0,1){30}}\put(80,0){\vector(0,1){30}} % \put(20,70){\vector(1,0){20}}\put(40,70){\vector(-1,0){20}} % \put(160,70){\vector(1,0){30}}\put(190,70){\vector(-1,0){30}} % \multiput(160,30)(5,0){24}{\line(1,0){2}} % \multiput(160,200)(5,0){24}{\line(1,0){2}} % \put(280,30){\framebox(120,170){}} % \put(280,30){\makebox(120,165)[tr]{\gpart{total body}~}} % \put(280,220){\line(1,0){120}} % \put(280,208){\makebox(120,20)[bc]{\gpart{head}}} % \put(280,207){\line(1,0){120}} % \put(410,215){\makebox(0,0)[l]{|headheight|}} % \put(410,203){\makebox(0,0)[l]{|headsep|}} % \put(410,110){\makebox(0,0)[l]{|textheight|}} % \put(280,35){\makebox(120,0)[bc]{|textwidth|}} % \put(410,20){\makebox(0,0)[l]{|footskip|}} % \put(280,40){\makebox(120,140)[c]{\gpart{body}}} % \put(280,15){\makebox(120,10)[c]{\gpart{foot}}} % \put(280,14){\line(1,0){120}} % \end{picture}} % \caption[Dimension names for \textsf{geometry}]{% % \begin{minipage}[t]{.8\textwidth}\raggedright\small % Dimension names used in the \textsf{geometry} package. % |width|=|textwidth| and |height|=|textheight| by default. % |left|, |right|, |top| and |bottom| are margins. % If margins on verso pages are swapped by |twoside| option, % margins specified by |left| and |right| options % are used for the inside and outside margins respectively. % |inner| and |outer| are aliases of |left| and |right| % respectively. % \end{minipage}} % \label{fig:layout} % \end{figure} % The dimensions for paper, total body and margins have the following % relations. % \begin{eqnarray} % \label{eq:paperwidth} % |paperwidth| &=& |left|+|width|+|right| \\ % |paperheight| &=& |top|+|height|+|bottom| % \label{eq:paperheight} % \end{eqnarray} % The dimensions of the total body, |width| and |height|, are defined % as follows: % \begin{eqnarray} % \label{eq:width} % |width| &:=& |textwidth| \quad( + |marginparsep| + |marginparwidth| )\\ % |height| &:=& |textheight| \quad(+ |headheight| + |headsep| + |footskip| ) % \label{eq:height} % \end{eqnarray} % In Equation (\ref{eq:width}), |width:=textwidth| by default, % but |marginparsep| and |marginparwidth| are included in |width| % if |includemp| option is set |true|. % In Equation (\ref{eq:height}), |height:=textheight| by default. % If |includehead| is set to |true|, |headheight| and |headsep| are % considered as a part of |height| in the the vertical completion calculation. % In the same way, |includefoot| includes % |footskip|. Note that options |ignore*| just exclude the corresponding % spaces from |textheight|, but do not change those lengths themselves. % Figure~\ref{fig:includes} shows how these options work. % \begin{figure} % \centering\small % {\unitlength=.65pt % \begin{picture}(490,280)(0,-10) % \put(25,255){\makebox(120,0)[bl]{\textbf{(a)}~\textit{default}}}% % \put(20,0){\framebox(170,230){}} % \put(20,230){\makebox(170,230)[br]{\gpart{paper}}} % \put(40,30){\framebox(120,165){}} % \put(70,165){\vector(0,1){30}} % \put(55,145){\makebox(0,20)[lc]{|textheight|}} % \put(70,145){\vector(0,-1){115}} % \multiput(40,203)(5,0){24}{\line(1,0){3}} % \multiput(40,213)(5,0){24}{\line(1,0){3}} % \multiput(40,10)(5,0){24}{\line(1,0){3}} % \put(40,203){\makebox(120,20)[bc]{\gpart{head}}} % \put(40,40){\makebox(120,140)[c]{\gpart{body}}} % \put(40,10){\makebox(120,10)[c]{\gpart{foot}}} % \put(150,230){\vector(0,-1){35}}\put(150,30){\vector(0,-1){30}} % \put(150,195){\vector(0,1){35}}\put(150,0){\vector(0,1){30}} % \put(160,197){\makebox(0,30)[lc]{|top|}} % \put(160,0){\makebox(0,30)[lc]{|bottom|}} % \multiput(160,30)(5,0){24}{\line(1,0){2}} % \multiput(160,195)(5,0){24}{\line(1,0){2}} % \put(265,255){\makebox(120,0)[bl] % {\textbf{(b)}~|includehead| and |includefoot|}}% % \put(260,0){\framebox(170,230){}} % \put(260,230){\makebox(170,230)[br]{\gpart{paper}}} % \put(280,30){\framebox(120,165){}} % \put(310,150){\vector(0,1){25}} % \put(295,130){\makebox(0,20)[lc]{|textheight|}} % \put(310,130){\vector(0,-1){80}} % \multiput(280,183)(5,0){24}{\line(1,0){3}} % \multiput(280,175)(5,0){24}{\line(1,0){3}} % \multiput(280,50)(5,0){24}{\line(1,0){3}} % \put(280,183){\makebox(120,20)[bc]{\gpart{head}}} % \put(280,40){\makebox(120,140)[c]{\gpart{body}}} % \put(400,140){\line(1,1){45}} % \put(437,187){\makebox(50,10)[l]{\gpart{total body}}} % \put(280,30){\makebox(120,10)[c]{\gpart{foot}}} % \put(370,230){\vector(0,-1){35}}\put(370,30){\vector(0,-1){30}} % \put(370,195){\vector(0,1){35}}\put(370,0){\vector(0,1){30}} % \put(380,197){\makebox(0,30)[lc]{|top|}} % \put(380,0){\makebox(0,30)[lc]{|bottom|}} % \end{picture}} % \caption[An effect of \texttt{includehead} and \texttt{includefoot}.]{% % \begin{minipage}[t]{.8\textwidth}\raggedright\small % |includehead| and |includefoot| include the head and foot respectively % into \gpart{total body}. \textbf{(a)} |height| $=$ |textheight| (default). % \textbf{(b)} |height| $=$ |textheight| $+$ |headheight| $+$ |headsep| $+$ % |footskip| if |includehead| and |includefoot|. If the top and bottom % margins are fixed, |includehead| and |includefoot| make |textheight| % shorter than default. % \end{minipage}} % \label{fig:includes} % \end{figure} % Each of the seven dimensions in the right-hand side of Equations % (\ref{eq:width}) and (\ref{eq:height}) corresponds to the ordinary % \LaTeX\ control sequence with the same name. % % Figure~\ref{fig:modes} illustrates various layouts with different layout % modes. The dimensions for a header and a footer can be controlled by % |nohead| or |nofoot| mode, which sets each length to 0pt directly. % On the other hand, options |ignore*| do \textit{not} change % the corresponding native dimensions. % \begin{figure} % \centering\small % {\unitlength=.65pt % \begin{picture}(460,525)(0,0) % \put( 20,310){\framebox(120,170){}} % \put( 20,507){\makebox(120,0)[bl]% % {\textbf{(a)}~|includeheadfoot|}} % \put( 20,460){\line(1,0){120}}\put( 20,450){\line(1,0){120}} % \put( 20,330){\line(1,0){120}} % \put( 20,485){\makebox(120,0)[br]{\gpart{total body}}} % \put( 20,335){\makebox(120,0)[bc]{|textwidth|}} % \put(150,470){\makebox(0,0)[l]{|headheight|}} % \put(150,450){\makebox(0,0)[l]{|headsep|}} % \put(150,390){\makebox(0,0)[l]{|textheight|}} % \put(150,320){\makebox(0,0)[l]{|footskip|}} % \put( 10,460){\makebox(120,20)[bc]{\gpart{head}}} % \put( 10,320){\makebox(120,140)[c]{\gpart{body}}} % \put( 10,310){\makebox(120,10)[c]{\gpart{foot}}} % \put(250,310){\framebox(120,170){}} % \put(250,507){\makebox(120,0)[bl]% % {\textbf{(b)}~|includeall|}} % \put(250,460){\line(1,0){95}}\put(250,450){\line(1,0){95}} % \put(250,330){\line(1,0){95}}\put(345,330){\line(0,1){120}} % \put(350,330){\line(0,1){120}}\put(350,450){\line(1,0){20}} % \put(350,330){\line(1,0){20}} % \put(250,485){\makebox(120,0)[br]{\gpart{total body}}} % \put(250,460){\makebox(95,20)[bc]{\gpart{head}}} % \put(250,320){\makebox(95,140)[c]{\gpart{body}}} % \put(385,390){\makebox(95,0)[cl]% % {\gpart{\shortstack[l]{marginal\\note}}}} % \put(250,310){\makebox(95,10)[c]{\gpart{foot}}} % \put(250,335){\makebox(95,0)[bc]{|textwidth|}} % \multiput(360, 390)(4,0){6}{\line(1,0){2}} % \multiput(348,333)(0,-4){12}{\line(0,1){2}} % \multiput(360,333)(0,-4){8}{\line(0,1){2}} % \put(355,292){\makebox(0,0)[bl]{|marginparwidth|}} % \put(345,275){\makebox(0,0)[bl]{|marginparsep|}} % \put( 20, 40){\framebox(120,170){}} % \put( 20,237){\makebox(120,0)[bl]% % {\textbf{(c)}~|includefoot|}} % \put( 20, 60){\line(1,0){120}} % \put( 20,215){\makebox(120,0)[br]{\gpart{total body}}} % \put(150,130){\makebox(0,0)[l]{|textheight|}} % \put(150, 50){\makebox(0,0)[l]{|footskip|}} % \put( 20, 50){\makebox(120,160)[c]{\gpart{body}}} % \put( 20, 40){\makebox(120,10)[c]{\gpart{foot}}} % \put( 20, 65){\makebox(120,10)[c]{|textwidth|}} % \put(250, 40){\framebox(120,170){}} % \put(250,237){\makebox(120,0)[bl]% % {\textbf{(d)}~|includefoot,includemp|}} % \put(250, 60){\line(1,0){95}}\put(350, 60){\line(1,0){20}} % \put(250,215){\makebox(120,0)[br]{\gpart{total body}}} % \put(250, 50){\makebox(95,160)[c]{\gpart{body}}} % \put(385,130){\makebox(95,0)[cl]% % {\gpart{\shortstack[l]{marginal\\note}}}} % \put(250, 40){\makebox(95,10)[c]{\gpart{foot}}} % \put(250, 65){\makebox(95,0)[bc]{|textwidth|}} % \put(345, 60){\line(0,1){150}}\put(350, 60){\line(0,1){150}} % \multiput(360, 130)(4,0){6}{\line(1,0){2}} % \multiput(348, 63)(0,-4){12}{\line(0,1){2}} % \multiput(360, 63)(0,-4){8}{\line(0,1){2}} % \put(355,22){\makebox(0,0)[bl]{|marginparwidth|}} % \put(345, 5){\makebox(0,0)[bl]{|marginparsep|}} % \end{picture}} % \caption[Sample layouts for \gpart{total body} with different % layout modes]{% % \begin{minipage}[t]{.8\textwidth}\small % Sample layouts for \gpart{total body} with different switches. % (a) |includeheadfoot|, (b) |includeall|, (c) |includefoot| % and (d) |includefoot,includemp|. % If |reversemp| is set to |true|, the location of the % marginal notes are swapped on every page. % Option |twoside| swaps both margins and marginal notes on verso pages. % Note that the marginal notes are printed on the page, even when % |ignoremp| or |includemp=false|, but can fall off the page in some cases. % \end{minipage}} % \label{fig:modes} % \end{figure} % % \subsection{Auto-Completion Scheme}\label{sec:completion} % % Suppose that the paper size is pre-defined in Equation~(\ref{eq:paperwidth}) % or (\ref{eq:paperheight}), if two dimensions out of the three dimensions % in the right-hand side of each equation are specified, the rest of the % dimensions can be determined by the specified ones. However, when none or % only one of the three dimensions is specified, the rest of the dimensions % can't generally be determined without some assumptions. % % The \textsf{geometry} package has an auto-completion scheme with some % default parameters to determine the unspecified dimensions independently % for each direction. If the size of \gpart{total body} (i.e., |width| in % the horizontal direction) is specified, the margins (|left| and |right|) % can be determined with a default ratio of one margin to the other % (|left/right|). % If one margin is specified, the rest of dimensions can also be determined % by the default margin ratio. % Page margin setting by margin ratio was introduced in KOMA % script\footnote{CTAN:~\texttt{macros/latex/contrib/supported/koma-script} % by Frank Neukam and Markus Kohm.}. % % The default vertical margin ratio is $2/3$, namely, % \begin{equation} % |top| : |bottom| = 2 : 3 \qquad\textit{default}. % \end{equation} % As for the horizontal margin ratio, the default value depends on % whether the document is onesided or twosided, % \begin{equation} % |left|\;(|inner|) : |right|\;(|outer|) % = \left\{ \begin{array}{ll} % 1 : 1 \qquad\textit{default for oneside},\\ % 2 : 3 \qquad\textit{default for twoside}. % \end{array}\right. % \end{equation} % Obviously the default horizontal margin ratio for oneside is `centering'. % % For example, if one specifies |right=2.4cm| with a \textit{twosided} % layout in A4 paper (21.0cm$\times$29.7cm), unspecified |left| and |width| % are automatically determined using the default horizontal margin ratio % (2/3) as follows: % \begin{eqnarray} % |left| &=& \langle\textsf{horizontal-margin-ratio}\rangle % \times |right| \nonumber\\ % &=& |2/3| \times |2.4cm| = |1.6cm|\\[1ex] % |width| &=& |paperwidth| - |left| - |right| \nonumber\\ % &=& |21.0cm| - |1.6cm| - |2.4cm| = |17.0cm|. % \end{eqnarray} % In this case, the vertical dimensions |top|, |height| and |bottom| % are determined by the default vertical margin ratio with 2:3 % and the default size of \gpart{total body} with 70\% of the paper height: % \begin{eqnarray}\displaystyle % |height| &=& |0.7| \times |paperheight|\nonumber\\ % &=& |0.7| \times |29.7cm| = |20.79cm| \\[1ex] % |top| &=& \frac{\langle\textsf{vertical-margin-ratio}\rangle} % {1+\langle\textsf{vertical-margin-ratio}\rangle} % \times (|paperheight| - |height|) \nonumber\\ % &=& \frac{2}{2+3}\times(|29.7cm| - |20.79cm|)\nonumber\\[1ex] % &=& 0.4\times |8.91cm| = |3.564cm|\\[2ex] % |bottom| &=& 0.6\times |8.91cm| = |5.346cm| % \end{eqnarray} % % The auto-completion rules are shown in Table~\ref{tab:completion} % and Equation~(\ref{eq:completion}). % $A$, $B$ and $C$ in Table~\ref{tab:completion} are user-specified values, % $*$ denotes unspecified ones. The right-hand side table shows the % corresponding results of auto-completion. The unspecified values can be % determined by $A$, $B$ and $L$ (|paperwidth| or |paperheight|). % In Table~\ref{tab:completion}, functions ${\cal R}(x)$ and ${\cal M}(x)$ % are defined as follows: % \begin{equation} % \begin{array}{rcl} % {\cal R}(x) &=& L-x\\ % {\cal M}(x) &=& {\cal R}(x)\;/\;(1+\sigma)\\ % \end{array} % \label{eq:completion} % \end{equation} % Here $\sigma$ denotes the ratio of left margin (inner) to right margin % (outer) or the ratio of top to bottom. To set $\sigma$ as a geometry option, % you can use \{|h|,|v|\}|marginratio| options with |a:b|-type value, % for example, |hmarginratio=2:3|. % \begin{eqnarray} % \label{eq:hratios} % |hmarginratio| &=& |left| : |right|\\ % |vmarginratio| &=& |top| : |bottom| % \label{eq:vratios} % \end{eqnarray} % By default, $\sigma$ is 1/1 (=1) for oneside and 2/3 for twoside % in the horizontal direction, and 2/3 in the vertical. % If none of three dimensions is specified in each direction, the default % setting is used: width and height is set to 70\% of the paper width % and height respectively. If all the three dimensions would be specified, % margins remain and width or height is ignored. % % \begin{table} % \def\AST{\texttt{*}}\centering % \begin{tabular}{cccccccl} % \multicolumn{3}{c}{Settings}& &\multicolumn{3}{c}{Results}\\ % \noalign{\vspace{.1em}} % \cline{1-3}\cline{5-7} % \parbox{3em}{\hfil\glen{left}}&\parbox{3em}{\hfil\glen{width}}& % \parbox{3em}{\hfil\glen{right}}&&% % \parbox{3em}{\hfil\glen{left}}&\parbox{3em}{\hfil\glen{width}}& % \parbox{3em}{\hfil\glen{right}}&\\ % \cline{1-3}\cline{5-7} % \glen{top}&\glen{height}&\glen{bottom}&&% % \glen{top}&\glen{height}&\glen{bottom}&\\ % \cline{1-3}\cline{5-7} % \noalign{\vspace{.2em}} % \AST & \AST & \AST && $\sigma{\cal M}(0.7L)$ & $0.7L$ & ${\cal M}(0.7L)$&\\ % \AST & $A$ & \AST && $\sigma{\cal M}(A)$ & $A$ & ${\cal M}(A)$ &\\ % $A$ & \AST & \AST && $A$ & ${\cal R}(A+A/\sigma)$ & $A/\sigma$ &\\ % \AST & \AST & $A$ &$\Longrightarrow$% % & $\sigma A$ & ${\cal R}(A+\sigma{}A)$ & $A$ &\\ % $A$ & $B$ & \AST && $A$ & $B$ & ${\cal R}(A+B)$ &\\ % \AST & $A$ & $B$ && ${\cal R}(A+B)$ & $A$ & $B$ &\\ % $A$ & \AST & $B$ && $A$ & ${\cal R}(A+B)$ & $B$ &\\ % $A$ & $C$ & $B$ && $A$ & ${\cal R}(A+B)$ & $B$ &\\ % \cline{1-3}\cline{5-7} % \end{tabular} % \caption[Auto-comletion rules]{% % \begin{minipage}[t]{.8\textwidth}\small % Auto-completion rules. The mark `|*|' in each row (left table) denotes % the dimensions not specified explicitly, which can be determined as the % corresponding Results (right table). $\sigma$ denotes the value of % margin ratio. Functions ${\cal R}(x)$ and ${\cal M}(x)$ are defined % in Equation~(\ref{eq:completion}). The bottom case shows % over-specification, which gives in the same result as the $A$-\AST-$B$ case. % \end{minipage}} % \label{tab:completion} % \end{table} % % \section{User Interface} % \subsection{General Features} % % The geometry options using the \textsf{keyval} interface % `\meta{key}=\meta{value}' can be set either in the optional argument to % the \cs{usepackage} command, or in the argument of the % \cs{geometry} macro. This macro, if necessary, should be used only in the % preamble, i.e., before |\begin{document}|. % In either case, the argument consists of a list of % comma-separated \textsf{keyval} options. % The main features of setting options are listed below. % \begin{itemize}\itemsep=0pt % \item Multiple lines are allowed. (But blank lines are not allowed.) % \item Any spaces between words are ignored. % \item Options are basically order-independent.\\ % (There are some exceptions. See Section~\ref{sec:order-depend} % for details.) % \end{itemize} % For example, % \begin{quote} % |\usepackage[ a5paper , hmargin = { 3cm,|\\ % | .8in } , height|\\ % | = 10in ]{geometry}| % \end{quote} % is equivalent to % \begin{quote} % |\usepackage[height=10in,a5paper,hmargin={3cm,0.8in}]{geometry}| % \end{quote} % Some options are allowed to have sub-list, e.g. |{3cm,0.8in}|. % Note that the order of values in the sub-list is significant. % The above setting is also equivalent to the followings: % \begin{quote} % |\usepackage{geometry}|\\ % |\geometry{height=10in,a5paper,hmargin={3cm,0.8in}}| % \end{quote} % or % \begin{quote} % |\usepackage[a5paper]{geometry}|\\ % |\geometry{hmargin={3cm,0.8in},height=8in}|\\ % |\geometry{height=10in}|. % \end{quote} % Thus, multiple use of \cs{geometry} just appends options. % % \textsf{Geometry} supports package % \textsl{calc}\footnote{CTAN:~\texttt{macros/latex/required/tools}}. % For example, % \begin{quote} % |\usepackage{calc}|\\ % |\usepackage[textheight=20\baselineskip+10pt]{geometry}| % \end{quote} % % \subsection{Option Types} % \textsf{Geometry} options are categorized into four types: % % \begin{enumerate}\itemsep=0pt % \item \textbf{Boolean type} % % takes a boolean value (|true| or |false|). If no value, % |true| is set by default. % \begin{quote} % \meta{key}|=true|\OR|false|.\\ % \meta{key} with no value is equivalent to % \meta{key}|=true|. % \end{quote} % \textit{Examples:}~ |verbose=true|, |includehead|, % |twoside=false|.\\ % Paper name is the exception. The preferred paper name should be set % with no values. Whatever value is given, it is ignored. For % instance, |a4paper=XXX| is equivalent to |a4paper|. % % \item \textbf{Single-valued type} % % takes a mandatory value. % \begin{quote} % \meta{key}|=|\meta{value}. % \end{quote} % \textit{Examples:}~ |width=7in|, |left=1.25in|, % |footskip=1cm|, |height=.86\paperheight|. % % \item \textbf{Double-valued type} % % takes a pair of comma-separated values in braces. The two values can % be shortened to one value if they are identical. % \begin{quote} % \meta{key}|=|\argii{value1}{value2}.\\ % \meta{key}|=|\meta{value} is equivalent to % \meta{key}|=|\argii{value}{value}. % \end{quote} % \textit{Examples:}~ |hmargin={1.5in,1in}|, |scale=0.8|, % |body={7in,10in}|. % % \item \textbf{Triple-valued type} % % takes three mandatory, comma-separated values in braces. % \begin{quote} % \meta{key}|=|\argiii{value1}{value2}{value3} % \end{quote} % Each value must be a dimension or null. When you give an empty value % or `|*|', it means null and leaves the appropriate value % to the auto-completion mechanism. You need to specify at least one % dimension, typically two dimensions. You can set nulls for all the % values, but it makes no sense. % \textit{Examples:}\\ % \hspace*{2em} |hdivide={2cm,*,1cm}|, |vdivide={3cm,19cm, }|, % |divide={1in,*,1in}|. % \end{enumerate} % % \section{Option Specification} % % This section describes all the options provided by \textsf{geometry}. % % \subsection{Paper Size} % % The options below set paper/media size and orientation. % \begin{Options} % \item[paper\OR papername] ~\\ % specifies a paper name. The paper names available in \textsf{geometry}. % |paper=|\meta{paper-name}. For example |paper=a4paper|, which is % equivalent to just |a4paper|. % \item[\vtop{ % \hbox{a0paper, a1paper, a2paper, a3paper, a4paper, a5paper, a6paper} % \hbox{b0paper, b1paper, b2paper, b3paper, b4paper, b5paper, b6paper} % \hbox{letterpaper, executivepaper, legalpaper}}]~\\[1ex] % specifies paper name. They can typically be used with no values. % Note that whatever value (even |false|) is given to this option, the % value will be ignored. For example, the followings have the same effect: % |a5paper|, |a5paper=true|, |a5paper=false| and |a5paper=XXXX|. % \item[\New{3}screen] a special paper size with (W,H) = (225mm,180mm). % For presentation with PC and video projector, ``|screen,centering|'' % with `slide' documentclass would be useful. % \item[paperwidth] width of the paper. |paperwidth=|\meta{length}. % \item[paperheight] height of the paper. |paperheight=|\meta{length}. % \item[papersize] width and height of the paper.\\ % |papersize=|\argii{width}{height} or |papersize=|\meta{length}. % \item[landscape] switches the paper orientation to landscape mode. % \item[portrait] switches the paper orientation to portrait mode. % This is equivalent to |landscape=false|. % \end{Options} % % Options for paper names (e.g., |a4paper|) and orientation % (|portrait| and |landscape|) can be set as document class options. % For example, you can set |\documentclass[a4paper,landscape]{article}|, % then |a4paper| and |landscape| are processed in \textsf{geometry} as well. % This is also the case for |twoside| and |twocolumn| % (see also Section~\ref{sec:dimension}). % % \subsection{Body Size}\label{sec:body} % % The options specifying the size of \gpart{total body} are described in this % section. % \begin{Options} % \item[hscale] % ratio of width of \gpart{total body} to \cs{paperwidth}. % |hscale=|\meta{h-scale}, e.g., |hscale=0.8| is equivalent to % |width=0.8|\cs{paperwidth}. (|0.7| by default) % \item[vscale] % ratio of height of \gpart{total body} to \cs{paperheight}, e.g., % |vscale=|\meta{v-scale}. (|0.7| by default) |vscale=0.9| is equivalent % to |height=0.9|\cs{paperheight}. % \item[scale] ratio of \gpart{total body} to the paper. % |scale=|\argii{h-scale}{v-scale} or |scale=|\meta{scale}. % (|0.7| by default) % \item[width\OR totalwidth] ~\\ % width of \gpart{total body}. |width=|\meta{length} or % |totalwidth=|\meta{length}. This dimension should not be confused with % |textwidth|. Generally, |width| $\ge$ |textwidth| because |width| % includes the width of the marginal notes if |includemp| is set to |true|. % If |textwidth| and |width| are specified at the same time, |width| is % ignored. % \item[height\OR totalheight] ~\\ % height of \gpart{total body}, excluding header and footer by default. % If |includehead| or |includefoot| is set, |height| includes % the head or foot of the page as well as |textheight|. % |height=|\meta{length} or |totalheight=|\meta{length}. If both % |textheight| and |height| are specified, |height| will be ignored. % \item[total] width and height of \gpart{total body}.\\ % |total=|\argii{width}{height} or |total=|\meta{length}. % \item[textwidth] modifies \cs{textwidth}, the width of \gpart{body} % (the text are). |textwidth=|\meta{length}. % \item[textheight] modifies \cs{textheight}, the height of \gpart{body}. % |textheight=|\meta{length}. % \item[text\OR body] sets both \cs{textwidth} and \cs{textheight} of the body % of page. |body=|\argii{width}{height} or |text=|\meta{length}. % \item[\New{3}lines] enables users to specify \cs{textheight} by the number % of lines. |lines|=\meta{integer}. % \item[\New{3}includehead] includes the head of the page, \cs{headheight} % and \cs{headsep}, into \gpart{total body}. It is set to |false| by % default. It is opposite to |ignorehead|. See Figure~\ref{fig:includes}. % \item[\New{3}includefoot] includes the foot of the page, \cs{footskip}, % into \gpart{body}. It is opposite to |ignorefoot|. % It is |false| by default. See Figure~\ref{fig:includes}. % \item[\New{3}includeheadfoot]~\\ % sets both |includehead| and |includefoot| to |true|, which is opposite % to |ignoreheadfoot|. See Figure~\ref{fig:includes}. % \item[\Mod{3}includemp] includes the margin notes, \cs{marginparwidth} % and \cs{marginparsep}, into \gpart{body} when calculating horizontal % calculation. In version 3, |includemp| is independent of options % |marginparwidth| and |marginparsep|, and set to |false| by default. % \item[\New{3}includeall] sets both |includeheadfoot| and |includemp| to % |true|. See Figure~\ref{fig:includes} and Figure~\ref{fig:modes}. % \item[\New{3}ignorehead] disregards the head of the page, % |headheight| and |headsep|, in determining vertical layout, but does not % change those lengths. It is equivalent to |includehead=false|. It is set % to |true| by default. See also |includehead|. % \item[\New{3}ignorefoot] disregards the foot of page, |footskip|, % in determining vertical layout, but does not change that length. % This option is set to |true| by default. See also |includefoot|. % \item[\New{3}ignoreheadfoot]~\\ sets both |ignorehead| and |ignorefoot| % to |true|. See also |includeheadfoot|. % \item[\New{3}ignoremp] disregards the marginal notes in determining the % horizontal margins (|true| is set by default). If marginal notes fall off % the page, the warning message will be displayed when |verbose=true|. % See also Figure~\ref{fig:modes} and |includemp|. % \item[\New{3}ignoreall] sets both |ignoreheadfoot| and |ignoremp| to |true|. % See also |includeall|. % \item[\New{3}heightrounded]~\\ % This option rounds \cs{textheight} to \textit{n}-times (\textit{n}: % an integer) of \cs{baselineskip} plus \cs{topskip} to avoid % ``underfull vbox'' in some cases. For example, if \cs{textheight} is % 486pt with \cs{baselineskip} 12pt and \cs{topskip} 10pt, then % \begin{quote} % $(39\times12\textrm{pt}+10\textrm{pt}=)\: 478\textrm{pt} % < 486\textrm{pt} < % 490\textrm{pt} \:(=40\times12\textrm{pt}+10\textrm{pt})$, % \end{quote} % as a result \cs{textheight} is rounded to 490pt. |heightrounded=false| % by default. % \end{Options} % % The following options can specify body and margins simultaneously with % three comma-separated values in braces. % \begin{Options} % \item[hdivide] horizontal partitions (left,width,right). % |hdivide=|\argiii{left margin}{width}{right margin}. % Note that you should not specify all of the three parameters. % The best way of using this option is to specify two of three and % leave the rest with null(nothing) or `|*|'. For example, when you set % |hdivide={2cm,15cm, }|, the margin from the right-side edge of page % will be determined calculating |paperwidth-2cm-15cm|. % \item[vdivide] vertical partitions (top,height,bottom). % |vdivide=|\argiii{top margin}{height}{bottom margin}. % \item[divide] |divide=|\vargiii{$A$}{$B$}{$C$} is interpreted as % |hdivide=|\vargiii{$A$}{$B$}{$C$} and |vdivide=|\vargiii{$A$}{$B$}{$C$}. % \end{Options} % % \subsection{Margin Size}\label{sec:margin} % % The options specifying the size of visible margins are listed below. % \begin{Options} % \item[left\OR lmargin\OR inner]~\\ % left margin (for oneside) or inner margin (for twoside) of % \gpart{total body}. In other words, the distance between the left (inner) % edge of the paper and that of \gpart{total body}. |left=|\meta{length}. % |inner| has no special meaning, just an alias of |left| and |lmargin|. % \item[right\OR rmargin\OR outer]~\\ % right or outer margin of \gpart{total body}. |right=|\meta{length}. % \item[top\OR tmargin] top margin of the page. |top=|\meta{length}. % Note this option has nothing to do with the native dimension % \cs{topmargin}. % \item[bottom\OR bmargin]~\\ % bottom margin of the page. |bottom=|\meta{length}. % \item[hmargin] left and right margin. % |hmargin=|\argii{left margin}{right margin} or |hmargin=|\meta{length}. % \item[vmargin] top and bottom margin. % |vmargin=|\argii{top margin}{bottom margin} or |vmargin=|\meta{length}. % \item[margin] |margin=|\vargii{$A$}{$B$} is equivalent to % |hmargin=|\vargii{$A$}{$B$} and |vmargin=|\vargii{$A$}{$B$}. % |margin=|$A$ is automatically expanded to |hmargin=|$A$ and |vmargin=|$A$. % \item[\New{3}hmarginratio] % horizontal margin ratio of |left| (inner) to |right| (outer). % The value of \meta{ratio} should be specified with colon-separated % two values. Each value should be a positive integer less than 100 % to prevent arithmetic overflow, e.g., |2:3| instead of |1:1.5|. % The default ratio is |1:1| for oneside, |2:3| for twoside. % \item[\New{3}vmarginratio] % vertical margin ratio of |top| to |bottom|. The default ratio is |2:3|. % \item[\New{3}marginratio\OR ratio]~\\ % horizontal and vertical margin ratios. % |marginratio=|\argii{horizontal ratio}{vertical ratio} or % |marginratio=|\meta{ratio}. % \item[\New{3}hcentering] sets auto-centering horizontally and is % equivalent to |hmarginratio=1:1|. It is set to |true| by default for % oneside. See also |hmarginratio|. % \item[\New{3}vcentering] sets auto-centering vertically and is % equivalent to |vmarginratio=1:1|. The default is |false|. % See also |vmarginratio|. % \item[\New{3}centering] sets auto-centering and is equivalent to % |marginratio=1:1|. See also |marginratio|. The default is |false|. % See also |marginratio|. % \item[twoside] switches on twoside mode with left and right margins swapped % on verso pages. The option sets \cs{@twoside} and \cs{@mparswitch} % switches. See also |asymmetric|. % \item[\New{3}asymmetric] implements a twosided layout in which margins are % not swapped on alternate pages (by setting \cs{oddsidemargin} to % \cs{evensidemargin} |+| |bindingoffset|) and in which the marginal notes % stay always on the same side. This option can be used as an alternative % to the twoside option. See also |twoside|. % \item[\New{3}bindingoffset]~\\ removes a specified space % from the lefthand-side of the page for oneside or the inner-side for % twoside. |bindingoffset=|\meta{length}. This is useful if pages % are bound by a press binding (glued, stitched, stapled \ldots). % See Figure~\ref{fig:bindingoffset}. % \item[hdivide] See description in Section~\ref{sec:body}. % \item[vdivide] See description in Section~\ref{sec:body}. % \item[divide] See description in Section~\ref{sec:body}. % \end{Options} % \begin{figure} % \centering\small % {\unitlength=.65pt % \begin{picture}(500,270)(0,0) % \put(20,0){\framebox(170,230){}} % \put(20,255){\makebox(80,20)[l]{\textbf{a)}~every page for oneside or}} % \put(20,240){\makebox(80,20)[l]{\hspace{3ex}odd pages for twoside}} % \put(110,225){\makebox(80,20)[r]{\gpart{paper}}} % \put(55,37){\framebox(110,170)[tc]{\gpart{total body}}} % \multiput(38,0)(0,7){33}{\line(0,1){4}} % \put(38,100){\vector(1,0){17}}\put(55,100){\vector(-1,0){17}} % \put(60,95){\makebox(80,10)[l]{|left|}} % \put(60,80){\makebox(80,10)[l]{(|inner|)}} % \put(165,100){\vector(1,0){25}}\put(190,100){\vector(-1,0){25}} % \put(195,95){\makebox(80,10)[l]{|right|}} % \put(195,80){\makebox(80,10)[l]{(|outer|)}} % \put(20,16){\vector(1,0){18}} % \put(45,10){\makebox(80,10)[bl]{|bindingoffset|}} % \put(280,255){\makebox(80,20)[l]{\textbf{b)}~even (back) pages for twoside}} % \put(280,0){\framebox(170,230){}} % \put(370,225){\makebox(80,20)[r]{\gpart{paper}}} % \put(305,37){\framebox(110,170)[tc]{\gpart{total body}}} % \multiput(432,0)(0,7){33}{\line(0,1){4}} % \put(280,100){\vector(1,0){25}}\put(305,100){\vector(-1,0){25}} % \put(310,95){\makebox(80,10)[l]{|outer|}} % \put(310,80){\makebox(80,10)[l]{(|right|)}} % \put(415,100){\vector(1,0){17}}\put(432,100){\vector(-1,0){17}} % \put(373,95){\makebox(80,10)[l]{|inner|}} % \put(373,80){\makebox(80,10)[l]{(|left|)}} % \put(450,16){\vector(-1,0){18}} % \put(330,10){\makebox(80,10)[bl]{|bindingoffset|}} % \end{picture}} % \caption[\texttt{bindingoffset} option]{% % \begin{minipage}[t]{.8\textwidth}\raggedright\small % |bindingoffset| option. Note that |twoside| option swaps the horizontal % margins and the marginal notes together with |bindingoffset| on even % pages (see \textbf{b)}), but |asymmetric| option suppresses the swap % of the margins and marginal notes (but |bindingoffset| is still swapped). % \end{minipage}} % \label{fig:bindingoffset} % \end{figure} % % \subsection{Native Dimensions}\label{sec:dimension} % % The options below specify \LaTeX\ native dimensions and switches for page % layout. See Figure~\ref{fig:layout}. Note that unlike version 2.3, % |nohead|, |nofoot| and |noheadfoot| become overwritable, in other words, % just shorthand for setting the corresponding LaTeX dimensions % (\cs{headheight}, \cs{headsep} and \cs{footskip}) to 0pt. % % \begin{Options} % \item[headheight\OR head]~\\ % modifies \cs{headheight}, height of header. % |headheight=|\meta{length} or |head=|\meta{length}. % \item[headsep] modifies \cs{headsep}, separation between header and text % (body). |headsep=|\meta{length}. % \item[footskip\OR foot]~\\ modifies \cs{footskip}, distance separation % between baseline of last line of text and baseline of footer. % |footskip=|\meta{length} or |foot=|\meta{length}. % \item[\Mod{3}nohead] eliminates spaces for the head of the page, which is % equivalent to both \cs{headheight}|=0pt| and \cs{headsep}|=0pt|. % \item[\Mod{3}nofoot] eliminates spaces for the foot of the page, which is % equivalent to \cs{footskip}|=0pt|. % \item[\Mod{3}noheadfoot] equivalent to |nohead| and |nofoot|. % \item[footnotesep] changes the dimension \cs{skip}\cs{footins}, separation % between the bottom of text body and the top of footnote text. % \cs{headheight}|=0pt|, \cs{headsep}|=0pt| and \cs{footskip}|=0pt|. % \item[\Mod{3}marginparwidth\OR marginpar]~\\ % modifies \cs{marginparwidth}, width of the marginal notes. % |marginparwidth=|\meta{length}. % Unlike version 2.3, it does \textit{not} set |includemp=true|. % \item[\Mod{3}marginparsep] modifies \cs{marginparsep}, separation between % body and marginal notes. |marginparsep=|\meta{length}. % Unlike version 2.3, it does \textit{not} set |includemp=true|. % \item[\New{3}nomarginpar] shrinks spaces for marginal notes to 0pt, which % is equivalent to \cs{marginparwidth}|=0pt| and \cs{marginparsep}|=0pt|. % \item[columnsep] modifies \cs{columnsep}, the separation between two % columns in |twocolumn| mode. % \item[hoffset] modifies \cs{hoffset}. |hoffset=|\meta{length}. % \item[voffset] modifies \cs{voffset}. |voffset=|\meta{length}. % \item[offset] horizontal and vertical offset.\\ % |offset=|\argii{hoffset}{voffset} or |offset=|\meta{length}. % \item[twocolumn] sets |twocolumn| mode with \cs{@twocolumntrue}. % |twocolumn=false| denotes onecolumn mode with\cs{@twocolumnfalse}. % \item[twoside] sets both \cs{@twosidetrue} and \cs{@mparswitchtrue}. % See Section~\ref{sec:margin}. % \item[textwidth] sets \cs{textwidth} directly. See Section~\ref{sec:body}. % \item[textheight] sets \cs{textheight} directly. See Section~\ref{sec:body}. % \item[\New{3}reversemp\OR reversemarginpar]~\\ % makes the marginal notes appear in the left (inner) margin with % \cs{@reversemargintrue}. Unlike version 2.3 or earlier, % it does \textit{not} change |includemp| mode. This is |false| by default. % \end{Options} % % \subsection{Drivers}\label{sec:drivers} % % Package \textsf{geometry} supports \textsl{dvips}, \textsl{dvipdfm}, % \textsl{pdflatex} and \textsl{V\TeX} environment. These driver options are % exclusive. % % \begin{Options} % \item[\Mod{3}dvips] writes the paper size in dvi output with the \cs{special} % macro. If you use \textsl{dvips} as a DVI-to-PS driver, % for example, to print a document with |\geometry{a3paper,landscape}| % on A3 paper in landscape orientation, you don't need options % ``|-t a3 -t landscape|'' to \textsl{dvips}. % In version 3, this option sets an addtional correction for landscape % documents so that PostScript outputs shouldn't be displayed upside down % by PostScript viewers, e.g., Ghostscript. % If you use \textsl{V\TeX} environment or \textsl{pdflatex} command, % this option is automatically deselected and changed to the corresponding % driver option. This option works with xdvi and \textsl{dviout} % (though you may get some warnings). % \item[\New{3}dvipdfm] works like |dvips| except landscape correction. % \item[pdftex] sets \cs{pdfpagewidth} and \cs{pdfpageheight} properly % if \textsl{pdflatex} command is used for typeset. % When \textsl{pdflatex} command is used, |pdftex| is automatically % selected. On the other hand when one is not using \textsl{pdflatex} % command this option is ineffective. % \item[vtex] sets dimensions \cs{mediawidth} and \cs{mediaheight} % for \textsl{V\TeX}. % This option is automatically selected when one is using \textsl{V\TeX} % environment. On the other hand when one is not using \textsl{V\TeX} % this option is ineffective. % \end{Options} % % Drivers options can be automatically changed depending on the typeset % environment. % \begin{center} % \begin{tabular}{ll@{\quad$\rightarrow$\quad}ll} % environment & given driver option & resulted option \\\hline % \textsl{latex} & |pdftex|~/~|vtex| & \textit{none} \\ % \textsl{pdflatex} & \textit{any} & |pdftex| \\ % \textsl{V\TeX} & \textit{any} & |vtex|. \\\hline % \end{tabular} % \end{center} % % \subsection{Other Options} % % The other useful options are described here. % \begin{Options} % \item[verbose] displays parameter results on the terminal. % |verbose=false| (default) still puts them into the log file. % \item[reset] sets back the layout dimensions and switches to the % settings before \textsf{geometry} is loaded. Options given in % |geometry.cfg| are also cleared. % Note that this cannot reset |pass| and |mag| with |truedimen|. % |reset=false| has no effect and cannot cancel the previous % |reset|(|=true|) if any. For example, when you go % \begin{quote} % |\documentclass[landscape]{article}|\\ % |\usepackage[twoside,reset,left=2cm]{geometry}| % \end{quote} % with |\ExecuteOptions{scale=0.9}| in |geometry.cfg|, % then as a result, |landscape| and |left=2cm| remain effective, % and |scale=0.9| and |twoside| are ineffective. % \item[mag] sets magnification value (\cs{mag}) and automatically modifies % \cs{hoffset} and \cs{voffset} according to the magnification. % |mag=|\meta{value}. Note that \meta{value} should be an integer value % with 1000 as a normal size. For example, |mag=1414| with |a4paper| % provides an enlarged print fitting in |a3paper|, which is $1.414$ % (=$\sqrt{2}$) times larger than |a4paper|. Font enlargement needs extra % disk space. \textbf{Note that you should not specify |mag| more than % once.} Multiple |mag| specification causes an error. % See also |truedimen| option. % \item[truedimen] changes all internal explicit dimension values into % \textit{true} dimensions, e.g., |1in| is changed to |1truein|. % Typically this option will be used together with |mag| option. Note that % this is ineffective against externally specified dimensions. For example, % when you set ``\texttt{mag=1440, margin=10pt, truedimen}'', margins are % not `true' but magnified. If you want to set exact margins, you should % set like ``\texttt{mag=1440, margin=10truept, truedimen}'' instead. % \item[\New{3}pass] disables all of the geometry options and calculations % except |verbose| and |showframe|. It can be used for checking % out the page layout of the documentclass, other packages and manual % settings without \textsf{geometry}. % \item[\New{3}showframe] shows visible frames for the text area and page, % and the lines for the head and foot on the first page. % \item[\New{3}compat2] sets all kind of options so that % |\usepackage[compat2]{geometry}| would behave as if one is using % the old version (v2.3) with the old default layout: % \texttt{[scale=\{0.8,0.9\}, centering, includeheadfoot]}, % which is here expressed by options available in version 3. % Note this option should be set as a first option. % \end{Options} % % \section{Default Settings} % % \subsection{Default Layout}\label{sec:default} % % Let us recapitulate the default layout here. % The \textsf{geometry} package has the following default page layout % for onesided documents: % \begin{quote} % |scale=0.7, marginratio={1:1, 2:3}, ignoreall| % \end{quote} % For twoside, the horizontal margin ratio is also set |2:3|, % \begin{quote} % |scale=0.7, marginratio=2:3, ignoreall|. % \end{quote} % Of course, you don't need to set them explicitly. |\usepackage{geometry}| % will internally set the above options. % Additional options will overwrite the layout dimensions. For example, % \begin{quote} % |\usepackage[hmargin=2cm]{geometry}| % \end{quote} % will overwrite horizontal dimensions, but use the default for vertical % layout. Page dimensions specified by the documentclass being used % and other direct settings before \textsf{geometry} is loaded are passed % down to \textsf{geometry}. % % Note version 2.3 or earlier had default layout different from the % version 3. The old default options can be expressed with options % available in the current version: % \begin{quote} % |scale={0.8,0.9}, centering, includeheadfoot|. % \end{quote} % Adding |compat2| as a first option sets those options so that, for example, % \begin{quote} % |\usepackage[compat2, width=10cm]{geometry}| % \end{quote} % would behave as if one is using the old version (v2.3). % % \subsection{Configuration File} % % One can set up a configuration file to make default options. To do this, % produce a file |geometry.cfg| containing an \cs{ExecuteOptions} macro, % for example, % \begin{quote} % |\ExecuteOptions{a4paper,dvips}| % \end{quote} % and install it somewhere \TeX{} can find it. % % The options specified in the |geometry.cfg| can be cleared by % option |reset|. % % \section{Relations Between Options} % This section shows how complexity is solved when options are over-specified. % % \subsection{Order Dependence}\label{sec:order-depend} % % The \textsf{geometry} options are basically order-independent, but there % are some exceptions. For multiple specification of the same option, % the last setting is adopted. For example, % \begin{quote} % |verbose=true, verbose=false| % \end{quote} % obviously results in |verbose=false|. % If you set % \begin{quote} % |hmargin={3cm,2cm}, left=1cm| % \end{quote} % the left(or inner) margin is overwritten by |left=1cm|. As a result, it is % equivalent to |hmargin={1cm,2cm}|. % % The |reset| option removes all the geometry options (except |pass|) % before it. If you set % \begin{quote} % |\documentclass[landscape]{article}|\\ % |\usepackage[margin=1cm,twoside]{geometry}|\\ % |\geometry{a5paper, reset, left=2cm}| % \end{quote} % then |margin=1cm|, |twoside| and |a5paper| are removed. % As a result, this case is equivalent to % \begin{quote} % |\documentclass[landscape]{article}|\\ % |\usepackage[left=2cm]{geometry}| % \end{quote} % % \subsection{Priority} % % There are several ways to set dimensions of the printable area: % |scale|, |total|, |text| and |lines|. Basically specification with the more % concrete dimension has the higher priority: % \[\begin{array}{c} % \textrm{low}\quad\longrightarrow\quad\textrm{high} % \quad(\textrm{priority})\\[1em] % \left\{\begin{array}{l}|hscale|\\|vscale|\\|scale| % \end{array}\right\} < % \left\{\begin{array}{l}|width|\\|height|\\|total| % \end{array}\right\} < % \left\{\begin{array}{l}|textwidth|\\|textheight| % \\|text|\end{array}\right\} < |lines|. % \end{array}\] % For example, % \begin{quote} % |\usepackage[hscale=0.8, textwidth=7in, width=18cm]{geometry}| % \end{quote} % is the same as |\usepackage[textwidth=7in]{geometry}|. Another example: % \begin{quote} % |\usepackage[lines=30, scale=0.8, text=7in]{geometry}| % \end{quote} % results in \texttt{[lines=30, textwidth=7in]}. % % Options determining margin size also have priority rule: % margin ratios versus margin length. For example, if both |marginratio=1:2| % and |margin=1cm| are set at the same time, |margin=1cm| wins because % |margin=1cm| is more concrete dimension than ratios. That is why normal % margin options work well with default margin ratios % (|marginratio={1:1, 2:3}| for oneside). % \[\begin{array}{c} % \textrm{low}\quad\longrightarrow\quad\textrm{high} % \quad(\textrm{priority})\\[1em] % \left\{\begin{array}{l}|hmarginratio|\\|vmarginratio|\\|marginratio| % \end{array}\right\} < % \left\{\begin{array}{l} % |hmargin|\:\textit{or}\:|left|\:\textrm{\&}\:|right|\\ % |vmargin|\:\textit{or}\:|top|\:\textrm{\&}\:|bottom|\\ % |margin| % \end{array}\right\}. % \end{array}\] % % \section{Examples} % % \begin{itemize} % \item A onesided page layout with the text area centered in the paper. % The examples below have the same result because the horizontal margin ratio % is set |1:1| for oneside by default. % \begin{itemize} % \item |centering| % \item |marginratio=1:1| % \item |vcentering| % \end{itemize} % % \item A twosided page layout with the inside offset for binding |1cm|. % \begin{itemize} % \item |twoside, bindingoffset=1cm| % \end{itemize} % In this case, |textwidth| is shorter than the case without % |bindingoffset=1cm| by $0.7\times|1cm|$ ($=$|0.7cm|). % % \item A layout with the left, right, and top margin |3cm|, |2cm| and % |2.5in| respectively, with textheight of 40 lines, and with the head and % foot of the page included in \gpart{total body}. % The two examples below have the same result. % \begin{itemize} % \item |left=3cm, right=2cm, lines=40, top=2.5in, includeheadfoot| % \item |hmargin={3cm,2cm}, tmargin=2.5in, lines=40, includeheadfoot| % \end{itemize} % % \item A layout with the height of \gpart{total body} |10in|, the bottom % margin |2cm|, and the default width. The top margin will be calculated % automatically. Each solution below results in the same page layout. % \begin{itemize} % \item |vdivide={*, 10in, 2cm}| % \item |bmargin=2cm, height=10in| % \item |bottom=2cm, textheight=10in| % \end{itemize} % Note that dimensions for \gpart{head} and \gpart{foot} are excluded from % |height| of \gpart{total body}. An additional |includefoot| makes % \cs{footskip} included in |totalheight|. Therefore, in the two cases below, % |textheight| in the former layout is shorter than the latter % (with 10in exactly) by \cs{footskip}. In other words, % |height| = |textheight| + |footskip| when |includefoot=true| in this case. % \begin{itemize} % \item |bmargin=2cm, height=10in, includefoot| % \item |bottom=2cm, textheight=10in, includefoot| % \end{itemize} % % \item A layout with \glen{textwidth} and \glen{textheight} 90\% of the % paper and with \gpart{body} centered. % Each solution below results in the same page layout. % \begin{itemize} % \item |scale=0.9, centering| % \item |text={.9\paperwidth,.9\paperheight}, ratio=1:1| % \item |width=.9\paperwidth, vmargin=.1\paperheight, marginratio=1:1| % \item |hdivide={*,0.9\paperwidth,*}, vdivide={*,0.9\paperheight,*}| % \item |margin={.1\paperwidth,.1\paperheight}, marginratio=1:1| % \end{itemize} % You can add |heightrounded| to avoid an ``underfull vbox warning'' like % \begin{quote}\small % |Underfull \vbox (badness 10000) has occurred while \output is active|. % \end{quote} % See Section~\ref{sec:body} for the detail description about |heightrounded|. % % \item A layout with the width of marginal notes |3cm| and included in the % width of \gpart{total body}. The following examples are the same. % \begin{itemize} % \item |marginparwidth=3cm, includemp| % \item |marginpar=3cm, igoremp=false| % \end{itemize} % % \item A layout the full scale \gpart{body} of the paper with A5 paper in % landscape. The following examples are the same. % \begin{itemize} % \item |a5paper, landscape, scale=1.0| % \item |landscape=TRUE, paper=a5paper, margin=0pt| % \end{itemize} % % \item A screen size layout appropriate to presentation with PC and video % projector. % \begin{verbatim} % \documentclass{slide} % \usepackage[screen,margin=0.8in]{geometry} % ... % \begin{slide} % ... % \end{slide}\end{verbatim} % \item A layout with fonts and spaces both enlarged from A4 to A3. % In the case below, the resulted paper size is A3. % \begin{itemize} % \item |a4paper, mag=1414|. % \end{itemize} % If you want to have a layout with two times bigger fonts, but without % changing paper size, you can go % \begin{itemize} % \item |letterpaper, mag=2000, truedimen|. % \end{itemize} % You can add |dvips| option, that is useful to preview it with proper % paper size by |dviout| or |xdvi|. % % \item An old style setting with v2.3 or earlier % \begin{verbatim} % \usepackage[a4paper,mag=1200,truedimen,margin=2cm, % twosideshift=10pt, % headsep=7pt,headheight=14.5pt, % marginparwidth=30pt]{geometry}\end{verbatim} % can be rewritten with options in version 3 without |compat2|: % \begin{verbatim} % \usepackage{calc} % \usepackage[a4paper,mag=1200,truedimen,margin=2cm, % twoside, left=2cm+10pt, right=2cm-10pt, % includeheadfoot, headsep=7pt,headheight=14.5pt, % includemp, marginparwidth=30pt]{geometry}\end{verbatim} % In this case, |includeall| can be used instead of |includeheadfoot| and % |includemp|. % % \item A complex page layout. % \begin{verbatim} % \usepackage[a5paper, landscape, twocolumn, twoside, % left=2cm, hmarginratio=2:1, includemp, marginparwidth=43pt, % bottom=1cm, foot=.7cm, includefoot, textheight=11cm, heightrounded, % columnsep=1cm, dvips, verbose]{geometry}\end{verbatim} % Try typesetting it and checking out the result yourself. |:-)| % \end{itemize} % % \section{Known Problems} % \begin{itemize} % \item With |pdftex=true|, |mag| $\neq 1000$ and |truedimen|, % |paperwidth| and |paperheight| shown in verbose mode are different % from the real size of the resulted PDF. The PDF itself is correct anyway. % \item With |pdftex=true|, |mag| $\neq 1000$, \textit{no} |truedimen|, % and \textsf{hyperref}, \textsf{hyperref} should be loaded % by \cs{usepackage} before \textsf{geometry}. % Otherwise the resulted PDF size will become wrong. % \item With \textsf{crop} package and |mag| $\neq 1000$, % |center| option of \textsf{crop} doesn't work well. % \end{itemize} % % \section{Acknowledgments} % I would like to thank the following people for their % pointing out bugs and suggesting, and for many helpful comments:~ % Friedrich Flender, Piet van Oostrum, Keith % Reckdahl, Peter Riocreux, James Kilfiger, Jean-Marc Lasgouttes % Frank Bennett, Vladimir Volovich, Wlodzimierz Macewicz, % Jean-Bernard Addor, Michael Vulis (MicroPress), and % Rolf Niepraschk. % % I am deeply grateful to Frank Mittelbach for checking the codes patiently % and providing extremely helpful insight and suggestions for version 3. % % \StopEventually{% % \ifmulticols % \addtocontents{toc}{\protect\end{multicols}} % \fi % } % % \section{The Code} % \begin{macrocode} %<*package> % \end{macrocode} % This package requires package \textsf{keyval} included in % \LaTeX\ graphics bundle. % \begin{macrocode} \RequirePackage{keyval}% % \end{macrocode} % % Internal switches are declared here. % \begin{macrocode} \newif\ifGm@verbose \newif\ifGm@landscape \newif\ifGm@includehead \newif\ifGm@includefoot \newif\ifGm@includemp \newif\ifGm@hbody \newif\ifGm@vbody \newif\ifGm@heightrounded \newif\ifGm@showframe \newif\ifGm@compatii \newif\ifGm@special \newif\ifGm@sworient\Gm@sworientfalse \newif\ifGm@pass\Gm@passfalse % \end{macrocode} % \begin{macro}{\Gm@cnth} % \begin{macro}{\Gm@cntv} % Counters for horizontal and vertical partitioning patterns. % \begin{macrocode} \newcount\Gm@cnth \newcount\Gm@cntv % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{\c@Gm@tempcnt} % The counter is used to set number with \textsf{calc}. % \begin{macrocode} \newcount\c@Gm@tempcnt % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@bindingoffset} % An additional inner offset for binding. % \begin{macrocode} \newdimen\Gm@bindingoffset % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@wd@mp} % \begin{macro}{\Gm@odd@mp} % \begin{macro}{\Gm@even@mp} % Correction lengths for \cs{textwidth}, \cs{oddsidemargin} and % \cs{evensidemargin} in |includemp| mode. % \begin{macrocode} \newdimen\Gm@wd@mp \newdimen\Gm@odd@mp \newdimen\Gm@even@mp % \end{macrocode} % \end{macro}\end{macro}\end{macro} % \begin{macro}{\Gm@dimlist} % Native dimension setting list. % \begin{macrocode} \newtoks\Gm@dimlist % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@warning} % Macro for printing warning messages. % \begin{macrocode} \def\Gm@warning#1{\PackageWarningNoLine{geometry}{#1}}% \@onlypreamble\Gm@warning % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@Dhratio} % \begin{macro}{\Gm@Dhratiotwo} % \begin{macro}{\Gm@Dvratio} % The default values for the horizontal and vertical \textsl{marginalratio} % are defined. \cs{Gm@Dhratiotwo} denotes the default value of % horizonal \textsl{marginratio} for twoside page layout with % left and right margins swapped on verso pages, which is % set by |twoside|. % \begin{macrocode} \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 % \end{macrocode} % \end{macro}\end{macro}\end{macro} % % \begin{macro}{\Gm@Dhscale} % \begin{macro}{\Gm@Dvscale} % The default values for the horizontal and vertical \textsl{scale} % are defined. In version 3 the default scale has been changed from % \{0.8, 0.9\} to \{0.7, 0.7\} in each direction. % \begin{macrocode} \def\Gm@Dhscale{0.7}% \def\Gm@Dvscale{0.7}% \@onlypreamble\Gm@Dhscale \@onlypreamble\Gm@Dvscale % \end{macrocode} % \end{macro}\end{macro} % % \begin{macro}{\Gm@dvips}% % \begin{macro}{\Gm@dvipdfm}% % \begin{macro}{\Gm@pdftex}% % \begin{macro}{\Gm@vtex}% % The driver names. % \begin{macrocode} \def\Gm@dvips{dvips}% \def\Gm@dvipdfm{dvipdfm}% \def\Gm@pdftex{pdftex}% \def\Gm@vtex{vtex}% \@onlypreamble\Gm@dvips \@onlypreamble\Gm@dvipdfm \@onlypreamble\Gm@pdftex \@onlypreamble\Gm@vtex % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro} % % \begin{macro}{\Gm@true}% % \begin{macro}{\Gm@false}% % \begin{macrocode} \def\Gm@true{true}% \def\Gm@false{false}% % \end{macrocode} % \end{macro}\end{macro} % % \begin{macro}{\Gm@dorg} % The macro saves \LaTeX{} native dimensions and switches before % processing \textsf{geometry} options, and is called when |reset| % or |pass| is set. % \begin{macrocode} \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 % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@init} % The macro for initializing modes and flags is defined here. This macro % is called at the beginning of the package and when |reset| is specified. % \begin{macrocode} \def\Gm@init{% \Gm@hbodyfalse\Gm@vbodyfalse \Gm@includeheadfalse\Gm@includefootfalse\Gm@includempfalse \Gm@landscapefalse\Gm@compatiifalse\Gm@heightroundedfalse \Gm@verbosefalse\Gm@showframefalse\Gm@specialfalse \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 % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@setdriver} % The macro sets the specified driver. % \begin{macrocode} \def\Gm@setdriver#1{% \expandafter\let\expandafter\Gm@driver\csname Gm@#1\endcsname}% % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@unsetdriver} % The macro unsets the specified driver if it has been set. % \begin{macrocode} \def\Gm@unsetdriver#1{% \expandafter\ifx\csname Gm@#1\endcsname\Gm@driver \let\Gm@driver\@empty \fi}% % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@setbool} % \begin{macro}{\Gm@setboolrev} % The macros set a boolean option. % \begin{macrocode} \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 % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{\Gm@doif} % \begin{macro}{\Gm@doifelse} % \cs{Gm@doif} excutes the third argument |#3| using a boolean value % |#2| of a option |#1|. \cs{Gm@doifelse} executes the third % argument |#3| if a boolean option |#1| with its value |#2| is |true|, % and executes the fourth argument |#4| if |false|. % \begin{macrocode} \def\Gm@doif#1#2#3{% \lowercase{\def\Gm@bool{#2}}% \ifx\Gm@bool\@empty \let\Gm@bool\Gm@true \fi \ifx\Gm@bool\Gm@true \else \ifx\Gm@bool\Gm@false \else \let\Gm@bool\relax \fi \fi \ifx\Gm@bool\relax \Gm@warning{`#1' should be set to `true' or `false'}% \else #3 \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 % \end{macrocode} % \end{macro}\end{macro} % % \begin{macro}{\Gm@reverse} % The macro reverses a bool value. % \begin{macrocode} \def\Gm@reverse#1{% \csname ifGm@#1\endcsname \csname Gm@#1false\endcsname\else\csname Gm@#1true\endcsname\fi}% \@onlypreamble\Gm@reverse % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@checkbool} % The macro is used in \cs{Gm@showparams} to print |true| or nothing. % \begin{macrocode} \def\Gm@checkbool#1{#1: \csname ifGm@#1\endcsname true\else --\fi^^J}% \@onlypreamble\Gm@checkbool % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@defbylen} % \begin{macro}{\Gm@defbycnt} % Macros \cs{Gm@defbylen} and \cs{Gm@defbycnt} can be used to define % \cs{Gm@xxxx} variables by length and counter respectively % with \textsf{calc} package. % \begin{macrocode} \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 % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{\Gm@set@ratio} % The macro parses the value of options specifying marginal ratios, % which is used in \cs{Gm@setbyratio} macro. % \begin{macrocode} \def\Gm@sep@ratio#1:#2{\@tempcnta=#1\@tempcntb=#2}% \@onlypreamble\Gm@set@ratio % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@setbyratio} % The macro determines the dimension specified by |#4| calculating % |#3|$\times a / b$, where $a$ and $b$ are given by \cs{Gm@mratio} % with $a:b$ value. If |#1| in brackets is |b|, $a$ and $b$ are swapped. % The second argument with |h| or |v| denoting horizontal or vertical % is not used in this macro. % \begin{macrocode} \def\Gm@setbyratio[#1]#2#3#4{% determine #4 by ratio \expandafter\Gm@sep@ratio\Gm@mratio\relax \if#1b \edef\@@tempa{\the\@tempcnta}% \@tempcnta=\@tempcntb \@tempcntb=\@@tempa\relax \fi \expandafter\setlength\expandafter\@tempdimb\expandafter {\csname Gm@#3\endcsname}% \ifnum\@tempcntb>\z@ \multiply\@tempdimb\@tempcnta \divide\@tempdimb\@tempcntb \fi \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdimb}}% \@onlypreamble\Gm@setbyratio % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@detiv} % This macro determines the fourth length(|#4|) from |#1|(\glen{paperwidth} % or \glen{paperheight}), |#2| and |#3|. It is used in % \cs{Gm@detall} macro. % \begin{macrocode} \def\Gm@detiv#1#2#3#4{% determine #4. \expandafter\setlength\expandafter\@tempdima\expandafter {\csname paper#1\endcsname}% \expandafter\setlength\expandafter\@tempdimb\expandafter {\csname Gm@#2\endcsname}% \addtolength\@tempdima{-\@tempdimb}% \expandafter\setlength\expandafter\@tempdimb\expandafter {\csname Gm@#3\endcsname}% \addtolength\@tempdima{-\@tempdimb}% \ifdim\@tempdima<\z@ \Gm@warning{`#4' results in NEGATIVE (\the\@tempdima).% ^^J\@spaces `#2' or `#3' should be shortened in length}% \fi \expandafter\edef\csname Gm@#4\endcsname{\the\@tempdima}}% \@onlypreamble\Gm@detiv % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@detiiandiii} % This macro determines |#2| and |#3| from |#1| with the first argument % (|#1|) can be |width| or |height|, which is expanded into dimensions % of paper and total body. It is used in \cs{Gm@detall} macro. % \begin{macrocode} \def\Gm@detiiandiii#1#2#3{% determine #2 and #3. \expandafter\setlength\expandafter\@tempdima\expandafter {\csname paper#1\endcsname}% \expandafter\setlength\expandafter\@tempdimb\expandafter {\csname Gm@#1\endcsname}% \addtolength\@tempdima{-\@tempdimb}% \ifdim\@tempdima<\z@ \Gm@warning{`#2' and `#3' result in NEGATIVE (\the\@tempdima).% ^^J\@spaces `#1' should be shortened in length}% \fi \ifx\Gm@mratio\@undefined \divide\@tempdima\tw@ \@tempdimb=\@tempdima \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 \fi \fi \expandafter\edef\csname Gm@#2\endcsname{\the\@tempdima}% \expandafter\edef\csname Gm@#3\endcsname{\the\@tempdimb}}% \@onlypreamble\Gm@detiiandiii % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@detall} % This macro determines partition of each direction. % The first argument (|#1|) should be |h| or |v|, the second (|#2|) % |width| or |height|, the third (|#3|) |lmargin| or |top|, and % the last (|#4|) |rmargin| or |bottom|. % \begin{macrocode} \def\Gm@detall#1#2#3#4{% \@tempcnta\z@ \edef\Gm@mratio{\@nameuse{Gm@#1marginratio}}% % \end{macrocode} % \cs{@tempcnta} is treated as a three-digit binary value with % top, middle and bottom denoted |left|(|top|), |width|(|height|) % and |right|(|bottom|) margins user specified respectively. % \begin{macrocode} \if#1h \ifx\Gm@lmargin\@undefined\else\advance\@tempcnta4\relax\fi \ifGm@hbody\advance\@tempcnta2\relax\fi \ifx\Gm@rmargin\@undefined\else\advance\@tempcnta1\relax\fi \Gm@cnth\@tempcnta \else \ifx\Gm@tmargin\@undefined\else\advance\@tempcnta4\relax\fi \ifGm@vbody\advance\@tempcnta2\relax\fi \ifx\Gm@bmargin\@undefined\else\advance\@tempcnta1\relax\fi \Gm@cntv\@tempcnta \fi % \end{macrocode} % Case the value is |000| (=0) with nothing fixed (default): % \begin{macrocode} \ifcase\@tempcnta \if#1h \edef\Gm@width{\Gm@Dhscale\paperwidth}% \else \edef\Gm@height{\Gm@Dvscale\paperheight}% \fi \Gm@detiiandiii{#2}{#3}{#4}% % \end{macrocode} % Case |001| (=1) with |right|(|bottom|) fixed: % \begin{macrocode} \or\Gm@setbyratio[f]{#1}{#4}{#3}\Gm@detiv{#2}{#3}{#4}{#2}% % \end{macrocode} % Case |010| (=2) with |width|(|height|) fixed: % \begin{macrocode} \or\Gm@detiiandiii{#2}{#3}{#4}% % \end{macrocode} % Case |011| (=3) with both |width|(|height|) and |right|(|bottom|) fixed: % \begin{macrocode} \or\Gm@detiv{#2}{#2}{#4}{#3}% % \end{macrocode} % Case |100| (=4) with |left|(|top|) fixed: % \begin{macrocode} \or\Gm@setbyratio[b]{#1}{#3}{#4}\Gm@detiv{#2}{#3}{#4}{#2}% % \end{macrocode} % Case |101| (=5) with both |left|(|top|) and |right|(|bottom|) fixed: % \begin{macrocode} \or\Gm@detiv{#2}{#3}{#4}{#2}% % \end{macrocode} % Case |110| (=6) with both |left|(|top|) and |width|(|height|) fixed: % \begin{macrocode} \or\Gm@detiv{#2}{#2}{#3}{#4}% % \end{macrocode} % Case |111| (=7) with all fixed though it is over-specified: % \begin{macrocode} \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 % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@clean} % The macro for setting unspecified dimensions to be \cs{@undefined}. % This is used by \cs{geometry} macro. % \begin{macrocode} \def\Gm@clean{% \ifnum\Gm@cnth<4\let\Gm@lmargin\@undefined\fi \ifodd\Gm@cnth\else\let\Gm@rmargin\@undefined\fi \ifnum\Gm@cntv<4\let\Gm@tmargin\@undefined\fi \ifodd\Gm@cntv\else\let\Gm@bmargin\@undefined\fi \ifGm@hbody\else \let\Gm@hscale\@undefined \let\Gm@width\@undefined \let\Gm@textwidth\@undefined \fi \ifGm@vbody\else \let\Gm@vscale\@undefined \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 % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@parse@divide} % The macro parses (|h|,|v|)|divide| options. % \begin{macrocode} \def\Gm@parse@divide#1#2#3#4{% \def\Gm@star{*}% \@tempcnta\z@ \@for\Gm@tmp:=#1\do{% \expandafter\KV@@sp@def\expandafter\Gm@frag\expandafter{\Gm@tmp}% \edef\Gm@value{\Gm@frag}% \ifcase\@tempcnta\relax\edef\Gm@key{#2}% \or\edef\Gm@key{#3}% \else\edef\Gm@key{#4}% \fi \@nameuse{Gm@set\Gm@key false}% \ifx\empty\Gm@value\else \ifx\Gm@star\Gm@value\else \setkeys{Gm}{\Gm@key=\Gm@value}% \fi\fi \advance\@tempcnta\@ne}% \let\Gm@star\relax}% \@onlypreamble\Gm@parse@divide % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@branch} % The macro splits a value into the same two values. % \begin{macrocode} \def\Gm@branch#1#2#3{% \@tempcnta\z@ \@for\Gm@tmp:=#1\do{% \KV@@sp@def\Gm@frag{\Gm@tmp}% \edef\Gm@value{\Gm@frag}% \ifcase\@tempcnta\relax% cnta == 0 \setkeys{Gm}{#2=\Gm@value}% \or% cnta == 1 \setkeys{Gm}{#3=\Gm@value}% \else\fi \advance\@tempcnta\@ne}% \ifnum\@tempcnta=\@ne \setkeys{Gm}{#3=\Gm@value}% \fi}% \@onlypreamble\Gm@branch % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@magtooffset} % This macro is used to adjust offsets by \cs{mag}. % \begin{macrocode} \def\Gm@magtooffset{% \@tempdima=\mag\Gm@truedimen sp% \@tempdimb=1\Gm@truedimen in% \divide\@tempdimb\@tempdima \multiply\@tempdimb\@m \addtolength{\hoffset}{1\Gm@truedimen in}% \addtolength{\voffset}{1\Gm@truedimen in}% \addtolength{\hoffset}{-\the\@tempdimb}% \addtolength{\voffset}{-\the\@tempdimb}}% \@onlypreamble\Gm@magtooffset % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@setafter} % This macro stores \LaTeX{} native dimensions, which are stored and % set afterwards. % \begin{macrocode} \def\Gm@setafter#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 % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@processdimlist} % This macro processes \cs{Gm@dimlist}. % \begin{macrocode} \def\Gm@processdimlist{% \def\Gm@td{\Gm@truedimen}% \def\Gm@len##1##2{\setlength{##1}{##2}}% \the\Gm@dimlist}% \@onlypreamble\Gm@processdimlist % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@setpaper} % The macro sets |paperwidth| and |paperheight| dimensions % using \cs{Gm@setafter} macro. % \begin{macrocode} \def\Gm@setpaper(#1,#2)#3{% \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 % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@chpaper} % The macro changes the paper size. % \begin{macrocode} \def\Gm@chpaper{\@nameuse{Gm@\Gm@paper}}% \@onlypreamble\Gm@chpaper % \end{macrocode} % \end{macro} % Various paper size are defined here. % \begin{macrocode} \@namedef{Gm@a0paper}{\Gm@setpaper(841,1189){mm}}% \@namedef{Gm@a1paper}{\Gm@setpaper(595,841){mm}}% \@namedef{Gm@a2paper}{\Gm@setpaper(420,595){mm}}% \@namedef{Gm@a3paper}{\Gm@setpaper(297,420){mm}}% \@namedef{Gm@a4paper}{\Gm@setpaper(210,297){mm}}% \@namedef{Gm@a5paper}{\Gm@setpaper(149,210){mm}}% \@namedef{Gm@a6paper}{\Gm@setpaper(105,149){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@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}}% % \end{macrocode} % % All the available options are defined below. % \begin{key}{Gm}{paper} % |paper| takes paper name as its value. Available paper names are listed % below. % \begin{macrocode} \define@key{Gm}{paper}{\setkeys{Gm}{#1}}% \let\KV@Gm@papername\KV@Gm@paper % \end{macrocode} % \end{key} % \begin{key}{Gm}{a[0-6]paper} % \begin{key}{Gm}{b[0-6]paper} % \begin{key}{Gm}{letterpaper} % \begin{key}{Gm}{legalpaper} % \begin{key}{Gm}{executivepaper} % \begin{key}{Gm}{screen} % The following paper names are available. |screen| is introduced % in version 3, which should not be specified in the class option list. % \begin{macrocode} \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}{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}% % \end{macrocode} % \end{key}\end{key}\end{key}\end{key}\end{key} % \end{key} % \begin{key}{Gm}{paperwidth} % \begin{key}{Gm}{paperheight} % \begin{key}{Gm}{papersize} % Direct specification for paper size is also possible. % \begin{macrocode} \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}}% % \end{macrocode} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{landscape} % \begin{key}{Gm}{portrait} % Paper orientation setting is also available. % \begin{macrocode} \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}}% % \end{macrocode} % \end{key}\end{key} % \begin{key}{Gm}{hscale} % \begin{key}{Gm}{vscale} % \begin{key}{Gm}{scale} % These options can determine the length(s) of \gpart{total body} % giving \textit{scale(s)} against the paper size. % \begin{macrocode} \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}}% % \end{macrocode} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{width} % \begin{key}{Gm}{height} % \begin{key}{Gm}{total} % \begin{key}{Gm}{totalwidth} % \begin{key}{Gm}{totalheight} % These options give concrete dimension(s) of \gpart{total body}. % |totalwidth| and |totalheight| are aliases of |width| and |height| % respectively. % \begin{macrocode} \define@key{Gm}{width}{\Gm@hbodytrue\Gm@defbylen{width}{#1}}% \define@key{Gm}{height}{\Gm@vbodytrue\Gm@defbylen{height}{#1}}% \define@key{Gm}{total}{\Gm@branch{#1}{width}{height}}% \let\KV@Gm@totalwidth\KV@Gm@width \let\KV@Gm@totalheight\KV@Gm@height % \end{macrocode} % \end{key}\end{key}\end{key}\end{key}\end{key} % \begin{key}{Gm}{textwidth} % \begin{key}{Gm}{textheight} % \begin{key}{Gm}{text} % \begin{key}{Gm}{body} % These options directly sets the dimensions \cs{textwidth} and % \cs{textheight}. |body| is an alias of |text|. % \begin{macrocode} \define@key{Gm}{textwidth}{\Gm@hbodytrue\Gm@defbylen{textwidth}{#1}}% \define@key{Gm}{textheight}{\Gm@vbodytrue\Gm@defbylen{textheight}{#1}}% \define@key{Gm}{text}{\Gm@branch{#1}{textwidth}{textheight}}% \let\KV@Gm@body\KV@Gm@text % \end{macrocode} % \end{key}\end{key}\end{key}\end{key} % \begin{key}{Gm}{lines} % The option sets \cs{textheight} with the number of lines. % \begin{macrocode} \define@key{Gm}{lines}{\Gm@vbodytrue\Gm@defbycnt{lines}{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{includehead} % \begin{key}{Gm}{includefoot} % \begin{key}{Gm}{includeheadfoot} % \begin{key}{Gm}{includemp} % \begin{key}{Gm}{includeall} % |include*| options include the corresponding part(s) in % \gpart{total body}. % \begin{macrocode} \define@key{Gm}{includehead}[true]{\Gm@setbool{includehead}{#1}}% \define@key{Gm}{includefoot}[true]{\Gm@setbool{includefoot}{#1}}% \define@key{Gm}{includeheadfoot}[true]{\Gm@doifelse{includeheadfoot}{#1}% {\Gm@includeheadtrue\Gm@includefoottrue}% {\Gm@includeheadfalse\Gm@includefootfalse}}% \define@key{Gm}{includemp}[true]{\Gm@setbool{includemp}{#1}}% \define@key{Gm}{includeall}[true]{\Gm@doifelse{includeall}{#1}% {\Gm@includeheadtrue\Gm@includefoottrue\Gm@includemptrue}% {\Gm@includeheadfalse\Gm@includefootfalse\Gm@includempfalse}}% % \end{macrocode} % \end{key}\end{key}\end{key}\end{key}\end{key} % \begin{key}{Gm}{ignorehead} % \begin{key}{Gm}{ignorefoot} % \begin{key}{Gm}{ignoreheadfoot} % \begin{key}{Gm}{ignoremp} % \begin{key}{Gm}{ignoreall} % |ignore*| options disregard \gpart{head}, \gpart{foot} % and \gpart{marginpars} in determining the location of \gpart{total body}. % \begin{macrocode} \define@key{Gm}{ignorehead}[true]{% \Gm@setboolrev[ignorehead]{includehead}{#1}}% \define@key{Gm}{ignorefoot}[true]{% \Gm@setboolrev[ignorefoot]{includefoot}{#1}}% \define@key{Gm}{ignoreheadfoot}[true]{\Gm@doifelse{ignoreheadfoot}{#1}% {\Gm@includeheadfalse\Gm@includefootfalse}% {\Gm@includeheadtrue\Gm@includefoottrue}}% \define@key{Gm}{ignoremp}[true]{% \Gm@setboolrev[ignoremp]{includemp}{#1}}% \define@key{Gm}{ignoreall}[true]{\Gm@doifelse{ignoreall}{#1}% {\Gm@includeheadfalse\Gm@includefootfalse\Gm@includempfalse}% {\Gm@includeheadtrue\Gm@includefoottrue\Gm@includemptrue}}% % \end{macrocode} % \end{key}\end{key}\end{key}\end{key}\end{key} % \begin{key}{Gm}{heightrounded} % The option rounds \cs{textheight} to n-times of \cs{baselineskip} % plus \cs{topskip}. % \begin{macrocode} \define@key{Gm}{heightrounded}[true]{\Gm@setbool{heightrounded}{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{hdivide} % \begin{key}{Gm}{vdivide} % \begin{key}{Gm}{divide} % The options are useful to specify partitioning % in each direction of the paper. % \begin{macrocode} \define@key{Gm}{hdivide}{\Gm@parse@divide{#1}{lmargin}{width}{rmargin}}% \define@key{Gm}{vdivide}{\Gm@parse@divide{#1}{tmargin}{height}{bmargin}}% \define@key{Gm}{divide}{\Gm@parse@divide{#1}{lmargin}{width}{rmargin}% \Gm@parse@divide{#1}{tmargin}{height}{bmargin}}% % \end{macrocode} % \end{key}\end{key}\end{key} % % \begin{key}{Gm}{lmargin} % \begin{key}{Gm}{rmargin} % \begin{key}{Gm}{tmargin} % \begin{key}{Gm}{bmargin} % \begin{key}{Gm}{left} % \begin{key}{Gm}{inner} % \begin{key}{Gm}{innermargin} % \begin{key}{Gm}{right} % \begin{key}{Gm}{outer} % \begin{key}{Gm}{outermargin} % \begin{key}{Gm}{top} % \begin{key}{Gm}{bottom} % These options set \gpart{margins}. % |left|, |inner|, |innermargin| are aliases of |lmargin|. % |right|, |outer|, |outermargin| are aliases of |rmargin|. % |top| and |bottom| are aliases of |tmargin| and |bmargin| respectively. % \begin{macrocode} \define@key{Gm}{lmargin}{\Gm@defbylen{lmargin}{#1}}% \define@key{Gm}{rmargin}{\Gm@defbylen{rmargin}{#1}}% \let\KV@Gm@left\KV@Gm@lmargin \let\KV@Gm@inner\KV@Gm@lmargin \let\KV@Gm@innermargin\KV@Gm@lmargin \let\KV@Gm@right\KV@Gm@rmargin \let\KV@Gm@outer\KV@Gm@rmargin \let\KV@Gm@outermargin\KV@Gm@rmargin \define@key{Gm}{tmargin}{\Gm@defbylen{tmargin}{#1}}% \define@key{Gm}{bmargin}{\Gm@defbylen{bmargin}{#1}}% \let\KV@Gm@top\KV@Gm@tmargin \let\KV@Gm@bottom\KV@Gm@bmargin % \end{macrocode} % \end{key}\end{key}\end{key}\end{key}\end{key} % \end{key}\end{key}\end{key}\end{key}\end{key} % \end{key}\end{key} % \begin{key}{Gm}{hmargin} % \begin{key}{Gm}{vmargin} % \begin{key}{Gm}{margin} % These options are shorthands for setting \gpart{margins}. % \begin{macrocode} \define@key{Gm}{hmargin}{\Gm@branch{#1}{lmargin}{rmargin}}% \define@key{Gm}{vmargin}{\Gm@branch{#1}{tmargin}{bmargin}}% \define@key{Gm}{margin}{\Gm@branch{#1}{lmargin}{tmargin}% \Gm@branch{#1}{rmargin}{bmargin}}% % \end{macrocode} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{hmarginratio} % \begin{key}{Gm}{vmarginratio} % \begin{key}{Gm}{marginratio} % \begin{key}{Gm}{hratio} % \begin{key}{Gm}{vratio} % \begin{key}{Gm}{ratio} % Options specifying the margin ratios. % \begin{macrocode} \define@key{Gm}{hmarginratio}{\edef\Gm@hmarginratio{#1}}% \define@key{Gm}{vmarginratio}{\edef\Gm@vmarginratio{#1}}% \define@key{Gm}{marginratio}{\Gm@branch{#1}{hmarginratio}{vmarginratio}}% \let\KV@Gm@hratio\KV@Gm@hmarginratio \let\KV@Gm@vratio\KV@Gm@vmarginratio \let\KV@Gm@ratio\KV@Gm@marginratio % \end{macrocode} % \end{key}\end{key}\end{key} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{hcentering} % \begin{key}{Gm}{vcentering} % \begin{key}{Gm}{centering} % Useful shorthands to make \gpart{body} centered. % \begin{macrocode} \define@key{Gm}{hcentering}[true]{\Gm@doifelse{hcentering}{#1}% {\def\Gm@hmarginratio{1:1}}{}}% \define@key{Gm}{vcentering}[true]{\Gm@doifelse{vcentering}{#1}% {\def\Gm@vmarginratio{1:1}}{}}% \define@key{Gm}{centering}[true]{\Gm@doifelse{centering}{#1}% {\def\Gm@hmarginratio{1:1}\def\Gm@vmarginratio{1:1}}{}}% % \end{macrocode} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{twoside} % If |twoside=true|, \cs{@twoside} and \cs{@mparswitch} is set to |true|. % \begin{macrocode} \define@key{Gm}{twoside}[true]{\Gm@doifelse{twoside}{#1}% {\@twosidetrue\@mparswitchtrue}{\@twosidefalse\@mparswitchfalse}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{asymmetric} % |asymmetric| sets \cs{@mparswitchfalse} and \cs{@twosidetrue} % A |asymmetric=false| has no effect. % \begin{macrocode} \define@key{Gm}{asymmetric}[true]{\Gm@doifelse{asymmetric}{#1}% {\@twosidetrue\@mparswitchfalse}{}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{bindingoffset} % The macro specifies a white space added to the left or inner margin. % \begin{macrocode} \define@key{Gm}{bindingoffset}{\Gm@setafter\Gm@bindingoffset{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{headheight} % \begin{key}{Gm}{headsep} % \begin{key}{Gm}{footskip} % \begin{key}{Gm}{head} % \begin{key}{Gm}{foot} % The direct settings of \gpart{head} and/or \gpart{foot} dimensions. % \begin{macrocode} \define@key{Gm}{headheight}{\Gm@setafter\headheight{#1}}% \define@key{Gm}{headsep}{\Gm@setafter\headsep{#1}}% \define@key{Gm}{footskip}{\Gm@setafter\footskip{#1}}% \let\KV@Gm@head\KV@Gm@headheight \let\KV@Gm@foot\KV@Gm@footskip % \end{macrocode} % \end{key}\end{key}\end{key}\end{key}\end{key} % \begin{key}{Gm}{nohead} % \begin{key}{Gm}{nofoot} % \begin{key}{Gm}{noheadfoot} % They are only shorthands to set \gpart{head} and/or \gpart{foot} % to be |0pt|. % \begin{macrocode} \define@key{Gm}{nohead}[true]{\Gm@doifelse{nohead}{#1}% {\Gm@setafter\headheight\z@\Gm@setafter\headsep\z@}{}}% \define@key{Gm}{nofoot}[true]{\Gm@doifelse{nofoot}{#1}% {\Gm@setafter\footskip\z@}{}}% \define@key{Gm}{noheadfoot}[true]{\Gm@doifelse{noheadfoot}{#1}% {\Gm@setafter\headheight\z@\Gm@setafter\headsep \z@\Gm@setafter\footskip\z@}{}}% % \end{macrocode} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{footnotesep} % The option directly sets a native dimension \cs{footnotesep}. % \begin{macrocode} \define@key{Gm}{footnotesep}{\Gm@setafter{\skip\footins}{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{marginparwidth} % \begin{key}{Gm}{marginpar} % \begin{key}{Gm}{marginparsep} % They directly set native dimensions \cs{marginparwidth} and % \cs{marginparsep}. For compatibility, |includemp| is set to |true| % if |compat2| is set. % \begin{macrocode} \define@key{Gm}{marginparwidth}{\ifGm@compatii\Gm@includemptrue\fi \Gm@setafter\marginparwidth{#1}}% \let\KV@Gm@marginpar\KV@Gm@marginparwidth \define@key{Gm}{marginparsep}{\ifGm@compatii\Gm@includemptrue\fi \Gm@setafter\marginparsep{#1}}% % \end{macrocode} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{nomarginpar} % The macro is a shorthand for \cs{marginparwidth}|=0pt| and % \cs{marginparsep}|=0pt|. % \begin{macrocode} \define@key{Gm}{nomarginpar}[true]{\Gm@doifelse{nomarginpar}{#1}% {\Gm@setafter\marginparwidth\z@\Gm@setafter\marginparsep\z@}{}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{columnsep} % The option sets a native dimension \cs{columnsep}. % \begin{macrocode} \define@key{Gm}{columnsep}{\Gm@setafter\columnsep{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{hoffset} % \begin{key}{Gm}{voffset} % \begin{key}{Gm}{offset} % The former two options set native dimensions \cs{hoffset} and % \cs{voffset}. |offset| can set both of them with the same value. % \begin{macrocode} \define@key{Gm}{hoffset}{\Gm@setafter\hoffset{#1}}% \define@key{Gm}{voffset}{\Gm@setafter\voffset{#1}}% \define@key{Gm}{offset}{\Gm@branch{#1}{hoffset}{voffset}}% % \end{macrocode} % \end{key}\end{key}\end{key} % \begin{key}{Gm}{twocolumn} % The option sets \cs{twocolumn} switch. % \begin{macrocode} \define@key{Gm}{twocolumn}[true]{% \Gm@doif{twocolumn}{#1}{\csname @twocolumn\Gm@bool\endcsname}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{reversemp} % \begin{key}{Gm}{reversemarginpar} % The both options set \cs{reversemargin}. % \begin{macrocode} \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}}% % \end{macrocode} % \end{key}\end{key} % \begin{key}{Gm}{dviver} % \begin{macrocode} \define@key{Gm}{driver}{\edef\@@tempa{#1}% \ifx\@@tempa\@empty\let\Gm@driver\@empty\else\setkeys{Gm}{#1}\fi}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{dvips} % \begin{key}{Gm}{dvipdfm} % \begin{key}{Gm}{pdftex} % \begin{key}{Gm}{vtex} % The \textsf{geometry} package supports |dvips|, |dvipdfm|, % |pdflatex| and |vtex|. |dvipdfm| works like |dvips|. % \begin{macrocode} \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}}}% % \end{macrocode} % \end{key}\end{key}\end{key}\end{key} % \begin{key}{Gm}{verbose} % The verbose mode. % \begin{macrocode} \define@key{Gm}{verbose}[true]{\Gm@setbool{verbose}{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{reset} % The option cancels all the options specified before |reset|, % except |pass|. |mag| ($\neq1000$) with |truedimen| cannot be also % reset. % \begin{macrocode} \define@key{Gm}{reset}[true]{\Gm@doifelse{reset}{#1}% {\Gm@init\Gm@dorg\ProcessOptionsKV[c]{Gm}\Gm@setdefaultpaper}{}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{mag} % |mag| is expanded immediately when it is specified. So |reset| can't % reset |mag| when it is set with |truedimen|. % \begin{macrocode} \define@key{Gm}{mag}{\mag=#1}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{truedimen} % If |truedimen| is set to |true|, all of the internal explicit dimensions % is changed to \textit{true} dimensions, e.g., |1in| is changed to % |1truein|. % \begin{macrocode} \define@key{Gm}{truedimen}[true]{\Gm@doifelse{truedimen}{#1}% {\let\Gm@truedimen\Gm@true}{\let\Gm@truedimen\@empty}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{pass} % The option makes all the options specified ineffective except % verbose switch. % \begin{macrocode} \define@key{Gm}{pass}[true]{\Gm@setbool{pass}{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{showframe} % The showframe option. % \begin{macrocode} \define@key{Gm}{showframe}[true]{\Gm@setbool{showframe}{#1}}% % \end{macrocode} % \end{key} % \begin{key}{Gm}{compat2} % The option sets the old default options for compatibility % with version 2. |compat2=false| does nothing. % \begin{macrocode} \define@key{Gm}{compat2}[true]{% \Gm@doifelse{compat2}{#1}{\Gm@compatiitrue \setkeys{Gm}{scale={0.8,0.9},centering,includeheadfoot}}{}}% % \end{macrocode} % \end{key} % Option |twosideshift| has been obsoleted. But for compatibility % with version 2, one can use |twosideshift| when |compat2| is set % to |true|. % \begin{macrocode} \define@key{Gm}{twosideshift}{% \ifGm@compatii\@twosidetrue\@mparswitchtrue\Gm@defbylen{twosideshift}{#1}% \else\Gm@warning{`twosideshift' is obsolete}% \fi}% % \end{macrocode} % % \begin{macro}{\Gm@setdefaultpaper} % The macro stores paper dimensions. % This macro should be called after |\ProcessOptionsKV[c]{Gm}|. % \begin{macrocode} \def\Gm@setdefaultpaper{% \ifx\Gm@paper\@undefined \Gm@setpaper(\strip@pt\paperwidth,\strip@pt\paperheight){pt}% \Gm@sworientfalse \fi}% \@onlypreamble\Gm@setdefaultpaper % \end{macrocode} % \end{macro} % \begin{macro}{\Gm@checkpaper} % The macro checks if paperwidth/height is larger than 0pt, % which is used in \cs{Gm@process}. % \begin{macrocode} \def\Gm@checkpaper{% \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.}% \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.}% \fi}% % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@checkmp} % The macro checks if marginpars fall off the page. % \begin{macrocode} \def\Gm@checkmp{% \ifGm@includemp\else \@tempcnta\z@\@tempcntb\@ne \if@twocolumn \@tempcnta\@ne \else \if@reversemargin \@tempcnta\@ne\@tempcntb\z@ \fi \fi \@tempdima\marginparwidth \advance\@tempdima\marginparsep \ifnum\@tempcnta=\@ne \@tempdimc\@tempdima \setlength\@tempdimb{\Gm@lmargin}% \advance\@tempdimc-\@tempdimb \ifdim\@tempdimc>\z@ \Gm@warning{The marginal notes would fall off the page.^^J \@spaces Add \the\@tempdimc\space and more to the left margin}% \fi \fi \ifnum\@tempcntb=\@ne \@tempdimc\@tempdima \setlength\@tempdimb{\Gm@rmargin}% \advance\@tempdimc-\@tempdimb \ifdim\@tempdimc>\z@ \Gm@warning{The marginal notes would fall off the page.^^J \@spaces Add \the\@tempdimc\space and more to the right margin}% \fi \fi \fi}% \@onlypreamble\Gm@checkmp % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@checkdrivers} % The macro checks the typeset environment and changes the driver option % if necessary. % \begin{macrocode} \def\Gm@checkdrivers{% \ifx\pdfpagewidth\@undefined\else \ifnum\pdfoutput=\@ne \Gm@setdriver{pdftex}% \fi \fi \ifx\VTeXversion\@undefined\else \ifnum\OpMode=\@ne \Gm@setdriver{vtex}% \else \ifnum\OpMode=\tw@ \Gm@setdriver{vtex}% \fi \fi \fi \ifx\Gm@driver\Gm@dvips \Gm@specialtrue \else \ifx\Gm@driver\Gm@dvipdfm \Gm@specialtrue \fi \fi}% \@onlypreamble\Gm@checkdrivers % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@mpfix} % The macro sets marginpar correction when |includemp| is set, % which is used in \cs{Gm@process}. % Local variables \cs{Gm@wd@mp}, \cs{Gm@odd@mp} and \cs{Gm@even@mp} % are set here. Note that \cs{Gm@even@mp} should be used only for twoside % layout. % \begin{macrocode} \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 \Gm@odd@mp\@tempdimb \if@mparswitch\else \Gm@even@mp\@tempdimb \fi \else \if@mparswitch \Gm@even@mp\@tempdimb \fi \fi \fi}% \@onlypreamble\Gm@mpfix % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@process} % The main macro processing specified layout dimensions is defined. % \begin{macrocode} \def\Gm@process{% % \end{macrocode} % If |pass| is set, the original dimensions and switches are restored % and process is ended here. % \begin{macrocode} \ifGm@pass \Gm@dorg \else % \end{macrocode} % The stored native dimension settings are processed here. % \begin{macrocode} \Gm@processdimlist % \end{macrocode} % The margin ratios are set to the default if not specified. % \begin{macrocode} \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 % \end{macrocode} % The paper size is checked here. % \begin{macrocode} \Gm@checkpaper % \end{macrocode} % The paper dimensions can be swapped when paper orientation % is changed over by |landscape| and |portrait| options. % \begin{macrocode} \ifGm@sworient \setlength\@tempdima{\paperwidth}% \setlength\paperwidth{\paperheight}% \setlength\paperheight{\@tempdima}% \Gm@setpaper(\strip@pt\paperwidth,\strip@pt\paperheight){pt}% \Gm@sworientfalse \fi % \end{macrocode} % The bindingoffset value is removed from the paper width, % which will be set back after auto-completion calculation. % \begin{macrocode} \addtolength\paperwidth{-\Gm@bindingoffset}% % \end{macrocode} % The local variables are set here for marginpar correction % \cs{Gm@wd@mp}, \cs{Gm@odd@mp} and \cs{Gm@even@mp} % when |includemp| is set. % \begin{macrocode} \ifGm@includemp \Gm@mpfix \fi % \end{macrocode} % If the horizontal dimension of \gpart{body} is specified by user, % \cs{Gm@width} is set properly here. % \begin{macrocode} \ifGm@hbody \ifx\Gm@width\@undefined \ifx\Gm@hscale\@undefined \edef\Gm@width{\Gm@Dhscale\paperwidth}% \else \edef\Gm@width{\Gm@hscale\paperwidth}% \fi \fi \ifx\Gm@textwidth\@undefined\else \setlength\@tempdima{\Gm@textwidth}% \ifGm@includemp \advance\@tempdima\Gm@wd@mp \fi \edef\Gm@width{\the\@tempdima}% \fi \fi % \end{macrocode} % If the vertical dimension of \gpart{body} is specified by user, % \cs{Gm@height} is set properly here. % \begin{macrocode} \ifGm@vbody \ifx\Gm@height\@undefined \ifx\Gm@vscale\@undefined \edef\Gm@height{\Gm@Dvscale\paperheight}% \else \edef\Gm@height{\Gm@vscale\paperheight}% \fi \fi \ifx\Gm@lines\@undefined\else \setlength\@tempdima{\baselineskip}% \multiply\@tempdima\Gm@lines \addtolength\@tempdima{\topskip}% \addtolength\@tempdima{-\baselineskip}% \edef\Gm@textheight{\the\@tempdima}% \fi \ifx\Gm@textheight\@undefined\else \setlength\@tempdima{\Gm@textheight}% \ifGm@includehead \addtolength\@tempdima{\headheight}% \addtolength\@tempdima{\headsep}% \fi \ifGm@includefoot \addtolength\@tempdima{\footskip}% \fi \edef\Gm@height{\the\@tempdima}% \fi \fi % \end{macrocode} % The auto-completion calculation is executed for each direction. % \begin{macrocode} \Gm@detall{h}{width}{lmargin}{rmargin}% \Gm@detall{v}{height}{tmargin}{bmargin}% % \end{macrocode} % The real dimensions are set properly according to the result % of the auto-completion calculation. % \begin{macrocode} \setlength\textwidth{\Gm@width}% \setlength\textheight{\Gm@height}% \setlength\topmargin{\Gm@tmargin}% \setlength\oddsidemargin{\Gm@lmargin}% \addtolength\oddsidemargin{-1\Gm@truedimen in}% % \end{macrocode} % If |includemp| is set to |true|, \cs{textwidth} and \cs{oddsidemargin} % are adjusted. % \begin{macrocode} \ifGm@includemp \advance\textwidth-\Gm@wd@mp \advance\oddsidemargin\Gm@odd@mp \fi % \end{macrocode} % Determining \cs{evensidemargin}. % In the twoside page layout, the right margin value % \cs{Gm@rmargin} is used. % If the marginal note width is included, % \cs{evensidemargin} should be corrected by \cs{Gm@even@mp}. % \begin{macrocode} \if@mparswitch \setlength\evensidemargin{\Gm@rmargin}% \addtolength\evensidemargin{-1\Gm@truedimen in}% \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 % \end{macrocode} % The bindingoffset correction for \cs{oddsidemargin}. % \begin{macrocode} \advance\oddsidemargin\Gm@bindingoffset % \end{macrocode} % \cs{topmargin} is adjusted here. % \begin{macrocode} \addtolength\topmargin{-1\Gm@truedimen in}% % \end{macrocode} % If the head of the page is included in \gpart{total body}, % \cs{headheight} and \cs{headsep} are removed from \cs{textheight}, % otherwise from \cs{topmargin}. % \begin{macrocode} \ifGm@includehead \addtolength\textheight{-\headheight}% \addtolength\textheight{-\headsep}% \else \addtolength\topmargin{-\headheight}% \addtolength\topmargin{-\headsep}% \fi % \end{macrocode} % If the foot of the page is included in \gpart{total body}, % \cs{footskip} is removed from \cs{textheight}. % \begin{macrocode} \ifGm@includefoot \addtolength\textheight{-\footskip}% \fi % \end{macrocode} % If |heightrounded| is set, \cs{textheight} is rounded. % \begin{macrocode} \ifGm@heightrounded \setlength\@tempdima{\textheight}% \addtolength\@tempdima{-\topskip}% \@tempcnta\@tempdima \@tempcntb\baselineskip \divide\@tempcnta\@tempcntb \setlength\@tempdimb{\baselineskip}% \multiply\@tempdimb\@tempcnta \advance\@tempdima-\@tempdimb \multiply\@tempdima\tw@ \ifdim\@tempdima>\baselineskip \addtolength\@tempdimb{\baselineskip}% \fi \addtolength\@tempdimb{\topskip}% \textheight\@tempdimb \fi % \end{macrocode} % The paper width is set back by adding \cs{Gm@bindingoffset}. % \begin{macrocode} \addtolength\paperwidth{\Gm@bindingoffset}% \fi}% \@onlypreamble\Gm@process % \end{macrocode} % \end{macro} % % \begin{macro}{\Gm@showparam} % The macro for typeout of geometry status and native dimensions for % page layout. % \begin{macrocode} \def\Gm@showparams{% -------------------- Geometry parameters^^J% \ifGm@pass 'pass' is specified!! (disables the geometry layouter)^^J% \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: \Gm@driver^^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 % \end{macrocode} % \end{macro} % % \begin{macro}{\ProcessOptionsKV} % This macro can process class and package options using `key=value' % scheme. Only class options are processed with an optional argument `|c|', % package options with `|p|' , and both of them by default. % \begin{macrocode} \def\ProcessOptionsKV{\@ifnextchar[%] {\@ProcessOptionsKV}{\@ProcessOptionsKV[]}}% \def\@ProcessOptionsKV[#1]#2{% \let\@tempa\@empty \@tempcnta\z@ \if#1p\@tempcnta\@ne\else\if#1c\@tempcnta\tw@\fi\fi \ifodd\@tempcnta \edef\@tempa{\@ptionlist{\@currname.\@currext}}% \else \@for\CurrentOption:=\@classoptionslist\do{% \@ifundefined{KV@#2@\CurrentOption}% {}{\edef\@tempa{\@tempa,\CurrentOption,}}}% \ifnum\@tempcnta=\z@ \edef\@tempa{\@tempa,\@ptionlist{\@currname.\@currext}}% \fi \fi \edef\@tempa{\noexpand\setkeys{#2}{\@tempa}}% \@tempa \AtEndOfPackage{\let\@unprocessedoptions\relax}}% \@onlypreamble\ProcessOptionsKV \@onlypreamble\@ProcessOptionsKV % \end{macrocode} % \end{macro} % % Geometry parameters are initialized here. % \cs{Gm@init} can be called by |reset| or |pass| options. % \begin{macrocode} \Gm@init % \end{macrocode} % The optional arguments to \cs{documentclass} are processed here. % \begin{macrocode} \ProcessOptionsKV[c]{Gm}% % \end{macrocode} % Paper dimensions given by class default are stored. % \begin{macrocode} \Gm@setdefaultpaper % \end{macrocode} % \begin{macro}{\Gm@setkey} % \cs{ExecuteOptions} is replaced with \cs{Gm@setkey} to make it % possible to deal with '\meta{key}=\meta{value}' as its argument. % \begin{macrocode} \def\Gm@setkeys{\setkeys{Gm}}% \@onlypreamble\Gm@setkeys \let\Gm@origExecuteOptions\ExecuteOptions \let\ExecuteOptions\Gm@setkeys % \end{macrocode} % \end{macro} % A local configuration file may define more options. % To set A4 paper as default, \texttt{geometry.cfg} needs to contain % |\ExecuteOptions{a4paper}|. % \begin{macrocode} \InputIfFileExists{geometry.cfg}{}{}% % \end{macrocode} % The original definition for \cs{ExecuteOptions} macro is restored. % \begin{macrocode} \let\ExecuteOptions\Gm@origExecuteOptions % \end{macrocode} % The optional arguments to \cs{usepackage} are processed here. % \begin{macrocode} \ProcessOptionsKV[p]{Gm}% % \end{macrocode} % Actual settings and calculation for layout dimensions are processed. % \begin{macrocode} \Gm@process % \end{macrocode} % % |verbose|, |showframe| and driver options are processed % at \cs{begin}|{document}|. % \begin{macrocode} \AtBeginDocument{% % \end{macrocode} % Paper size is temporally adjusted according to \cs{mag} for % printing devices. % \begin{macrocode} \edef\Gm@orgw{\the\paperwidth}% \edef\Gm@orgh{\the\paperheight}% % \end{macrocode} % If |pass| is set to |true|, no adjustment for page dimensions is done. % \begin{macrocode} \ifGm@pass\else \ifnum\mag=\@m\else \Gm@magtooffset \divide\paperwidth\@m \multiply\paperwidth\the\mag \divide\paperheight\@m \multiply\paperheight\the\mag \fi \fi % \end{macrocode} % Checking the driver options. % \begin{macrocode} \Gm@checkdrivers % \end{macrocode} % If |pdftex| is set to |true|, pdf-commands are set properly. % \begin{macrocode} \ifx\Gm@driver\Gm@pdftex \ifx\pdfpagewidth\@undefined \Gm@warning{`pdftex' option is invalid in this environment}% \else \setlength\pdfpagewidth{\Gm@orgw}% \setlength\pdfpageheight{\Gm@orgh}% \ifnum\mag=\@m\else\ifx\Gm@truedimen\Gm@true \setlength\paperwidth{\Gm@orgw}% \setlength\paperheight{\Gm@orgh}% \fi\fi \fi \fi % \end{macrocode} % With \textsl{V\TeX} environment, \textsl{V\TeX} variables are set here. % \begin{macrocode} \ifx\Gm@driver\Gm@vtex \ifx\VTeXversion\@undefined \Gm@warning{`vtex' option is invalid in this environment}% \else \mediawidth=\paperwidth \mediaheight=\paperheight \fi \fi % \end{macrocode} % If |dvips| or |dvipdfm| is set to |true|, paper size is embedded in dvi % file with \cs{special}. For dvips, a landscape correction is added % because a landscape document converted by dvips is upside-down in % PostScript viewers. % \begin{macrocode} \ifGm@special \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}% \ifx\Gm@driver\Gm@dvips\ifGm@landscape \AtBeginDvi{\special{! /landplus90 true store}}% \fi\fi \fi % \end{macrocode} % If |showframe=true|, page frames and lines are showed % on the first page. % \begin{macrocode} \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 % \end{macrocode} % If |verbose=true| and |pass=false|, the system checks % if marginpars fall off the page. % \begin{macrocode} \ifGm@verbose\ifGm@pass\else\Gm@checkmp\fi\fi % \end{macrocode} % If |verbose=true| the parameter results are displayed on the terminal. % |verbose=false| (default) still puts them into the log file. % \begin{macrocode} \ifGm@verbose\expandafter\typeout\else\expandafter\wlog\fi {\Gm@showparams}% % \end{macrocode} % save memory. % \begin{macrocode} \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@orgw\relax \let\Gm@orgh\relax \let\Gm@dimlist\relax}% % \end{macrocode} % % \begin{macro}{\geometry} % The user-interface macro \cs{geometry} is defined here. % This command should be used in the preamble. % \begin{macrocode} \def\geometry#1{% \Gm@clean \setkeys{Gm}{#1}% \Gm@process}% \@onlypreamble\geometry % % \end{macrocode} % \end{macro} % % In the configuration file |geometry.cfg|, one can use % \cs{ExecuteOptions} to set the site or user default settings. % \begin{macrocode} %<*config> %% Uncomment and edit the line below to set default options. %%\ExecuteOptions{a4paper,dvips} % % \end{macrocode} % % \Finale % \endinput