ftp.nice.ch/pub/next/unix/text/rtfdtohtml.1.3.s.tar.gz#/rtfdtohtml-1.3/doc/RichTextSpec.rtf

This is RichTextSpec.rtf in view mode; [Download] [Up]

Microsoft â
Rich Text Format Specification

Information in this document is subject to change without notice and does not represent a commitment on the part of Microsoft Corporation.

You have the royalty-free right to reproduce and distribute products that use RTF (Rich Text Format) as a file conversion medium provided that you: (a) do not use Microsoft's name, logo, or trademarks to market your software product; and (b) agree to indemnify, hold harmless, and defend Microsoft from and against any claims or lawsuits, including attorneys' fees, that arise from the use or distribution of your software.

You may reproduce and distribute this specification provided that it is reproduced in its entirety including this copyright page.

If you have suggestions for enhancements or extensions to the RTF Specification, have developed an application using RTF, or wish to receive the most up-to-date copy of the RTF specification, please write:

Microsoft Corporation
Department: RTF
16011 NE 36th Way
Box 97017
Redmond, WA 98073-9717

©Copyright Microsoft Corporation, 1987-1989

Microsoftâ, MS-DOSâ, and the Microsoft logo are registered trademarks of Microsoft Corporation.

Appleâ and the Apple logo are registered trademarks of Apple Computer, Inc.

Macintoshä is a trademark licensed to Apple Computer, Inc.

IBMâ is a registered trademark of International Business Machines Corporation

Helveticaâ, Timesâ, and Palatinoâ are registered trademarks of Allied Corporation.

ITC Avant Gardeâ and ITC Zapf Chanceryâ are registered trademarks of International Typeface Corporation.


Notice:  The electronic version of this document was typed in by Charles C. Lloyd, an independent contractor.  Every effort was made to reproduce the hard copy version provided by Microsoft verbatim.  However, typographical errors may exist in this electronic version, so if you are in doubt, contact Microsoft for an official hard copy.  Also, please notify me of any errors you may find so I may update the master copy.  I can be reached at wiltel!clloyd@uunet.uu.net.  Williams Telecommunications was in no way involved with the effort to transcribe this document.

Rich Text Format

The Rich Text Format (RTF) standard is a method of encoding formatted text and graphics for easy transfer between applications.  Currently, users depend on special translation software to move word processing documents between different DOS applications, and between DOS applications and Apple Macintosh applications.

The RTF standard provides a standard format for text and graphics interchange that can be used with different output devices, operating environments, and operating systems.  RTF uses the ANSI, Macintosh, or IBM PC character set to control the representation and formatting of a document, both on the screen and in print.  With the RTF standard, documents composed under different operating systems and with different software applications can be transferred between those operating systems and applications.

RTF Syntax

An RTF file consists of unformatted text, "control words," "control symbols," and "groups."  A standard RTF file consists of only 7-bit ASCII characters for ease of transport.

A "control word" is a specially formatted command that RTF uses to mark printer control codes and information that Microsoft Word uses to manage documents.  A control word consists of a backslash followed by an alphabetic string and a delimiter, as shown in the following example:

\rtf1 ...

Explanation of above:

Element	Meaning	|
\	Backslash begins each control word
rtf	Alphabetic string
1	Numeric delimiter

The delimiter can be a space or one or more nonalphabetic characters.  A numeric delimiter can have a leading minus sign (-) and the numeric portion can be in the range 0-32,767.  When writing RTF files to be read by Word for Windows or Word for the Macintosh, you should limit numeric delimiters to 31,680, since neither application expects a delimiter larger that 31,680.  If a  numeric parameter immediately follows the control word, this parameter is the delimiter, and is itself followed by a delimiter, also consisting of a space or one or more alphabetic characters.  If a space delimits a control word, then it does not appear in the document.  If a control word is delimited by another character, then space following the delimiter will be part of the document.  For this reason, you should use spaces only where necessary; do not use spaces merely to break up RTF code.

A "control symbol" consists of a backslash followed by a single, nonalphabetic character.  For example, \~ represents a nonbreaking space.  Control symbols take no delimiters.

A "group" consists of text and control words or control symbols enclosed in braces({}).  Formatting specified within a group affects only the text within the group.  Generally, text within a group inherits any formatting of the text preceding the group.  However, Microsoft implementation of RTF assume that the footnote, header/footer, and annotation groups (described later in this chapter) do not inherit formatting of the preceding text.  Therefore, to ensure that these groups will always be formatted correctly, you should set the formatting within these groups to the default with the \sectd, \pard, and \plain control words, and then add any desired formatting.

