summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/geometry/geometry.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-07 01:31:46 +0000
committerKarl Berry <karl@freefriends.org>2008-11-07 01:31:46 +0000
commit3ce8ae42c698d44315421ad06c07b8618271fe11 (patch)
tree809698e87325d5e699b30f5a9a3a18d6f98d3ee9 /Master/texmf-dist/source/latex/geometry/geometry.dtx
parentda2287ad4b9064c7cd79a5b1f3917dfff2bc3adc (diff)
geometry 4.0 (6nov08)
git-svn-id: svn://tug.org/texlive/trunk@11210 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/geometry/geometry.dtx')
-rw-r--r--Master/texmf-dist/source/latex/geometry/geometry.dtx717
1 files changed, 523 insertions, 194 deletions
diff --git a/Master/texmf-dist/source/latex/geometry/geometry.dtx b/Master/texmf-dist/source/latex/geometry/geometry.dtx
index ad991a72efc..2e4f75ce69d 100644
--- a/Master/texmf-dist/source/latex/geometry/geometry.dtx
+++ b/Master/texmf-dist/source/latex/geometry/geometry.dtx
@@ -1,42 +1,153 @@
% \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.
-%%
-%
-%<package>\NeedsTeXFormat{LaTeX2e}%
-%<package>\ProvidesPackage{geometry}[2002/07/08 v3.2 Page Geometry]
-%<driver>\ProvidesFile{geometry.drv}
-%<manual>\ProvidesFile{manual.drv}
-%<driver> [Geometry documentation driver file]
-%<manual> [Geometry manual driver file (A4 PDF)]
-%<*driver|manual>
+%
+% Copyright 1996-2002, 2008 by Hideo Umeki <latexgeometry@gmail.com>
+%
+% LaTeX Package: Geometry
+% -----------------------
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3c of this license
+% or (at your option) any later version. The latest version of this
+% license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work is "maintained" (as per the LPPL maintenance status)
+% by Hideo Umeki.
+%
+% This work consists of the files geometry.dtx and
+% the derived files: geometry.{sty,ins,drv}, geometry-samples.tex.
+%
+% Distribution:
+% CTAN: macros/latex/contrib/geometry/geometry.dtx
+% CTAN: macros/latex/contrib/geometry/geometry.pdf
+%
+% Unpacking: to get geometry.{ins,drv} and geometry-test.tex
+% (a) Directly
+% tex geometry.dtx
+% (b) If geometry.ins is present, you can go
+% tex geometry.ins
+% (c) If you insist on using LaTeX,
+% latex \let\install=y\input{geometry.dtx}
+% (quote the arguments according to the demands of your shell)
+%
+% Documentation: to get geometry.dvi or pdf
+% (a) Directly
+% (pdf)latex geometry.dtx
+% (b) If geometry.drv is present, you can go
+% (pdf)latex geometry.drv
+%
+% Installation:
+% TDS:tex/latex/geometry/geometry.sty
+% TDS:doc/latex/geometry/geometry.pdf
+% TDS:source/latex/geometry/geometry.dtx
+%
+%<*ignore>
+\begingroup
+ \def\x{LaTeX2e}
+\expandafter\endgroup
+\ifcase 0\ifx\install y1\fi\expandafter
+ \ifx\csname processbatchFile\endcsname\relax\else1\fi
+ \ifx\fmtname\x\else 1\fi\relax
+\else\csname fi\endcsname
+%</ignore>
+%<*install>
+\input docstrip.tex
+\Msg{************************************************************************}
+\Msg{* Installation}
+\Msg{* Package: geometry 2008/11/06 v4.0 Page Geometry}
+\Msg{************************************************************************}
+
+\keepsilent
+\askforoverwritefalse
+
+\preamble
+
+Copyright (C) 1996-2002, 2008 by Hideo Umeki <latexgeometry@gmail.com>
+
+This work may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3c of this license
+or (at your option) any later version. The latest version of this
+license is in
+ http://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work is "maintained" (as per the LPPL maintenance status)
+by Hideo Umeki.
+
+This work consists of the files geometry.dtx and
+the derived files: geometry.{sty,ins,drv}, geometry-samples.tex.
+
+\endpreamble
+
+\generate{%
+ \file{geometry.ins}{\from{geometry.dtx}{install}}%
+ \file{geometry.drv}{\from{geometry.dtx}{driver}}%
+ \usedir{tex/latex/geometry}%
+ \file{geometry.sty}{\from{geometry.dtx}{package}}%
+ \file{geometry.cfg}{\from{geometry.dtx}{config}}%
+ \file{geometry-samples.tex}{\from{geometry.dtx}{samples}}%
+}
+
+\obeyspaces
+\Msg{************************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by LaTeX:}
+\Msg{*}
+\Msg{* \space\space geometry.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file `geometry.drv'}
+\Msg{* through (PDF)LaTeX.}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*}
+\Msg{************************************************************************}
+
+\endbatchfile
+%</install>
+%<*ignore>
+\fi
+%</ignore>
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{geometry.drv}%
+ [2008/11/06 v4.0 Page Geometry]%
\documentclass{ltxdoc}
-\usepackage{times}
-\def\ttdefault{cmtt}
-%<manual>\usepackage[colorlinks, linkcolor=blue,
-%<manual> pdftitle={Geometry Manual}, pdfauthor={Hideo Umeki}]{hyperref}
-\usepackage[ hmargin={4cm,1.5cm},top=1.5cm, marginpar=3.5cm
-%<manual> ,a4paper,pdftex, hmargin=3cm, top=2cm
- ]{geometry}
-%<manual>\OnlyDescription
-%<driver>%\OnlyDescription
+\usepackage[colorlinks, linkcolor=blue]{hyperref}
+\usepackage[a4paper, hmargin={3.8cm,1.5cm},vmargin={1.5cm,1cm},
+ includeheadfoot, marginpar=3.5cm]{geometry}
\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}
-%</driver|manual>
+%</driver>
% \fi
%
-% \CheckSum{2369}
+% \CheckSum{2563}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \GetFileInfo{geometry.drv}
+%
+% \title{The \textsf{geometry} package}
+% \date{\filedate\ \fileversion}
+% \author{Hideo Umeki\\\texttt{latexgeometry@gmail.com}}
%
% \def\OpenB{{\ttfamily\char`\{}}
% \def\Comma{{\ttfamily\char`,}}
@@ -61,14 +172,15 @@
% \raggedright}
% {\end{list}}
%
+% \maketitle
+%
% \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}|.
+% This package provides a flexible and easy interface to page dimensions.
+% You can set the page layout with intuitive parameters. For instance,
+% if you want to set a margin to 2cm from each edge of the paper,
+% you can go just |\usepackage[margin=2cm]{geometry}|.
% \end{abstract}
%
% \newif\ifmulticols
@@ -82,7 +194,52 @@
% \tableofcontents
% }
%
-% \section{Preface to Version 3}
+% \section{Preface to version 4}
+%
+% Many improvements to the code and documentation were made according to
+% suggestions and comments from users.
+% Main changes are listed below.
+% \begin{itemize}
+% \item \textbf{More robust driver detection.}\par
+% The driver detection method has been totally rewritten so that
+% it can automatically detect the driver appropriate for the
+% typesetting program in use. Therefore, explicit driver setting is no longer
+% needed in most cases, except for the driver |dvipdfm|.
+% This improvement makes \textsf{geometry} work more robustly
+% for typesetting programs under e\TeX, Xe\TeX{} and
+% V\TeX{} as well as normal \TeX{} environment. The packages
+% \textsf{ifpdf} and \textsf{ifvtex} are used, which are available in
+% CTAN. See Section~\ref{sec:drivers} for details.
+% Note that \textsf{ifvtex} package v1.3 (2007/09/09), however, has a
+% bug (a typo) that affects the detection of VTeX.
+% So you need to use the new version of \textsf{ifvtex} later than v1.3.
+% \item \textbf{New option: |resetpaper|.}\par
+% This option disables explicit paper setting in \textsf{geometry} and
+% uses the paper size specified before \textsf{geometry}. This option
+% may be useful to print nonstandard sized documents with normal
+% printers and papers.
+% \item \textbf{Adjustment to |topskip| introduced.}\par
+% When large font sizes are specified, \cs{topskip} has to be
+% adjusted so that the formula
+% ``$\cs{textheight} = (lines - 1) \times \cs{baselineskip} + \cs{topskip}$''
+% to be correct. To do this, \cs{topskip} is set to
+% \cs{ht}\cs{strutbox}, if \cs{topskip} is smaller than
+% \cs{ht}\cs{strutbox}.
+% \item \textbf{ANSI paper sizes added.}\par
+% New paper size definitions for ANSI A to E are added.
+% \item \textbf{Bug fixed: Wrong ISO paper sizes.}\par
+% The paper sizes for A1,A2,A5 and A6 were wrong (by 1mm).
+% \item \textbf{Bug fixed: pdf\TeX{} magnification problem.}\par
+% PDF paper offset is adjusted properly when magnification is set by |mag|
+% option with pdf\TeX{}.
+% \item \textbf{Package source organization changed.}\par
+% Files |geometry.ins| and |geometry-samples.tex| are integrated into
+% |geometry.dtx| so that they can be generated from |geometry.dtx| by
+% the `tex' command. Documentation can be also generated directly from
+% |geometry.dtx| by `(pdf)latex' command.
+% \end{itemize}
+%
+% \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
@@ -221,8 +378,8 @@
% 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}
+% \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
@@ -470,7 +627,7 @@
% \label{fig:modes}
% \end{figure}
%
-% \subsection{Auto-Completion Scheme}\label{sec:completion}
+% \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
@@ -601,8 +758,8 @@
% \label{tab:completion}
% \end{table}
%
-% \section{User Interface}
-% \subsection{General Features}
+% \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
@@ -652,7 +809,7 @@
% |\usepackage[textheight=20\baselineskip+10pt]{geometry}|
% \end{quote}
%
-% \subsection{Option Types}
+% \subsection{Option types}
% \textsf{Geometry} options are categorized into four types:
%
% \begin{enumerate}\itemsep=0pt
@@ -708,11 +865,11 @@
% |divide={1in,*,1in}|.
% \end{enumerate}
%
-% \section{Option Specification}
+% \section{Option specification}
%
% This section describes all the options provided by \textsf{geometry}.
%
-% \subsection{Paper Size}
+% \subsection{Paper size}
%
% The options below set paper/media size and orientation.
% \begin{Options}
@@ -723,12 +880,13 @@
% \item[\vtop{
% \hbox{a0paper, a1paper, a2paper, a3paper, a4paper, a5paper, a6paper}
% \hbox{b0paper, b1paper, b2paper, b3paper, b4paper, b5paper, b6paper}
+% \hbox{ansiapaper, ansibpaper, ansicpaper, ansidpaper, ansiepaper}
% \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).
+% \item[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}.
@@ -747,7 +905,7 @@
% This is also the case for |twoside| and |twocolumn|
% (see also Section~\ref{sec:dimension}).
%
-% \subsection{Body Size}\label{sec:body}
+% \subsection{Body size}\label{sec:body}
%
% The options specifying the size of \gpart{total body} are described in this
% section.
@@ -784,39 +942,39 @@
% |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
+% \item[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}
+% \item[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|.
+% \item[includefoot] includes the foot of the page, \cs{footskip},
+% into \gpart{total body}. It is opposite to |ignorefoot|.
% It is |false| by default. See Figure~\ref{fig:includes}.
-% \item[\New{3}includeheadfoot]~\\
+% \item[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}
+% \item[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
+% \item[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,
+% \item[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|,
+% \item[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|
+% \item[ignoreheadfoot]~\\ sets both |ignorehead| and |ignorefoot|
% to |true|. See also |includeheadfoot|.
-% \item[\New{3}ignoremp] disregards the marginal notes in determining the
+% \item[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|.
+% \item[ignoreall] sets both |ignoreheadfoot| and |ignoremp| to |true|.
% See also |includeall|.
-% \item[\New{3}heightrounded]~\\
+% \item[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
@@ -846,7 +1004,7 @@
% |hdivide=|\vargiii{$A$}{$B$}{$C$} and |vdivide=|\vargiii{$A$}{$B$}{$C$}.
% \end{Options}
%
-% \subsection{Margin Size}\label{sec:margin}
+% \subsection{Margin size}\label{sec:margin}
%
% The options specifying the size of visible margins are listed below.
% \begin{Options}
@@ -869,36 +1027,36 @@
% \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]
+% \item[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]
+% \item[vmarginratio]
% vertical margin ratio of |top| to |bottom|. The default ratio is |2:3|.
-% \item[\New{3}marginratio\OR ratio]~\\
+% \item[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
+% \item[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
+% \item[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
+% \item[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
+% \item[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
+% \item[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).
@@ -949,7 +1107,7 @@
% \label{fig:bindingoffset}
% \end{figure}
%
-% \subsection{Native Dimensions}\label{sec:dimension}
+% \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,
@@ -966,22 +1124,22 @@
% \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
+% \item[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
+% \item[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[noheadfoot] equivalent to |nohead| and |nofoot|, which means that
+% \cs{headheight}, \cs{headsep} and \cs{footskip} are all set to |0pt|.
% \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]~\\
+% \item[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
+% \item[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
+% \item[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.
@@ -995,56 +1153,48 @@
% 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]~\\
+% \item[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}
+% \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.
-%
+% Package \textsf{geometry} supports |dvips|, |dvipdfm| including its
+% derivatives \textsf{dvipdfmx} and \textsf{xdvipdfmx}, |pdftex|
+% for \textsf{pdflatex}, and |vtex| for V\TeX{} environment.
+% These driver options are exclusive. The driver can be set by either
+% |driver=|\meta{driver name} or any of the drivers directly like |pdftex|.
+% A driver auto-detection mechanism is introduced in version 4.
+% Therefore, you don't have to set a driver in most cases, except for
+% |dvipdfm|.
+% Explicit setting |driver=auto| is also available. When it is set, the
+% previous driver setting is ignored and the auto-detection will work.
+% \begin{Options}
+% \item[driver] sets driver. |driver=|\meta{driver name}.
+% |dvips|, |dvipdfm|, |pdftex|, |vtex| and |auto| are available as a
+% driver name.
+% \end{Options}
+% The options below can be set directly instead of |driver=|\meta{value}.
% \begin{Options}
-% \item[\Mod{3}dvips] writes the paper size in dvi output with the \cs{special}
+% \item[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[dvipdfm] works like |dvips| except landscape correction.
+% \item[pdftex] sets \cs{pdfpagewidth} and \cs{pdfpageheight} internally.
% \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.
+% for V\TeX. When this driver is selected (explicitly or
+% automatically), \textsf{geometry} will auto-detect which output mode
+% (DVI, PDF or PS) is selected in V\TeX, and do proper
+% settings for it.
% \end{Options}
+% If explicit driver setting is mismatched with the typesetting program
+% in use, the default driver |dvips| would be selected.
%
-% 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}
+% \subsection{Other options}
%
% The other useful options are described here.
% \begin{Options}
@@ -1069,9 +1219,9 @@
% 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.
+% disk space. \textbf{Note that setting |mag| should precede any other
+% settings with `true' dimensions, such as |1.5truein|, |2truecm|
+% and so on.} 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
@@ -1079,13 +1229,13 @@
% 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
+% \item[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,
+% \item[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
+% \item[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]},
@@ -1093,9 +1243,9 @@
% Note this option should be set as a first option.
% \end{Options}
%
-% \section{Default Settings}
+% \section{Default settings}
%
-% \subsection{Default Layout}\label{sec:default}
+% \subsection{Default layout}\label{sec:default}
%
% Let us recapitulate the default layout here.
% The \textsf{geometry} package has the following default page layout
@@ -1130,7 +1280,7 @@
% \end{quote}
% would behave as if one is using the old version (v2.3).
%
-% \subsection{Configuration File}
+% \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,
@@ -1143,10 +1293,10 @@
% The options specified in the |geometry.cfg| can be cleared by
% option |reset|.
%
-% \section{Relations Between Options}
+% \section{Relations between options}
% This section shows how complexity is solved when options are over-specified.
%
-% \subsection{Order Dependence}\label{sec:order-depend}
+% \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,
@@ -1176,6 +1326,10 @@
% |\usepackage[left=2cm]{geometry}|
% \end{quote}
%
+% The |mag| option should be set in advance of any other settings with
+% `true' length, such as |left=1.5truecm|, |width=5truein| and so on.
+% The |\mag| primitive can be set before this package is called.
+%
% \subsection{Priority}
%
% There are several ways to set dimensions of the printable area:
@@ -1272,9 +1426,10 @@
% \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|
+% \item |width=.9\paperwidth, vmargin=.05\paperheight, marginratio=1:1|
+% \item |hdivide={*,0.9\paperwidth,*}, vdivide={*,0.9\paperheight,*}|
+% (as for onesided documents)
+% \item |margin={0.05\paperwidth,0.05\paperheight}|
% \end{itemize}
% You can add |heightrounded| to avoid an ``underfull vbox warning'' like
% \begin{quote}\small
@@ -1286,7 +1441,7 @@
% width of \gpart{total body}. The following examples are the same.
% \begin{itemize}
% \item |marginparwidth=3cm, includemp|
-% \item |marginpar=3cm, igoremp=false|
+% \item |marginpar=3cm, ignoremp=false|
% \end{itemize}
%
% \item A layout the full scale \gpart{body} of the paper with A5 paper in
@@ -1343,29 +1498,49 @@
% Try typesetting it and checking out the result yourself. |:-)|
% \end{itemize}
%
-% \section{Known Problems}
+% \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.
+% The author appreciates helpful suggestions and comments from
+% Jean-Bernard Addor,
+% Frank Bennett,
+% Alexis Dimitriadis,
+% Friedrich Flender,
+% Stephan Hennig,
+% Morten H$\phi$gholm,
+% Jonathan Kew,
+% James Kilfiger,
+% Jean-Marc Lasgouttes,
+% Wlodzimierz Macewicz,
+% Rolf Niepraschk,
+% Hans Fr. Nordhaug,
+% Keith Reckdahl,
+% Peter Riocreux,
+% Will Robertson,
+% Nico Schl\"{o}emer
+% Perry C. Stearns,
+% Frank Stengel,
+% Plamen Tanovski,
+% Petr Uher,
+% Piet van Oostrum,
+% Vladimir Volovich,
+% and
+% Michael Vulis.
%
-% I am deeply grateful to Frank Mittelbach for checking the codes patiently
+% The author is deeply grateful to Frank Mittelbach for checking the codes patiently
% and providing extremely helpful insight and suggestions for version 3.
%
% \StopEventually{%
@@ -1374,14 +1549,19 @@
% \fi
% }
%
-% \section{The Code}
+% \section{Implementation}
% \begin{macrocode}
%<*package>
% \end{macrocode}
-% This package requires package \textsf{keyval} included in
-% \LaTeX\ graphics bundle.
+% This package requires three other packages:
+% \begin{itemize}
+% \item\textsf{keyval} in \LaTeX\ graphics bundle,
+% \item\textsf{ifpdf} and \item\textsf{ifvtex} in `oberdiek' bundle,
+% \end{itemize}
% \begin{macrocode}
\RequirePackage{keyval}%
+\RequirePackage{ifpdf}%
+\RequirePackage{ifvtex}%
% \end{macrocode}
%
% Internal switches are declared here.
@@ -1396,9 +1576,9 @@
\newif\ifGm@heightrounded
\newif\ifGm@showframe
\newif\ifGm@compatii
-\newif\ifGm@special
\newif\ifGm@sworient\Gm@sworientfalse
\newif\ifGm@pass\Gm@passfalse
+\newif\ifGm@resetpaper
% \end{macrocode}
% \begin{macro}{\Gm@cnth}
% \begin{macro}{\Gm@cntv}
@@ -1502,6 +1682,15 @@
% \end{macrocode}
% \end{macro}\end{macro}
%
+% \begin{macro}{\Gm@orgpw}
+% \begin{macro}{\Gm@orgph}
+% These macros keep original paper (media) size intact.
+% \begin{macrocode}
+\edef\Gm@orgpw{\the\paperwidth}%
+\edef\Gm@orgph{\the\paperheight}%
+% \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|
@@ -1545,7 +1734,7 @@
\Gm@hbodyfalse\Gm@vbodyfalse
\Gm@includeheadfalse\Gm@includefootfalse\Gm@includempfalse
\Gm@landscapefalse\Gm@compatiifalse\Gm@heightroundedfalse
- \Gm@verbosefalse\Gm@showframefalse\Gm@specialfalse
+ \Gm@verbosefalse\Gm@showframefalse\Gm@resetpaperfalse
\let\Gm@paper\@undefined
\let\Gm@width\@undefined\let\Gm@height\@undefined
\let\Gm@textwidth\@undefined\let\Gm@textheight\@undefined
@@ -1953,12 +2142,12 @@
% 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@a1paper}{\Gm@setpaper(594,841){mm}}%
+\@namedef{Gm@a2paper}{\Gm@setpaper(420,594){mm}}%
\@namedef{Gm@a3paper}{\Gm@setpaper(297,420){mm}}%
\@namedef{Gm@a4paper}{\Gm@setpaper(210,297){mm}}%
-\@namedef{Gm@a5paper}{\Gm@setpaper(149,210){mm}}%
-\@namedef{Gm@a6paper}{\Gm@setpaper(105,149){mm}}%
+\@namedef{Gm@a5paper}{\Gm@setpaper(148,210){mm}}%
+\@namedef{Gm@a6paper}{\Gm@setpaper(105,148){mm}}%
\@namedef{Gm@b0paper}{\Gm@setpaper(1000,1414){mm}}%
\@namedef{Gm@b1paper}{\Gm@setpaper(707,1000){mm}}%
\@namedef{Gm@b2paper}{\Gm@setpaper(500,707){mm}}%
@@ -1966,6 +2155,11 @@
\@namedef{Gm@b4paper}{\Gm@setpaper(250,353){mm}}%
\@namedef{Gm@b5paper}{\Gm@setpaper(176,250){mm}}%
\@namedef{Gm@b6paper}{\Gm@setpaper(125,176){mm}}%
+\@namedef{Gm@ansiapaper}{\Gm@setpaper(8.5,11){in}}%
+\@namedef{Gm@ansibpaper}{\Gm@setpaper(11,17){in}}%
+\@namedef{Gm@ansicpaper}{\Gm@setpaper(17,22){in}}%
+\@namedef{Gm@ansidpaper}{\Gm@setpaper(22,34){in}}%
+\@namedef{Gm@ansiepaper}{\Gm@setpaper(34,44){in}}%
\@namedef{Gm@letterpaper}{\Gm@setpaper(8.5,11){in}}%
\@namedef{Gm@legalpaper}{\Gm@setpaper(8.5,14){in}}%
\@namedef{Gm@executivepaper}{\Gm@setpaper(7.25,10.5){in}}%
@@ -1983,12 +2177,14 @@
% \end{key}
% \begin{key}{Gm}{a[0-6]paper}
% \begin{key}{Gm}{b[0-6]paper}
+% \begin{key}{Gm}{ansi[a-e]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.
+% The following paper names are available. |screen| and ANSI paper sizes
+% have been introduced in ver.3, but of course they can't be used as
+% a documentclass option.
% \begin{macrocode}
\define@key{Gm}{a0paper}[true]{\def\Gm@paper{a0paper}\Gm@chpaper}%
\define@key{Gm}{a1paper}[true]{\def\Gm@paper{a1paper}\Gm@chpaper}%
@@ -2004,6 +2200,11 @@
\define@key{Gm}{b4paper}[true]{\def\Gm@paper{b4paper}\Gm@chpaper}%
\define@key{Gm}{b5paper}[true]{\def\Gm@paper{b5paper}\Gm@chpaper}%
\define@key{Gm}{b6paper}[true]{\def\Gm@paper{b6paper}\Gm@chpaper}%
+\define@key{Gm}{ansiapaper}[true]{\def\Gm@paper{ansiapaper}\Gm@chpaper}%
+\define@key{Gm}{ansibpaper}[true]{\def\Gm@paper{ansibpaper}\Gm@chpaper}%
+\define@key{Gm}{ansicpaper}[true]{\def\Gm@paper{ansicpaper}\Gm@chpaper}%
+\define@key{Gm}{ansidpaper}[true]{\def\Gm@paper{ansidpaper}\Gm@chpaper}%
+\define@key{Gm}{ansiepaper}[true]{\def\Gm@paper{ansiepaper}\Gm@chpaper}%
\define@key{Gm}{letterpaper}[true]{\def\Gm@paper{letterpaper}\Gm@chpaper}%
\define@key{Gm}{legalpaper}[true]{\def\Gm@paper{legalpaper}\Gm@chpaper}%
\define@key{Gm}{executivepaper}[true]{\def\Gm@paper{executivepaper}%
@@ -2011,7 +2212,7 @@
\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}
+% \end{key}\end{key}
% \begin{key}{Gm}{paperwidth}
% \begin{key}{Gm}{paperheight}
% \begin{key}{Gm}{papersize}
@@ -2331,8 +2532,10 @@
% \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}%
+\define@key{Gm}{driver}{\edef\@@tempa{#1}\edef\@@auto{auto}%
+ \ifx\@@tempa\@empty\let\Gm@driver\@empty\else
+ \ifx\@@tempa\@@auto\let\Gm@driver\@empty\else
+ \setkeys{Gm}{#1}\fi\fi}%
% \end{macrocode}
% \end{key}
% \begin{key}{Gm}{dvips}
@@ -2367,6 +2570,14 @@
{\Gm@init\Gm@dorg\ProcessOptionsKV[c]{Gm}\Gm@setdefaultpaper}{}}%
% \end{macrocode}
% \end{key}
+% \begin{key}{Gm}{resetpaper}
+% If |resetpaper| is set to |true|, the paper size redefined in the package
+% is discarded and the original one is restored. This option may be useful
+% to print nonstandard sized documents with normal printers and papers.
+% \begin{macrocode}
+\define@key{Gm}{resetpaper}[true]{\Gm@setbool{resetpaper}{#1}}%
+% \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|.
@@ -2487,28 +2698,52 @@
%
% \begin{macro}{\Gm@checkdrivers}
% The macro checks the typeset environment and changes the driver option
-% if necessary.
+% if necessary. To make the engine detection more robust, the macro is
+% rewritten in version 4 with packages \textsf{ifpdf} and \textsf{ifvtex}.
% \begin{macrocode}
\def\Gm@checkdrivers{%
- \ifx\pdfpagewidth\@undefined\else
- \ifnum\pdfoutput=\@ne
+% \end{macrocode}
+% If the driver option is not specified explicitly, then driver
+% auto-detection works.
+% \begin{macrocode}
+ \ifx\Gm@driver\@empty
+ \typeout{*geometry auto-detecting driver*}%
+% \end{macrocode}
+% \cs{ifpdf} is defined in \textsf{ifpdf} package in `oberdiek' bundle.
+% \begin{macrocode}
+ \ifpdf
\Gm@setdriver{pdftex}%
+ \else
+ \Gm@setdriver{dvips}%
\fi
- \fi
- \ifx\VTeXversion\@undefined\else
- \ifnum\OpMode=\@ne
+% \end{macrocode}
+% Xe\TeX{} supports the same page size parameter as pdf\TeX.
+% \begin{macrocode}
+ \@ifundefined{XeTeXrevision}{}{\Gm@setdriver{pdftex}}%
+% \end{macrocode}
+% \cs{ifvtex} is defined in \textsf{ifvtex} package in `oberdiek'
+% bundle. Make sure to use |ifvtex.sty| newer than v1.3 because v1.3
+% (2007/09/09) has a bug that affects the detection of V\TeX.
+% \begin{macrocode}
+ \ifvtex
\Gm@setdriver{vtex}%
- \else
- \ifnum\OpMode=\tw@
- \Gm@setdriver{vtex}%
- \fi
\fi
- \fi
- \ifx\Gm@driver\Gm@dvips
- \Gm@specialtrue
+% \end{macrocode}
+% When the driver option is set by the user, check if it is valid or not.
+% \begin{macrocode}
\else
- \ifx\Gm@driver\Gm@dvipdfm
- \Gm@specialtrue
+ \ifx\Gm@driver\Gm@pdftex
+ \ifpdf\else
+ \@ifundefined{XeTeXrevision}{\Gm@warning{%
+ Wrong driver setting: `pdftex'; using default driver}%
+ \Gm@setdriver{dvips}}{}%
+ \fi
+ \fi
+ \ifx\Gm@driver\Gm@vtex
+ \ifvtex\else
+ \Gm@warning{Wrong driver setting: `vtex'; using default driver}%
+ \Gm@setdriver{dvips}%
+ \fi
\fi
\fi}%
\@onlypreamble\Gm@checkdrivers
@@ -2556,9 +2791,9 @@
% If |pass| is set, the original dimensions and switches are restored
% and process is ended here.
% \begin{macrocode}
- \ifGm@pass
- \Gm@dorg
- \else
+ \ifGm@pass
+ \Gm@dorg
+ \else
% \end{macrocode}
% The stored native dimension settings are processed here.
% \begin{macrocode}
@@ -2625,6 +2860,18 @@
\fi
\fi
% \end{macrocode}
+% \cs{topskip} has to be adjusted so that the formula
+% ``$\cs{textheight} = (lines - 1) \times \cs{baselineskip} + \cs{topskip}$''
+% to be correct even if large font sizes are specified by users.
+% If \cs{topskip} is smaller than \cs{ht}\cs{strutbox}, then \cs{topskip}
+% is set to \cs{ht}\cs{strutbox}.
+% \begin{macrocode}
+ \ifdim\topskip<\ht\strutbox
+ \setlength\@tempdima{\topskip}%
+ \setlength\topskip{\ht\strutbox}%
+ \Gm@warning{\noexpand\topskip was changed from \the\@tempdima\space to \the\topskip}%
+ \fi
+% \end{macrocode}
% If the vertical dimension of \gpart{body} is specified by user,
% \cs{Gm@height} is set properly here.
% \begin{macrocode}
@@ -2893,8 +3140,13 @@
% Paper size is temporally adjusted according to \cs{mag} for
% printing devices.
% \begin{macrocode}
- \edef\Gm@orgw{\the\paperwidth}%
- \edef\Gm@orgh{\the\paperheight}%
+ \ifGm@resetpaper
+ \edef\Gm@pw{\Gm@orgpw}%
+ \edef\Gm@ph{\Gm@orgph}%
+ \else
+ \edef\Gm@pw{\the\paperwidth}%
+ \edef\Gm@ph{\the\paperheight}%
+ \fi
% \end{macrocode}
% If |pass| is set to |true|, no adjustment for page dimensions is done.
% \begin{macrocode}
@@ -2911,30 +3163,35 @@
% Checking the driver options.
% \begin{macrocode}
\Gm@checkdrivers
+ \typeout{*geometry detected driver: \Gm@driver*}%
% \end{macrocode}
% If |pdftex| is set to |true|, pdf-commands are set properly.
+% To avoid |pdftex| magnification problem, \cs{pdfhorigin} and
+% \cs{pdfvorigin} are adjusted for \cs{mag}.
% \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
+ \setlength\pdfpagewidth{\Gm@pw}%
+ \setlength\pdfpageheight{\Gm@ph}%
+ \ifnum\mag=\@m\else
+ \@tempdima=\mag sp%
+ \divide\pdfhorigin\@tempdima
+ \multiply\pdfhorigin\@m
+ \divide\pdfvorigin\@tempdima
+ \multiply\pdfvorigin\@m
+ \ifx\Gm@truedimen\Gm@true
+ \setlength\paperwidth{\Gm@pw}%
+ \setlength\paperheight{\Gm@ph}%
+ \fi
\fi
\fi
% \end{macrocode}
-% With \textsl{V\TeX} environment, \textsl{V\TeX} variables are set here.
+% With V\TeX{} environment, 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
+ \mediawidth=\paperwidth
+ \mediaheight=\paperheight
+ \ifvtexdvi
+ \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
\fi
\fi
% \end{macrocode}
@@ -2943,12 +3200,24 @@
% because a landscape document converted by dvips is upside-down in
% PostScript viewers.
% \begin{macrocode}
- \ifGm@special
+ \ifx\Gm@driver\Gm@dvips
\AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
\ifx\Gm@driver\Gm@dvips\ifGm@landscape
\AtBeginDvi{\special{! /landplus90 true store}}%
\fi\fi
- \fi
+% \end{macrocode}
+% When |dvipdfm| option is set and \textsf{atbegshi} package in
+% `oberdiek' bundle is loaded, \cs{AtBeginShipoutFirst} is used
+% instead of \cs{AtBeginDvi} for compatibility with \textsf{hyperref}
+% and |dvipdfm| program.
+% \begin{macrocode}
+ \else\ifx\Gm@driver\Gm@dvipdfm
+ \ifx\AtBeginShipoutFirst\relax
+ \AtBeginDvi{\special{papersize=\the\paperwidth,\the\paperheight}}%
+ \else
+ \AtBeginShipoutFirst{\special{papersize=\the\paperwidth,\the\paperheight}}%
+ \fi
+ \fi\fi
% \end{macrocode}
% If |showframe=true|, page frames and lines are showed
% on the first page.
@@ -2995,8 +3264,10 @@
\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@orgpw\relax
+ \let\Gm@orgph\relax
+ \let\Gm@pw\relax
+ \let\Gm@ph\relax
\let\Gm@dimlist\relax}%
% \end{macrocode}
%
@@ -3013,17 +3284,75 @@
% \end{macrocode}
% \end{macro}
%
+% \section{Config file}
% In the configuration file |geometry.cfg|, one can use
% \cs{ExecuteOptions} to set the site or user default settings.
% \begin{macrocode}
%<*config>
+%<<SAVE_INTACT
-%% Uncomment and edit the line below to set default options.
-%%\ExecuteOptions{a4paper,dvips}
+% Uncomment and edit the line below to set default options.
+%\ExecuteOptions{a4paper}
+%SAVE_INTACT
%</config>
% \end{macrocode}
%
+% \section{Sample file}
+% Here is an executable sample tex file.
+% \begin{macrocode}
+%<*samples>
+%<<SAVE_INTACT
+\documentclass{article}% uses letterpaper by default
+% \documentclass[a4paper]{article}% for A4 paper
+%---------------------------------------------------------------
+% Edit and uncomment one of the settings below
+%---------------------------------------------------------------
+% \usepackage{geometry}
+% \usepackage[centering]{geometry}
+% \usepackage[width=10cm,vscale=.7]{geometry}
+% \usepackage[margin=1cm, papersize={12cm,19cm}, resetpaper]{geometry}
+% \usepackage[margin=1cm,includeheadfoot]{geometry}
+\usepackage[margin=1cm,includeheadfoot,includemp]{geometry}
+% \usepackage[margin=1cm,bindingoffset=1cm,twoside]{geometry}
+% \usepackage[hmarginratio=2:1, vmargin=2cm]{geometry}
+% \usepackage[hscale=0.5,twoside]{geometry}
+% \usepackage[hscale=0.5,asymmetric]{geometry}
+% \usepackage[hscale=0.5,heightrounded]{geometry}
+% \usepackage[left=1cm,right=4cm,top=2cm,includefoot]{geometry}
+% \usepackage[lines=20,left=2cm,right=6cm,top=2cm,twoside]{geometry}
+% \usepackage[width=15cm, marginparwidth=3cm, includemp]{geometry}
+% \usepackage[hdivide={1cm,,2cm}, vdivide={3cm,8in,}, nohead]{geometry}
+% \usepackage[headsep=20pt, head=40pt,foot=20pt,includeheadfoot]{geometry}
+% \usepackage[text={6in,8in}, top=2cm, left=2cm]{geometry}
+% \usepackage[centering,includemp,twoside,landscape]{geometry}
+% \usepackage[mag=1414,margin=2cm]{geometry}
+% \usepackage[mag=1414,margin=2truecm,truedimen]{geometry}
+% \usepackage[compat2,marginpar=50pt,twosideshift=50pt]{geometry}
+% \usepackage[a5paper, landscape, twocolumn, twoside,
+% left=2cm, hmarginratio=2:1, includemp, marginparwidth=43pt,
+% bottom=1cm, foot=.7cm, includefoot, textheight=11cm, heightrounded,
+% columnsep=1cm,verbose]{geometry}
+%---------------------------------------------------------------
+% No need to change below
+%---------------------------------------------------------------
+\geometry{verbose,showframe}% options appended.
+\newcommand\mynote{\marginpar%
+[\raggedright\rule{\marginparwidth}{.7pt}\\A left side note.]%
+{\raggedright\rule{\marginparwidth}{.7pt}\\A side note.}}%
+\def\fox{A quick brown fox jumps over the lazy dog. }
+\def\fivefoxes{\fox\fox\fox\fox\fox}
+\def\manyfoxes{\fivefoxes\mynote\fivefoxes\par\fivefoxes\fivefoxes\par}
+% \let\mynote\relax % removes marginal notes.
+\begin{document}
+\manyfoxes\manyfoxes\manyfoxes\manyfoxes
+\manyfoxes\manyfoxes\manyfoxes\manyfoxes
+\manyfoxes\manyfoxes\manyfoxes\manyfoxes
+\end{document}
+%SAVE_INTACT
+%</samples>
+% \end{macrocode}
+%
% \Finale
%
-\endinput
+\endinput \ No newline at end of file