Formatting Large Documents

This document covers the following topics:

When you define chapter titles, a table of contents is automatically created. When you define index entries, an index is automatically created.

The different parts of a formatted document are output in the following sequence:

  1. document text (including all embedded documents at the specified positions)

  2. index

  3. table of contents


Embedding Documents

You can merge several source documents into a single output document (i.e. the formatted version of all source documents). To do so, you use the .EM instruction.

The documents to be embedded may either contain short texts (e.g. standard phrases which you include in a letter) or long texts (e.g. a chapter of a book).

When you write a book, you can create a document which contains all .EM instructions and which thus controls the output of all chapters of the book.

.EM - Embed

.EM document-name

To embed a document in the current document (i.e. the document containing the .EM instruction), you must specify the .EM instruction with the name of the document that you want to embed. For example, to embed the document named "preface", you must specify:

.EM preface

If the document name consists of several words which are separated by blanks, the document name must be specified in single quotation marks. For example:

.EM 'new strategy'

No special instruction is needed at the end of an embedded document. Con-form automatically returns to the document which contained the .EM instruction and continues processing the information following the .EM instruction. However, if required, you can also use the .EF instruction (see below).

The document specified by the .EM instruction may also contain .EM instructions. This process may be continued up to a maximum nesting depth of 5.

.EF - End of File

.EF

When you want to embed only the beginning of a document, you can include the .EF instruction in the document that you want to embed.

Upon encountering this instruction, Con-form returns control to the document which contains the .EM instruction and continues processing the information following the .EM instruction.

All information in the embedded document which follows the .EF instruction is not considered.

.EP - End of Processing

.EP

You can include the. EP instruction in any document (it need not necessarily be an embedded document) to stop formatting.

In the case of an embedded document, Con-form does not return control to the document which contains the .EM instruction.

It is not possible to conditionally suppress the processing of the .EP instruction by using it in an .IF construction. Formatting is always stopped.

.OP EMN - Embed Nobreak

.OP EMN=ON
.OP EMN=OFF

You can only use the instruction .OP EMN=ON when filling is switched on (.FI ON).

When you embed a document in another document, the text after the embedded document always starts in a new line - even if filling is switched on.

To disallow the line break, you must specify the following:

.OP EMN=ON

As a result, the text of the current document continues in the same line as the text of the embedded document.

Initially, this option is switched off. This corresponds to the following:

.OP EMN=OFF

Example

This example illustrates how to embed a document. When the embedded document contains no specific instructions, it is formatted according to the instructions given in the document which contains the .EM instruction. However, instructions in the embedded document (e.g. values for margins, filling and justification) also apply to the document which contains the .EM instruction. Therefore, you must take care to reset these values at the end of the embedded document.

Source Text - Document to be Embedded

.LM 10;.RM 60
.FI ON;.JU OFF
This is the document to be embedded. When it is embedded in another
document, it is formatted according to the instructions defined
here.
.LM 0;.RM 70
.FI ON;.JU ON

Source Text - Document Containing the .EM Instruction

.LM 0;.RM 70
.FI ON;.JU ON
To include the text from another document into the current document,
you must specify the .EM instruction with the name of the document to
be embedded.
.IL 1
.EM doc2
.IL 1
When you do not reset the values in the embedded document, they are also
applied to the main document.

Formatted Output

To  include the text from another document into the current  document,
you  must specify the .EM instruction with the name of the document to
be embedded.

          This is the document to be embedded. When it is
          embedded in another document, it is formatted
          according to the instructions defined here.

When  you  do not reset the values in the embedded document, they  are
also applied to the main document.

Saving and Restoring the Settings

If a part of your document is to be formatted differently than the main part of it, you can save the current settings of the document with the .SA instruction. For the next section of text, you can then modify the settings as required. Later you specify the .RS instruction to restore the original settings which have been saved with the last .SA instruction and continue processing.

Note:
This feature is helpful when you want to embed a document.

