~ubuntu-branches/ubuntu/karmic/fweb/karmic

« back to all changes in this revision

Viewing changes to Manual/fwebnum.sty

  • Committer: Bazaar Package Importer
  • Author(s): Yann Dirson
  • Date: 2002-01-04 23:20:22 UTC
  • Revision ID: james.westby@ubuntu.com-20020104232022-330ad4iyzpvb5bm4
Tags: upstream-1.62
ImportĀ upstreamĀ versionĀ 1.62

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
% This file is a LaTeX2e package.  One may select it by the FWEB style-file
 
2
% command 
 
3
%
 
4
%       LaTeX.package = "fwebnum"
 
5
%
 
6
% which should be put into fweb.sty.
 
7
 
 
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
 
12
%
 
13
%       LaTeX.package.options = "dontnumberunnamed"
 
14
%
 
15
% to override that.
 
16
 
 
17
 
 
18
% J. A. Krommes, September 9, 1995
 
19
 
 
20
\NeedsTeXFormat{LaTeX2e}
 
21
 
 
22
\ProvidesPackage{fwebnum}[1995/09/15]
 
23
 
 
24
\DeclareOption{numberunnamed}{\numberunnamedtrue}
 
25
\DeclareOption{dontnumberunnamed}{\numberunnamedfalse}
 
26
 
 
27
\ExecuteOptions{numberunnamed} % Set up default.
 
28
\ProcessOptions
 
29
 
 
30
\gdef\Wrefstepcounter#1{\stepcounter{section}%
 
31
\protected@edef\@currentlabel{\thesection}}
 
32
 
 
33
\gdef\@seccntformat#1{\csname the#1\endcsname.\hskip1em}
 
34
 
 
35
\gdef\@sect#1#2#3#4#5#6[#7]#8{%
 
36
\ifnum#2>\c@secnumdepth
 
37
        \let\@svsec\@empty
 
38
\else
 
39
        \Wrefstepcounter{#1}%
 
40
        \protected@edef\@svsec{\@seccntformat{#1}}%
 
41
\fi
 
42
\@tempskipa#5\relax
 
43
\ifdim\@tempskipa>\z@
 
44
        \begingroup
 
45
                #6\relax
 
46
                \@hangfrom{\hskip#3\relax\@svsec}%
 
47
                {\interlinepenalty\@M
 
48
                #8\par}%
 
49
        \endgroup
 
50
        \csname#1mark\endcsname{#7}%
 
51
        \addcontentsline{toc}{#1}%
 
52
                {\ifnum#2>\c@secnumdepth
 
53
                \else
 
54
                        \protect\numberline{\csname the#1\endcsname}%
 
55
                \fi
 
56
                #7}%
 
57
\else
 
58
        \def\@svsechd{#6\hskip#3\relax
 
59
                \@svsec#8\csname#1mark\endcsname{#7}%
 
60
                \addcontentsline{toc}{#1}%
 
61
                        {\ifnum#2>\c@secnumdepth
 
62
                        \else
 
63
                                \protect\numberline{\csname the#1\endcsname}%
 
64
                        \fi
 
65
                        #7}%
 
66
                }%
 
67
\fi
 
68
\@xsect{#5}%
 
69
}
 
70
 
 
71
\gdef\Wmodhd#1{} % No redundant section numbering at top of page.
 
72
 
 
73
\gdef\thesubsection{\thesection}
 
74
\gdef\thesubsubsection{\thesection}
 
75
\gdef\thesubsubsubsection{\thesection}
 
76
 
 
77
% The following overrides LaTeX's default \numberline, which doesn't skip
 
78
% enough for large section numbers and overwrites the header.  One could
 
79
% get fancier here.
 
80
\newdimen\W@tempdima
 
81
 
 
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}}
 
85
}}
 
86
 
 
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}}
 
92