The &D_GENERATE Menu - Document Formatting The &D_GENERATE Menu - Document Formatting

To allow one to fully utilize MOSES's database structure, a text formatting capability is provided. This formatter basically takes input text and formats it according to a set of given instructions for a specified output device. To simplify matters, this process occurs within an internal menu, entered via the command:


     &D_GENERATE, -OPTIONS

The available options are:


     -CMD, CMD_FILL_CHAR

     -SAVE

     -NO_CONT

The -CMD option is used to alter the "internal command character" which will be used in this menu. Normally, this character is the &. The other two options control what is done with the results when the document formatter is exited. The -SAVE option instructs MOSES to save the current settings for page numbers, etc., and the -NO_CONT option says not to write a table of contents. To exit this menu, one issues a command:

     CMD_FILL_CHAREND

Here CMD_FILL_CHAR is the same character specified with the -CMD option; i.e. if no -CMD option were issued, the menu would be exited with


     &END_&D_GENERATE

The basic job of the document formatter is to take a paragraph of text and rearrange it according to a user defined "style" which was discussed earlier and a set of formatting commands. Formatting commands are enclosed within a pair of { and }. To associate a given style with a paragraph, one should use the formatting command


     {STYLE,  ST_NAME}

The style ST_NAME will be used for all paragraphs until another style name is selected. Notice that if one uses a style before it is defined, an error will result. Notice that this is the general form of a formatting command; a { immediately followed by a command name, followed by a token delimiter, followed by data for the command, and finished with a }.

Until now, paragraphs have been discussed, but not defined. MOSES uses a method of implicit paragraph generation. In other words, a paragraph is a collection of lines delimited by either a line beginning with a blank, or certain formatting commands. This scheme works well for most text, but on occasion, one wishes to format the text himself. To allow for this, MOSES can operate in the "pre-formatted" mode, where text is simply transmitted to the output device without rearranging it. In the pre-formatted mode, each line is a paragraph. To enter this mode, one issues the formatting command:


     {PRE}

and to exit:


     {!PRE}

In addition to the general commands described above, there are several others available which may expedite special tasks. In particular


     {SKIP, POI_REL}

     {MOVE, POI_ABS}

     {EJECT}

     {EODD}

allow for positioning text on a page. Here, POI_REL is a number of points relative to the current position at which the next text will be printed, and POI_ABS is a absolute position on a page where the next text will be printed. The {EJECT} and {EODD} commands cause next text to be printed on a new page. The !EODD command will create a blank page if the current page is an odd numbered one, and the document is double sided.

To control the general appearance of the pages, one can use


     {RPAGNUM, NUMB}

     {HEAD, TEXT}

     {FOOT, TEXT}

The first of these commands sets the "current" page number to be NUMB, and {HEAD} and {FOOT} are used to define headers and footers. The styles used for headers and footers are HEAD and FOOT respectively. The TEXT on a header or footer can be any one line of text containing positioning instructions, and it can contain the special symbol #, which will be replaced with the current page number when the text is written. For both footers and headers, the -BEFORE option of the style defines how far down from the bottom margin or top of the page the header or footer will be printed.

In many instances, one is producing a document which requires a table of contents and which has sections. This is facilitated by the commands:


     {SECTION, TEXT}

     {PART, TEXT}

     {SUBPART, TEXT}

     {BPAGE, TEXT}

     {CONTENTS, TEXT}

     {INDEX, TEXT}

For the first three of these commands, a section label will be created, the section heading will be printed using the style SECTION, and a table of contents entry will be generated. The next command will simply create a blank page with a single line of text in the center of it. The next command will either place the table of contents at this position in the document or create a place for it. The last command will place the index at this position in the document.

In addition to the general formatting via styles, MOSES has the ability to temporarily override styles within a paragraph. This is accomplished by enclosing parts of the text within a set of delimiters. To set some text bold, one should use


     {b}

at the beginning of the bolding and

     {dc}

at the conclusion. Likewise for underlining one uses


     {U}

at the beginning and


     {!U}

at the end. For italics, one uses the pairs {I} and {!I}.

Often on wishes to format a "list" of things. This is accomplished by entering the "LIST" mode with:


     {LIST, LIST_TYPE -OPTIONS}

Here LIST_TYPE is the type of list and must be chosen from ITEMIZE or USE_FIRST; and if omitted, ITEMIZE will be used. A LIST_TYPE of ITEMIZE will put a "bullet" as the beginning of each list item while USE_FIRST will use the first non-blank character in the list as the item delimiter. Now, the list is composed of "items" which are simply paragraphs. To exit LIST mode, one uses:


     {!LIST}

There is one option:



     -SPACE, SPACE

which defines the vertical space in points at the beginning and end of the list.

The final formatting construct is "TABLE" mode which is entered with


     {TABLE, TABLE_TITLE, -OPTIONS}

and exited with


     {!TABLE}

A table consists of a centered title, TABLE_TITLE, and a matrix. The matrix is defined as each paragraph being a row. The general definition of a table row is

     |column(1)|column(2) ..... |

where the beginning of the row is indented (rows are viewed as paragraphs). The | delimit the definition of the elements within the row. By default, the element will be centered within the column width. If one does not wish the elements to be centered, he can use < or > as the first character of a part to either left or right justify the part within the column. There is one option:

     -MARK, SEP_CHAR

which is used to change the column separation character from | to SEP_CHAR. A degenerate list of a single row can be simply defined with


     {CENTER |part(1)|part(2) ..... |}

This table will have no title.