.SA - Save Context

.SA

To save the current settings of the document, you must specify the .SA instruction.

You can then modify the settings as required. For example, you can define different left and right margins for the text after the .SA instruction.

The following actions automatically issue the .SA instruction:

  • .NL KEEP

  • .NL FLOAT

  • The processing of footnotes (.FN)

  • The processing of header lines (.HL)

To restore the original settings which have been saved with the last .SA instruction, you must use the .RS instruction (see below).

.RS - Restore Context

.RS

To restore the settings which have been saved with the last .SA instruction, you must specify the .RS instruction.

As a result, formatting continues with the settings which were in effect before the last .SA instruction was executed.

The following actions automatically issue the .RS instruction:

  • .NL OFF

  • The completion of the processing of footnotes (.FN)

  • The completion of the processing of header lines (.HL)

Example

This example illustrates the instructions .SA and .RS.

Source Text

.LM 0;.RM 70
.FI ON;.JU ON
You can use the .SA instruction to save the current settings (for
example, the settings for the margins, filling and justification).
.SA
.** Define different settings for the following lines.
.LM 10;.RM 50
.FI ON;.JU OFF
.IL 1
Different margins have been defined for this part of the document and
justification has been switched off.
.IL 1
.** Restore the previous settings.
.RS
When you use the .RS instruction, the previously stored settings are
restored and formatting continues with the settings which were in effect
before the .SA instruction was executed.

Formatted Output

You  can  use  the .SA instruction to save the current  settings  (for
example, the settings for the margins, filling and justification).

          Different margins have been defined for
          this part of the document and
          justification has been switched off.

When  you use the .RS instruction, the previously stored settings  are
restored  and  formatting  continues with the settings which  were  in
effect before the .SA instruction was executed.

Chapter Titles and the Table of Contents

You define chapter titles with the .CH instruction. The titles are output in the current position of the text as well as in the table of contents. The table of contents is automatically output at the end of the document, starting on a new page. When you also specify index entries, the table of contents is output after the index.

You can use the .PT instruction to control the layout of the table of contents.

.CH - Chapter

.CH number
.CH +number
.CH -number
.CH

To define chapter titles and make entries in the table of contents, you must use the .CH instruction. The text which follows the .CH instruction - before the next line break - is the chapter title. For example:

.CH 1
Chapter One

The title is output at the current position in the text and in the table of contents. The parameter after the .CH instruction defines the level (see Defining Different Levels for Titles).

Con-form automatically checks whether at least 7 free lines are available on the current page (i.e. Con-form implicitly performs the instruction .NL 7). If seven lines are not available, Con-form starts a new page and outputs the title on the new page. Thus, a chapter or section will not start near the bottom of a page.

The Importance of Line Breaks after the Title

When filling is switched on (.FI ON), a line break must occur after the title. Otherwise, all text between the .CH instruction and the next line break is interpreted as the title and included in the table of contents. For example:

.FI ON;.JU ON
.CH 1
This is the chapter title.
When filling has been switched on, you must ensure that a line break
occurs after the chapter title.
.IL 1
All text between the .CH instruction and the next line break is included
in the table of contents.

The above instructions cause the following formatted output:

1. This is the chapter title. When filling has been switched on, you
   must ensure that a line break occurs after the chapter title.

All text between the .CH instruction and the next line break is included
in the table of contents.

The table of contents is automatically output at the end of the formatted document:

1. This is the chapter title. When filling has been switched on, you
   must ensure that a line break occurs after the chapter title......  1

To define a line break, you can either leave blank lines in the source text or specify the end-of-line character which is usually the dollar sign ($). See Starting Text on a New Line for further information concerning line breaks.

Defining Different Levels for Titles

To define different levels, you must specify the level as a parameter with the .CH instruction. For example:

Instruction Level Numbering Style
.CH 1 Chapter Title 1
.CH 2 Section Title 1.1
.CH 3 Subsection Title 1.1.1
.CH 4 Subsubsection Title 1.1.1.1