Any other characters in the file are plain text. As previously mentioned, the backslash (\) and braces ({}) have special meaning in RTF.  To use these characters as text, precede them with a backslash.

Software that takes a formatted file and turns it into an RTF file is called a "writer."  Software that translates an RTF file into a formatted file is called a "reader."    An RTF writer separates the application's control information from the plain text and writes a new file containing the plain text and the RTF groups associated with that text.  An RTF reader does the converse of this procedure.

An entire RTF file is considered a group and must be enclosed in braces.  The control word \rtfn must follow the first open brace.  The numeric parameter identifies the version of the RTF standard used.  The RTF standard described in this chapter corresponds to version 1.

The control word defining the character set should be one of the first entries following \rtfn.  It must precede any document text or table.

Each group specifies the part of the document affected by the group and the different attributes of that text.  The RTF file can also include groups for fonts, styles, screen color, pictures, footnotes, annotations, headers and footers, summary information, fields, and bookmarks, as well as document, section, paragraph, and character formatting properties.  If the font, style, screen color, and summary information groups and document formatting properties are included, they must precede the first plain text character in the document.  If included, the group for fonts should precede the group for styles.

The groups are discussed in the following sections.  If a group isn't used, it can be omitted.

Certain groups, referred to as "destinations," mark the beginning of a collection of related text.  An example of this is the \footnote group, where the footnote text follows the control word.  Destinations added after the RTF specification published in the March 1987 Microsoft Systems Journal may be preceded by the control symbol \*.  This control symbol identifies destinations whose related text should be ignored if the RTF reader does not recognize the destination.  RTF writers should follow this convention when adding new control word.  Destinations whose related text should be inserted into the document even if the destination is not recognized should not use \*.  In this chapter, all destinations that use \* will be shown with \* as part of the control word.

System Default Values

The following control words specify system default value:

Control Word	Meaning	|
\deffn	Specifies the default font number

\defformat	Tells the RTF reader that the document should be saved in RTF format

\deftabn	Specifies the default tab width

The Character Set

After specifying the RTF writer, you must declare the character set.  the RTF specification currently supports the following character sets:

Control Word	Character set	|
\ansi	ANSI (default)

\mac	Apple Macintosh

\pc	IBM PC

\pca	IBM PC page 850, used by IBM Personal System/2

The Font Table

This group contains descriptions of fonts and begins with the control word \fonttbl.  All fonts available to the RTF writer can be included in the font table, even if the document doesn't use all the fonts.

A font is defined by its name, a font number, and a font family as shown in the following example.  Semicolons are used as delimiters between fonts.

{\fonttbl\f0\froman Tms Rmn;}...

Explanation of above:

Element	Meaning	|
\fonttbl	Control word
\f0	Font number
\froman	Font Family
 Tms Rmn	Font name

The font numbers represent the full font definitions in the group, and vary with each document.  The font families are listed below:

Control Word	Font family	|
\fnil	Unknown or default fonts (default)

\froman	Roman, proportionally spaced serif fonts (Tms Rmn, Palatino, etc.)

\fswiss	Swiss, proportionally spaced sans serif fonts (Swiss, etc.)

\fmodern	Fixed-pitch serif and sans serif fonts (Courier, Elite, Pica, etc.)

\fscript	Script fonts (Cursive, etc.)

\fdecor	Decorative fonts (Old English, ITC Zapf Cancery, etc.)

\ftech	Technical, symbol, and mathematical fonts (Symbol, etc.)

If an RTF file uses a default font, the default font number is specified with the \deffn control word, which must precede the font table group.  The RTF writer supplies the default font number used in the creation of the document as the numeric argument.  The RTF reader then translates this number through the font table into the most similar font available on the reader's system.

The Style Sheet
The style sheet group begins with the control word \stylesheet.  This group contains definitions and descriptions of the various styles used in the document.  The style sheet is declared only once, in the RTF file header.  All styles in the document's style sheet can be included, even if not all the styles are used.

In some applications, styles are based on, or are the basis for, other styles.  In these cases, two other control words can be used:

Control Word	Meaning	|
\sbasedonn	Defines the number of the style on which current style is based; default (222) is no style

