1
% $Header: /usr/home/levy/texts/geomsty/RCS/geom.sty,v 1.21 95/08/02 16:22:57 levy Exp Locker: levy $
2
% NFSS2 mods 95/06/18 by J Rawnsley
8
\ProvidesPackage{geom}[95/06/18]
11
\ifx\DeclareFontShape\@undefined
13
\let\normalshape\normalfont
14
\let\mediumseries\relax
18
% This is the geom style master file, by Silvio Levy.
19
% It contains modifications to latex.tex and lplain.tex.
20
% LATEX VERSION 2.09 <14 January 1991>
22
\typeout{Reading Geometry Center style by Silvio Levy, $Revision: 1.21 $}
23
\typeout{NFSS2 compatibility by J. Rawnsley, Maths Institute, Warwick 95/06/18}
25
% Find out which style has been loaded (book or article).
26
% If \chapter is undefined we assume the style is article, otherwise book.
28
\def\@article{\@@article} \def\@book{\@@book}
29
\@ifundefined{chapter}{\def\@style{\@@article}}{\def\@style{\@@book}}
31
% Load an appropriate file with changes to book.sty or article.sty.
33
\ifx\@style\@book \input geombook.sty \else \input geomart.sty \fi
35
% Load in other definitions.
37
\input geomenv.sty % environments
38
\input geomfig.sty % figures
39
\input geomfnt.sty % new fonts
40
\input geomindx.sty % indexing macros
42
%\usepackage{multicol} % two-column formatting
43
\input multicol.sty % two-column formatting
45
\input multicol.sty % two-column formatting
47
% ****************************************
49
% ****************************************
51
% \@@warning and \@warning don't need the word ``LaTeX''.
53
\def\@@warning#1{\typeout{Warning: #1.}}
55
% **********************************************
56
% * SPACING / LINE AND PAGE BREAKING *
57
% **********************************************
59
% Avoid the lack of spacing after a list when the first item is run-in.
61
\def\endtrivlist{\if@newlist\@noitemerr\fi
63
\ifhmode\unskip \par\fi
65
\ifdim\lastskip >\z@ \@tempskipa\lastskip \vskip -\lastskip
66
\advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip
71
\let\endcenter=\endtrivlist
72
\let\endflushleft=\endtrivlist
73
\let\endflushright=\endtrivlist
74
\let\endverbatim=\endtrivlist
75
\expandafter\let\csname endverbatim*\endcsname =\endtrivlist
77
% ****************************************
79
% ****************************************
81
% Proofing is true by default.
83
\newif\ifproofing\proofingtrue
84
\def\include#1{\ifproofing\@include#1 \else\input{#1.tex}\fi}
85
\def\noproofing{\noexpand\proofingfalse}
86
\def\@proofingfalse{\proofingfalse}
87
\def\checkproofing{\ifx\@partlist\@proofingfalse\proofingfalse\fi}
88
\def\includeonly#1{\@partswtrue\edef\@partlist{#1}\checkproofing}
90
% ****************************************
91
% * CROSS-REFERENCING MACROS *
92
% ****************************************
96
% The main differences between these macros and LaTeX's are that keys
97
% are not expanded, and the first field in the record's value contains
98
% the type of object referred to. For example,
99
% \newlabel{square torus in space}{{problem 1.1.1}{5}}
100
% This information is read at the time the record is formed
101
% from the \object@type. Expansion of the key is inhibited by storing
102
% it into the token list \@key, with everything protected by \noexpand's.
105
\def\setlabeltype#1{\edef\object@type{#1}}
107
\def\set@key#1{{\aftergroup\@key\aftergroup{\sanitize#1\endsanity}}}
110
% These are the user-level macros:
112
% \fullref{...} expands to theorem~3.7
113
% \Fullref{...} expands to Theorem~3.7
114
% \ref{...} expands to 3.7
115
% \pageref{...} expands to 377
117
\def\fullref{\@ref{\@xf\@car}}
118
\def\Fullref{\@ref{\@xf\@xf\@xf\cap@first\@xf\@car}}
119
\def\pageref{\@ref{\@xf\@cdr}}
120
\def\ref{\@ref{\@xf\@xf\@xf\discard@first\@xf\@car}}
121
\def\reftype{\@ref{\@xf\@xf\@xf\discard@second\@xf\@car}}
122
\def\Reftype{\@ref{\@xf\@xf\@xf\@xf\@xf\@xf\@xf\discard@second
123
\@xf\@xf\@xf\cap@first\@xf\@car}}
124
\def\cap@first#1{\uppercase{#1}}
125
\def\discard@first#1~{}
126
\def\discard@second#1~\preref{#1\@gobble}
129
% This is similar to \ref in LaTeX, but has two arguments: the second
130
% is the key, which is not expanded; the first is an operator to be
131
% applied to the value of the record.
134
\def\@ref#1{\@ifnextchar*{\@r@f{#1}}{\@r@f{#1}+}}
135
\def\@r@f#1#2#3{\set@key{#3}\@ifundefined{r@\the\@key}%
136
{{\bf ??}\@warning{Reference `\expand@key' %on page \thepage\space
138
{\@value=\@xf\@xf\@xf{\csname r@\the\@key\endcsname}#1\the\@value\@nil\null}%
139
\if#2*\refindex{#3} (#3)\else\refinvindex{#3}\fi}
140
\def\expand@key{\@xf\empty\the\@key}
142
\def\@lbibitem[#1]#2{\set@key{#2}\item[\@biblabel{#1}]\if@filesw
143
\xdef\@gtempa{\immediate\write\@auxout{\string\bibcite{\the\@key}{#1}}}
144
\@gtempa\fi\ignorespaces}
147
% Like \label in LaTeX, but follows the conventions explained at the
148
% top of this file. The \label* variant creates a more comprehensive
152
\def\label{\@ifnextchar*{\l@bel}{\l@bel+}}
153
\def\l@bel#1#2{\set@key{#2}\@bsphack\if@filesw
155
\xdef\@gtempa{\write\@auxout{\string\newlabel{\the\@key}%
156
{{\object@type\string~\string\preref{\@currentlabel}}%
157
{\string\preref{\thepage}}}%
159
\if@nobreak \ifvmode\nobreak\fi\fi\fi\@esphack
160
\if#1*\labelindex{#2}\else\index{#2}\fi\ignorespaces}
162
\def\newlabel{\bgroup\@sanitize\afterassignment\@readlabel\global\@key}
163
\def\bibcite{\bgroup\@sanitize\afterassignment\@readbibcite\global\@key}
164
\def\@readlabel{\egroup\r@adlabel r}
165
\def\@readbibcite{\egroup\r@adlabel b}
166
\def\r@adlabel#1#2{\@ifundefined{#1@\the\@key}{}%
167
{\@warning{Label `\expand@key' multiply defined}}%
168
\global\@namedef{#1@\the\@key}{#2}}
173
\def\citeseparator{,}
174
\def\@citex[#1]#2{\set@key{#2}\if@filesw
175
\xdef\@gtempa{\immediate\write\@auxout{\string\citation{\the\@key}}}\@gtempa\fi
177
\@xf\@cite\@xf{\@xf\@for\@xf\@citeb\@xf:\@xf=\the\@key\do
178
{\@citea\def\@citea{\citeseparator\penalty\@m\ }%
179
\def\@tempa##1##2\@nil{\edef\@citeb{\if##1\space##2\else##1##2\fi}}%
180
\expandafter\@tempa\@citeb\@nil
181
\@ifundefined{b@\@citeb}{{\reset@font\bf ?}\@warning
182
{Citation `\@citeb' %on page \thepage \space
184
{\csname b@\@citeb\endcsname}}}{#1}}
189
\def\@cite#1#2{\preref{[{#1\if@tempswa , #2\fi}]}}
191
\def\nocite#1{\set@key{#1}\@bsphack\if@filesw
192
\xdef\@gtempa{\immediate\write\@auxout{\string\citation{\the\@key}}}\@gtempa\fi
195
\def\@testdef #1#2#3{\set@key{#2}\def\@tempa{#3}%
196
\@xf\ifx\csname #1@\the\@key\endcsname\@tempa\else\@tempswatrue\fi}
198
\def\\{\let\stoken= } \\
199
\def\sanitize{\futurelet\next\sanswitch}
200
\def\sanswitch{\let\@tempa\relax \ifx\next\endsanity \let\@tempa\endsanity
201
\else\ifcat\noexpand\next\stoken\aftergroup\space\let\@tempa\eat
202
\else\ifcat\noexpand\next\bgroup\aftergroup{\let\@tempa\eat
203
\else\ifcat\noexpand\next\egroup\aftergroup}\let\@tempa\eat
204
\else\let\@tempa\copytoken\fi\fi\fi\fi \@tempa}
205
\def\eat{\afterassignment\sanitize \let\next= }
206
\long\def\copytoken#1{%
207
\ifcat\noexpand#1##\aftergroup\string\aftergroup\string##\aftergroup\string
208
\else\ifcat\noexpand#1\noexpand~\aftergroup\string
209
\else\ifcat\noexpand#1\relax\aftergroup\str@ng \fi\fi\fi
210
\aftergroup#1\sanitize}
211
\def\endsanity\endsanity{}
212
\def\str@ng#1{\string#1\expandafter\if@secondletter\string #1\next\nex}
213
\def\if@secondletter#1#2#3\nex{\ifx #2\next\else\ifnum`#2<`A \else
214
\ifnum`#2<`Z \space\else\ifnum`#2<`a \else\ifnum`#2<`z \space\fi\fi\fi\fi\fi}
216
% Labels are automatically added to theorems, section headings and the
217
% like if \autolabel is true.
219
\newif\ifautolabel\autolabeltrue
221
% ****************************************
223
% ****************************************
225
\long\def\@writefile#1#2{\@ifundefined{tf@#1}{}{
226
\edef\@tempa{\immediate\write\csname tf@#1\endcsname}
227
{\aftergroup\@tempa\aftergroup{\sanitize #2\endsanity}}}}
229
% **********************************************
230
% * MATH ENVIRONMENTS *
231
% **********************************************
233
%% following RmS 91/09/29: \reset@font added.
235
\def\@eqnnum{{\reset@font\rm (\theequation)}}
240
\def\equation{$$ % $$ BRACE MATCHING HACK
241
\def\object@type{equation}\refstepcounter{equation}}
243
%% following RmS 92/01/10: put \hbox around \@eqnnum
245
\def\endequation{\eqno \hbox{\@eqnnum}% $$ BRACE MATCHING HACK
246
$$\global\@ignoretrue}
248
\def\eqnarray{\def\object@type{equation}%
249
\stepcounter{equation}\edef\@currentlabel{\theequation}%
250
\global\@eqnswtrue\m@th
251
\global\@eqcnt\z@\tabskip\@centering\let\\\@eqncr
252
$$\halign to\displaywidth\bgroup\@eqnsel\hskip\@centering
253
$\displaystyle\tabskip\z@{##}$&\global\@eqcnt\@ne
254
\hskip 2\arraycolsep \hfil${##}$\hfil
255
&\global\@eqcnt\tw@ \hskip 2\arraycolsep $\displaystyle\tabskip\z@{##}$\hfil
256
\tabskip\@centering&\llap{##}\tabskip\z@\cr}
257
\def\@eqncr{{\ifnum0=`}\fi\@ifstar{\global\@eqpen\@M
258
\@yeqncr}{\global\@eqpen\interdisplaylinepenalty \@yeqncr}%
259
\edef\@currentlabel{\theequation}}
262
% allow equations to be numbered with other environments
265
\def\equationwith#1{%
266
\@xf\edef\@xf\c@equation\@xf{\csname c@#1\endcsname}%
267
\@xf\let\@xf\theequation\csname the#1\endcsname
271
% Bring back \eqalign from plain TeX (for less than full-width alignments)
273
\def\eqalign#1{\null\,\vcenter{\openup\jot\m@th
274
\ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
277
% ****************************************
278
% * THE LIST ENVIRONMENT *
279
% ****************************************
281
% make the \listparindent non-zero
283
\def\list#1#2{\ifnum \@listdepth >5\relax \@toodeep
284
\else \global\advance\@listdepth\@ne \fi
285
\rightmargin \z@ \listparindent.8\parindent \itemindent\z@
286
\csname @list\romannumeral\the\@listdepth\endcsname
287
\def\@itemlabel{#1}\let\makelabel\@mklab \@nmbrlistfalse #2\relax
289
\parskip\parsep \parindent\listparindent
290
\advance\linewidth -\rightmargin \advance\linewidth -\leftmargin
291
\advance\@totalleftmargin \leftmargin
292
\parshape \@ne \@totalleftmargin \linewidth
296
\def\@mklab#1{#1\hskip 0pt plus .0001fil\relax}
298
% Use \unhbox instead of \box for labels like theorems etc.
300
% Removed a \penalty0 to avoid line ending with blank space
302
% to make part (a) of an enumerate that immediate follows a label
303
% start on a fresh line, change the last line of \@item to:
305
%\def\@item[#1]{\if@noparitem \@donoparitem
307
% \hskip \labelsep}\vrule width 0pt \ignorespaces}
309
\def\@item[#1]{\if@noparitem \@donoparitem
310
\else \if@inlabel \indent \par \fi
311
\ifhmode \unskip\unskip \par \fi
312
\if@newlist \if@nobreak \@nbitem \else
313
\addpenalty\@beginparpenalty
314
\addvspace\@topsep \addvspace{-\parskip}\fi
315
\else \addpenalty\@itempenalty \addvspace\itemsep
319
\everypar{\global\@minipagefalse\global\@newlistfalse
320
\if@inlabel\global\@inlabelfalse \hskip -\parindent \unhbox\@labels
323
\everypar{}}\global\@nobreakfalse
324
\if@noitemarg \@noitemargfalse \if@nmbrlist \refstepcounter{\@listctr}\fi \fi
325
\setbox\@tempboxa\hbox{\makelabel{#1}}%
326
%\setbox\@tempboxa\hbox{\makelabel{\normalshape #1}}% this would kill \sc
327
\global\setbox\@labels
328
\hbox{\unhbox\@labels \hskip \itemindent
329
\hskip -\labelwidth \hskip -\labelsep
330
\ifdim \wd\@tempboxa >\labelwidth
332
\else \hbox to\labelwidth {\makelabel{\normalshape #1}}\fi
333
\hskip \labelsep}\ignorespaces}
335
% ****************************************
336
% * ITEMIZE AND ENUMERATE *
337
% ****************************************
339
% Save \@currentlabel to allow correct label in the cases like this:
348
\def\enumerate{\ifnum \@enumdepth >3 \@toodeep\else
349
\advance\@enumdepth \@ne
350
\edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
351
{\csname label\@enumctr\endcsname}{\usecounter
352
{\@enumctr}\def\makelabel##1{\hss\llap{\normalshape ##1}}}\fi
353
\let\@@currentlabel\@currentlabel}
355
% commented out Jan 11 93; had been added to version 1.14, but I have no
356
% idea how it was supposed to work, or what unrobustness it was trying
357
% to solve (see log). With this code, \@@currentlabel was never assigned.
359
% \let\@savecurrentlabel\@currentlabel}
361
%\@ifundefined{@@currentlabel}{\@currentlabel}{\@savecurrentlabel}
363
% ****************************************
364
% * THEOREM ENVIRONMENTS *
365
% ****************************************
369
% *****************************************
371
% *****************************************
373
% Allow up to \presection at bottom of page before new section
374
% to encourage section to start on fresh page
376
\newskip\presection \presection 0pt plus 10ex \relax
378
\def\@startsection#1#2#3#4#5#6{\if@noskipsec \leavevmode \fi
379
\par \@tempskipa #4\relax
381
\ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
382
\advance\@tempskipa by\presection
383
\if@nobreak \everypar{}\else
384
\addpenalty{\@secpenalty}\addvspace{\@tempskipa}%
385
\allowbreak\vskip -\presection \fi \@ifstar
386
{\@ssect{#1}{#2}{#3}{#4}{#5}{#6}}{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
388
% Add a . after section number instead of skipping 1em
389
% Mess with \addcontentsline
392
\def\@sect#1#2#3#4#5#6[#7]#8{\def\object@type{#1}%
393
\ifnum #2>\c@secnumdepth\def\@svsec{}\def\@tempb{}%
394
\else\refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname. }%
395
\edef\@tempb{\noexpand\numberline{\csname the#1\endcsname}} \fi
397
\def\@tempa{\addcontentsline{toc}{#1}}%
398
\ifdim \@tempskipa>\z@
400
\@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}%
402
\csname #1mark\endcsname{#7}%
403
\expandafter\@tempa\expandafter{\@tempb #7}%
404
\ifautolabel\label*{#8}\fi
406
\def\@svsechd{#6\hskip #3\relax
407
\@svsec #8\csname #1mark\endcsname {#7}%
408
\expandafter\@tempa\expandafter{\@tempb #7}%
409
\ifautolabel\label*{#8}\fi}\fi
412
% Add automatic content line and label
414
\def\@ssect#1#2#3#4#5#6#7{%
415
\ifnum #2>\c@secnumdepth\def\@tempb{}%
416
\else \def\@tempb{\numberline{}}\fi
418
\def\@tempa{\addcontentsline{toc}{s#1}}%
419
\ifdim \@tempskipa>\z@
421
\@hangfrom{\hskip #3}{\interlinepenalty \@M #7\par}%
423
\csname s#1mark\endcsname{#7}%
424
\ifstarredcontents\expandafter\@tempa\expandafter{\@tempb #7}\fi
425
\ifautolabel\label*{#7}\fi
427
\def\@svsechd{#6\hskip #3\relax #7%
428
\csname s#1mark\endcsname {#7}%
429
\ifautolabel\label*{#7}\fi}\fi
432
\newif\ifstarredcontents\starredcontentstrue
433
\def\ssubsectionmark#1{}
434
\def\ssubsubsectionmark#1{}
435
\def\sparagraphmark#1{}
436
\def\ssubparagraphmark#1{}
438
% *****************************************
439
% * TABLE OF CONTENTS, ETC. *
440
% *****************************************
442
% Don't expand macros when writing lines for the table of contents.
444
\def\addcontentsline#1#2#3{\if@filesw \begingroup
446
\let\label\@gobble \let\index\@gobble \let\glossary\@gobble
448
\xdef\@gtempa{\write \@auxout{\string\@writefile{#1}{\noexpand\string
449
\noexpand\contentsline{#2}{\the\@key}{\thepage}}}}\@gtempa}
450
\if@nobreak \ifvmode\nobreak\fi\fi\endgroup\fi}
452
\long\def\addtocontents#1#2{\if@filesw \begingroup
454
\let\label\@gobble \let\index\@gobble \let\glossary\@gobble
455
\edef\@tempa{\write \@auxout {\string\@writefile{#1}{\the\@key}}}\@tempa
456
\if@nobreak \ifvmode\nobreak\fi\fi\endgroup\fi}
458
% ****************************************
460
% ****************************************
462
% Make marginal pars tiny and ragged right
464
\long\def\@savemarbox#1#2{\global\setbox#1\vtop{\hsize\marginparwidth
465
\@parboxrestore\marginparstyle #2}}
467
\def\marginparstyle{\tiny\normalshape\mediumseries\raggedright}
469
% ****************************************
470
% * INITIAL DECLARATION COMMANDS *
471
% ****************************************
473
% Don't expand macros in marks.
476
\def\markboth#1#2{{\global\@mark={{#1}{#2}}{%
477
\mark{\the\@mark}}\if@nobreak\ifvmode\nobreak\fi\fi}}
479
\def\markbothsame#1{{\global\@mark={{#1}{#1}}{%
480
\mark{\the\@mark}}\if@nobreak\ifvmode\nobreak\fi\fi}}
482
\def\markright#1{{\expandafter\@markright\the\@mark
483
{#1}\mark{\the\@mark}}\if@nobreak\ifvmode\nobreak\fi\fi}
485
\def\@markright#1#2#3{\global\@mark{{#1}{#3}}}
489
% ****************************************
491
% ****************************************
493
% CHECK if this bug really has disappeared.
494
% the two lines after ``here was the bug''
495
% avoid disappearing \write's before a \marginpar
496
% at the top of a page (SL 900302). The bug is exemplified by
497
% \documentstyle{article}
499
% \label{foo}\marginpar{foo}
502
\def\@specialoutput{\ifnum\outputpenalty > -\@Mii
505
\ifnum \outputpenalty <-\@Miii
506
\ifnum\outputpenalty<-\@MM \deadcycles\z@\fi
507
\global\setbox\@holdpg\vbox{\unvbox\@cclv}%
508
\else % here was the bug
509
\ifdim\ht\@cclv=\pagegoal\else
510
\setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa\fi
511
\setbox\@tempboxa\box\@cclv
512
\@pagedp\dp\@holdpg \@pageht\ht\@holdpg
514
\@next\@currbox\@currlist{\ifnum\count\@currbox >\z@
515
\ifvoid\footins\else\advance\@pageht\ht\footins
516
\advance\@pageht\skip\footins \advance\@pagedp\dp\footins
517
\insert\footins{\unvbox\footins}\fi
519
\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
520
\@addmarginpar\fi}\@latexbug
521
\ifnum \outputpenalty <\z@ \penalty\interlinepenalty\fi
524
% Avoid headers on blank pages
525
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
526
\thispagestyle{plain}\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
529
%Revision 1.21 95/08/02 16:22:57 levy
530
%introduced cite separator
532
%Revision 1.20 95/07/18 18:19:57 levy
533
%\normalshape migrated from \@item to \enumerate, so \sc will work w/
536
%Revision 1.19 95/07/03 14:08:49 levy
537
%NFSS2 changes by John Rawnsley
539
%Revision 1.19 95/07/03 14:07:58 levy
540
%*** empty log message ***
542
%Revision 1.17 93/08/04 10:00:53 levy
543
%fixed problem with \ssectionmark (so running heads for Bibliography etc.
546
%Revision 1.16 93/01/31 16:15:20 levy
547
%created \marginparstyle
549
%Revision 1.16 93/01/12 01:50:02 levy
550
%*** empty log message ***
552
%Revision 1.15 1992/08/25 19:53:57 levy
553
%fixed \@mklab (previous fix was nonsense)
555
%Revision 1.14 92/08/25 19:33:50 levy
556
%@@currentlabel more robust
558
%Revision 1.13 92/07/31 09:50:26 levy
561
%Revision 1.12 92/07/17 13:44:12 levy
562
%*** empty log message ***
564
%Revision 1.11 92/07/13 21:54:14 levy
565
%further cleaned up the environments
567
%Revision 1.10 92/07/13 11:11:48 levy
568
%*** empty log message ***
570
%Revision 1.9 92/07/13 08:57:20 levy
571
%changes to geomenv.sty
573
%Revision 1.8 1992/07/06 19:04:42 levy
574
%sanitize \bibcite, \cite
576
%Revision 1.7 92/06/26 18:46:57 levy
579
%Revision 1.6 92/06/03 11:25:59 levy
580
%*** empty log message ***
582
%Revision 1.5 92/04/16 12:58:26 levy
583
%*** empty log message ***
585
%Revision 1.4 92/04/07 09:09:03 levy
586
%*** empty log message ***
588
%Revision 1.3 1992/03/21 02:37:06 levy
589
%*** empty log message ***
591
%Revision 1.2 1992/03/20 22:39:40 levy
592
%*** empty log message ***
594
%Revision 1.1 1992/03/20 19:09:34 levy