Note:
The parameter after the .CH instruction is not the number of the chapter, but the level of the title. The chapter number is automatically increased by one when the next .CH 1 instruction (i.e. a title on the first level) is encountered.

You can define up to ten different levels for titles and up to 99 entries for each level. Each time a .CH instruction is processed, a chapter number is automatically built. The chapter number is stored in the variable $CH (see Modifiable System Variables).

When you specify the level as a parameter with the .CH instruction, the titles are initially numbered. However, you can switch chapter numbering off (see the instruction .OP CHA).

Initially, the entries in the table of contents are indented. However, you can switch indentation off (see the instruction .OP CHI).

Note:
When you do not want to use different levels for your titles, you need not specify a number with the .CH instruction. In this case, the titles are neither numbered nor indented in the table of contents.

The following example shows how to define titles on different levels:

.CH 1
Chapter Title
This is the text below the chapter title.
.IL 1
.CH 2
Section Title
This is text below the second level section title. In the table of
contents, all titles below level 1 are automatically indented.
.IL 1
.CH 3
Subsection Title
This is text below the third level subsection title.
.IL 1
.CH 1
Chapter Title
This is chapter two.

The above instructions cause the following formatted output:

1. Chapter Title
This is the text below the chapter title.

1.1 Section Title
This is text below the second level section title. In the table of
contents, all titles below level 1 are automatically indented.

1.1.1 Subsection Title
This is text below the third level subsection title. The table
of contents is output at the end of the formatted document.

2. Chapter Title
This is chapter two.

The table of contents is output as follows:

1. Chapter Title.....................................................  1
  1.1 Section Title..................................................  1
    1.1.1 Subsection Title...........................................  1
2. Chapter Title.....................................................  1

Defining the Number of Levels Higher or Lower than the Current Level

You can also use a plus or minus sign to define the number of levels higher or lower than the current level. When you specify the instruction .CH +0, the next title is output at the same level as the current title.

The following example shows how to define titles on different levels:

.CH 1
Chapter One
To define the next chapter title at the same level, you specify .CH +0.
.IL 1
.CH +0
Chapter Two
To define a section title within the second chapter, you specify the number
of levels higher or lower.
.IL 1
.CH +1
This is the section title
.CH +1
A subsection
.CH -1
Another section title
.CH +1
First subsection
.CH +0
Second subsection
.CH +0
Third subsection
.IL 1
.CH 1
Chapter Three

The above instructions cause the following formatted output:

1. Chapter One
To define the next chapter title at the same level, you specify .CH +0.

2. Chapter Two
To define a section title within the second chapter, you specify the number
of levels higher or lower.

2.1 This is the section title
2.1.1 A subsection
2.2 Another section title
2.2.1 First subsection
2.2.2 Second subsection
2.2.3 Third subsection

3. Chapter Three

The table of contents is output as follows:

1. Chapter One.......................................................  1
2. Chapter Two.......................................................  1
  2.1 This is the section title......................................  1
    2.1.1 A subsection...............................................  1
  2.2 Another section title..........................................  1
    2.2.1 First subsection...........................................  1
    2.2.2 Second subsection..........................................  1
    2.2.3 Third subsection...........................................  1
3. Chapter Three.....................................................  1

Emphasizing a Title

At the current position in the text, the title is not automatically formatted in a specific way. For example, to emphasize the title or print blank lines before and after it, you must include the appropriate instructions in the source text:

.CH 1;.US;.** Underscore the next line
Chapter One
.IL 1
.CH 1;.BP;.** Print the next line in boldface
Chapter Two
.** Print the next chapter title in italics.
.** The escape sequence /I1 was entered in a separate line.
.** When the escape sequence is entered directly in front of the words
.** "Chapter Three", the number is not printed in italics.
.OP ESC=/
/I1
.CH 1
Chapter Three/I0

The above instructions cause the following formatted output:

1. Chapter One

