summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gmeometric/gmeometric.sty
blob: 61ad56414ce93e0f5ab4b9f755de596a89420e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
%
% \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 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}
% 
%% \FileInfo

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gmeometric}
     [2007/04/29 v0.70 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 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 |\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}.
%
%
% \begin{gmlonely}
%   \subdivision{Installation}
%
%   Just put the \pk{gmeometric.sty} somewhere in the \file{texmf/\:tex/\:latex}
%   branch. 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{gmeometricDoc.tex}\\
%   \pk{gmeometricDoc.pdf}
% \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{gmeometricDoc.tex} file.
%   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 only 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 license \acro{(LPPL)} warns about it.
% 
% \division{The Code}

\RequirePackage{gmutils}[2007/04/23]% this package defines the storing and
% restoring commands.

% redefine |\@onlypreamble|, add storing to BeginDocument.
\newcommand*\gme@tobestored{{%
    \Gm@cnth \Gm@cntv \c@Gm@tempcnt \Gm@bindingoffset \Gm@wd@mp
    \Gm@odd@mp \Gm@even@mp \Gm@orgw \Gm@orgh \Gm@dimlist}}


\@xa\AtBeginDocument\@xa{\@xa\StoreMacros\gme@tobestored}

\StoreMacro\@onlypreamble
\let\@onlypreamble\@gobble

\RequirePackageWithOptions{geometry}

% Restore |\@onlypreamble|:
\RestoreMacro\@onlypreamble

% Add restore to BeginDocument:

\@xa\AtBeginDocument\@xa{\@xa\RestoreMacros\gme@tobestored}

\endinput
%
% \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}
%
% \NoEOF

% (For my GNU Emacs:)
%%% Local Variables: 
%%% mode: doctex
%%% TeX-master: "../../../../LaTeX/TeXGuru/gmeometric/gmeometricDoc.tex"
%%% End: