Download The FWEB user manual

Transcript
Chapter 2: WEB CONCEPTS
7
@* [INTRO]INTRODUCTION.
The command `@*n' (not illustrated in the above example) begins a major (sub)section
of level n, where `@*0' is equivalent to the simple `@*', `@*1' indicates a subsection, and
`@*2' indicates a subsubsection. The highest permissible major level is 2 (a subsubsection).
Such subsections are also entered in the Table of Contents. For more information, see
Section 10.1.3.4 [Sections], page 95.
As the example demonstrates, the name of the very last section, which should be starred,
should be `\INDEX'. Note the backslash; `\INDEX' is a TEX macro. This command tells
Fweave to write out the index in a special two-column format. By default, `\INDEX' expands to `INDEX', but this name can be overridden by the style-le parameter `index.name'
(see Section 12.3.1.1 [S index], page 113). For more discussion of Fweb's indexing facilities,
see Chapter 11 [Index], page 103.
Minor (unnamed) sections are begun by `@ '(\at-space"); these have no associated names
and are not entered into the Table of Contents. A newline counts as a space.
2.2.0.2 The TEX part
All sections begin with (optional) TEX commentary. That can just be straight text; to
input that, no knowledge of TEX is required. It can also include mathematical exposition
or any of the other advanced features oered by TEX.
Whenever Fweb is in TEX mode, one can temporarily shift into code mode by enclosing
the code within vertical bars. That code is typeset just like code in the code part (see
below), except that newlines are replaced by spaces. Thus, one can say things like
Consider the C code fragment `|@c for(i=0; i<10; i++){}|', which ...
(If the global language were C instead of Fortran, the `@c' inside the vertical bars would
not be necessary.) The ability to switch back and forth between text mode and code mode
at will allows for a very convenient and exible style of exposition.
2.2.0.3 The denition part
The TEX part is followed by an optional denition part. The beginning of the denition
part is signaled by the appearance of any one of the commands `@d', `@f', `@m', `@v', or `@W'
(explained later). In the previous example, the rst section has a denition part consisting
of one Fweb macro denition (`@m'); the second section has no denition part. For more
information, see Chapter 7 [Macros], page 62.
(Failure to appreciate how easy it is to shift from part to part can get one into trouble.
For example, don't write documentation such as `Consider the @m command', because the
`@m' will inadvertently terminate the documentation part and begin the denition part.
What one needs to do here is to use the literal `@', as in `@@m'.)
2.2.0.4 The code part
An unnamed code part is begun by `@a'. A named code part is begun by the appearance of a module name, such as `@<Global variables@>', followed by an equals sign; see
Section 2.3 [Modules], page 8. Within the code part, one can place any sequence of code