2. Chapter Two

3. Chapter Three

The table of contents is not influenced by the above instructions:

1. Chapter One.......................................................  1
2. Chapter Two.......................................................  1
3. Chapter Three.....................................................  1

To control the layout of the table of contents, you must use the .PT instruction.

.OP CHA - Chapter Numbering

.OP CHA=NUM
.OP CHA=UNN

When you specify the level as a parameter with the .CH instruction, the titles are initially numbered. This corresponds to the following instruction:

.OP CHA=NUM

To switch chapter numbering off, you must specify:

.OP CHA=UNN

For example:

.OP CHA=UNN
.CH 1
Chapter 1
This is the first chapter.
.CH 2;.IL 1
Section 1.1
This is the first section.
.CH 2;.IL 1
Section 1.2
This is the second section.
.CH 1;.IL 1
Chapter 2
This is the second chapter.

The above instructions cause the following formatted output:

Chapter 1
This is the first chapter.

Section 1.1
This is the first section.

Section 1.2
This is the second section.

Chapter 2
This is the second chapter.

The table of contents is output as follows:

Chapter 1............................................................  1
  Section 1.1........................................................  1
  Section 1.2........................................................  1
Chapter 2............................................................  1

Initially, the entries in the table of contents are indented. However, you can switch indentation off (see the instruction .OP CHI).

.OP CHI - Chapter Indentation in the Table of Contents

.OP CHI=ON
.OP CHI=OFF

When you specify the level as a parameter with the .CH instruction, the titles in the table of contents are initially indented - according to the level you specified. This corresponds to the following instruction:

.OP CHI=ON

To switch indentation off, you must specify:

.OP CHI=OFF

For example:

.OP CHI=OFF
.CH 1
Chapter One
This is the first chapter.
.CH 2;.IL 1
First Section
This is the first section.
.CH 2;.IL 1
Second Section
This is the second section.
.CH 1;.IL 1
Chapter Two
This is the second chapter.

The above instructions cause the following formatted output:

1. Chapter One
This is the first chapter.

1.1 First Section
This is the first section.

1.2 Second Section
This is the second section.

2. Chapter Two
This is the second chapter.

The table of contents is output as follows:

1. Chapter One.......................................................  1
1.1 First Section....................................................  1
1.2 Second Section...................................................  1
2. Chapter Two.......................................................  1

.OP CHL - Chapter Levels in the Table of Contents

.OP CHL=number

When you specify the level as a parameter with the .CH instruction, you can define a maximum of 10 different levels. This corresponds to the initial setting:

.OP CHL=10

You can specify the maximum level of titles that is included in the table of contents. All titles with levels greater than the number specified with the .OP CHL instruction are not included in the table of contents. For example:

.OP CHL=2
.CH 1
Chapter Title
The chapter title at level 1 is included in the table of contents.
.CH 2;.IL 1
Section Title
The section title at level 2 is included in the table of contents.
.CH 3;.IL 1
Subsection Title
The subsection title at level 3 is not included in the table of contents.

The above instructions cause the following formatted output:

1. Chapter Title
The chapter title at level 1 is included in the table of contents.

1.1 Section Title
The section title at level 2 is included in the table of contents.

1.1.1 Subsection Title
The subsection title at level 3 is not included in the table of contents.

The table of contents is output as follows:

1. Chapter Title.....................................................  1
  1.1 Section Title..................................................  1

When you do not want to include any titles in the table of contents, you must specify the following:

.OP CHI=0

When you specify the above instruction at the beginning of a document, a table of contents is not created. When you specify the above instruction after you have already included several titles in the table of contents, the titles after this instruction are not included in the table of contents.

.SC - Set Chapter Number

.SC chapter-number

This instruction is only valid when .OP CHA=NUM is in effect, i.e. when chapter numbering is switched on.

You can define another chapter number for the current chapter or section. The next .CH n instruction then determines the chapter or section level. For example:

