%
% \GetFileInfo{gmeometric.sty}
% \title{The \pk{gmeometric} Package\thfileinfo}
% \author{Grzegorz Murzynowski}
% \maketitle
%
%
% \begin{copyrnote}
%
%% Written by Grzegorz Murzynowski,
%% natror at o2 dot pl
%%
%% \copyright\,2006, 2007, 2008 by Grzegorz Murzynowski.
%%
%% This program is subject to the \LaTeX\ Project Public License.
%% See
%% \url{
http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html}
%% for the details of that license.
%%
%% LPPL status: "author-maintained".\par
%
%\end{copyrnote}
%
% \CheckSum{61}
% \chschange{v0.69}{2007/4/26}{40}
% \chschange{v0.70}{2007/4/29}{36}
% \chschange{v0.71}{2007/11/16}{41}
% \chschange{v0.72}{2007/11/17}{239}
% \chschange{v0.73}{2008/11/22}{237}
% \toCTAN{v0.73}{2008/11/22}
%
%
% \skiplines we skip the driver
\ifnum\catcode`\@=12
\documentclass[codespacesgrey, noindex, pagella, fontspec=quiet]{gmdocc}
\twocoltoc
\begin{document}
\GetFileInfo{\jobname.sty}
\DocInput{\jobname.sty}
\PrintChanges
\thispagestyle{empty}
\typeout{%
Produce change log with^^J%
makeindex -r -s gmglo.ist -o \jobname.gls \jobname.glo^^J
(gmglo.ist should be put into some texmf/makeindex directory.)^^J}
\afterfi{\end{document}
% The package is too small to make index of it.
%^^A\typeout{%
%^^A Produce index with^^J%
%^^A makeindex -r \jobname^^J}
}
\fi % of driver pass
% \endskiplines
%% \FileInfo
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gmeometric}
[2008/11/22 v0.73 to allow the `geometry' macro in the document (GM)]
%
%% \division{Introduction, usage}
%%
%% This package allows you to use the |\geometry| macro, provided by
%% the \pk{geometry} v3.2 and v4.1 by Hideo Umeki, anywhere in a~document:
%% originally it's claused |\@onlypreamble| and the main work of
%% \pk{gmeometric} is to change that.
%%
%% Note it's rather queer to change the page layout \emph{inside}
%% a~document and it should be considered as drugs or alcohol: it's
%% O.K.\ only if you \emph{really} know what you're doing.
%%
%% In order to work properly, the macro should launch the |\clearpage|
%% or the \cs{cleardoublepage} to `commit' the changes. So, the
%% unstarred version trigges the first while the starred the
%% latter. If that doesn't work quite as expected, try to precede or
%% succede it with |\onecolumn| or |\twocolumn|.
%%
%% It's important that |\clear(double)page| launched by |\geometry|
%% not to be a~no-op, i.e., |\clear(double)page| immediately
%% preceding |\geometry| (nothing is printed in between) discards the
%% `commitment'.
%%
%% \stanza
%% You may use \pk{gmeometric} just like \pk{geometry} i.e., to specify
%% the layout as the package options: they shall be passed to
%% \pk{geometry}.
%%
%% This package also checks if the engine is \XeTeX\ and sets the
%% proper driver if so. Probably it's redundant since decent \XeTeX\
%% packages provide their \pk{geometry.cfg} file that does that.
%%
%
% \begin{gmlonely}
% \subdivision{Installation}
%
% Unpack the \file{gmeometric.tds.zip} archive in a~\file{texmf}
% directory or put the \pk{gmeometric.sty} somewhere in the
% \file{texmf/tex/latex} branch on your own. Creating
% a~\file{texmf/tex/latex/gm} directory may be advisable if
% you consider using other packages written by me.
%
% Then you should refresh your \TeX\ distribution's files' database
% most probably.
% \end{gmlonely}
%
%
% \subdivision{Contents of the \pk{gmeometric.zip} archive}
%
% The distribution of the \pk{gmeometric} package consists of the
% following four files.
% \begin{verse}
% \pk{gmeometric.sty}\\
% \pk{README}\\
% \pk{gmeometric.pdf}\\
% \pk{gmeometric.tds.zip}
% \end{verse}
%
%
% \begin{gmlonely}
% \subdivision{Compiling of the documentation}
%
% The last of the above files (the \pk{.pdf}, i.e., \emph{this
% file}) is a~documentation compiled from the \pk{.sty} file by
% running \LaTeX\ (twice) on the \pk{gmeometric.sty} file
% (|xelatex gmeometric.sty| in the directory you wish the
% documentation to be in, you don't have copy the \file{.sty} file
% there, \TeX\ will find it).
% Compiling of the documentation requires the packages: \pk{gmdoc}
% (\pk{gmdoc.sty} and \pk{gmdocc.cls}), \pk{gmverb.sty},
% \pk{gmutils.sty}, \pk{gmiflink.sty} and also some standard
% packages: \pk{hyperref.sty}, \pk{color.sty}, \pk{geometry.sty},
% \pk{multicol.sty}, \pk{lmodern.sty}, \pk{fontenc.sty} that should
% be installed on your computer by default.
%
% If you have not installed the \pk{mwart.cls} class (available on
% CTAN in \pk{mwcls} package), the result of your compilation may
% differ a bit from the \pk{.pdf} provided in this \pk{.zip} archive
% in formattings: If you have not installed \pk{mwart.cls}, the
% standard \pk{article.cls} class will be used.
% \end{gmlonely}
%
%
% \division{Usage} The main use of this package is to allow the
% |\geometry| command also inside the \env{document} (originally it's
% |\@onlypreamble|). To make |\geometry| work properly is quite
% a~different business. It may be advisable to `commit' the layout
% changes with |\newpage|, |\clearpage|, or |\cleardoublepage| and
% maybe |\one/twocolumn|.
%
% Some layout commands should be put before |\one/twocolumn| and other
% after it. An example:
%
%\begin{verbatim}
% \thispagestyle{empty}
%
% \advance\textheight 3.4cm\relax
% \onecolumn
% \newpage
%
% \advance\footskip-1.7cm
% \geometry{hmargin=1.2cm,vmargin=1cm}
% \clearpage
%\end{verbatim}
%
% And another:
%\begin{verbatim}
% \newpage
% \geometry{bottom=3.6cm}
%\end{verbatim}
%
% In some cases it doesn't work perfectly
% anyway. Well, the \acro{(LPPL)} license warns about it.
%
% \division{The code}
\RequirePackage{gmutils}[2008/11/21]% this package defines the storing and
% restoring commands.
% Redefine |\@onlypreamble|, add storing to BeginDocument.
\newcommand*\gme@tobestored{{% this list consists of the \CS'es
% relaxed at begin document by \pk{geometry} (the only
% \incs{AtBeginDocument} in \pk{geometry} v4.1).
% \changes{v0.73}{2008/11/22}{ two \CS'es added to the
% list for compatibility with \pk{geometry} v4.1}
\Gm@cnth \Gm@cntv \c@Gm@tempcnt \Gm@bindingoffset \Gm@wd@mp
\Gm@odd@mp \Gm@even@mp \Gm@orgpw \Gm@orgph \Gm@orgw \Gm@orgh
\Gm@dimlist}}
\AtBeginDocument{\@xa\StoreMacros\gme@tobestored}
% \changes[\AtBeginDocument]{v0.73}{2008/11/22}{removed two
% \cs{expandafter}s expanding \cs{gme@tobestored}: much less tokens
% added to the begin-document hook}
\StoreMacro\@onlypreamble
\let\@onlypreamble\@gobble
% To make it work properly in \XeTeX:
\@ifXeTeX{%
\@ifundefined{pdfoutput}{\newcount\pdfoutput}{}%
\PassOptionsToPackage{dvipdfm}{geometry}%
}{}
\RequirePackageWithOptions{geometry}
% Restore |\@onlypreamble|:
\RestoreMacro\@onlypreamble
% Hypothesis: |\ifx...\@undefined| fails in the document because
% something made |\csname Gm@lines\endcsname|. So we change the test
% to decent. And i~think I've found the guilty: |\@ifundefined| in
% |\Gm@showparams|. So I~change it to the more elegant
% |\ifx\@undefined|.
%^^A at first I~rewrote \cs{Gm@process}, let it be, maybe
%^^A one day I'll rewrite entire \pk{geometry}
%^^A \def\Gm@process{%
%^^A \ifGm@pass
%^^A \Gm@dorg
%^^A \else
%^^A \Gm@processdimlist
%^^A \@ifundefined{Gm@hmarginratio}{%
%^^A \if@twoside
%^^A \edef\Gm@hmarginratio{\Gm@Dhratiotwo}%
%^^A \else
%^^A \edef\Gm@hmarginratio{\Gm@Dhratio}%
%^^A \fi
%^^A }{}%
%^^A \@ifundefined{Gm@vmarginratio}{%
%^^A \edef\Gm@vmarginratio{\Gm@Dvratio}%
%^^A }%
%^^A \Gm@checkpaper
%^^A \ifGm@sworient
%^^A \@tempdima=\paperwidth
%^^A \paperwidth=\paperheight
%^^A \paperheight=\@tempdima
%^^A \Gm@setpaper(\strip@pt\paperwidth,\strip@pt\paperheight){pt}%
%^^A \Gm@sworientfalse
%^^A \fi
%^^A \advance\paperwidth by-\Gm@bindingoffset
%^^A \ifGm@includemp
%^^A \Gm@mpfix
%^^A \fi
%^^A \ifGm@hbody
%^^A \@ifundefined{Gm@width}{%
%^^A \@ifundefined{Gm@hscale}{%
%^^A \edef\Gm@width{\Gm@Dhscale\paperwidth}%
%^^A }{%
%^^A \edef\Gm@width{\Gm@hscale\paperwidth}%
%^^A }%
%^^A }%
%^^A \@ifundefined{Gm@textwidth}{}{%
%^^A \setlength\@tempdima{\Gm@textwidth}%
%^^A \ifGm@includemp
%^^A \advance\@tempdima\Gm@wd@mp
%^^A \fi
%^^A \edef\Gm@width{\the\@tempdima}%
%^^A }%
%^^A \fi
%^^A \ifGm@vbody
%^^A \@ifundefined{Gm@height}{%
%^^A \@ifundefined{Gm@vscale}{%
%^^A \edef\Gm@height{\Gm@Dvscale\paperheight}%
%^^A }{%
%^^A \edef\Gm@height{\Gm@vscale\paperheight}%
%^^A }%
%^^A }{}%
%^^A \@ifundefined{Gm@lines}{}{%
%^^A \@tempdima=\baselineskip
%^^A \multiply\@tempdima\Gm@lines
%^^A \advance\@tempdima by\topskip
%^^A \advance\@tempdima by-\baselineskip
%^^A \edef\Gm@textheight{\the\@tempdima}%
%^^A }%
%^^A \@ifundefined{Gm@textheight}{}{%
%^^A \@tempdima=\Gm@textheight
%^^A \ifGm@includehead
%^^A \advance\@tempdima by\headheight
%^^A \advance\@tempdima by\headsep
%^^A \fi
%^^A \ifGm@includefoot
%^^A \addtolength\@tempdima{\footskip}%
%^^A \fi
%^^A \edef\Gm@height{\the\@tempdima}%
%^^A }%
%^^A \fi
%^^A \Gm@detall{h}{width}{lmargin}{rmargin}%
%^^A \Gm@detall{v}{height}{tmargin}{bmargin}%
%^^A \setlength\textwidth{\Gm@width}%
%^^A \setlength\textheight{\Gm@height}%
%^^A \setlength\topmargin{\Gm@tmargin}%
%^^A \setlength\oddsidemargin{\Gm@lmargin}%
%^^A \addtolength\oddsidemargin{-1\Gm@truedimen in}%
%^^A \ifGm@includemp
%^^A \advance\textwidth-\Gm@wd@mp
%^^A \advance\oddsidemargin\Gm@odd@mp
%^^A \fi
%^^A \if@mparswitch
%^^A \setlength\evensidemargin{\Gm@rmargin}%
%^^A \addtolength\evensidemargin{-1\Gm@truedimen in}%
%^^A \ifGm@includemp
%^^A \advance\evensidemargin\Gm@even@mp
%^^A \fi
%^^A \ifGm@compatii
%^^A \@ifundefined{Gm@twosideshift}{%
%^^A \def\Gm@twosideshift{20\Gm@truedimen pt}%
%^^A }%
%^^A \addtolength\oddsidemargin{\Gm@twosideshift}%
%^^A \addtolength\evensidemargin{-\Gm@twosideshift}%
%^^A \fi
%^^A \else
%^^A \evensidemargin\oddsidemargin
%^^A \fi
%^^A \advance\oddsidemargin\Gm@bindingoffset
%^^A \addtolength\topmargin{-1\Gm@truedimen in}%
%^^A \ifGm@includehead
%^^A \addtolength\textheight{-\headheight}%
%^^A \addtolength\textheight{-\headsep}%
%^^A \else
%^^A \addtolength\topmargin{-\headheight}%
%^^A \addtolength\topmargin{-\headsep}%
%^^A \fi
%^^A \ifGm@includefoot
%^^A \addtolength\textheight{-\footskip}%
%^^A \fi
%^^A \ifGm@heightrounded
%^^A \setlength\@tempdima{\textheight}%
%^^A \addtolength\@tempdima{-\topskip}%
%^^A \@tempcnta\@tempdima
%^^A \@tempcntb\baselineskip
%^^A \divide\@tempcnta\@tempcntb
%^^A \setlength\@tempdimb{\baselineskip}%
%^^A \multiply\@tempdimb\@tempcnta
%^^A \advance\@tempdima-\@tempdimb
%^^A \multiply\@tempdima\tw@
%^^A \ifdim\@tempdima>\baselineskip
%^^A \addtolength\@tempdimb{\baselineskip}%
%^^A \fi
%^^A \addtolength\@tempdimb{\topskip}%
%^^A \textheight\@tempdimb
%^^A \fi
%^^A \addtolength\paperwidth{\Gm@bindingoffset}%
%^^A \fi}%
\def\Gm@showparams{% \changes{v0.72}{2007/11/17}{a~bug fix:
%% \cs{@ifundefined\{Gm@lines\}} raised an error when \cs{geometry}
%% used inside the \env{document}, I~change it to
%% \cs{ifx}\cs{@undefined}}
-------------------- Geometry parameters^^J%
\ifGm@pass
'pass' is specified!! (disables the geometry layouter)^^J%
\else
paper: \ifx\Gm@paper\@undefined class default\else\Gm@paper\fi^^J%
\Gm@checkbool{landscape}%
twocolumn: \if@twocolumn\Gm@true\else--\fi^^J%
twoside: \if@twoside\Gm@true\else--\fi^^J%
asymmetric: \if@mparswitch --\else\if@twoside\Gm@true\else --\fi\fi^^J%
h-parts: \Gm@lmargin, \Gm@width, \Gm@rmargin%
\ifnum\Gm@cnth=\z@\space(default)\fi^^J%
v-parts: \Gm@tmargin, \Gm@height, \Gm@bmargin%
\ifnum\Gm@cntv=\z@\space(default)\fi^^J%
hmarginratio: \ifnum\Gm@cnth<5 \ifnum\Gm@cnth=3--\else%
\Gm@hmarginratio\fi\else--\fi^^J%
vmarginratio: \ifnum\Gm@cntv<5 \ifnum\Gm@cntv=3--\else%
\Gm@vmarginratio\fi\else--\fi^^J%
lines: \ifx\Gm@lines\@undefined--\else\Gm@lines\fi^^J% here
% I~(natror) fix the bug: it was \inverb|\@ifundefined| that of
% course was assigning \inverb|\relax| to \inverb|\Gm@lines| and
% that resulted in an error when \inverb|\geometry| was used inside
% document.
\Gm@checkbool{heightrounded}%
bindingoffset: \the\Gm@bindingoffset^^J%
truedimen: \ifx\Gm@truedimen\@empty --\else\Gm@true\fi^^J%
\Gm@checkbool{includehead}%
\Gm@checkbool{includefoot}%
\Gm@checkbool{includemp}%
driver: \Gm@driver^^J%
\fi
-------------------- Page layout dimensions and switches^^J%
\string\paperwidth\space\space\the\paperwidth^^J%
\string\paperheight\space\the\paperheight^^J%
\string\textwidth\space\space\the\textwidth^^J%
\string\textheight\space\the\textheight^^J%
\string\oddsidemargin\space\space\the\oddsidemargin^^J%
\string\evensidemargin\space\the\evensidemargin^^J%
\string\topmargin\space\space\the\topmargin^^J%
\string\headheight\space\the\headheight^^J%
\string\headsep\@spaces\the\headsep^^J%
\string\footskip\space\space\space\the\footskip^^J%
\string\marginparwidth\space\the\marginparwidth^^J%
\string\marginparsep\space\space\space\the\marginparsep^^J%
\string\columnsep\space\space\the\columnsep^^J%
\string\skip\string\footins\space\space\the\skip\footins^^J%
\string\hoffset\space\the\hoffset^^J%
\string\voffset\space\the\voffset^^J%
\string\mag\space\the\mag^^J%
\if@twocolumn\string\@twocolumntrue\space\fi%
\if@twoside\string\@twosidetrue\space\fi%
\if@mparswitch\string\@mparswitchtrue\space\fi%
\if@reversemargin\string\@reversemargintrue\space\fi^^J%
(1in=72.27pt, 1cm=28.45pt)^^J%
-----------------------}
% Add restore to BeginDocument:
\AtBeginDocument{\@xa\RestoreMacros\gme@tobestored}
\endinput
% \ChangesGeneral
%
% \changes{v0.70}{2007/04/29}{Back to the v0.68 settings because
% \cs{not@onlypreamble} was far too little. Well, in this version the
% redefinition of \cs{geometry} is given up since the `committing'
% commands depend on the particular situation so defining only two
% options doesn't seem advisable}
%
% \changes{v0.71}{2007/11/17}{a~\acro{TDS}-compliant \file{zip}
% archive made}
%
% \changes{v0.72}{2008/08/06}{2008/08/06 only the way of documenting changes so
% I~don't increase the version number}
%
%
% \NoEOF
% (For my GNU Emacs:)
%%% Local Variables:
%%% mode: doctex
%%% TeX-master: "../../../../LaTeX/TeXGuru/gmeometric/gmeometricDoc.tex"
%%% End: