.left margin
.ifnot hlp
.hl 1 TABLE of CONTENTS
.X Table of contents
.else hlp .i-1;2 Table__of__contents
.P
.endif hlp
A table of contents may be produced by RUNOFF.  It will include
all chapters and section headers at level 1.  If you wish to include
other levels you should use the _.ENABLE LEVELS command.
The table of contents may be enabled or disabled by the _.ENABLE TOC and
_.DISABLE TOC commands.
The resulting table of contents is not quite the same as that produced by DSR 
in that the header levels are not indented the same.  This may be changed in 
future versions.
.x DSR
.if hlp
.if rsx.i5;ADDITIONAL HELP AVAILABLE: filespec SEND begin END figures
.endif rsx
.i-1;3 filespec
.endif hlp
.P
A table of contents file is produced if you specify a second output filespec.
The table of contents file is labeled _.RNT by default.  For example you wish
to get a table of contents and regular runoff file. You type: 
.if RT
.i10;RUN RUNOFF
.i10;*EXAMPLE,EXAMPLE=EXAMPLE
.else rt
.i10;>RNO EXAMPLE,EXAMPLE=EXAMPLE
.endif rt
.s
EXAMPLE.DOC and EXAMPLE.RNT are the two files produced from the input
EXAMPLE.RNO. The EXAMPLE.RNT file must then be passed through RNO to get the
final TOC. You may edit the _.RNT file if it is not satisfactory. You would do
the following: 
.if rt
.i10;RUN RUNOFF
.i10;*EXAMPLE.TOC=EXAMPLE.RNT
.else rt
.i10;>RNO EXAMPLE.TOC=EXAMPLE.RNT
.endif rt
.s
You now have the final EXAMPLE.DOC and EXAMPLE.TOC files.  They may be printed
separately or a new composite file may be created:
.if IAS.i10;PDS>COPY EXAMPLE.TOC,EXAMPLE.DOC EXAMPLE.TXT
.endif IAS
.if VMS.i10;_$ COPY EXAMPLE.TOC,EXAMPLE.DOC EXAMPLE.TXT
.endif VMS
.if rsx.i10;MCR>PIP EXAMPLE.TXT=EXAMPLE.TOC,EXAMPLE.DOC
.endif rsx
.if RT.i10;COPY/CONCATENATE EXAMPLE.TOC,EXAMPLE.DOC EXAMPLE.TXT
.endif rt
.s
Now the composite file EXAMPLE.TXT may be printed as a whole document.
.ifnot hlp.s
The following commands control the TOC output.
.endif hlp
.left margin +5
.if hlp.i-6;3 SEND
.endif HLP
.s.tp5.i-5; _.SEND TOC  [;]text
.i-5; _.STC text
.p.x SEND> TOC
sends the "text" to the _.RNT file.  The text may be used to control the
TOC output.  The text may actually be a set of commands for example
_.REQUIRE "FORMAT" to insert a set of commands to control the format
of the TOC.  If the same command appears in the text then you can make sure
the TOC and documentation all have the same format.
.bb
.s.tp5.i-5;_.SEND PAGE TOC [n] [;text]
.p.x SEND>PAGE TOC
This sends text to the _.RNT file followed by a page number.
If n is included then the text is preceeded by _.IF#TOCn and
followed by _.ENDIF#TOCn.  The parameter n must be in the range 1 to 9.
This command facilitates multiple indices.  You can use the _.DISABLE 
UNCONDITIONAL command to turn off regular index entries, and pick
up and print the conditional entries in a second or third pass.
.eb
.if hlp.i-6;3 begin
.endif HLP
.s.tp10.i-5; _.TOC
.p.x TOC
This command is not used in DSR as a separate program produces the table of
contents. You do not normally use this command. It is automatically placed at
the beginning of a _.RNT file. It enables formatting for the table of
contents.  It does the following: 
.list 0
.le; New pages for each chapter are inhibited.
.bb
.le; The _.CHAPTER command uses the paragraph test page to check the number
of lines available.
.eb
.LE; All tab stops are cleared.
.le; _.NO NUMBER CHAPTER
.le; _.STYLE CHAPTER 1,-1,-1,0,2
.bb
.LE; _.STYLE HEADERS ,,,,,0,0,0
.br;This sets skips and test page for levels to zero.
.eb
.le; _.INDENT LEVELS 8,8
.END LIST
.if hlp.i-6;3 END
.endif HLP
.s2.TP 10.I-5; _.END TOC
.p.x END> TOC
You would not normally use this command unless you wish to append more
text to the _.RNT file for processing with the same page numbering as
the table of contents.
This command is the complement to _.TOC.  It ends the table of contents
and allows normal text processing.  It does the following:
.list 0
.LE New pages are allowed at the start of each chapter.
.LE Tab stops are ^&NOT\& changed.
.LE _.NUMBER CHAPTER
.le _.STYLE CHAPTER 12,1,3,-1,-1
.bb
.le _.STYLE HEADERS ,,,,,2,1,7
.eb
.le _.INDENT LEVELS 0,0
.end list 2
.ifnot HLP
.lm
The format of the final table of contents may be varied either by editing
the _.RNT file or by using _.STC to add extra commands.  The following hints
may help you in designing your own format.
.LIST 0
.le The _.RNT file needs _.FILL to operate properly so do not edit a _.NO FILL
command into it.
.LE The page numbers are right justified using tabs without
ellipses enabled.
If you want ellipses used in the table of contents you should 
 _.SEND TOC _.ELLIPSES.