.CH 1
Chapter One
.SC 4;.** Set the current chapter number to 4.
.CH 1;.** Start a new chapter. The chapter number is increased by 1.
Chapter Five

The above instructions cause the following formatted output:

1. Chapter One
5. Chapter Five

The table of contents is output as follows:

1. Chapter One.......................................................  1
5. Chapter Five......................................................  1

As long as you do not specify a new level 1 chapter title (using the instruction .CH 1), all sections and subsections receive the chapter number which has been defined for the current chapter. When the instruction .CH 1 occurs after the .SC instruction, the chapter number is increased by one. For example:

.CH 1
Chapter Title
.SC 4;.** Set the current chapter number to 4.
.CH 2;.** Output a section title at level 2.
Section Title
.SC 7;.** Set the current chapter number to 7.
.CH 2;.** Output another section title at level 2.
Section Title
.CH 3;.** Output a subsection title at level 3.
First Subsection Title
.SC 7.5;.** Set the current section number to 7.5
.CH 3;.** Output another subsection title at level 3.
Second Subsection Title
.SC 15;.** Set the current chapter number to 15.
.CH 1;.** Start a new chapter with number 16.
Chapter Title

The above instructions cause the following formatted output:

1. Chapter Title
4.1 Section Title
7.1 Section Title
7.1.1 First Subsection Title
7.5.1 Second Subsection Title
16. Chapter Title

In the table of contents, the titles are indented according to their levels:

1. Chapter Title.....................................................  1
  4.1 Section Title..................................................  1
  7.1 Section Title..................................................  1
    7.1.1 First Subsection Title.....................................  1
    7.5.1 Second Subsection Title....................................  1
16. Chapter Title....................................................  1

.PT - Put to Table of Contents

.PT instruction
.PT text

You use the .PT instruction to control the layout of the table of contents. You can define text as well as instructions (or macros with parameters as necessary) with the .PT instruction. However, you must not mix text and instruction within a single .PT instruction.

For example, to print a centered and underscored title above the table of contents, you specify the following instructions:

.PT .CE 1;.US
.PT Table of Contents

You can use the .HL instruction (to define a header which appears at the top of each page) as a parameter of the .PT instruction. Like the .PT instruction, the .HL instruction is also specified with either an instruction or text. For example:

.PT .HL .CE 1
.PT .HL Table of Contents

The .PT instruction must be entered at the beginning of the document. When you enter it, for example, at the end of the document, it may happen that the formatted output does not appear as desired.

The table of contents is always output at the end of the document. However, when you have printed the document, you can re-arrange the printed pages and move the table of contents to the beginning of the document. In this case, it is useful when a different page number style (for example, Roman page numbers) has been defined for the table of contents.

When you specify a top and/or bottom title for the document and do not define different top or bottom titles for the table of contents, the table of contents also contains the top and bottom titles of the main document. When page numbering has been defined, consecutive numbering continues from the last page of the actual document.

Tip:
When you work in Con-nect, you can file a formatted version of the document and then modify the formatted version of the table of contents in the Con-nect editor.

The following example illustrates how to output the page number in the bottom title of the table of contents and how to define upper-case Roman page numbers with number 1 as the first page.

.FI ON;.JU ON
.PT .NP 1
.PT .PM R
.PT .BT //ToC  #
.PT .US;.** Underscore the following line.
.PT Table of Contents
.PT .IL 1
.CH 1;.** Chapter numbering is switched on by default.
The Table of Contents
.IL 1
.CH 2
The .PT Instruction
.IL 1
You use the .PT instruction to influence the layout of the table of
contents. You can specify text or instructions with the .PT
instruction. However, you must not mix text and instructions within a
single .PT instruction.
.IL 2
.CH 2
The .OP PTC Instruction
.IL 1
By default, the .PT instruction is switched on. You can switch it
off so that the text or instruction after a .PT instruction is not
applied to the table of contents.

The above instructions cause the following formatted output:

1. The Table of Contents