\snextn	Defines next style associated with current style; if omitted, next style is the current style

An example of an RTF style sheet and styles follows.  In this example, PostScript is declared but not used.  Some of the control words in this example are discussed in the following sections.

...
{\stylesheet{\fs20\sbasedon222\snext0 Normal;}{\s1\qr\fs20\sbasedon0\snext1 FLUSHRIGHT;}{\s2\fi-720\li720\fs20\ri2880\fs20\sbasedon0\snext2 IND;}}
...
\windowctrl\ftnbj\ftnrestart\sectd\linex0\endnhere
\pard\plain\fs20 This is Normal style.
\par\pard\plain\s1
This is right justified.  I call this style FLUSHRIGHT.
\par\pard\plain\s2
This is an indented paragraph.  I call this style IND.  It produces a hanging indent.

\par}
...

NOTE: The stylesheet is everything between the first two ellipses.
	The styles are applied to text between the second two ellipses.

The results:

This is Normal style.
This is right justified.  I call this style FLUSHRIGHT.
This is an indented paragraph.  I call this style IND.  It produces a hanging indent.



The Color Table
Screen colors, character colors, and other color information are contained in the color table group.  The control word \colortbl begins this group.  Values for red, green, blue, and the foreground and background colors are shown in the following list.  These parameter value correspond to the color indexes used by Microsoft Windows (0-255).  Each color table entry is defined by the amount of red, green, and blue it has.  For more information on color setup, see your Windows documentation.

The following are valid control words for this group:

Control Word	Meaning	|
\redn	Red index

\greenn	Green index

\bluen	Blue index

\cfn	Foreground color (default is 0)

\cbn	Background color (default is 0)

Each definition must be delimited by a semicolon, even if the definition is omitted.  If a color definition is omitted, the RTF reader uses its default color.  In the example below, three colors are defined.  The first color is omitted, as shown by the semicolon following the \colortbl control word.

...
{\colortbl;\red0\green0\blue0;\red0\green0\blue255;}
...

The following example defines a block of text in color (where supported).  Note that the cf/cb index in the index of an entry in the color table, which represents a red/green/blue color combination.

...
{\f1\cb1\cf2 This is colored text.  The background is color 1 and the foreground is color 2.}
...

If the file is translated by software that does not display color, this group is ignored.

Pictures

An RTF file can include picture files composed with other applications.  These files are in hexadecimal (default) or binary format.  The control word \pict begins this group.  Control words that define and describe the picture parameters follow the \pict control word.

These control words are listed in the table that follows.  Some measurements in this table are in twips; a twip is one-twentieth of a point.  The control words for picture border patterns (\brdrs, \brdrdb, \brdrth, \brdrsh, \brdrdot, and \brdrhair) are ignored when translated into Microsoft Word for the Macintosh, which uses character properties to make borders.

Control Word	Meaning	|
\brdrs	Single border for picture

\brdrdb	Double border for picture

\brdrth	Thick border for picture

\brdrsh	Shadow border for picture

\brdrdot	Dotted border for picture

\brdrhair	Hairline border for picture

\macpict	Source of picture is QuickDraw

\wmetafilen	Source of picture is Windows metafile; argument identifies the metafile type; default is 1 (MM_TEXT)

\wbitmap	Source of picture is a bitmap; argument identifies the bitmap type; default is 0 (logical bitmap)

\picwn	xExt field if picture is metafile; picture width in pixels if picture is bitmap or from QuickDraw

\pichn	yExt field if picture is metafile; picture height in pixels if picture is bitmap or from QuickDraw

\picwgoaln	Desired width of picture in twips

\pichgoaln	Desired height of picture in twips

\picscalexn	Horizontal scaling value; argument is a value representing a percentage (default is 100)

\picscaleyn	Vertical scaling value; argument is a value representing a percentage (default is 100)

\picscaled	Scales picture to fit within specified frame; used only with /macpict pictures

\piccroptn	Top cropping value in twips; positive value crops toward center of picture; negative value crops away from center, adding space border around picture (default is 0)

\piccropbn	Bottom cropping value in twips; positive value crops toward center of picture; negative value crops away from center, adding space border around picture (default is 0)

\piccropln	Left cropping value in twips; positive value crops toward center of picture; negative value crops away from center, adding space border around picture (default is 0)

\piccroprn	Right cropping value in twips; positive value crops toward center of picture; negative value crops away from center, adding space border around picture (default is 0)