.le _.ENABLE LEVELS n1,n2 may be used to automatically determine which
header levels are printed in the table of contents.  The parameter n2
is the maximum header level to output to the _.RNT file and hence the maximum
to appear in the table of contents.
.le A title page may be placed in front of the table of contents by
putting it into a separate file called TITLE and inserting
 _.STC _.REQUIRE "TITLE" at the front of the _.RNO file.
.le You may wish to number the table of contents in lower roman numerals
by using the command _.STC _.DISPLAY NUMBER RL.
.le The _.STYLE commands may be inserted into the _.RNT file to control the
actual format of the final table.  By doing this you can vary the
spacing between the entries, the spacing between items in the entries,
the Capitalization of the header levels and so on.
.le _.INDENT LEVELS can also be used to change the HEADER LEVEL indentation.
.le Finally, the foreward or preface may be inserted into the table of
contents file by _.STC _.REQUIRE "PREFACE" and it will follow the same numbering
as the table of contents.
You may wish to _.END TOC at the beginning of the PREFACE.RNO file.
This should only be necessary if the preface contains section headers.
.end list 1
.endif hlp
.if HLP.i-6;3 figures
.endif hlp
.s.c;FIGURES
.p
.bb
Separate tables of contents may be generated for figures and tables.
To do this use the _.SEND PAGE TOC to send the figure names to the
_.RNT file, and specify n=1 for figures, n=2 for tables.
Assume you are creating a document called BUILDING.
For example a figure would be:
.i5;_.SEND PAGE TOC 1;Figure 5 - TOP VIEW OF BUILDING
.br;At the beginning of the BUILDING.RNO file you use the commands:
.i5;_.SEND TOC _.IF TOC0 _.DUNC
.i5;_.SEND TOC _.ENDIF TOC0
.br;And at the end of BUILDING.RNO:
.i5;_.SEND TOC _.EUNC
.br;Then a _.RNO file would be created to cause 3 passes through BUILDING.RNT.
The file would contain the following:
.lm+5.nf
_.REQ "BUILDING.RNT"
_.VARIANT TOC0
_.VARIANT TOC1 _.PAGE _.C;FIGURES
_.REQ "BUILDING.RNT"
_.NO VARIANT TOC1 _.VARIANT TOC2 _.PAGE
_.C;TABLES
_.REQ "BUILDING.RNT"
.lm
.p;Up to 9 different tables of contents may be created.
.eb
