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
|
% This file is a LaTeX2e package. One may select it by the FWEB style-file
% command
%
% LaTeX.package = "fwebnum"
%
% which should be put into fweb.sty.
% The package provides a slight modification of LaTeX's \@sect command to
% replace the Dewey-decimal type of section numbering with integer section
% numbers a la the original WEB. By default, it numbers the unnamed
% sections. However, one may say
%
% LaTeX.package.options = "dontnumberunnamed"
%
% to override that.
% J. A. Krommes, September 9, 1995
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fwebnum}[1995/09/15]
\DeclareOption{numberunnamed}{\numberunnamedtrue}
\DeclareOption{dontnumberunnamed}{\numberunnamedfalse}
\ExecuteOptions{numberunnamed} % Set up default.
\ProcessOptions
\gdef\Wrefstepcounter#1{\stepcounter{section}%
\protected@edef\@currentlabel{\thesection}}
\gdef\@seccntformat#1{\csname the#1\endcsname.\hskip1em}
\gdef\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum#2>\c@secnumdepth
\let\@svsec\@empty
\else
\Wrefstepcounter{#1}%
\protected@edef\@svsec{\@seccntformat{#1}}%
\fi
\@tempskipa#5\relax
\ifdim\@tempskipa>\z@
\begingroup
#6\relax
\@hangfrom{\hskip#3\relax\@svsec}%
{\interlinepenalty\@M
#8\par}%
\endgroup
\csname#1mark\endcsname{#7}%
\addcontentsline{toc}{#1}%
{\ifnum#2>\c@secnumdepth
\else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
\else
\def\@svsechd{#6\hskip#3\relax
\@svsec#8\csname#1mark\endcsname{#7}%
\addcontentsline{toc}{#1}%
{\ifnum#2>\c@secnumdepth
\else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
}%
\fi
\@xsect{#5}%
}
\gdef\Wmodhd#1{} % No redundant section numbering at top of page.
\gdef\thesubsection{\thesection}
\gdef\thesubsubsection{\thesection}
\gdef\thesubsubsubsection{\thesection}
% The following overrides LaTeX's default \numberline, which doesn't skip
% enough for large section numbers and overwrites the header. One could
% get fancier here.
\newdimen\W@tempdima
\def\W@settoc#1{{\setbox0=\hbox{\bf #1.\qquad}
\global\W@tempdima=\wd0
\gdef\numberline##1{\hbox to\W@tempdima{\hfil##1.\enspace}}
}}
% The following is needed in case the table-of-contents appears at the
% front; it doesn't know the maximum section number at that point, so we
% guess it's in the range 10--99.
\def\FWEBtoc{\ifFWEBstandalone\Wtoc{99}\fi
\gdef\Wcon##1{\FWEBend}}
|