1.1 The .PT Instruction

You  use  the  .PT instruction to influence the layout of the  table  of
contents. You can specify text or instructions with the .PT instruction.
However,  you  must  not mix text and instructions within a  single  .PT
instruction.


1.2 The .OP PTC Instruction

By default, the .PT instruction is switched on. You can switch it off so
that  the text or instruction after a .PT instruction is not applied  to
the table of contents.

The table of contents is output as follows:

Table of Contents

1. The Table of Contents.............................................  1
  1.1 The .PT Instruction............................................  1
  1.2 The .OP PTC Instruction........................................  1

The page number is printed in the bottom title of the table of contents:

                                                                  ToC  I

.OP PTC - Switch .PT Instruction On/Off

.OP PTC=ON
.OP PTC=OFF

Initially, the .PT instruction is in effect, i.e. the text or instruction after the.PT instruction is applied to the table of contents. This corresponds to the following instruction:

.OP PTC=ON

To switch this feature off, so that the text or instruction after the .PT instruction is not applied to the table of contents, you specify:

.OP PTC=OFF

Index Entries and the Index Summary

.IX - Index

.IX text

Index entries are made using the .IX instruction. For example:

.IX Index entries;; how to specify

The text to be included in the index can be up to 60 characters long and may contain any printable characters. If you want to include the instruction separator character (initially, this is the semicolon) in the index, you must repeat it (i.e. you must specify ";;").

The text defined with the last .IX instruction is stored in the variable $IX (see Modifiable System Variables).

Unlike the .CH instruction, the .IX instruction does not output the index entry at the current position in the text. It stores the index entry together with the number of the page on which the entry has been defined.

All index entries are automatically sorted alphabetically and output at the end of the document, starting on a new page. When your document also contains a table of contents, the index summary is output between the document text and the table of contents.

Lower-case letters precede the corresponding upper-case letters in the index summary. The sorting sequence is "aAbBcC ... zZ".

Note:
A specific sorting sequence can be defined while installing Con-form.

When you used the .CH instruction in your source text, the index summary automatically receives the heading "Index". In addition, when chapter numbering was active (.OP CHA=NUM), the heading "Index" is preceded by the next chapter number. When the .CH instruction was not used in your source text, the heading "Index" does not appear.

"Index n" (where n is the page number) is automatically output at the bottom of all odd-numbered pages. Therefore, you should not use the .BT instruction to define page numbers in the bottom title. Consecutive numbering continues from the last page of the actual document - even if you did not define page numbers for your document. A page number is not output on an even-numbered page.

Example

This example illustrates how to define index entries. Filling has been switched on. Therefore, the index entries do not cause line breaks in the formatted document. The .CH instruction has been used in the source text. Therefore, the index receives a chapter number and a table of contents is created. In this example, the index is output on an even-numbered page. Therefore, the page does not contain a page number.

Note:
When you work in Con-nect and file a formatted version of this example document, the document format is Cnf (instead of Txt). This is because the index contains an entry starting with a period (.IX).

Source Text

.FI ON;.JU ON
.CH 1
Defining Index Entries
.IL 1
Index entries are made using the .IX instruction.
.IX .IX instruction
The text to be included in the index can be up to 60 characters long
.IX Restrictions for index entries
and it may contain any printable characters.
.IX Characters, allowed in an index entry
All index entries are sorted alphabetically and output at the end
of the document.
.IX Sorting sequence

Formatted Output - Document Text

1. Defining Index Entries

Index  entries  are  made  using the .IX instruction.  The  text  to  be
included in the index can be up to 60 characters long and it may contain
any  printable  characters. All index entries are sorted  alphabetically
and output at the end of the document.

Formatted Output - Index

2. Index



Characters, allowed in an index entry ...   1

Restrictions for index entries ...   1

Sorting sequence ...   1

.IX instruction ...   1

Formatted Output - Table of Contents

1. Defining Index Entries............................................  1
2. Index.............................................................  2