% \iffalse meta-comment %% %% geometry.dtx %% Copyright (C) 1996,1997 Hideo Umeki (umeki@ssel.toshiba.co.jp). %% All rights reserved. %% Distributed under the terms of the GNU General Public License. %% %<*dtx> \ProvidesFile{geometry.dtx} % %\NeedsTeXFormat{LaTeX2e}[1995/06/01] %\ProvidesPackage{geometry} %\ProvidesFile{geometry.drv} % \fi % \ProvidesFile{geometry.dtx} [1997/04/16 v1.06 Page Geometry Setting] % \iffalse meta-comment %<*driver> \documentclass[11pt]{ltxdoc} \usepackage{geometry} \geometry{hdivide = {0.2\w,*,25mm}, vmargin=.5in, nohead} \begin{document} %\OnlyDescription \DocInput{geometry.dtx} \end{document} % % \fi % % \CheckSum{1108} % % \newenvironment{key}[2]{\expandafter\macro\expandafter{% % `#2'}}{\endmacro} % \providecommand\argii[2]{% % {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`,{}}\meta{#2}{\ttfamily\char`\}}} % \providecommand\argiii[3]{% % {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`,{}}\meta{#2} % {\ttfamily\char`,{}}\meta{#3}{\ttfamily\char`\}}} % \providecommand\OR{\ \strut\vrule width .4pt\ } % \providecommand\len[1]{\textsf{#1}} % \newenvironment{Options}[1]% % {\begin{list}{}{\renewcommand{\makelabel}[1]{\texttt{##1}\hfil}% % \setlength{\itemsep}{-.5\parsep} % \settowidth{\labelwidth}{\texttt{#1\space}}% % \setlength{\leftmargin}{\labelwidth}% % \addtolength{\leftmargin}{\labelsep}}}% % {\end{list}} % % \GetFileInfo{geometry.dtx} % % \title{The \textsf{geometry} package} % \author{Hideo Umeki\\ % \texttt{umeki@ssel.toshiba.co.jp}} % \date{\filedate ~(\fileversion)} % % \changes{v1.00}{1996/05/31}{major changes by the `keyval' interface} % \changes{v1.01}{1996/06/03}% % {bugs fixed for paper setting and option processing} % \changes{v1.01}{1996/06/03}{geometry.cfg file inclusion} % \changes{v1.01}{1996/06/03}{dvips option added} % \changes{v1.02}{1996/06/07}{definition for reset option changed} % \changes{v1.02}{1996/06/07}% % {instructions for reset and dvips options revised} % \changes{v1.03}{1996/06/25}{document refined} % \changes{v1.03}{1996/07/17}{compatible with calc package} % \changes{v1.04}{1996/08/05}{bug fixed that papersize= had no effect% % when papertype was given in geometry.cfg or as a package option} % \changes{v1.05}{1997/02/17}{definition for dvips option changed} % \changes{v1.06}{1997/04/16}{reversemarginpar supported} % \maketitle % % \section{Introduction} % % To set dimensions for page layout is not straightforward. % For instance, when you have to write a document % according to the following layout instructions: % \begin{quote} % The total allowable width of the text area is 6.5 inches wide by 8.75 % inches high. The first line on each page should begin 1.2 inches from % the top edge of the page. The left margin should be 0.5 inch from % the left edge. % \end{quote} % you will find a gap between comprehensible layout parameters and the % \LaTeX\ dimensions to be specified. % In this case, you need to specify % \begin{quote} % |\setlength\textwidth{6.5in}|\\ % |\setlength\textheight{8.75in}|\\ % |\setlength\topmargin{0.2in}|\\ % |\setlength\oddsidemargin{-0.5in}|\\ % |\setlength\headheight{0pt}|\\ % |\setlength\headsep{0pt}| % \end{quote} % % This package allows \LaTeXe\ users to customize the page layout % (page size) by an easy and flexible user interface |\geometry|. % One can realize the above page layout by putting, for example, % \begin{quote} % |\usepackge{geometry}|\\ % |\geometry{body={6.5in,8.75in}, top=1.2in, left=2cm, nohead}| % \end{quote} % in the preamble. % % The name \textsl{geometry} comes from \texttt{-geometry} option for % specifying a size and location of a window in X Window System. % In the system one can set a window with the option like % \begin{quote} % \texttt{-geometry 150x200+8-10}. % \end{quote} % Setting a window on the root window corresponds to setting a total text % area, including page header and footer, on the paper in this package; % for instance, % \begin{quote} % |\geometry{ width=7in, height=9in, top=.5in, bottom=1in }|. % \end{quote} % % The previous version of the |geometry| package was called % |pagesize|, but was renamed because the package is totally rewritten to % use the \LaTeXe\ |keyval|\footnote{The |geometory| package requires % David Carlisle's |keyval| package, which can be found in the graphics % bundle of standard \LaTeXe\ packages.} interface and to introduce a new % algorithm for determining layout parameters. As a result, the package % provides more flexible user interface and new specification for page % layout while it does not work in \LaTeX209 environment. % % \section{Page structure for layout} % % To realize a straightforward setting for page layout, the following page % structure is introduced: A paper contains a total body and margins. % The total body consists of a body, a header, a footer and a marginal % note, which is optional. The margins are defined as a left-, right-, % top-\footnote{It is different from the ordinary \LaTeX\ dimension % |\string\topmargin|.} and bottom-margin. % \begin{quote} % \begin{tabular}{rcl} % \len{paper} &:& \len{total body} and \len{margins} \\ % \len{total body} &:& \len{head}, \len{body} and % \len{foot} ( plus \len{marginal notes} )\\ % \len{margins} &:& \len{left-}, \len{right-}, \len{top-} % and \len{bottom-margin} % \end{tabular} % \end{quote} % A body is also called a text area, size of which can be modified by % |\textwidth| and |\textheight|. % % The layout parts and the corresponding dimensions in the package are % listed below. % \begin{quote} % \begin{tabular}{r@{\hspace{2.5em}}ll} % & \multicolumn{2}{c}{Dimensions in |geometry|}\\ % Parts\hfil\null & \hfil Horizontal & \hfil Vertical \\\hline % \noalign{\vskip.2em} % \len{paper} &|paperwidth| &|paperheight|\\ % \len{total body} &|width| or |totalwidth| % &|height| or |totalheight|\\ % \len{body} &|textwidth| & |textheight|\\ % [.2em]\hline\noalign{\vskip.2em} % \len{left margin} &|left| or |lmargin| & \hfil---\\ % \len{right margin} &|right| or |rmargin| &\hfil---\\ % \len{top margin} &\hfil--- &|top| or |tmargin|\\ % \len{bottom margin} &\hfil--- &|bottom| or |bmargin|\\ % [.2em]\hline\noalign{\vskip.2em} % \len{marginal notes}&\vtop{\hbox{|marginparwidth| plus}% % \hbox{|marginparsep|}} & \hfil---\\[.3em] % \len{head} &\hfil---&\vtop{\hbox{|headheight| plus} % \hbox{|headsep|}}\\[.4em] % \len{foot} &\hfil---&|footskip|\\ % \noalign{\vskip.2em}\hline % \end{tabular} % \end{quote} % For example, |left| means a horizontal distance between the left edge of % a paper and that of a body. % % The dimensions for paper, total body and margins have the following % relations. % \[ \begin{array}{rcl} % |paperwidth| &=& |left| + |width| + |right|\\ % |paperheight| &=& |top| + |height| + |bottom|\\[1em] % \end{array} \] % Suppose paper size is pre-defined, if two dimensions out of three in the % right-hand side of each equation are given, the remnant dimension will % be determined. The partitioning algorithm in each direction is as % follows. % \begin{center} % \begin{tabular}{cccccccl} % \multicolumn{3}{c}{Settings}& &\multicolumn{3}{c}{Results}\\ % \noalign{\vspace{.1em}} % \cline{1-3}\cline{5-7} % \parbox{3em}{\hfil\len{left}}&\parbox{3em}{\hfil\len{width}}& % \parbox{3em}{\hfil\len{right}}&&% % \parbox{3em}{\hfil\len{left}}&\parbox{3em}{\hfil\len{width}}& % \parbox{3em}{\hfil\len{right}}&\\ % \cline{1-3}\cline{5-7} % \len{top}&\len{height}&\len{bottom}&&% % \len{top}&\len{height}&\len{bottom}&\\ % \noalign{\vspace{.1em}} % \cline{1-3}\cline{5-7} % |*| & |*| & |*| & & $m$ & $\ell$ & $m$ & Default.\\ % $\alpha$ & |*| & |*| & & $\alpha$ & $R_1$ & $\alpha$& % Balancing.\\ % |*| & |*| & $\alpha$ & & $\alpha$ & $R_1$ & $\alpha$& % Balancing.\\ % |*| & $\alpha$ & |*| &$\Longrightarrow$& % $R_2$ & $\alpha$ & $R_2$ & Centering.\\ % $\alpha$ & |*| & $\beta$ & & $\alpha$ & $R_3$ & $\beta$ &\\ % $\alpha$ & $\beta$ & |*| & & $\alpha$ & $\beta$ & $R_3$ &\\ % |*| & $\alpha$ & $\beta$ & & $R_3$ & $\alpha$ & $\beta$ &\\ % $\alpha$ & $\gamma$ &$\beta$&& $\alpha$ & $R_3$ & $\beta$& % Margins win.\\ % \cline{1-3}\cline{5-7} % \end{tabular} % \end{center} % The mark `|*|' denotes the parameter not specified, which means the % parameter will be determined by other ones. % $R_{n}$ ($n$=$1,2,3$) are remnant lengths which can be determined by % $\alpha$, $\beta$ and $L$ (|paperwidth| or |paperheight|) : % \[ \begin{array}{rcl} % R_1&=&L-2\alpha\\ % R_2&=&(L-\alpha)/2\\ % R_3&=&L-\alpha-\beta % \end{array}\] % If none of three dimensions is specified in each direction, default % setting is used: In horizontal direction, $\ell$ and $m$ are 80\% and % 10\% of |paperwidth| respectively. In vertical, 90\% and 5\% of % |paperheight|. % % The size of the total body, |width| and |heigth|, is defined as % the following relations. % \[ \begin{array}{rcl} % |width| &:=& |textwidth|\quad ( + |marginparsep| + % |marginparwidth| )\\ % |height| &:=& |textheight| + |headheight| + % |headsep| + |footskip| % \end{array} \] % Each of the seven dimensions in the right-hand side of the above % equations corresponds to the ordinary \LaTeX\ control sequence with the % same name. % The |width| definition can be switched by |includemp| option. % The dimensions for a header and a footer can be also controlled by % options (mode keys) as well as direct specification of lengths. % \begin{center} % \begin{tabular}{l@{\hspace{2em}}p{11cm}} % \hfil Mode keys & \hfil Effects \\\hline % |nohead| & sets |headheight=0pt, headsep=0pt| at the end.\\ % |nofoot| & sets |footskip=0pt| at the end.\\ % |noheadfoot| & equals |nohead| and |nofoot|\\ % |includemp| & takes account of the dimensions for marginal notes \newline % when determining |width|:\newline % |width| := |textwidth| + |marginparsep| + |marginparwidth|\\ % |reversemp| & makes the marginal notes appear in the left margin\newline % and sets |includemp| unless |includemp=false| exists.\newline % |reversemarginpar| results in the same effect.\\ % \hline % \end{tabular} % \end{center} % % \section{The user interface} % \subsection{General features} % The |\geometry| command takes one mandatory argument which specifies % neccessary (not all) parameters for the page layout. % The argument consists of a list of comma-separated options, which are % specified by the |keyval| interface: \meta{key}=\meta{value}. % The specification of |\geometry| argument has the % following features: % \begin{itemize}\itemsep=0pt % \item Option list with multiple lines is allowed. % \item Any spaces between words are ignored. % \item Options are basically order-independent.\\ % (There are some exceptions. See Section \ref{order-depend} for details.) % \end{itemize} % For instance, % \begin{quote} % \begin{verbatim} % \geometry{ a5paper , hmargin = { 3cm, % .1\w } , height % = 10in } % \end{verbatim} % \end{quote} % is equivalent to % \begin{quote} % |\geometry{height=10in,a5paper,hmargin={3cm,0.1\w}}|. % \end{quote} % Note that when a value has a sub-list of values, for instance % |hmargin={3cm,0.1\w}|, the order in the sub-list of values is important. % Here |\w| and |\h| are defined as |paperwidth| and |paperheight| % respectively in |\geometry| argument. % Blank lines are not allowed. % % \subsection{Option types} % There are five types of options: % \begin{enumerate}\itemsep=0pt % % \item \textbf{Boolean type (mode)} % % takes a boolean value (|true| or |false|). If no value, |true| % is set for default. % \begin{quote} % \meta{key}|=|\texttt{true}\OR\texttt{false}.\\ % \meta{key} with no value is equivalent to \meta{key}|=|\texttt{true}. % \end{quote} % \textit{Examples:}~ |verbose=true|, |nohead|, |twoside=false|.\\ % Paper name is the exception. The preferred paper name should be set % with no values. Even if any value is given, it is ignored. For % instance, |a4paper=XXX| is equivalent to |a4paper|. % % \item \textbf{Single-valued type} % % takes a mandatory value, namely dimension: % \begin{quote} % \meta{key}|=|\meta{value}. % \end{quote} % \textit{Examples:}~ |width=8in|, |left=1.25in|, |footskip=1cm|, % |height=.86\h|. % % \item \textbf{Two-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}|={|\meta{value1}|,|\meta{value2}|}|.\\ % \meta{key}|=|\meta{value} is equivalent to % \meta{key}|={|\meta{value}|,|\meta{value}|}|. % \end{quote} % \textit{Examples:}~ |hmargin={1.5in,1in}|, |scale=0.8|, % |body={7in,10in}|. % % \item \textbf{Three-valued type} % % takes three mandatory, comma-separated values in braces. % \begin{quote} % \meta{key}|={|\meta{value1}|,|\meta{value2}|,|\meta{value3}|}| % \end{quote} % \textit{Examples:}\\ % \hspace*{2em} |hdivide={2cm,*,1cm}|, |vdivide={3cm,19cm, }|, % |divide={1in,*,1in}|. % % \end{enumerate} % % \section{List of options} % % \subsection{Boolean options} % % The boolean options are also called ``mode keys''. You can change the mode % of page geometry. These options can appear not only in the argument of % |\geometry| but also in the package option list of geometry with no % arguments like, % \begin{quote} % |\usepackage[verbose,landscape]{geometry}|, % \end{quote} % which is equivalent to % \begin{quote} % |\usepackage{geometry}|\\ % |\geometry{verbose,landscape,|$\cdots$|}|. % \end{quote} % The option |reset| is the only exception. It should not appear % in the package option. % % The boolean options are listed below. % \begin{Options}{xxxxxxxxxxxxxxx} % \item[verbose] typeouts warnings and list of resulted page parameters. % \item[landscape] switches the paper orientation to landscape mode. % \item[portrait] switches the paper orientation to portrait mode. % \item[twoside] switches on two-sided printing. % \item[includemp] takes account of spaces for margin notes:\\ % |\marginparwidth| and |\marginparsep| % when adjusting horizontal partition. % \item[reversemp\OR reversemarginpar]~\\ % sets |includemp| and makes the marginal notes appear in % the left margin. % \item[nohead] eliminates spaces for the head of page, which is % equivalent to\\ ``|\headheight=0pt,| |\headsep=0pt|''. % \item[nofoot] eliminates spaces for the foot of page, which is % equivalent to\\ |\footskip=0pt|. % \item[noheadfoot] eliminates spaces for the head and foot of page, which % is equivalent to |nohead| and |nofoot|, i.e., \\ % ``|\headheight=0pt,| |\headsep=0pt,| |\footskip=0pt|''. % \item[reset] initializes all the modes above to be |false| except paper % name. The |reset| option, if necessary, must be used in the |\geometry| % argument and precede all other options. Note that |reset=false| cannot % cancel the previous |reset|(|=true|), just do nothing. % \item[\vtop{\hbox{a1paper, a2paper, a3paper, a4paper, a5paper,} % \hbox{b1paper, b2paper, b3paper, b4paper, b5paper,} % \hbox{letterpaper, executivepaper, legalpaper}}]~\\[1ex] % specifies paper name. These must be used % with no values. Note that if a paper name is written in the % argument, the paper is set regardless of the value, even |false|!. % For example, the followings are all the same: % ``|a5paper|'', ``|a5paper=true|'', ``|a5paper=false|'' and % ``|a5paper=XXXX|''. % \end{Options} % Some of the above options can be set as the document class % options. For instance, you can set |\documentclass[a4paper]{article}|, % then the paper size is inherited to the |geometry| package. % % \subsection{Single-valued keys} % % The keys with a mandatory value are listed below. % \begin{Options}{xxxxxxxxxxxxxxx} % \item[paper\OR papername] ~\\ paper name predefined in the |geometry| % package. |paper=|\meta{paper name}. For instance |paper=a4paper|. % \item[paperwidth] width of the paper. |paperwidth=|\meta{paper width}. % \item[paperheight] height of the paper. |paperheight=| % \meta{paper height}. % \item[width\OR totalwidth] ~\\ width of the total body. % |width=|\meta{width} or |totalwidth=|\meta{width}. This dimension % should not be confused with |textwidth|. Generally, |width| $\ge$ % |textwidth| because |width| includes the width of marginal notes % when the |includemp| key or dimensions for marginal notes is set. % If |textwidth| and |width| are specified at a time, |width| % will be ignored. % \item[height\OR totalheight] ~\\ height of the total body (including % header and footer). \\ |height=|\meta{height} or % |totalheight=|\meta{height}. If |textheight| and |height| are specified % at a time, |height| will be ignored. % \item[left\OR lmargin] left margin of the total body. In other words, % the distance between the left edge of the paper and that of the total % body. \\ |left=|\meta{left margin}. % \item[right\OR rmargin] right margin of the total body. % |right=|\meta{right margin}. % \item[top\OR tmargin] top margin of the total body. % |top=|\meta{top margin}. % \item[bottom\OR bmargin] bottom margin of the total body. % |bottom=|\meta{bottom margin}. % \item[hscale] ratio of width of the total body to |\paperwidth|. % |hscale=|\meta{h-ratio}.\\ % |hscale=0.8| is equivalent to |width=0.8\w|, % where |\w| is defined as an abbreviation of |\paperwidth| % and valid in the |geometry| argument. % \item[vscale] ratio of height of the total body to |\paperheight|. % |vscale=|\meta{v-ratio}.\\ % |vscale=0.9| is equivalent to |width=0.9\h|, % where |\h| is an abbreviation of |\paperheight|. % \item[textwidth] modifies |\textwidth|, width of text (body). % |textwidth=|\meta{width}. % \item[textheight] modifies |\textheight|, height of text (body). % |textheight=|\meta{height}. % \item[marginparwidth\OR marginpar]~\\ % modifies |\marginparwidth|, width of % the marginal notes. When this option is set, |includemp| is also set % |true| automatically. \\|marginparwidth=|\meta{length}. % \item[marginparsep] modifies |\marginparsep|, separation between body % and marginal notes. |includemp| is also set |true| automatically. \\ % |marginparsep=|\meta{length}. % \item[headheight\OR head] modifies |\headheight|, height of header.\\ % |headheight=|\meta{length} or |head=|\meta{length}. % \item[headsep] modifies |\headsep|, separation between header % and text (body).\\ |headsep=|\meta{length}. % \item[footskip\OR foot] modifies |\footskip|, distance separation % between baseline of last line of text and baseline of footer. % |footskip=|\meta{length} or |foot=|\meta{length}. % \item[hoffset] modifies |\hoffset|. |hoffset=|\meta{length}. % \item[voffset] modifies |\voffset|. |voffset=|\meta{length}. % \item[twosideshift] specifies extra space added to left-margin of % odd-numbered pages and subtracted from that of even-numbered pages. % |twoside| mode is also set. |twosideshift=|\meta{length}. The default % is 20pt. % \end{Options} % % \subsection{Two-valued keys} % % The following list shows keys taking two values in braces or one value % for short. % \begin{Options}{xxxxxxxxxxxxxxx} % \item[|papersize|] width and height of the paper.\\ % |papersize=|\argii{width}{height},\quad or |papersize=|\meta{length}. % \item[|total|] width and height of the total body.\\ % |total=|\argii{width}{height},\quad or |total=|\meta{length}. % \item[|body|\OR |text|] textwidth and textheight of the body of page.\\ % |body=|\argii{width}{height},\quad or |body=|\meta{length}. % \item[|scale|] ratio of the total body length to the paper's.\\ % |scale=|\argii{h-ratio}{v-ratio},\quad or |scale=|\meta{ratio}. % \item[|hmargin|] left and right margin.\\ % |hmargin=|\argii{left margin}{right margin},\quad or % |hmargin=|\meta{length}. % \item[|vmargin|] top and bottom margin.\\ % |vmargin=|\argii{top margin}{bottom margin},\quad or % |vmargin=|\meta{length}. % \item[|margin|] |margin={|$\alpha$|,|$\beta$|}| is equivalent to % ``|hmargin={|$\alpha$|,|$\beta$|},| % |vmargin={|$\alpha$|,|$\beta$|}|''.\\ % |margin=|$\alpha$ equals ``|hmargin=|$\alpha$|,| |vmargin=|$\alpha$''. % \item[|offset|] horizontal and vertical offset.\\ % |offset=|\argii{hoffset}{voffset},\quad or |offset=|\meta{length}. % \end{Options} % % \subsection{Three-valued keys} % % The keys taking three comma-separated values in braces are listed below. % \begin{Options}{xxxxxxxxxxxxxxx} % \item[hdivide] horizontal partitions (left,width,right).\\ % |hdivide={|\meta{left margin}|,|\meta{width}|,|\meta{right margin}|}|. % Note that you should not specify all of the three parameters. Specify % two out of three with the rest parameter set empty or `|*|'. % For example, when you set % |hdivide={2cm,15cm, }|, % the margin from the rightside edge of page is determined calculating % |paperwidth| |-| |2cm| |-| |15cm|. % \item[vdivide] vertical partitions (top,height,bottom).\\ % |vdivide={|\meta{top margin}|,|\meta{height}|,|\meta{bottom margin}|}|. % \item[divide] |divide={|$\alpha$|,|$\beta$|,|$\gamma$|}| is equivalent % to\\ % ``|hdivide={|$\alpha$|,|$\beta$|,|$\gamma$|},| % |vdivide={|$\alpha$|,|$\beta$|,|$\gamma$|}|''. % \end{Options} % % \section{Package options} % % As described in the previous section, the boolean keys except for % |reset| option can be used in the package option list. % There is another package option: % \begin{Options}{xxxxxxxxxxxxxxx} % \item[dvips] writes the paper size in the PostScript output with % the |\special| macro. If you use `dvips' command, this option is very % useful. For instance, to print a document with % |\geometry{a3paper,landscape}| on A3 paper in landscape mode, % you don't need options ``\texttt{-t a3 -t landscape}'' % to the `dvips' command. % \end{Options} % Note that the |dvips| option cannot be used as an argument of % |\geometry|, and cannot be reset by |reset| option since % |dvips| option executes an |\AtBeginDocument| command. % % \section{Configuration file} % % You can set up a configuration file so that some of the boolean % options and package ones always take effect, even if not specified % in the document/package option or argument of |\geometry| command. % To do this, produce a file |geometry.cfg| ( like |graphics.cfg| of % graphics package) containing, for instance, % \begin{quote} % |\ExecuteOptions{a4paper,dvips}| % \end{quote} % and install it to the TEXINPUTS directory with |geometry.sty|. % % \section{Option priority} % % \[\begin{array}{l} % \multicolumn{1}{c}{\textrm{low}\quad\longrightarrow\quad\textrm{high} % \quad(\textrm{priority}) }\\[1em] % \bullet\quad\left\{% % \begin{array}{l}|hscale|\\|vscale| % \end{array}\right\} < % \left\{\begin{array}{l}|width|\\|height|\end{array}\right\} < % \left\{\begin{array}{l}|textwidth|\\|textheight| % \end{array}\right\},\\[1.5em] % \bullet\quad\left\{% % \begin{array}{l}|head(height)|\\|headsep|\\|foot(skip)|% % \end{array}\right\} < % \left\{\begin{array}{l}|nohead|\\|nofoot|\\|noheadfoot| % \end{array}\right\}.\\ % \end{array}\] % For instance, % \begin{quote} % |\geometry{hscale=0.8, textwidth=7in, width=18cm }| % \end{quote} % is the same as |\geometry{textwidth=7in}|. % % \section{Order dependence}\label{order-depend} % % The options are basically order-independent, but there are some % exceptions. When the redundant or repeated specification is given, the % final setting is dependent on the order of appearance in the % argument. For instance, % \begin{quote} % |\geometry{verbose=true, verbose=false}| % \end{quote} % obviously results in |verbose=false|. % % Here is another example. If you set % \begin{quote} % |\geometry{hmargin={3cm,2cm},left=1cm}|, % \end{quote} % the left-margin is overwritten by |left=1cm|. % As a result, it is equivalent to % \begin{quote} % |\geometry{hmargin={1cm,2cm}}|. % \end{quote} % % The |reset| option should precede all other options in the |\geometry| % argument. If you set % \begin{quote} % |\geometry{nohead, reset}| , % \end{quote} % then |nohead| takes no effect. % % \section{Default Settings} % % Once you write |\usepackage{geometry}| in the preamble, the package will % perform the default layout, namely |scale={0.8, 0.9}|, by internal execution % of |\geometry{}|. % % \section{Examples} % % \begin{itemize} % \item Set the width of the total body to be 70\% that of the paper. % The total body is then centered horizontally. The following settings % result in the same effect. % \begin{quote} % |\geometry{hscale=0.7}|,\\ |\geometry{ width=0.7\w }|,\\ % |\geometry{hdivide={*,0.7\w,*}}|,\\ % |\geometry{ hmargin=0.15\w }|,\\ |\geometry{ left=0.15\w }|,\\ % |\geometry{left = .15\w, right= 0.15\w}|,\\ % |\geometry{ rmargin= .15\w }|. % \end{quote} % In this case, the default is used for vertical layout: |vscale=0.9|. % \item Set the height of the total body to be |10in|, the bottom-margin % |3cm|, and the width default. Then the top-margin is automatically % calculated in the package. % \begin{quote} % |\geometry{height=10in,bottom=2cm}|,\\ % |\geometry{bmargin = 2cm ,totalheight= 10in }|,\\ % |\geometry{vdivide = { *, 10in ,2cm } }|,\\ % and so on. % \end{quote} % \item Set the left-, right-, and top-margin |3cm|, |2cm| and |2.5in| % respectively. The page header is not used. The body is 40 lines of text % in height. % \begin{quote} % |\geometry{left=3cm,right=2cm, nohead,|\\ % | top=2.5in, textheight=40\baselineskip}|,\\ % |\geometry{ hmargin = {3cm, 2cm} , head=0pt, headsep=0pt|\\ % | tmargin = 2.5in, textheight=40\baselineskip}|,\\ % and so on. % \end{quote} % \item Include marginal notes when adjusting horizontal partition. % \begin{quote} % |\geometry{ includemp }|,\\ % |\geometry{ includemp = true }|,\\ % and so on. % \end{quote} % \item Modify the width of marginal notes to \texttt{3cm} and include % marginal notes when adjusting horizontal partition % \begin{quote} % |\geometry{ marginpar=3cm }|,\\ % |\geometry{ marginparwidth=3cm }|,\\ % |\geometry{ marginpar=3cm , includemp }|.\\ % In the last case |includemp| is not necessary.\\ % |\geometry{marginpar=3cm, reversemp}|\\ % makes the marginal notes appear in the left margin. % \end{quote} % \item Use A5 paper in landscape mode and a full scale of the % paper as the body. % \begin{quote} % |\geometry{ a5paper, landscape, scale=1.0 , noheadfoot}|,\\ % |\geometry{ landscape = TRUE , paper =a5paper, |\\ % | noheadfoot , total={\w,\h} }|,\\ % and so on. % \end{quote} % \end{itemize} % % \section{Acknowledgements} % I would like to thank Friedrich Flender, Piet van Oostrum and % Keith Reckdahl for their pointing out bugs and suggesting improvements. % % \StopEventually{} % % \section{The implementation} % The actual code of \textbf{geometry} package is as follows. % % This package requires David Carlisle's |keyval| package. % \begin{macrocode} %<*package> \RequirePackage{keyval}[1995/09/21] % \end{macrocode} % % Internal switches are declared. % \begin{macrocode} \newif\ifGeom@verbose \newif\ifGeom@landscape \newif\ifGeom@nohead \newif\ifGeom@nofoot \newif\ifGeom@includemp \newif\ifGeom@@includemp \newif\ifGeom@sethtotal \newif\ifGeom@setvtotal \newif\ifGeom@setwidth \newif\ifGeom@setheight \newif\ifGeom@settextwidth \newif\ifGeom@settextheight \newif\ifGeom@setlmargin \newif\ifGeom@setrmargin \newif\ifGeom@settmargin \newif\ifGeom@setbmargin % \end{macrocode} % \begin{macro}{\Geom@checknum} % The counter for determining directional partition is declared. % \begin{macrocode} \newcount\Geom@checknum % \end{macrocode} % \end{macro} % \begin{macro}{\Geom@Oheadheight} % \begin{macro}{\Geom@Oheadsep} % \begin{macro}{\Geom@Ofootskip} % The original lengths of \cmd{\headheight}, \cmd{\headsep} and % \cmd{\footskip} are saved. These lengths are set everytime \cmd{\geometry} is % called. % \begin{macrocode} \edef\Geom@Oheadheight{\the\headheight} \edef\Geom@Oheadsep{\the\headsep} \edef\Geom@Ofootskip{\the\footskip} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \begin{macro}{\Geom@Dhscale} % \begin{macro}{\Geom@Dvscale} % The default values for the horizontal and vertical \textsl{scale} are defined. % \begin{macrocode} \def\Geom@Dhscale{0.8} \def\Geom@Dvscale{0.9} % \end{macrocode} % \end{macro} % \end{macro} % \begin{macro}{\Geom@Dtwosideshift} % The default for \textsl{twosideshift} is defined. % \begin{macrocode} \def\Geom@Dtwosideshift{20pt} % \end{macrocode} % \end{macro} % The modes and the flag are initialized here. But |twoside| should not be % reset here because it may be inherited from the class option. % \begin{macrocode} \Geom@verbosefalse \Geom@landscapefalse \Geom@noheadfalse \Geom@nofootfalse \Geom@includempfalse \Geom@@includempfalse% checking setting of |includemp| % \end{macrocode} % \begin{macro}{\Geom@reset} % \begin{macrocode} \def\Geom@reset{% \@twosidefalse \@mparswitchfalse \Geom@verbosefalse \Geom@landscapefalse \Geom@noheadfalse \Geom@nofootfalse \Geom@includempfalse \Geom@@includempfalse} % \end{macrocode} % \end{macro} % % The option keys are defined below. % \begin{key}{Geom}{paper} % \begin{key}{Geom}{papername} % |paper| or |papername| takes paper name as its value. Available paper % names are listed below. % \begin{macrocode} \define@key{Geom}{paper}{\setkeys{Geom}{#1}} \let\KV@Geom@papername\KV@Geom@paper % \end{macrocode} % \end{key} % \end{key} % % \begin{key}{Geom}{a1paper} % \begin{key}{Geom}{a2paper} % \begin{key}{Geom}{a3paper} % \begin{key}{Geom}{a4paper} % \begin{key}{Geom}{a5paper} % \begin{key}{Geom}{b1paper} % \begin{key}{Geom}{b2paper} % \begin{key}{Geom}{b3paper} % \begin{key}{Geom}{b4paper} % \begin{key}{Geom}{b5paper} % \begin{key}{Geom}{letterpaper} % \begin{key}{Geom}{legalpaper} % \begin{key}{Geom}{executivepaper} % Thirteen standard paper names are available. % \begin{macrocode} \define@key{Geom}{a1paper}[true]{\def\Geom@paper{a1paper}} \define@key{Geom}{a2paper}[true]{\def\Geom@paper{a2paper}} \define@key{Geom}{a3paper}[true]{\def\Geom@paper{a3paper}} \define@key{Geom}{a4paper}[true]{\def\Geom@paper{a4paper}} \define@key{Geom}{a5paper}[true]{\def\Geom@paper{a5paper}} \define@key{Geom}{b1paper}[true]{\def\Geom@paper{b1paper}} \define@key{Geom}{b2paper}[true]{\def\Geom@paper{b2paper}} \define@key{Geom}{b3paper}[true]{\def\Geom@paper{b3paper}} \define@key{Geom}{b4paper}[true]{\def\Geom@paper{b4paper}} \define@key{Geom}{b5paper}[true]{\def\Geom@paper{b5paper}} \define@key{Geom}{letterpaper}[true]{\def\Geom@paper{letterpaper}} \define@key{Geom}{legalpaper}[true]{\def\Geom@paper{legalpaper}} \define@key{Geom}{executivepaper}[true]{\def\Geom@paper{executivepaper}} % \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}\end{key} % % \begin{key}{Geom}{papersize} % \begin{key}{Geom}{paperwidth} % \begin{key}{Geom}{paperheight} % \begin{macrocode} \define@key{Geom}{papersize}{\Geom@branch{#1}{paperwidth}{paperheight}} \define@key{Geom}{paperwidth}{\setlength\paperwidth{#1}% \let\Geom@paper\undefined} \define@key{Geom}{paperheight}{\setlength\paperheight{#1}% \let\Geom@paper\undefined} % \end{macrocode} % \end{key} % \end{key} % \end{key} % % \begin{key}{Geom}{total} % \begin{key}{Geom}{width} % \begin{key}{Geom}{height} % \begin{key}{Geom}{totalwidth} % \begin{key}{Geom}{totalheight} % \begin{macrocode} \define@key{Geom}{total}{\Geom@branch{#1}{width}{height}} \define@key{Geom}{width}{\Geom@sethtotaltrue\Geom@setwidthtrue% \edef\Geom@width{#1}} \define@key{Geom}{height}{\Geom@setvtotaltrue\Geom@setheighttrue% \edef\Geom@height{#1}} \let\KV@Geom@totalwidth\KV@Geom@width \let\KV@Geom@totalheight\KV@Geom@height % \end{macrocode} % \end{key} % \end{key} % \end{key} % \end{key} % \end{key} % % \begin{key}{Geom}{body} % \begin{key}{Geom}{text} % \begin{key}{Geom}{textwidth} % \begin{key}{Geom}{textheight} % \begin{macrocode} \define@key{Geom}{body}{\Geom@branch{#1}{textwidth}{textheight}} \let\KV@Geom@text\KV@Geom@body \define@key{Geom}{textwidth}{\Geom@sethtotaltrue\Geom@setwidthtrue% \Geom@settextwidthtrue% \edef\Geom@textwidth{#1}} \define@key{Geom}{textheight}{\Geom@setvtotaltrue\Geom@setheighttrue% \Geom@settextheighttrue% \edef\Geom@textheight{#1}} % \end{macrocode} % \end{key} % \end{key} % \end{key} % \end{key} % % \begin{key}{Geom}{scale} % \begin{key}{Geom}{hscale} % \begin{key}{Geom}{vscale} % \begin{macrocode} \define@key{Geom}{scale}{\Geom@branch{#1}{hscale}{vscale}} \define@key{Geom}{hscale}{\Geom@sethtotaltrue\edef\Geom@hscale{#1}} \define@key{Geom}{vscale}{\Geom@setvtotaltrue\edef\Geom@vscale{#1}} % \end{macrocode} % \end{key} % \end{key} % \end{key} % % \begin{key}{Geom}{margin} % \begin{key}{Geom}{hmargin} % \begin{key}{Geom}{vmargin} % \begin{key}{Geom}{lmargin} % \begin{key}{Geom}{rmargin} % \begin{key}{Geom}{tmargin} % \begin{key}{Geom}{bmargin} % \begin{key}{Geom}{left} % \begin{key}{Geom}{right} % \begin{key}{Geom}{top} % \begin{key}{Geom}{bottom} % \begin{macrocode} \define@key{Geom}{margin}{\Geom@branch{#1}{lmargin}{tmargin}% \Geom@branch{#1}{rmargin}{bmargin}} \define@key{Geom}{hmargin}{\Geom@branch{#1}{lmargin}{rmargin}} \define@key{Geom}{vmargin}{\Geom@branch{#1}{tmargin}{bmargin}} \define@key{Geom}{lmargin}{\Geom@setlmargintrue\edef\Geom@lmargin{#1}} \define@key{Geom}{rmargin}{\Geom@setrmargintrue\edef\Geom@rmargin{#1}} \define@key{Geom}{tmargin}{\Geom@settmargintrue\edef\Geom@tmargin{#1}} \define@key{Geom}{bmargin}{\Geom@setbmargintrue\edef\Geom@bmargin{#1}} \let\KV@Geom@left\KV@Geom@lmargin \let\KV@Geom@right\KV@Geom@rmargin \let\KV@Geom@top\KV@Geom@tmargin \let\KV@Geom@bottom\KV@Geom@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} % \begin{key}{Geom}{divide} % \begin{key}{Geom}{hdivide} % \begin{key}{Geom}{vdivide} % Provide useful ways to partition each direction of paper. % \begin{macrocode} \define@key{Geom}{divide}{\Geom@divideParser{#1}{lmargin}{width}{rmargin}% \Geom@divideParser{#1}{tmargin}{height}{bmargin}} \define@key{Geom}{hdivide}{\Geom@divideParser{#1}{lmargin}{width}{rmargin}} \define@key{Geom}{vdivide}{\Geom@divideParser{#1}{tmargin}{height}{bmargin}} % \end{macrocode} % \end{key} % \end{key} % \end{key} % \begin{key}{Geom}{offset} % \begin{key}{Geom}{hoffset} % \begin{key}{Geom}{voffset} % \begin{macrocode} \define@key{Geom}{offset}{\Geom@branch{#1}{hoffset}{voffset}} \define@key{Geom}{hoffset}{\setlength\hoffset{#1}} \define@key{Geom}{voffset}{\setlength\voffset{#1}} % \end{macrocode} % \end{key} % \end{key} % \end{key} % \begin{key}{Geom}{headheight} % \begin{key}{Geom}{headsep} % \begin{key}{Geom}{footskip} % \begin{key}{Geom}{head} % \begin{key}{Geom}{foot} % \begin{macrocode} \define@key{Geom}{headheight}{\Geom@noheadfalse\setlength\headheight{#1}} \define@key{Geom}{headsep}{\Geom@noheadfalse\setlength\headsep{#1}} \define@key{Geom}{footskip}{\Geom@nofootfalse\setlength\footskip{#1}} \let\KV@Geom@head\KV@Geom@headheight \let\KV@Geom@foot\KV@Geom@footskip % \end{macrocode} % \end{key} % \end{key} % \end{key} % \end{key} % \end{key} % \begin{key}{Geom}{marginparwidth} % \begin{key}{Geom}{marginparsep} % \begin{key}{Geom}{marginpar} % \begin{key}{Geom}{reversemarginpar} % \begin{key}{Geom}{reversemp} % To keep order-independence, if |includemp| is not found at this point of % time, |includemp| is set |true|. % \begin{macrocode} \define@key{Geom}{marginparwidth}% {\ifGeom@@includemp\else\Geom@includemptrue\fi% \setlength\marginparwidth{#1}} \define@key{Geom}{marginparsep}% {\ifGeom@@includemp\else\Geom@includemptrue\fi% \setlength\marginparsep{#1}} \let\KV@Geom@marginpar\KV@Geom@marginparwidth \define@key{Geom}{reversemarginpar}[true]%% {\ifGeom@@includemp\else\Geom@includemptrue\fi% \lowercase{\expandafter\csname if#1\endcsname \@reversemargintrue\else\@reversemarginfalse\fi}} \define@key{Geom}{reversemp}[true]%% {\ifGeom@@includemp\else\Geom@includemptrue\fi% \lowercase{\expandafter\csname if#1\endcsname \@reversemargintrue\else\@reversemarginfalse\fi}} % \end{macrocode} % \end{key} % \end{key} % \end{key} % \end{key} % \end{key} % \begin{key}{Geom}{twosideshift} % \begin{macrocode} \define@key{Geom}{twosideshift}{\@twosidetrue\def\Geom@twosideshift{#1}} % \end{macrocode} % \end{key} % \begin{key}{Geom}{reset} % |reset| option resets the modes and the |includemp| flag to prevent % them from being inherited. This should precede all other options if it % is used. % \begin{macrocode} \define@key{Geom}{reset}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \Geom@reset\fi}} % \end{macrocode} % \end{key} % \begin{key}{Geom}{verbose} % \begin{key}{Geom}{twoside} % \begin{key}{Geom}{includemp} % \begin{key}{Geom}{nohead} % \begin{key}{Geom}{nofoot} % \begin{key}{Geom}{noheadfoot} % \begin{key}{Geom}{landscape} % \begin{key}{Geom}{portrait} % \begin{macrocode} \define@key{Geom}{verbose}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \Geom@verbosetrue\else\Geom@verbosefalse\fi}} \define@key{Geom}{twoside}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \@twosidetrue\@mparswitchtrue \else\@twosidefalse\@mparswitchfalse\fi}} \define@key{Geom}{includemp}[true]%% {\Geom@@includemptrue \lowercase{\expandafter\csname if#1\endcsname \Geom@includemptrue\else\Geom@includempfalse\fi}} \define@key{Geom}{nohead}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \Geom@noheadtrue\else\Geom@noheadfalse\fi}} \define@key{Geom}{nofoot}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \Geom@nofoottrue\else\Geom@nofootfalse\fi}} \define@key{Geom}{noheadfoot}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \Geom@noheadtrue\Geom@nofoottrue\else \Geom@noheadfalse\Geom@nofootfalse\fi}} \define@key{Geom}{landscape}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \Geom@landscapetrue\else\Geom@landscapefalse\fi}} \define@key{Geom}{portrait}[true]%% {\lowercase{\expandafter\csname if#1\endcsname \Geom@landscapefalse\else\Geom@landscapetrue\fi}} % \end{macrocode} % \end{key} % \end{key} % \end{key} % \end{key} % \end{key} % \end{key} % \end{key} % \end{key} % % Package options are declared. % \begin{macrocode} \DeclareOption{verbose}{\Geom@verbosetrue} \DeclareOption{a1paper}{\setkeys{Geom}{a1paper}} \DeclareOption{a2paper}{\setkeys{Geom}{a2paper}} \DeclareOption{a3paper}{\setkeys{Geom}{a3paper}} \DeclareOption{a4paper}{\setkeys{Geom}{a4paper}} \DeclareOption{a5paper}{\setkeys{Geom}{a5paper}} \DeclareOption{b1paper}{\setkeys{Geom}{b1paper}} \DeclareOption{b2paper}{\setkeys{Geom}{b2paper}} \DeclareOption{b3paper}{\setkeys{Geom}{b3paper}} \DeclareOption{b4paper}{\setkeys{Geom}{b4paper}} \DeclareOption{b5paper}{\setkeys{Geom}{b5paper}} \DeclareOption{letterpaper}{\setkeys{Geom}{letterpaper}} \DeclareOption{legalpaper}{\setkeys{Geom}{legalpaper}} \DeclareOption{executivepaper}{\setkeys{Geom}{executivepaper}} \DeclareOption{portrait}{\Geom@landscapefalse} \DeclareOption{landscape}{\Geom@landscapetrue} \DeclareOption{twoside}{\@twosidetrue} \DeclareOption{nohead}{\Geom@noheadtrue} \DeclareOption{nofoot}{\Geom@nofoottrue} \DeclareOption{noheadfoot}{\Geom@noheadtrue\Geom@nofoottrue} \DeclareOption{includemp}{\Geom@@includemptrue\Geom@includemptrue} \DeclareOption{reversemarginpar}{\Geom@@includemptrue\Geom@includemptrue% \@reversemargintrue} \DeclareOption{reversemp}{\Geom@@includemptrue\Geom@includemptrue% \@reversemargintrue} \DeclareOption{dvips}{\AtBeginDocument{\AtBeginDvi{% \special{papersize=\the\paperwidth,\the\paperheight}}}} \DeclareOption*{\PackageWarningNoLine{geometry} {Unknown option `\CurrentOption'}} % \end{macrocode} % |portrait| is a default option. % \begin{macrocode} \ExecuteOptions{portrait} % \end{macrocode} % A local configuration file may define more options. % If a site wants a default paper, it needs to put % |\ExecuteOptions{a4paper}| in a |geometry.cfg| file. % \begin{macrocode} \InputIfFileExists{geometry.cfg}{}{} % \end{macrocode} % Options are processed in the order that they appear in the % option-lists. First the global options, and then the local ones. % \begin{macrocode} \ProcessOptions* % \end{macrocode} % % \begin{macro}{\Geom@checkbool} % \begin{macro}{\Geom@checkdef} % Macros for printout of page layout parameters. % \begin{macrocode} \def\Geom@checkbool#1{% \csname ifGeom@#1\endcsname #1\else\fi} \def\Geom@checkdef#1{% \@ifundefined{Geom@#1}{---}{\@nameuse{Geom@#1}}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\Geom@det@one} % Determine |#4| by |#1|(\len{paperwidth} or \len{paperheight}), % |#2| and |#3|. % \begin{macrocode} \def\Geom@det@one#1#2#3#4{% determine #4. \setlength\@tempdima{\@nameuse{paper#1}} \setlength\@tempdimb{\@nameuse{Geom@#2}} \addtolength\@tempdima{-\@tempdimb} \setlength\@tempdimb{\@nameuse{Geom@#3}} \addtolength\@tempdima{-\@tempdimb} \ifdim\@tempdima<\z@ \Geom@warning{`#4' results in NEGATIVE (\the\@tempdima). ^^J\@spaces Parameters of `#2' and `#3' should be shortened} \fi \expandafter\edef\csname Geom@#4\endcsname{\the\@tempdima}} % \end{macrocode} % \end{macro} % % \begin{macro}{\Geom@det@two} % Determine |#2| and |#3| by |#1|(\len{paperwidth} or \len{paperheight}) % and |#1|(\len{width} or \len{height}). % \begin{macrocode} \def\Geom@det@two#1#2#3{% determine #2 and #3. \setlength\@tempdima{\@nameuse{paper#1}} \setlength\@tempdimb{\@nameuse{Geom@#1}} \addtolength\@tempdima{-\@tempdimb} \divide\@tempdima\tw@ \ifdim\@tempdima<\z@ \Geom@warning{`#2' and `#3' result in NEGATIVE (\the\@tempdima). ^^J\@spaces Parameter for `#1' should be shortened} \fi \expandafter\edef\csname Geom@#2\endcsname{\the\@tempdima} \expandafter\edef\csname Geom@#3\endcsname{\the\@tempdima}} % \end{macrocode} % \end{macro} % % \begin{macro}{\Geom@det@all} % Determine directional partition. % \begin{macrocode} \def\Geom@det@all[#1]#2#3#4{% \Geom@checknum\z@ \if#1h \ifGeom@setlmargin\advance\Geom@checknum4\relax\fi \ifGeom@sethtotal \advance\Geom@checknum2\relax\fi \ifGeom@setrmargin\advance\Geom@checknum1\relax\fi \else \ifGeom@settmargin\advance\Geom@checknum4\relax\fi \ifGeom@setvtotal \advance\Geom@checknum2\relax\fi \ifGeom@setbmargin\advance\Geom@checknum1\relax\fi \fi \ifcase\Geom@checknum % 0:(*,*,*) \if#1h \Geom@warning{Horizontal partition is set default\space (hscale=\Geom@Dhscale)} \edef\Geom@width{\Geom@Dhscale\paperwidth} \else \Geom@warning{Vertical partition is set default\space (vscale=\Geom@Dvscale)} \edef\Geom@height{\Geom@Dvscale\paperheight} \fi \Geom@det@two{#2}{#3}{#4} \or % 1:(*,*,S) goto (5) \Geom@warning{`#2' and `#3' not unique. #3 <= #4} \expandafter\edef\csname Geom@#3\endcsname{\@nameuse{Geom@#4}} \Geom@det@one{#2}{#3}{#4}{#2} \or\Geom@det@two{#2}{#3}{#4} % 2:(*,S,*) \or\Geom@det@one{#2}{#2}{#4}{#3} % 3:(*,S,S) \or % 4:(S,*,*) goto (5) \Geom@warning{`#2' and `#4' not unique. #4 <= #3} \expandafter\edef\csname Geom@#4\endcsname{\@nameuse{Geom@#3}} \Geom@det@one{#2}{#3}{#4}{#2} \or\Geom@det@one{#2}{#3}{#4}{#2} % 5:(S,*,S) \or\Geom@det@one{#2}{#2}{#3}{#4} % 6:(S,S,*) \or % 7:(S,S,S) goto (5) \Geom@warning{Redundant specification in `#1'-direction. ^^J\@spaces `#2' (\@nameuse{Geom@#2}) is ignored} \Geom@det@one{#2}{#3}{#4}{#2} \else\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\Geom@divideParser} % The macro for parsing (h,v)|divide| options. % \begin{macrocode} \def\Geom@divideParser#1#2#3#4{% \def\Geom@star{*} \@tempcnta\z@ \@for\Geom@tmp:=#1\do{% \expandafter\KV@@sp@def\expandafter\Geom@frag\expandafter{\Geom@tmp} \edef\Geom@value{\Geom@frag} \ifcase\@tempcnta\relax% cnta == 0 \edef\Geom@key{#2} \or \edef\Geom@key{#3} \else \edef\Geom@key{#4} \fi \@nameuse{Geom@set\Geom@key false} \ifx\empty\Geom@value\else \ifx\Geom@star\Geom@value\else \setkeys{Geom}{\Geom@key=\Geom@value} \fi\fi \advance\@tempcnta\@ne } \let\Geom@star\relax} % \end{macrocode} % \end{macro} % % \begin{macro}{\Geom@branch} % The macro for `branching' or duplicating a option. % \begin{macrocode} \def\Geom@branch#1#2#3{% \@tempcnta\z@ \@for\Geom@tmp:=#1\do{% \KV@@sp@def\Geom@frag{\Geom@tmp} \edef\Geom@value{\Geom@frag} \ifcase\@tempcnta\relax% cnta == 0 \setkeys{Geom}{#2=\Geom@value} \or% cnta == 1 \setkeys{Geom}{#3=\Geom@value} \else\fi \advance\@tempcnta\@ne } \ifnum\@tempcnta=\@ne \setkeys{Geom}{#2=\Geom@value} \setkeys{Geom}{#3=\Geom@value} \fi} % \end{macrocode} % \end{macro} % Various paper size are defined. % \begin{macrocode} \@namedef{Geom@a1paper}{% \setlength\paperwidth{595mm}\setlength\paperheight{841mm}} \@namedef{Geom@a2paper}{% \setlength\paperwidth{420mm}\setlength\paperheight{595mm}} \@namedef{Geom@a3paper}{% \setlength\paperwidth{297mm}\setlength\paperheight{420mm}} \@namedef{Geom@a4paper}{% \setlength\paperwidth{210mm}\setlength\paperheight{297mm}} \@namedef{Geom@a5paper}{% \setlength\paperwidth{149mm}\setlength\paperheight{210mm}} \@namedef{Geom@b1paper}{% \setlength\paperwidth{707mm}\setlength\paperheight{1000mm}} \@namedef{Geom@b2paper}{% \setlength\paperwidth{500mm}\setlength\paperheight{707mm}} \@namedef{Geom@b3paper}{% \setlength\paperwidth{353mm}\setlength\paperheight{500mm}} \@namedef{Geom@b4paper}{% \setlength\paperwidth{250mm}\setlength\paperheight{353mm}} \@namedef{Geom@b5paper}{% \setlength\paperwidth{176mm}\setlength\paperheight{250mm}} \@namedef{Geom@letterpaper}{% \setlength\paperwidth{8.5in}\setlength\paperheight{11in}} \@namedef{Geom@legalpaper}{% \setlength\paperwidth{8.5in}\setlength\paperheight{14in}} \@namedef{Geom@executivepaper}{% \setlength\paperwidth{7.25in}\setlength\paperheight{10.5in}} % \end{macrocode} % \begin{macro}{\Geom@showParam} % The macro for typeout of geometry status and parameters. % \begin{macrocode} \def\Geom@showParam{% \typeout{----------------------- Geometry parameters} \typeout{mode: \Geom@checkbool{landscape}\space \Geom@checkbool{nohead}\space \Geom@checkbool{nofoot}\space \Geom@checkbool{includemp}\space \if@reversemargin reversemp\space\fi \if@twoside twoside\space\fi} \@ifundefined{Geom@paper}{}{\typeout{paper: \Geom@paper}} \typeout{hdivide: \Geom@checkdef{lmargin}, % \Geom@checkdef{width}, \Geom@checkdef{rmargin}} \typeout{vdivide: \Geom@checkdef{tmargin}, % \Geom@checkdef{height}, \Geom@checkdef{bmargin}} \if@twoside \typeout{twosideshift: \Geom@twosideshift} \fi \typeout{----------------------- LaTeX parameters} \typeout{\string\paperwidth\space\space\the\paperwidth} \typeout{\string\paperheight\space\the\paperheight} \typeout{\string\textwidth\space\space\the\textwidth} \typeout{\string\textheight\space\the\textheight} \typeout{\string\oddsidemargin\space\space\the\oddsidemargin} \typeout{\string\evensidemargin\space\the\evensidemargin} \typeout{\string\topmargin\space\space\the\topmargin} \typeout{\string\headheight\space\the\headheight} \typeout{\string\headsep\@spaces\the\headsep} \typeout{\string\footskip\space\space\space\the\footskip} \ifGeom@includemp \typeout{\string\marginparwidth\space\the\marginparwidth} \typeout{\string\marginparsep\space\space\space\the\marginparsep} \fi \typeout{\string\hoffset\space\the\hoffset} \typeout{\string\voffset\space\the\voffset} \typeout{(1in=72.27pt, 1cm=28.45pt)} \typeout{-----------------------------------------}} % \end{macrocode} % \end{macro} % % \begin{macrocode} \AtBeginDocument{% \ifGeom@verbose \Geom@showParam \fi} % \end{macrocode} % % \begin{macro}{\geometry} % The user interface \cmd{\geometry}\marg{key-val parameters} is defined here. % \begin{macrocode} \def\geometry#1{% % \end{macrocode} % % \begin{macro}{\w} % \begin{macro}{\h} % |\w| and |\h| are abbreviations for |\paperwidth| and |\paperheight| respectively. % They are valid only in the argument of |\geometry|. % \begin{macrocode} \@ifundefined{w}{\let\Geom@ow\relax}{\let\Geom@ow\w} \@ifundefined{h}{\let\Geom@oh\relax}{\let\Geom@oh\h} \let\w\paperwidth \let\h\paperheight % \end{macrocode} % \end{macro} % \end{macro} % % Initialization of switches and parameters. % \begin{macrocode} \Geom@sethtotalfalse \Geom@setvtotalfalse \Geom@setwidthfalse \Geom@setheightfalse \Geom@setlmarginfalse \Geom@setrmarginfalse \Geom@settmarginfalse \Geom@setbmarginfalse \setlength\hoffset{0pt} \setlength\voffset{0pt} \setlength\headheight{\Geom@Oheadheight} \setlength\headsep{\Geom@Oheadsep} \setlength\footskip{\Geom@Ofootskip} \def\Geom@twosideshift{\Geom@Dtwosideshift} % \end{macrocode} % The argument is processed here. % \begin{macrocode} \setkeys{Geom}{#1} % \end{macrocode} % If |paper| option is specified, the predefined paper dimensions % are set. % \begin{macrocode} \@ifundefined{Geom@paper}{}{\@nameuse{Geom@\Geom@paper}} % \end{macrocode} % If |landscape| option is specified, the paper orientation is changed to % landscape. % \begin{macrocode} \ifGeom@landscape \setlength\@tempdima{\paperwidth} \setlength\paperwidth{\paperheight} \setlength\paperheight{\@tempdima} \fi % \end{macrocode} % If |nohead| option is specified, the vertical spaces for the head % of page are all set to 0pt. If |nofoot|, the |\footskip| is set 0pt. % \begin{macrocode} \ifGeom@nohead \setlength\headheight{0pt} \setlength\headsep{0pt} \fi \ifGeom@nofoot \setlength\footskip{0pt} \fi % \end{macrocode} % The width of the total body \cmd{\Geom@width} is determined. % \begin{macrocode} \ifGeom@sethtotal \ifGeom@setwidth \ifGeom@settextwidth \setlength\@tempdima{\Geom@textwidth} \ifGeom@includemp \addtolength\@tempdima{\marginparwidth} \addtolength\@tempdima{\marginparsep} \fi \edef\Geom@width{\the\@tempdima} \fi \else \edef\Geom@width{\Geom@hscale\paperwidth} \fi \fi % \end{macrocode} % The height of the total body \cmd{\Geom@height} is determined. % \begin{macrocode} \ifGeom@setvtotal \ifGeom@setheight \ifGeom@settextheight \setlength\@tempdima{\Geom@textheight} \addtolength\@tempdima{\headheight} \addtolength\@tempdima{\headsep} \addtolength\@tempdima{\footskip} \edef\Geom@height{\the\@tempdima} \fi \else \edef\Geom@height{\Geom@vscale\paperheight} \fi \fi % \end{macrocode} % The horizontal and vertical partitionings are determined here. % \begin{macrocode} \Geom@det@all[h]{width}{lmargin}{rmargin} \Geom@det@all[v]{height}{tmargin}{bmargin} % \end{macrocode} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \cmd{\textwidth}, \cmd{\textheight}, \cmd{\topmargin}, % \cmd{\oddsidemargin} and \cmd{\evensidemargin} are calculated below. % \begin{macrocode} \setlength\textwidth{\Geom@width} \setlength\textheight{\Geom@height} \setlength\topmargin{\Geom@tmargin} \setlength\oddsidemargin{\Geom@lmargin} \ifGeom@includemp \addtolength\textwidth{-\marginparwidth} \addtolength\textwidth{-\marginparsep} \if@reversemargin \addtolength\oddsidemargin{\marginparwidth} \addtolength\oddsidemargin{\marginparsep} \fi \fi \addtolength\textheight{-\headheight} \addtolength\textheight{-\headsep} \addtolength\textheight{-\footskip} \addtolength\topmargin{-1in} \addtolength\oddsidemargin{-1in} \if@twoside \setlength\evensidemargin{\Geom@rmargin} \addtolength\evensidemargin{-1in} \setlength\@tempdima{\Geom@twosideshift} \addtolength\oddsidemargin{\@tempdima} \addtolength\evensidemargin{-\@tempdima} \ifGeom@includemp \if@mparswitch \setlength\@tempdima{\marginparwidth} \addtolength\@tempdima{\marginparsep} \addtolength\evensidemargin{\@tempdima} \if@reversemargin \addtolength\evensidemargin{-\marginparwidth} \addtolength\evensidemargin{-\marginparsep} \fi \fi \fi \else \setlength\evensidemargin{\oddsidemargin} \fi % \end{macrocode} % The local abbreviations \cmd{\w} and \cmd{\h} are replaced by the % original definitions or |\relax| if these are not predefined. % \begin{macrocode} \let\w\Geom@ow \let\h\Geom@oh } % \end{macrocode} % \end{macro} % A hack for silent execution of the default geometry setting. % \begin{macrocode} \let\Geom@warning\@gobble % \end{macrocode} % The default geometry command is executed in silent mode. % \begin{macrocode} \geometry{} % \end{macrocode} % The macro for typeout of warning is defined. % \begin{macro}{\Geom@warning} % \begin{macrocode} \def\Geom@warning#1{% \ifGeom@verbose \typeout{^^JWarning(geometry):\space #1.} \fi} % % \end{macrocode} % \end{macro} % % \Finale %