1
% This file is a LaTeX2e package. One may select it by the FWEB style-file
4
% LaTeX.package = "fwebnum"
6
% which should be put into fweb.sty.
8
% The package provides a slight modification of LaTeX's \@sect command to
9
% replace the Dewey-decimal type of section numbering with integer section
10
% numbers a la the original WEB. By default, it numbers the unnamed
11
% sections. However, one may say
13
% LaTeX.package.options = "dontnumberunnamed"
18
% J. A. Krommes, September 9, 1995
20
\NeedsTeXFormat{LaTeX2e}
22
\ProvidesPackage{fwebnum}[1995/09/15]
24
\DeclareOption{numberunnamed}{\numberunnamedtrue}
25
\DeclareOption{dontnumberunnamed}{\numberunnamedfalse}
27
\ExecuteOptions{numberunnamed} % Set up default.
30
\gdef\Wrefstepcounter#1{\stepcounter{section}%
31
\protected@edef\@currentlabel{\thesection}}
33
\gdef\@seccntformat#1{\csname the#1\endcsname.\hskip1em}
35
\gdef\@sect#1#2#3#4#5#6[#7]#8{%
36
\ifnum#2>\c@secnumdepth
40
\protected@edef\@svsec{\@seccntformat{#1}}%
46
\@hangfrom{\hskip#3\relax\@svsec}%
50
\csname#1mark\endcsname{#7}%
51
\addcontentsline{toc}{#1}%
52
{\ifnum#2>\c@secnumdepth
54
\protect\numberline{\csname the#1\endcsname}%
58
\def\@svsechd{#6\hskip#3\relax
59
\@svsec#8\csname#1mark\endcsname{#7}%
60
\addcontentsline{toc}{#1}%
61
{\ifnum#2>\c@secnumdepth
63
\protect\numberline{\csname the#1\endcsname}%
71
\gdef\Wmodhd#1{} % No redundant section numbering at top of page.
73
\gdef\thesubsection{\thesection}
74
\gdef\thesubsubsection{\thesection}
75
\gdef\thesubsubsubsection{\thesection}
77
% The following overrides LaTeX's default \numberline, which doesn't skip
78
% enough for large section numbers and overwrites the header. One could
82
\def\W@settoc#1{{\setbox0=\hbox{\bf #1.\qquad}
83
\global\W@tempdima=\wd0
84
\gdef\numberline##1{\hbox to\W@tempdima{\hfil##1.\enspace}}
87
% The following is needed in case the table-of-contents appears at the
88
% front; it doesn't know the maximum section number at that point, so we
89
% guess it's in the range 10--99.
90
\def\FWEBtoc{\ifFWEBstandalone\Wtoc{99}\fi
91
\gdef\Wcon##1{\FWEBend}}