summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/section/section.sty
blob: 11fdd0e9f79b71213decc9cf91e470a8a0a79952 (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
% SECTION.STY
% (c) (1992-1994) Oliver Pretzel (o.pretzel@ic.ac.uk)
% Created 29 Oct 94  version 1.4: 10 Mar 99.
% For use with Latex Standard Styles
% Adds control of section heading style to standard LaTeX.
% For LaTeX2.09 (OFSS and NFSS) and LaTeX2e.
%
% Optional features are set to standard.
%
% DOCUMENTATION at end of file
%
% WARNING: conflicts with REFMAN.STY.
%
% ALL RIGHTS RESERVED
%
% This file may be distributed freely.
% It may be modified for local use (please inform me of such modifications)
% Modified versions may only be distributed if
% 1. The name is changed
% 2. A statement acknowledging the modification heads the file.
%
% DO NOT USE \neq in this file
\chardef\neq\the\catcode`\@
\makeatletter\@makeother\"
%
\typeout{`section.sty' <1.4>}
%*************************
\ifx\reset@font\undefined\let\reset@font\relax\fi
%
% Options
%
\ifx\secindent\undefined
 \newdimen\secindent
 \newskip\secpreskp
 \newskip\secpstskp
 \newdimen\subindent
 \newskip\subpreskp
 \newskip\subpstskp
 \newskip\parpstskp
 \newcount\c@hddepth
\fi
%implict multiplication removes stretch
\secindent0pt% no indentation
\secpreskp1.2\baselineskip plus .35\baselineskip minus.07\baselineskip
%\secpreskp3.5ex plus 1 ex minus.2ex
\secpreskp-\secpreskp
\secpstskp.8\baselineskip plus .07\baselineskip
%\secpstskp2.3ex plus .2ex
\subindent0pt
\subpreskp1.13\baselineskip plus .35\baselineskip minus.07\baselineskip
%\subpreskp3.25ex plus 1 ex minus.2ex
\subpreskp-\subpreskp
\subpstskp.53\baselineskip plus.07\baselineskip
%\subpstskp1.5ex plus.2ex
\parpstskp-.8\baselineskip
%\parpstskp-1em
\ifx\chapter\undefined
 \def\chsize{\Large}\def\hdsize{\huge}\else
 \def\chsize{\huge}\def\hdsize{\Huge}
\fi
\let\ttsize\LARGE
\let\ausize\large
\let\dasize\large
\let\hdpos\raggedright
\c@hddepth\z@
\let\secsize\Large
\let\subsize\large
\let\fpind\relax
%
\def\nmdot{}
\def\cpdot{:}
\def\hdfnt{\reset@font\bf}
\def\ttfnt{\reset@font\rm}
\def\pgfnt{\reset@font\rm}
\def\mkfnt{\reset@font\sl}
\let\mkcse\uppercase
\def\hddot{}
\def\fefnt{\reset@font\bf}
\def\thfnt{\reset@font\it}
%
\def\fnum@figure{\figurename~\thefigure\cpdot}
\def\fnum@table{\tablename~\thetable\cpdot}
%
%
% theorems
%
\def\@begintheorem#1#2{%
 \trivlist \item[\hskip \labelsep{\fefnt #1\ #2\hddot}]\thfnt}
\def\@opargbegintheorem#1#2#3{\trivlist
 \item[\hskip \labelsep{\fefnt #1\ #2\ (#3)\hddot}]\thfnt}
%
{\@makeother\~
\long\gdef\@ifempty#1#2#3{\if~#1~#2\else#3\fi}
}
\long\def\@gobifnul#1#2{\@ifempty{#1}\@empty{#1#2}}
%\@Alph and \@alph \relax added to allow \@ifempty test when counter<=0
\def\@alph#1{%
  \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or
   k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or
    y\or z\else\@ctrerr\fi\relax}
\def\@Alph#1{%
  \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or
   K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or
    Y\or Z\else\@ctrerr\fi\relax}
%LaTeX 209
\ifx\@ialph\undefined\else\let\@ialph\undefined\let\@Ialph\undefined\fi
%
% Figures and Tables
%
\long\def\@makecaption#1#2{\vskip 10\p@
   \setbox\@tempboxa\hbox{#1\ #2}\ifdim \wd\@tempboxa >\hsize
   #1\ #2\par\else\hbox to\hsize{\hfil\box\@tempboxa\hfil}\fi}
%
% Modified LateX Sectioning Commands
%
\ifx\chapter\undefined
%
%Article
%
\def\part{\par\vskip1.4\baselineskip\@tempskipa\z@
   \@tempskipb\baselineskip\@afterindentfalse\secdef\@part\@spart}
\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne\@makesecdot{part}%
 \addcontentsline{toc}{part}{\protect\numberline{\thepart\nmdot}{#1}}\else
 \addcontentsline{toc}{part}{#1}\fi\@mkboth{}{}
 {\parindent\z@\hdpos\interlinepenalty\@M\ifnum\c@secnumdepth>\m@ne
 \@ifempty\thepart\@empty{\chsize\hdfnt\partname~\thepart\par\nobreak
 \vskip\@tempskipa}\fi}\@spart{#2}}
\def\@spart#1{\@ifempty{#1}\removelastskip{\parindent\z@\hdpos
 \interlinepenalty\@M\hdsize\hdfnt#1\par}\nobreak\vskip\@tempskipb
 \fpind\@afterheading}
\def\maketitle{\par\begingroup\def\thefootnote{\fnsymbol{footnote}}%
 \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
 \if@twocolumn\twocolumn[\@maketitle]%
 \else\newpage\global\@topnum\z@\@maketitle\fi
 \thispagestyle{empty}\@thanks\endgroup
 \setcounter{footnote}{0}\let\maketitle\relax\let\@maketitle\relax
 \def\@thanks{}\def\@author{}\def\@title{}\let\thanks\relax}
\def\@maketitle{\null \vskip \tw@ em\begin{center}%
 {\ttsize\ttfnt\@title\par}\vskip1.2\baselineskip{\ausize\ttfnt%1.5em
 \lineskip.4\baselineskip\begin{tabular}[t]{c}\@author\end{tabular}\par}%.5em
 \vskip.8\baselineskip{\dasize\ttfnt\@date}\end{center}% 1em
 \par\vskip1.2\baselineskip}% 1.5em
\if@twoside
 \def\ps@headings{\let\@mkboth\markboth
  \def\@oddfoot{}\def\@evenfoot{}
  \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}%
  \def\@oddhead{\mkfnt\rightmark\hfil\pgfnt\thepage}%
  \def\sectionmark##1{\markboth{\mkcse{\ifnum\c@secnumdepth>\z@\@gobifnul
  \thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}{}}%
  \def\subsectionmark##1{\markright{\ifnum\c@secnumdepth>\@ne\@gobifnul
  \thesubsection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}
\else
 \def\ps@headings{\let\@mkboth\markboth
  \def\@oddfoot{}\def\@evenfoot{}
  \def\@oddhead{\mkfnt\rightmark\hfil\pgfnt\thepage}%
  \def\sectionmark##1{\markright{\mkcse{\ifnum\c@secnumdepth>\z@
  \@gobifnul\thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}}
\fi
\def\ps@myheadings{\let\@mkboth\@gobbletwo
 \def\@oddhead{\mkfnt\rightmark \hfil\pgfnt\thepage}\def\@oddfoot{}%
 \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}\def\@evenfoot{}%
 \def\sectionmark##1{}\def\subsectionmark##1{}}
\def\tableofcontents{\makeheading{\contentsname
 \@mkboth{\mkcse{\contentsname}}{\mkcse{\contentsname}}}%
 \@starttoc{toc}}
\def\listoffigures{\makeheading{\listfigurename
 \@mkboth{\mkcse{\listfigurename}}{\mkcse{\listfigurename}}}%
 \@starttoc{lof}}
\def\listoftables{\makeheading{\listtablename\@mkboth
 {\mkcse{\listtablename}}{\mkcse{\listtablename}}}%
 \@starttoc{lot}}
\def\thebibliography#1{\makeheading{\refname\@mkboth
 {\mkcse{\refname}}{\mkcse{\refname}}}\list
 {\@biblabel{\arabic{enumiv}}}{\settowidth\labelwidth{\@biblabel{#1}}%
 \leftmargin\labelwidth\advance\leftmargin\labelsep
 \usecounter{enumiv}\let\p@enumiv\@empty
 \def\theenumiv{\arabic{enumiv}}}%
 \def\newblock{\hskip .11em plus.33em minus.07em}%
 \sloppy\clubpenalty4000\widowpenalty4000\sfcode`\.=\@m\relax}
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
 \columnseprule \z@\columnsep 35\p@\twocolumn[\makeheading{\indexname}]%
 \@mkboth{\mkcse{\indexname}}{\mkcse{\indexname}}%
 \thispagestyle{plain}\parindent\z@
 \parskip\z@ plus.3\p@\relax\let\item\@idxitem}
\def\l@part{\@tocheadline{0}{1.8\baselineskip}{3em}{\large\bf}}%2.25em
\def\l@section{\@tocheadline{1}{1em}{1.8em}{\bf}}
\def\makeheading{\section*}
\else
%
%Report/Book
%
\def\part{\cleardoublepage\thispagestyle{plain}%
  \if@twocolumn\onecolumn\@tempswatrue\else \@tempswafalse\fi
  \@tempskipa20\p@\@tempskipb\fill\hbox{}\vfil\secdef\@part\@spart}
\def\@part[#1]#2{\ifnum\c@secnumdepth>-2\@makesecdot{part}%
 \addcontentsline{toc}{part}{\protect\numberline{\thepart\nmdot}#1}\else
 \addcontentsline{toc}{part}{#1}\fi\@mkboth{}{}%
 {\parindent\z@\hdpos\ifnum\c@secnumdepth>-2\@ifempty\thepart\@empty
 {\chsize\hdfnt\partname~\thepart\par\vskip\@tempskipa}\fi
 \@spart{#2}}}
\def\@spart#1{\@ifempty{#1}\removelastskip{\hdpos\hdsize\hdfnt#1\par}%
 \vskip\@tempskipb\newpage\if@twoside\hbox{}\thispagestyle{empty}\newpage\fi
 \if@tempswa\twocolumn\fi}
\let\@endpart\undefined
\def\@makeschapterhead#1#2#3#4{\vskip#2{\parindent\z@\hdpos
 \if@nobreak\ifnum\c@secnumdepth>\m@ne\@ifempty\thechapter\@empty
 {\chsize\hdfnt\@chapapp~\thechapter \par\nobreak\vskip#3}\fi\fi
 \@ifempty{#1}\removelastkip{\hdsize\hdfnt#1\par}\nobreak\vskip#4}}
\def\@makechapterhead#1{\hbox{}\@makeschapterhead{#1}{50\p@}{20\p@}{40\p@}}
\def\@chapter[#1]#2{\ifnum\c@secnumdepth>\m@ne\@makesecdot{chapter}%
\typeout{\@chapapp\space\thechapter}\fi\@contmark{chapter}\z@{#1}%
 \addtocontents{lof}{\protect\addvspace{10\p@}}%
 \addtocontents{lot}{\protect\addvspace{10\p@}}\@nobreaktrue
 \if@twocolumn\@topnewpage[\@makechapterhead{#2}]\else\@makechapterhead{#2}\fi
 \fpind\@afterheading}
\def\@schapter#1{\@nobreakfalse\if@twocolumn
  \@topnewpage[\@makechapterhead{#1}]\else
  \@makechapterhead{#1}\fi\fpind\@afterheading}
\if@twoside
 \def\ps@headings{\let\@mkboth\markboth\def\@oddfoot{}\def\@evenfoot{}%
  \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}%
  \def\@oddhead{\hbox{}\mkfnt\rightmark\hfil\pgfnt\thepage}%
  \def\chaptermark##1{\markboth{\mkcse{\ifnum
  \c@secnumdepth>\m@ne\expandafter\@gobifnul\@chapapp\ \@gobifnul
  \thechapter{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}{}}%
  \def\sectionmark##1{\markright{\mkcse{\ifnum \c@secnumdepth >\z@\@gobifnul
  \thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi ##1}}}}
\else
 \def\ps@headings{\let\@mkboth\markboth
  \def\@oddfoot{}\def\@evenfoot{}%
  \def\@oddhead{\mkfnt \rightmark \hfil\pgfnt\thepage}%
  \def\chaptermark##1{\markright {\mkcse{\ifnum
  \c@secnumdepth>\m@ne \expandafter\@gobifnul\@chapapp\ \@gobifnul
  \thechapter{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}}
\fi
\def\ps@myheadings{\let\@mkboth\@gobbletwo
 \def\@oddhead{\mkfnt\rightmark \hfil\pgfnt\thepage}%
 \def\@oddfoot{}\def\@evenhead{\pgfnt \thepage\hfil\mkfnt
 \leftmark}\def\@evenfoot{}%
 \def\chaptermark##1{}\def\sectionmark##1{}%
 \def\subsectionmark##1{}}
\def\maketitle{\begin{titlepage}%
 \let\footnotesize\small \let\footnoterule\relax \setcounter{page}{0}%
 \null \vfil \vskip 5\baselineskip \begin{center}% 60pt
 {\ttsize\ttfnt\@title\par}\vskip2.45\baselineskip {\ausize\ttfnt\lineskip
 .62\baselineskip%3em .75em
 \begin{tabular}[t]{c}\@author \end{tabular}\par}%
 \vskip 1.25\baselineskip {\dasize \ttfnt \@date \par} \end{center} \par%1.5em
 \@thanks \vfil \null \end{titlepage}%
 \setcounter{footnote}{0} \let\thanks\relax
 \def\@thanks{}\def\@author{}\def\@title{}\let\maketitle\relax}%
\def\tableofcontents{\@restonecolfalse
 \if@twocolumn\@restonecoltrue\onecolumn\fi\makeheading{\contentsname
 \@mkboth{\mkcse{\contentsname}}{\mkcse{\contentsname}}}%
 \@starttoc{toc}\if@restonecol\twocolumn\fi}
\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
 \makeheading{\listfigurename\@mkboth{\mkcse{\listfigurename}}%
 {\mkcse{\listfigurename}}}\@starttoc{lof}\if@restonecol\twocolumn\fi}
\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
 \makeheading{\listtablename\@mkboth{\mkcse{\listtablename}}%
 {\mkcse{\listtablename}}}\@starttoc{lot}\if@restonecol\twocolumn\fi}
\def\thebibliography#1{\makeheading{\bibname\@mkboth
 {\mkcse{\bibname}}{\mkcse{\bibname}}}\list
 {\@biblabel{\arabic{enumiv}}}{\settowidth\labelwidth{\@biblabel{#1}}%
 \leftmargin\labelwidth\advance\leftmargin\labelsep
 \usecounter{enumiv}\let\p@enumiv\@empty
 \def\theenumiv{\arabic{enumiv}}}%
 \def\newblock{\hskip .11em plus.33em minus.07em}%
 \sloppy\clubpenalty4000\widowpenalty4000\sfcode`\.=\@m}
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
 \columnseprule\z@\columnsep 35\p@\twocolumn\makeheading{\indexname
 \@mkboth{\mkcse{\indexname}}{\mkcse{\indexname}}}%
 \thispagestyle{plain}\parindent\z@
 \parskip\z@ plus .3\p@\relax\let\item\@idxitem}
\def\l@part{\@tocheadline{\z@}{1.8\baselineskip}{3em}{\large\bf}}%2.25em
\def\l@chapter{\@tocheadline{\@ne}{1em}{1.8em}{\bf}}
\def\makeheading{\chapter*}
\fi
%
%Article, Book, Report
%
\def\section{\@startsection
{section}{\@ne}{\secindent}{\secpreskp}{\secpstskp}{\secsize\hdfnt}}
\def\subsection{\@startsection
{subsection}{\tw@}{\subindent}{\subpreskp}{\subpstskp}{\subsize\hdfnt}}
\def\subsubsection{\@startsection
{subsubsection}{3}{\subindent}{\subpreskp}{\subpstskp}{\normalsize\hdfnt}}
\def\paragraph{\@startsection{paragraph}{4}{\subindent}%
{\subpreskp}{\parpstskp}{\normalsize\hdfnt}}
\def\subparagraph{\@startsection{subparagraph}%
{5}{\parindent}{\subpreskp}{\parpstskp}{\normalsize\hdfnt}}
%
% section layout
%
\def\@makesecdot#1{\expandafter\let\expandafter\@secdot\csname the#1\endcsname
  \ifx\@secdot\@empty\else\refstepcounter{#1}\toks@\expandafter{%
  \csname p@#1\endcsname}\edef\@secdot{%
    \the\toks@\expandafter\@gobifnul\csname the#1\endcsname\nmdot}\fi}
					%not \@secdot
\def\@makesvsec#1{\ifind #1<\z@\def\@svsec{\llap{\@secdot}\hskip-#1}\else
 \def\@svsec{\@gobifnul\@secdot\quad}\fi}
\def\@contmark#1#2#3{\csname #1mark\endcsname{#3}\addcontentsline
 {toc}{#1}{\ifnum #2>\c@secnumdepth\else\protect\numberline{\@secdot}\fi#3}}
\def\@startsection#1#2#3#4#5#6{\if@noskipsec\leavevmode\fi
   \par\@tempskipa #4\@afterindenttrue
   \ifdim\@tempskipa<\z@\@tempskipa-\@tempskipa\@afterindentfalse\fi
   \fpind\if@nobreak\everypar{}\else
     \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi\@ifstar
     {\@ssect{#3}{#5}{#6}}{\@dblarg{\@sect{#1}{#2}{#3}{#5}{#6}}}}
\def\@sect#1#2#3#4#5[#6]#7{\@tempskipa #4\let\@svsec\@empty
 \ifnum#2>\c@secnumdepth\else\@makesecdot{#1}\@makesvsec{#3}\fi
 \ifdim\@tempskipa>\z@
 \begingroup#5\@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty
 \@M\ifnum#2>\c@hddepth\else\hdpos\fi#7\par}\endgroup
 \@contmark{#1}{#2}{#6}\else
 \def\@svsechd{\@contmark{#1}{#2}{#6}#5\hskip#3\@svsec
 \@gobifnul{#7}\hddot}\fi\@xsect{#4}}
\def\@ssect#1#2#3#4{\@tempskipa #2\relax\ifdim \@tempskipa>\z@
  \begingroup #3\@hangfrom{\ifind #1< \z@\else \hskip #1\fi}{\interlinepenalty
  \@M\ifnum#2>\c@hddepth\else\hdpos\fi#4\par}\endgroup\else
  \def\@svsechd{#3\ifind #1<\z@\else
  \hskip #1\fi\@gobifnul{#4}\hddot}\fi\@xsect{#2}}
\let\ifind\ifdim
%
% contents lines
%
\def\@tocheadline#1#2#3#4#5#6{\ifnum#1>\c@tocdepth\else
 \addpenalty\@secpenalty\vskip#2 plus\p@\begingroup
 \interlinepenalty\@M\rightskip\@tocrmarg\parfillskip-\@tocrmarg
 \secindent#3\noindent\leavevmode\hangindent\secindent
 \reset@font\rm#4#5\@tocpagenum{#6}\par\endgroup
 \penalty\@highpenalty\fi}
\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
  \vskip \z@ plus.2\p@\begingroup\leftskip#2\interlinepenalty\@M
  \rightskip\@tocrmarg\parfillskip-\@tocrmarg\secindent#3%
  \noindent\leavevmode\hangindent\secindent\reset@font\rm#4\nobreak\leaders
  \hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill \nobreak
  \hbox to\@pnumwidth{\hfil\reset@font\rm #5}\par\endgroup\fi}
\def\@tocpagenum#1{\nobreak\hfill\nobreak\hbox to\@pnumwidth{\hss#1}}
\def\numberline#1{\hbox to \secindent{#1\hfil} }
%
% REDEFINITIONS here:
%
% This line must be last line of code
\catcode`\@\neq\let\neq\ne\endinput

*******************
  DOCUMENTATION
*******************
Leslie Lamport in writing LaTeX assumed that authors would write
complete .sty (.clo) files to implement the design decisions for their
publications. However, the overwhelming majority of LaTeX publications use the
standard styles supplied by Lamport. These implement a particular set of
typographic conventions, which while consistent are not of universal validity,
for instance many publishers and authors would like a full stop:
`4. Introduction'
rather than
`4 Introduction'.

This file modifies the standard classes so that other conventions can be
more easily implemented. Careful use of the file will allow a greater
variation in the appearance of LaTeX documents.

0. Changes to section implementation.
The file redefines the way LaTeX deals with negative indents for section
headings, placing the number in the margin and the heading itself flush
with the margin. With negative indents it sets starred section headings
flush (as it does when \thesection is empty.
Standard LaTeX indenting can be produced by typing
>> \let\ifind\iffalse
This file's version can be reestablished by typing
>> \let\ifind\ifdim

The file also changes the way LaTeX reacts to empty numbers when sections have
non-negative indents, placing the heading where the number would go, rather
than further indented (as in standard LaTeX).
This effect can be removed by redefining an internal macro \@makesvsec (see
below).

The indents, pre- and postskips for section headings are placed in registers
so that they are constant throughout a document and (just as the heading sizes)
do not react to surrounding size changes. You can change this back to ordinary
LaTeX behaviour by \def ing them as macros rather than setting the register
values (in that case you should probably use \smaller\larger from
SMALLER.STY for the \...size commands).

WARNING LaTeX typesets headings that run on by manipulating \everypar. If you
make local changes to the heading style of such a section inside braces or a
group you must ensure that a non-empty paragraph occurs before the closing
brace. Otherwise some strange effects may occur, because the \everypar tokens
will be evaluated outside the group (this is a feature of LaTeX, not of
SECTION.STY). If your group ends with an empty section of this type just
follow it with \leavevmode or an explicit space: \ .

A detailed description of the format of LaTeX sectioning commands is given
below (in paragraph 9). This is partially taken from the file LATEX.TEX.
We first list the macros for local control which you can use without knowing
this structure.

The file sets vertical distances that LaTeX expressed in terms of `em's and
`ex's in equivalent `\baselineskip's, as `em' is a measure of the horizontal
size of a font and `ex' is not a true measure of the full height of a line.
Earlier vesions used `ex's.

The original values are placed as comments.

1. Sizing commands for Parts, Chapters and Titles etc
These are set to \large or whatever

>> \chsize: Chapter, Part Heading    (\LARGE\large)
>> \hdsize: Chapter, Part Title Text (\Huge\huge\LARGE)
>> \ttsize: Title of Document	     (\Huge\huge\LARGE)
>> \ausize: Author		     (\LARGE\Large)
>> \dasize: Date.		     (\Large\large)
>> \secsize: Section		     (\Large\large)
>> \subsize: Subsection 	     (\large\normalsize)
   subsubsection and below use \normalsize

2. Layout commands for headings.
>> \hdpos: Positioning of heading (\raggedright) (\centering \raggedleft)
   (see section 9);
>> counter hddpth (default 0)
   Maximum section level for \hdpos (chapters and parts ALWAYS use hdpos).
   To centre section headings and above:
         \let\hdpos\centering\setcounter{hddepth}{1}
>> \fpind: Indenting of first paragraph after \Part \Chapter
     and also to override setting via preskip for sections.
     \let to \@afterindenttrue to indent, \@afterindentfalse for flush,
     \relax: flush after \Part \Chapter, negative preskips; indented otherwise
     (LaTeX default behaviour).

3. Fonts
>> \ttfnt: font for title entries.
>> \hdfnt: font for all other headings (Part, Chapter..subparagraph).
>> \fefnt: font for theorem headings and description labels (fe=feature).
>> \thfnt: font for theorem statements.
>> \pgfnt: font for page numbers.
>> \mkfnt: font for page headings (mk=mark).
>> \mkcse: case for page headings.
 These can also be used to add other initial commands such as spaces or
 symbols.

4. Optional punctuation (standard|my preference)
 These marks are transferred via auxiliary files for tables of contents etc.
 They should be \def'd if their current value is to be transferred, and \let
 if the value in force when the file auxiliary is read should be used.

>> \hddot ({}|.) (after inline headings, theorems etc)
>> \cpdot (:|.) (in figure/table captions - also apears in list of figures.
>> \nmdot ({}|.) (after section numbers etc)

If these are \let to a single letter they are not expanded in the
    .toc.. files. So to remove \cpdot from list of figures:
	\let\cpdot\relax\listoffigures\let\cpdot:

5. Spacing parameters.
   The macros for chapters and parts have been altered so that all the
   vertical spacing commands are in a single macro in each case.

>>  \part inserts initial vertical space directly (preceded by \hbox{} if it
    is to be immovable) and passes the space between Part n  and title
    in  \@tempskipa and the space below the heading in \@tempskipb.
>>  Both \chapter and \chapter* call \@makechapterhead{chaptertitle}.
    This passes {chaptertitle} on to \@makeschapterhead together with the
    vertical spacing. Default setting is
    \def\@makechapterhead#1{\hbox{}\@makeschapterhead{#1}{50\p@}{20\p@}{40\p@}}
      \hbox{} makes first skip immovable,
      the first length is space above the heading,
      The second is the space between Chapter nn and the chapter title
      The third is the space below the heading.
    For both Part and Chapter the middle space is removed if either the
    section name or title are missing.
    If both are missing, the first space is also removed

>>  For sections and below the spaces are kept in registers:
   \secpreskp and \secpsrskp \secindent used for \section
   \subpreskp and \subpstskp \subindent used for \subsection/\subsubsection
   \paragraph uses \subindent \subpreskp \parpstskp
   \subparagraph uses \parindent \subpreskp \parpstskp

>> \secindent \subindent   Heading indentation
>> \secpreskp \subpreskp   Space before
>> \secpstskp \subpstskp \parpstskp  Space after.

6.  Internal modifications

 Sections with negative indents have heading flush with margin.

 If \thesection is \empty
   \let\thesection\empty or \def\thesection{}
 then section does not step the section counter.
 If the section produces empty output for a value then
 the section will start flush at the margin or \secindent if it is positive
 and there will be no \nmdot.
 It will produce (flush) page headings and a table of contents entry.
 Similarly if \thechapter or \thepart are defined to be empty they will
 suppress the heading line `Chapter..' and not step the counter.
 To restore standard LaTeX behaviour temporarily define \thesection to be
 \empty
 \def\thesection{\empty}
 In that case you can adjust post number spacing in the heading.
	\section[Heading]{\hskip-1em Heading}
 You can also redefine \@makesecdot see paragraph 7.

WARNING \letting \thesection etc to an unexpandable token (like \relax) will
cause strange effects under LaTeX because its value will not be expanded.

 \maketitle suppresses page headings (\thispagestyle{empty}) and only resets
 \@title etc locally. So place in a group if you want to preserve these for
 later reference (eg. in headers).

7. New internal macros
  Place any modifications in the section REDEFINITIONS of the main code

> \@secdot contains section number and \nmdot if the number is non-empty.
> \@makesecdot{NAME} defines \@secdot.
  To make LaTeX step the section counter independently of the definition
  of \thesection and always print \nmdot:
    \def\@makesecdot#1{\refstepcounter{#1}%
        \edef\@secdot{\csname the#1\endcsname}}
  If you want \nmdot suppressed when \thesection produces no output:
    \def\@makesecdot#1{\refstepcounter{#1}%
      \edef\@secdot{\expandafter\@gobifnul\csname the#1\endcsname\nmdot}}
> \@makesvsec{INDENT} defines the \@svsec macro used by LaTeX to typeset the
  section number.. Its parameter is the indent so that it can react
  differently to negative indents. (it does NOT make the indent).
  To obtain standard LaTeX behaviour:
    \def\@makesvsec#1{\def\@svsec{\@secdot\quad}}
  To make positioning commands apply to the heading ignoring the number:
    \def\@makesvsec#1{\def\@svsec{\llap{@secdot\quad}}}
  Do NOT forget the #1.
> \@contmark{NAME}{LEVEL}{HEADING} makes contents line and sectionmark.

 Contents headlines are defined by
> \@tocheadline
 This allows these lines to be adjusted similarly to the \@dottedtocline
 commands for other contents lines. The format of these is defined below (in
 paragraph 11).
>@tocpagenum#1 sets #1 flush right in \@tocheadline.
 Redefine (\let\@tocpagenum\@gobble) to remove page numbers.
 \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble
	      \centering\large\bf}}
 Centres parts lines of contents but leaves chapters unchanged
 \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble
	      \centering\def\numberline##1{\hskip-\secindent
	      \hbox to\secindent{##1\hfil}}\large\bf}}
 Same but centring ignores part number.
 \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble
	      \centering\def\numberline##1{\hfilneg
	      \hbox to\z@{##1\hss}\hfil}\large\bf}}
 Centres heading with number flush left
 Contents lines use \secindent as a temporary register

>\makeheading (set to \section*, \chapter*)
 Makes headings for contents, index etc.
 To put Contents itself in the contents list, redefine (locally):
     \let\thesection\empty\let\makeheading\section

8. Additional macros
> \@ifempty{test}{yes}{no} like \@ifundefined but tests for empty
  (fails iff test starts with ~ of catcode 12 (other) ).
> \@gobifnul{a}{b} = \@ifempty{a}{}{ab}.

9.  Description of sectioning values

 \@startsection {NAME}{LEVEL}{INDENT}{PRESKIP}{POSTSKIP}{STYLE}
	    optional * [ALTHEADING]{HEADING}
    Generic command to start a section.

    NAME	: e.g., 'subsection' must be the name of a section counter
    LEVEL	: a number, denoting depth of section -- section=1;
		  number increases down the hierarchy.
    INDENT	: Indentation of heading from left margin
    PRESKIP	: Absolute value = skip to leave above the heading.
		  If negative, then paragraph indent of text following
		  heading is suppressed.
    POSTSKIP	: if positive, then skip to leave below heading, else
		  negative of skip to leave to right of run-on heading.
    ALTHEADING  : for page headings and contents.
    STYLE	: commands to set style
  If '*' missing, then increments the counter.  If it is present, then
  there should be no [ALTHEADING] argument.
  Uses the counter 'secnumdepth' whose value is the highest section
  level that is to be numbered and entered into \@dottedtocline.

10. Treatment of Section Entries

 NAME  (fixed) Determines the counter to use.

 LEVEL (fixed) If level is greater than \counter{secnumdepth} (default 2) no
 indexentry or number

 INDENTS: \secindent (sections), \subindent (subsections,...,paragraphs).
 Subparagraphs have \parindent fixed. These are dimensions.

 Recommended: +-\parindent or 0pt

 If indent is negative then SECTION.STY causes the section number to be set
 flush right that distance from margin. Heading or text follows at the margin
 itself.

 Unnumbered headings are set at the margin if indent is negative. If the
 indent is non-negative they are set flush left with the number position.

 PRESKIPS \secpreskp (sections), \subpreskp(subsections..subparagraphs)
 POSTSKIPS \secpstskp (sections),\subpstskp(subsections,subsubsections)
           \parpstskp (paragraphs,subparagraphs)

 Recommended: leave PRESKIPS' abs values unchanged, They are set -ve to
 have flush first paragraphs. Use \secpreskp-\secpreskp to indent them.
 Recommended: set POSTSKIPS to -1em or -\parindent to make sections run on.

 By assigning these values to registers SECTION.STY makes them independent of
 the surrounding font and size. Set the registers if you want this, redefine
 them as macros if you want them to be font and size dependent.

 STYLE \secsize \subsize \hdfnt size and fonts.
 \secsize for sections,
 \subsize for subsections.
 Subsubsections and below have \normalsize (fixed).
 \hdfnt is universal for all headings.

11. Contents entries.

 \@tocheadline{LEVEL}{PRESKIP}{INDENT}{STYLE}{ENTRY}{PAGENUM}
 \@dottedtocline{LEVEL}{MARGIN}{INDENT}{ENTRY}{PAGENUM}

 LEVEL		: determines if entry made.
 PRESKIP	: vertical gap above.
 INDENT 	: This must leave enough room for the chapter or section number
		: It is added to the margin for the next level.
 MARGIN 	: Left margin inherited from level above (zero for headlines).
 STYLE		: Font sizing and setting.

 LaTeX assumes that the ENTRY for sections be defined by a macro \l@section.
 These are defined in the standard document styles but can be changed.
 All entries of the \l@section commands are fixed. SECTION.STY does not
 change the commands using \@dottedtocline in the style file. Those that do
 not do so (\l@part, \l@chapter) are modified to use \@tocheadline.

 INDENT for sections in {article} and chapters in {report} is rather tight at
 1.5em. If you increase it should also increase the MARGINS for lower
 sections.

12. The following internal LaTeX macros are redefined:

 \part\@part\@spart\@endpart
 \@chapter\@schapter		(also \fi moved)
 \@makechapterhead               functions of these have been significantly
 \@makeschapterhead              changed.

 \ps@headings\ps@myheadings
 \section\subsection
 \subsubsection\paragraph
 \subparagraph
 \thebibliography
 \theindex
 \@begintheorem
 \@oparbegintheorem
 \@makecaption			optional style features added
 \@startsection 		\fpind and does not pass #4 to \@sect,\@ssect
 \@sect,\@ssect 		ignored parameter removed
                        	\llap \@secdot used to adjust spacing
                        	if \p@section defined used for number style.
				calls \@makesecdot
				\@sect only: \@makesvsec and
				\@contmark, which is moved in
				\@svsechd so that \unskip in \@xsect works).
 \maketitle\@maketitle		suppress page number, reset \@title.. locally
 \numberline			adds space after number, so overfull box if
				too close to heading.

CHANGES
 Ver 1.3 (3.Apr 98)
    If \secindent < 0, then \section* produces a flush heading, not outdented.
    \hdpos takes level as parameter and is used for all sections, not just
    \part and \chapter.
    `ex' measurements replaced by \baselineskip equivalents.
 Ver 1.31
     Bugfix: \relax added to \@alph, \@Alph to enable use with \@ifempty test.
 Ver 1.32
     Bugfixes: \hdpos added to \@ssect, unused macro \secpos removed,
               \nobreak added after \thechapter in \makechapterhead
 Ver 1.4
     \hdpos made simple macro again. Counter \hddepth determines when it
     should be used. Functions of \@makechapterhead, \@smakechapterhead
     changed to make editing vertical spacing of chapters easier.
     \part\@part\@spart rewritten so that all spacing info in \part.
     \part calls \@spart which finishes off the heading.
 Memory use < 200 words.
End of SECTION.STY