\wbmbitspixeln	Bitmap bits/pixel (default is 1)

\wbmplanesn	Number of bitmap planes (default is 1)

\wbmwidthbytesn	Bitmap width in bytes

\binn	Picture is in binary format; numeric parameter is number of bytes to follow

The \wbitmap control word is optional; if neither \wmetafile nor \macpict is specified, the picture is assumed to be a Windows bitmap.

Be careful with spaces following control words when dealing with pictures in binary format.  When reading files, RTF considers the first space  the delimiter and subsequent spaces part of the document text.  Therefore, any extra white space is attached to the picture, with unpredictable results.

RTF writers should not use the carriage-return--line-feed (CRLF) combination to break up pictures in binary format.  In this case, the CRLF will be treated as literal text and considered part of the picture data.

The picture in hexadecimal or binary format follows the picture group control words.  The following example illustrates the group format and the result.

...
{\pict\wbitmap0\picw170\pich77\wbmbitspixel1\wbmplanes1\wbmwidthbytes22\picwgoal505
\pichgoal221
\picscalex172
\picscaley172
49f2000000000273023d1101a030
3901000a000000000273023d98
0048000200000275
0240000200010275023e000000000
273023d000002b90002b90002
b90002b90002b9
0002b90002b90002b90002b90002b90002
b92222b90002b90002b90
002b90002b9
0002b90002b90002b90002b9000
...

<Rendered image of horse omitted>

Explanation of above:

Control Word	Meaning	|
\pict	begins group
\wbitmap0	Source
\picw170	Width
\pich77	Height
\wbmbitspixel1	Bits per pixel
\wbmplanes1	Bitmap planes
\wbmwidthbytes22	Width of picture in bytes
\picwgoal505	Desired picture width
\pichgoal221	Desired picture width
\picscalex172	Horizontal scaling value
\picscaley172	Vertical scaling value
<data omitted>	Hexadecimal data


Footnotes

The group containing footnote text begins with the control word \footnote.  Footnotes are anchored to the character that immediately precedes the footnote group.  If automatic footnoting is defined, the group can be preceded by a footnote reference character, identified by the control word \chftn.

The following is an example of a group containing footnotes:

...
\ftnbj\ftnrestart\sectd\linemod\linex0\endnhere\pard\plain
\ri1170\fs20{\up6 Mead's landmark study has been amply annotated.\chftn
{footnote\pard\plain\s246\fs20{up6\chftn}See Sahlins, Bateson, and Geertz for a complete bibliography.}
It was her work in America during the Second World War, however, that forms the basis for this paper.  As other have noted,\chftn
{\footnote\pard\plain\s246\fs20{\up6\chftn}
A complete bibliography will be found at the end of this chapter.}
this period was a turning point for Margaret Mead.}
\par
...

Results:

Mead's landmark study has been amply annotated.1  It was her work in America during the Second World War, however, that forms the basis for this paper.  As other have noted,2 this period was a turning point for Margaret Mead.

1See Sahlins, Bateson, and Geertz for a complete bibliography.
2A complete bibliography will be found at the end of this chapter.



For other control words relating to footnotes, see "Document Formatting Properties," "Section Formatting Properties," and "Special Characters," later in this chapter.

Annotations

The group containing annotation text begins with the control word \*\annotation.  Annotations are anchored to the character that immediately precedes the annotation group.  The group must be preceded by an annotation reference character, identified by the control word \chatn, which itself must be preceded by a group that begins with the control word \*\atnid, and that contains the identification text for the author of the annotation.

An example of annotation text follows:

...
An example of a paradigm might be Newtonian physics or
Darwinian biology.{\v\fs16{\atnid bz}\chatn{\annotation
\pard\plain\s224\fs20{\field{\fldinst page \\#"'Page:
'#'\line'"}{\fldrslt}}{\fs16\chatn}
How about some examples that deal with social science?
That's what this paper is about.}}
...

Headers and Footers

Headers and footers are treated as separate groups in RTF.  These groups must precede the first plain text character in the given document section.  The control words \header and \footer begin these groups.

Headers and footers can be defined for each section.  If none is defined for a given sections, the headers and footers from the previous section (if any) are used.

The control words \header and \footer can be replaced by the following control words, as appropriate.  The \headerl and \headerr and \footerl and \footerr control words are used in conjunction with the \facingp control word, and the \headerf and \footerf control words are used in conjunction with the \titlepg control word.  For more information, see "Document Formatting Properties," later in this chapter.

Control Word	Meaning	|
\headerl	Header on left pages only

\headerr	Header on right pages only

\headerf	Header on first page only

\footerl	Footer on left pages only

\footerr	Footer on right pages only

\footerf	Footer on first page only

Information

The RTF file can also contain an information group, which is translated but not displayed with the text.  This information can include the title, author, key words, comments, and other information specific to the file.  This information can be used when a document management utility is available.

This group begins with the control word \info.  Some applications, such as Word, ask a user to type this document information when saving the document in native format.  When the document is then saved or translated into RTF, the RTF writer specifies this information using the following control words.  These control words are destinations, and should be enclosed in braces ({}).

Control Word	Meaning	|
\title	Title of document

\subject	Subject of document

\author	Author of document

\operator	Person who made last changes to document

\keywords	Selected key words for document

\comment	Comments; text is ignored

\versionn	Version number of document

\doccomm	Comments displayed in Edit Summary Info dialog box

The RTF writer may automatically enter other control words, as shown in the following list:

Control Word	Meaning	|
\vernn	Internal version number

\creatim	Creation time

\revtim	Revision time

\printim	Last print time

\buptim	Backup time

\edminsn	Total editing time (in minutes)

\yrn	Year

\mon	Month

\dyn	Day

\hrn	Hour

\minn	Minute

\nofpagesn	Number of pages

\nofwordsn	Number of words

\nofcharsn	Number of characters

\idn	Internal ID number

Entries without the n parameter have the \yr \mo \dy \hr \min format.  An example of an information group follows:

...
{\info{\title The Panda's Thumb}{\author Steven J. Gould}{keywords science natural history }}
...

Fields

The field group contains the text of Word fields.  For more detailed information on fields, see Fields.  The field groups begins with the control word \field.

The following control words can follow the \field control word:

Control Word	Meaning	|
\flddirty	Change has been made to the field result since the field was last updated

\fldedit	Text has been added to, or removed from, the field result since the field was last updated

\fldlock	Field is locked and cannot be updated

\fldpriv	Result is not in a form suitable for display (for example, binary data used by fields whose result is a picture)

Two subgroups are available within the \field group.  They must be enclosed in braces ({}) and begin with the following control words:

Control Word	Meaning	|
\*\fldinst	Field instructions

\fldrslt	Most recent calculated result of the field

The \fldrslt control word should be included even if no result has been calculated.  This simplifies the RTF reader's task, because even readers that do not recognize fields can generally include the value of the \fldrslt group in the document.

An example of some field text follows:

...
{\field\fldedit{\fldinst author}{\fldrslt Joe Smith}}\par\pard
{\field{\fldinst time \\@ "h:mm AM/PM"}{\fldrslt 8:12 AM}}
...

Element	Meaning	|
\field	Begins Field Group
{\fldinst author}	Field instructions
{\fldrslt Joe Smith}	Field result
\field	Begins Field Group
{\fldinst time \\@ "h:mm AM/PM"} Field instructions
{\fldrslt 8:12 AM}	Field result


Index Entries

The index entry group begins with the control word \xe.  Following this control word is the text of the index entry and other, optional control words that further define the index entry.

If the text of the index entry is not formatted as hidden text with the \v control word,  the text is put into the document as well as into the index.  For more information on the \v control word, see "Character Formatting Properties," later in this chapter.  Similarly, the text of the \txe subgroup, described later in this section, becomes part of the document if it is not formatted as hidden text.

The following control words  may also be used:

Control Word	Meaning	|
\bxe	Formats the page number or cross-reference bold

\ixe	Formats the page number or cross-reference italic

The following control words are destinations within the \xe group and are followed by text arguments.  These control words and their arguments must be enclosed in braces ({}).

Control Word	Meaning	|
\txe text	Uses text instead of a page number

\rxe bookmark-name	Generates page number for the range of the text specified by bookmark-name
Table of Contents Entries

The table of contents entry group begins with the control word \tc.  It is followed by the text of the table of contents entry and optional switches.

As with index entries, text that is not formatted as hidden with the \v character formatting control word should be put into the document.

The following control words can also be used in this group:

Control Word	Meaning	|
\tcfn	Type of table being compiled; n is mapped by existing Microsoft software to a letter between A and Z; default is 67, which maps to C, used for tables of contents

\tcln	Level number (default is 1)

Bookmarks
This group contains two control words: \*\bkmkstart, to indicate the start of the specified bookmark, and \*\bkmkend, to indicate the end of the specified bookmark.  A bookmark is shown in the following example:

...
\pard\plain\fs20 Kuhn believes that science, rather than discovering in experience certain structured relationships, actually creates (or already participates in) a presupposed structure to which it fits the data.
{\bkmkstart paradigm}Kuhn calls such a presupposed structure a paradigm.{\bkmkend paradigm}
...

Document Formatting Properties

This section lists the control words that act on the attributes of a document, such as margins and footnote placement.  These attributes must precede the first plain text character in the document.

The following control words specify document formatting.  If you omit a control word, RTF uses the default value shown in parentheses.  Measurements are in twips.

Control Word	Meaning	|
\paperwn	Paper width (12,240)

\paperhn	Paper height (15,840)

\margln	Left margin (1,800)

\margrn	Right margin (1,800)

\margtn	Top margin (1,440)

\margbn	Bottom margin (1,440)

\facingp	Facing pages (activates odd/even headers and gutters)

\guttern	Gutter width (0)

\deftabn	Default tab width (720)

\widowctrl	Widow control

\hyphhotz	Hyphenation hot zone (amount of space at right margin in which words are hyphenated)

\ftnsep	Text argument separates footnote from document

\ftnsepc	Text argument separates continued footnote from document

\ftncn	Text argument is a notice for continued footnotes

\endnotes	Footnotes at end of section (default)

\enddoc	Footnotes at end of document

\ftntj	Footnotes beneath text

\ftnbj	Footnotes at bottom of page

\ftnstartn	Beginning footnote number (1)

\ftnrestart	Footnote numbers restart at each section

\pgnstartn	Beginning page number (1)

\linestartn	Beginning line number (1)

\landscape	Landscape format

\fracwidth	Uses fractional character widths when printing (QuickDraw only)

\*\nextfile	Destination; argument is file name of file to print or index next; must be enclosed in braces ({})

\*\template	Destination; argument is file name of related template file; must be enclosed in braces ({})

\makebackup	Backup copy is made automatically when document is saved

\defformat	Tells RTF reader that document should be saved in RTF format

\revisions	Turns on revision marking

\margmirror	Switches margin definitions on left and right pages

\revpropn	Argument indicates how revised text will be displayed: 0, no properties shown; 1, bold; 2, italic; 3, underline (default); 4, double underline

\revbarn	Vertical lines mark altered text, based on the argument: 0, no marking; 1, left margin; 2, right margin; 3, outside (left on left pages, right on right pages; default)

Section Formatting Properties

The following control words are used to specify section formatting properties.  Default values are shown in parentheses.  Section properties apply to the text following the control word, with the exception of the section break control words (those beginning with \sbk).  Section break control words describe the break preceding the text.

Control Word	Meaning	|
\sectd	Reset to default section properties

\sbknone	No section break

\sbkcol	Section break starts new column

\sbkpage	Section break starts new page (default)

\sbkeven	Section break starts at even page

\sbkodd	Section break starts at odd page

\pgnstartsn	Beginning page number (1)

\pgncont	Continuous page numbering (default)

\pgnrestart	Page numbers restart at \pgnstarts value

\pgndec	Page number format is decimal

\pgnucrm	Page number format is uppercase roman numeral

\pgnlcrm	Page number format is lowercase roman numeral

\pgnucltr	Page number format is uppercase letter

\pgnlcltr	Page number format is lowercase letter

\pgnxn	Page number is n twips from right margin (720)

\pgnyn	Page number is n twips from top margin (720)

\headeryn	Header is n twips from top of page (720)

\footeryn	Footer is n twips from bottom of page (720)

\linemodn	Line number modulus (amount to increase each line number) (1)

\linexn	Distance from line number to left text margin in twips (360)

\linestartsn	Beginning line number (1)

\linerestart	Line numbers restart at \linestarts value

\lineppage	Line numbers restart each page

\linecont	Line numbers continue from preceding section

\vertalt	Text is top-aligned (default)

\vertal	Text is bottom-aligned

\vertalc	Text is centered vertically

\vertalj	Text is justified vertically

\colsn	Number of columns (snaking) (1)

\colsxn	Space between columns in twips (720)

\linebetcol	Line between columns

\endnhere	Endnotes included in section

\titlepg	Title page has special format

Paragraph Formatting Properties

The following control words are used to specify paragraph formatting properties.  Default values are shown in parentheses.  When specifying border properties, the border segment control word (\brdrt, \brdrb, \brdrl, \brdrr, or \box) must precede the control word(s) specifying the pattern for the border, to ensure compatibility with previous version of RTF.

Control Word	Meaning	|
\pard	Resets to default paragraph properties

\sn	Designates style; if a style is specified, style properties must be specified with the paragraph

\ql	Left-aligned (default)

\qr	Right-aligned

\qj	Justified

\qc	Centered

\fin	First-line indent (0)

\lin	Left indent (0)

\rin	Right indent (0)

\sbn	Space before (0)

\san	Space after (0)

\sln	Space between lines (if this control word is missing or if \s1000 is used, line spacing is automatically determined by the tallest character in line); if positive value, use this size if it is greater than the tallest character, otherwise use tallest character; if negative value, use the absolute value of number, even if tallest character is taller

\intbl	Paragraph is part of table

\keep	Keep paragraph intact

\keepn	Keep paragraph with next

\sbys	Side-by-side paragraphs

\pagebb	Break page before the paragraph

\noline	No line numbering

\txn	Tab position in twips from left margin

\tqr	Flush-right tab

\tqc	Centered tab

\tqdec	Decimal tab

\tb	Bar tab

\brdrt	Border top

\brdrb	Border bottom

\brdrl	Border left

\brdrr	Border right

\brdrbar	Border outside (right side of odd-numbered pages, left side of even-numbered pages)

\box	Border around paragraph (box paragraph)

\brdrbtw	Border between paragraphs

\brdrs	Single-thickness border

\brdrth	Thick border

\brdrsh	Shadowed border

\brdrdb	Double border

\brdrdot	Dotted border

\brdrhair	Hairline border

\brspn	Space in twip between borders and object

\tldot	Leader dots

\tlhyph	Leader hyphens

\tlul	Leader underline

\tlth	Leader thick line

Absolute-Positioned Objects

These paragraph formatting control words specify the location of the paragraph on the page.

Control Word	Meaning	|
\posxn	Positions paragraph n twips from the left edge of reference frame

\posxc	Centers paragraph horizontally within reference frame

\posxi	Positions paragraph horizontally inside reference frame

\posxl	Positions paragraph to left within reference frame

\posxo	Positions paragraph horizontally outside reference frame

\posxr	Positions paragraph to right within reference frame

\posyn	Positions paragraph n twips from the top edge of reference frame

\posyil	Positions paragraph vertically to be in-line

\posyt	Positions paragraph at top of reference frame

\posyc	Centers paragraph vertically within reference frame

\posyb	Positions paragraph at bottom of reference frame

\abswn	Absolute width of paragraph text in twips

\dxfrtextn	Horizontal distance in twips of an absolute-positioned paragraph from text in main text flow

\pvmrg	Positions vertically relative to margin

\pvpg	Positions vertically relative to page

\phmrg	Positions horizontally relative to margin

\phpg	Positions horizontally relative to page

\phcol	Positions horizontally relative to column

The following is an example of absolute-positioned text in a document:

...
\par\pard\pvpg\phpg\posxc\posyt\absw5040\dxfrtext173 abs pos para1
\par\pard\phmrg\posxo\posyo\dxfrtext1152 abs pos para2
...

Element	Meaning	|
abs pos para1	Text to be positioned
abs pos para2	Text to be positioned


Tables

A table is a collection of paragraphs.  A table row is a continuous sequence of paragraphs partitioned into cells.  The last paragraph of a cell is terminated by a cell mark (the \cell control word), and the row is terminated by a row mark (the \row control word).  There is no RTF table group; the \intbl paragraph formatting control word identifies the paragraph as part of a table.

Control Word	Meaning	|
\clbrdrb	Bottom table cell border

\clbrdrt	Top table cell border

\clbrdrl	Left table cell border

\clbrdrr	Right table cell border

\trowd	Sets table row defaults

\trql	Left-justifies table row with respect to its table column

\trqr	Right-justifies table row with respect to its containing column

\trqc	Centers table row with respect to its containing column

\trgaphn	Half the space between cells of a table row in twips

\trrhn	Height of a table row in twips; when 0, height is sufficient for all text in line; when positive, height is guaranteed to be at least the specified height; when negative, the absolute value of the height is used, regardless of the height of the text in the line

\trleftn	Position of leftmost edge of table with respect to the left edge of its column

\cellxn	Moves the right boundary of a table cell, including its half of the space between cells

\clmgf	The first cell in a range of table cells to be merged

\clmrg	Contents of table cell are merged with preceding cell

The following example shows some table text:

...
\par\trowd\trqc\trgaph108\trrh280\trleft36
\clbrdrt\brdrth\clbrdrl\brdrth\clbrdrb\brdrdb
\clbrdrr\brdrdb\cellx3636\clbrdrt\brdrth
\clbrdrl\brdrdb\clbrdrb\brdrdb\clbrdrr\brdrdb
\cellx7236/clbrdrt\brdrth\clbrdrl\brdrdb
\clbrdrb\brdrdb\clbrdrr\brdrdb\cellx10836\pard\intbl
\cell\pard\intbl\cell\pard\intbl\cell\pard\intbl\row
\trowd\trqc\trgaph108\trrh280\trleft36\clbrdrt\brdrdb
\clbrdrl\brdrth\clbrdrb\brdrsh\brdrs\clbrdrr\brdrdb
\cellx3636\clbrdrt\brdrdb\clbrdrl\brdrdb
\clbrdrb\brdrsh\brdrs\clbrdrr\brdrdb
\cellx7236\clbrdrt\brdrdb\clbrdr\brdrdb
\clbrdrb\brdrsh\brdrs\clbrdrr\brdrdb\cellx10836\pard
\intbl\cell\pard\intbl\cell\pard\intbl\cell\pard
\intbl\row\pard
...

Character Formatting Properties

The last group controls character formatting properties.  A control word preceding plain text turns on the specified attribute.  Some control words (indicated by an asterisk following the description) can be turned off by the control word followed by 0 (zero).  For example, \b turns on bold, while \b0 turns off bold.

Control Word	Meaning	|
\plain	Resets application's default character formatting properties

\b	Bold*

\i	Italic*

\strike	Strikethrough*

\outl	Outline*

\shad	Shadow*

\scaps	Small capitals*

\caps	All capitals*

\v	Hidden text*

\fn	Font number

\fsn	Font size in half points (default is 24)

\expndn	Expansion or compression of leading between characters in quarter-points; a negative value compresses (default is 0)

\ul	Continuous underline*

\ulw	Word underline*

\uld	Dotted underline*

\uldb	Double underline*

\ulnone	Stops all underlining*

\upn	Superscript position in half-points (default is 6)

\dnn	Subscript position in half-points (default is 6)

\revised	Text has been added since revision marking was turned on

In order to read negative \expnd values from Word for Macintosh, an RTF reader should use only the low-order 6 bits of the value read.  Word for the Macintosh does not emit negative values for \expnd.  Instead, it treats values from 57 to 63 as -7 to -1, respectively (the low-order 6 bits of 57 to 63 are the same as -7 to -1).

Special Characters

Special RTF characters are listed below.  If a character is not recognized by the RTF reader, it is ignored and the text following it is considered plain text.  The RTF specification is flexible enough to allow new characters to be added for interchange with other software.

Control Word	Meaning	|
\chdate	Current date (as in headers)

\chtime	Current time (as in headers)

\chpgn	Current page number (as in headers)

\chftn	Automatic footnote reference (footnotes follow in a group)

\chatn	Annotation reference (annotation text follows in a group)

\chftnsep	Anchoring character for footnote separator

\chftnsepc	Anchoring character for footnote continuation

\|	Formula character

\~	Nonbreaking space

\-	Optional hyphen

\_	Nonbreaking hyphen

\'hh	A hexadecimal value, based on the specified character set (may be used to identify 8-bit values)

\cell	End of table cell

\row	End of table row

\par	End of paragraph

\sect	End of section and paragraph

\page	Required page break

\column	Required column break

\line	Required line break (no paragraph break)

\tab	Tab character, same as ASCII 9

\:	Specifies a subentry in an index entry

\*	Marks a destination whose text should be ignored if not understood by the RTF reader.

An ASCII 9 will be accepted as a tab character.  The code \<ASCII10> (line feed) or \<ASCII13> (carriage return) is treated as the control word \par.  You must include the backslashes or RTF will ignore the control word.  You may also want to insert a carriage-return--line-feed pair (without backslashes) at least every 255 characters for better text transmission over communication lines.

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.