Rich Text Format Specifications ------------------------------- 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 specificaton provided that it is reproduced in its intirety 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 specifications, please write: Microsoft Corporation Department: RTF One Microsoft Way Redmond, WA 98052-6399 Copyright Microsoft Corporation, 1987-1989 Microsoft, MS-DOS, and the Microsoft logo are registered trademarks of the 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. Microsoft Word Technical Reference - Rich Text Format Specifications 1 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 and OS/2 applications, and between DOS or OS/2 applications and Apple Macintosh applications. The RTF standard provides a format for text and graphics interchange that can be used with different output devices, operating environments, and operating systems. RTF uses the ANSI, PC-8, 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 created under different operating systems and with different software applications can be transferred among those operating systems and applications. 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 actual text and writes a new file containing the text and the RTF groups associated with that text. An RTF reader does the converse of this procedure. RTF SYNTAX An RTF file consists of unformatted text, control words, control symbols, and groups. For ease of transport, a standard RTF file consists of only 7-bit ASCII characters. A control word is a specially formatted command that RTF uses to mark printer control codes and information that applications use to manage documents. A control word takes the following form: \LetterSequence as shown in the following example: A B C | ^ | \rtf1 A Backslash begins each control word B Alphabetic string C Numeric delimiter The Delimiter can be one of the following: - A space. In this case, the space is part of the control word. - A digit or a minus sign (-), which indicates that a numeric parameter follows. The subsequent digit sequence is then delimited by a space or any character other than a letter or a digit. In other words, the parameter can be a positive or negative number. The range of the values for the number is -32767 through 32767. However, Microsoft Word for Windows, Word for OS/2, and Word for the Macintosh restrict the range to -31680 through 31680. If a numeric parameter immediately follows the control word, this parameter becomes part of the control word. The control word is then delimited by a space or a nonalphabetic or non-numeric character in the same manner as any control word. - Any character other than a letter or a digit. In this case, the delimiting character terminates the control word but is not actually part of the control word. In the preceding discussion, a letter is an upper- or lowercase ASCII letter. If a space delimits the control word, space does not appear in the document. Any characters following the delimiter, including spaces, will appear in 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 ({ }). The opening { indicates the start of the group and the closing } indicates the end of the group. Each group specifies the text 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. These groups form the RTF file header. If the group for fonts is included, it should precede the group for styles. If any group is not used, it can be omitted. The groups are discussed in the following sections. Certain control words control properties (such as bold, italic, keep together, and so forth) that have only two states. When such a control word has no parameter or has a nonzero parameter, it is assumed that the control word turns on the property. When such a control word has a parameter of 0 (zero), it is assumed that the control word turns off the property. For example, \b turns on bold, whereas \b0 turns off bold. Certain control words, referred to as destinations, mark the beginning of a collection of related text. An example of a destination is the \footnote group, where the footnote text follows the control word. Destination control words and their following text must be enclosed in braces. 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 the convention of using this control symbol when adding new control words.) Destinations whose related text should be inserted into the document even if the RTF reader does not recognize the destination should not use \*. In this chapter, all destinations that were not included in the March 1987 RTF specification are shown with \* as part of the control word. Formatting specified within a group affects only the text within that group. Generally, text within a group inherits the formatting of the text in the preceding group. However, Microsoft implementations of RTF assume that the footnote, header and footer, and annotation groups (described later in this chapter) do not inherit the formatting of the preceding text. Therefore, to ensure that these groups are always 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. The control words, control symbols, and braces constitute control information. All other characters in the file are plain text. Here is an example of plain text that does not exist within a group: {\rtf1\ansi\deff0{\fonttbl{\f0\froman Tms Rmn;}{f1\fdecor Symbol;} {\f2\fswiss Helv;}}{\colortbl;\red0\green0\blue0; \red0\green0\blue255;\red0\green255\blue255; \red0\green255\blue0;\red255\green0\blue255; \red255\green0\blue0;\red255\green255\blue0; \red255\green255\blue255;}{stylesheet{\fs20 \snext0 Normal;}}{\info{\author John Doe}{\creatim\yr1990 \mo\7\dy\30\hr10\min48}{\version1}{\edmins0} {\nofpages1}{\nofwords0}{\nofchars0}{\vern8351}} \widowctrl\ftnbj\sectd\linex0\endnhere \pard\plain \fs20 This is plain text. \par} The phrase This is plain text is not part of a group. As previously mentioned, the backslash (\) and braces ({ }) have special meaning in RTF. To use these characters as text, precede them with a backslash, as in \\, \{, and \}. SEMANTICS OF AN RTF READER The reader of an RTF stream is concerned with the following: - Separating control information from plain text. - Acting on control information. - Collecting and properly disposing of the plain text, as directed by the current group state. Acting on control information is designed to be a relatively simple process. Some control information simply contributes special characters to the plain text stream. Other information serves to change the program state, which includes properties of the document as a whole, or to change any of a collection of group states which apply to parts of the document. As previously mentioned, a group state can specify the following: - The destination, or part of the document that the plain text is constructing. - Character-formatting properties, such as bold or italic. - Paragraph-formatting properties, such as justified or centered. - Section-formatting properties, such as the number of columns. - Table-formatting properties, which define the number of cells and dimensions of a table row. In practice, an RTF reader will proceed as follows: 1. The reader reads the next character. 2. If the character is an opening {, the reader stores the current state on the stack. If the character is a closing }, the reader retrieves the current state from the stack. If the character is a backslash, the reader collects the control word or control symbol and its parameter, if any, and looks up the control word or control symbol in a table. It then carries out the action prescribed in the table. (The possible actions are discussed below.) The read pointer is left before or after a control-word delimiter, as appropriate. If the character is anything other than {, }, or \, the reader assumes that the character is plain text and writes the character to the current destination using current formatting properties. 3. The reader then reads the next character. If the RTF reader cannot find a particular control word or control symbol in the look-up table, the control word or control symbol should be ignored. If a control word or control symbol is preceded by an opening {, it is part of a group. The current state should be saved on the stack, but no state change should occur. When a closing } is encountered, the current state should be retrieved from the stack, thereby resetting the current state. If the \* control symbol precedes a control word, then it defines a destination group and was itself preceded by an opening {. The RTF reader should discard all text up to and including the } that closes this group. For control words or control symbols that the RTF reader can find in the look-up table, the possible actions are as follows. Change destination The RTF reader changes the destination to the destination described in the table entry. Destination changes are legal only immediately after an opening {. (Other restrictions may also apply; for example, footnotes cannot be nested.) Many destination changes imply that the current property settings will be reset to their default settings. Examples of control words that change destination are \footnote, \header, \footer, \pic, \info, \fonttbl, \stylesheet, and \colortbl. Change formatting property The RTF reader changes the property as described in the table entry. The entry will specify whether a parameter is required. Insert special character The reader inserts into the document the character code or codes described in the table entry. Insert special character and perform action The reader inserts into the document the character code or codes described in the table entry and performs whatever other action the entry specifies. For example, when Microsoft Word interprets \par, a paragraph mark is inserted in the document and special code is run to record the paragraph properties belonging to that paragraph mark. CONTENTS OF AN RTF FILE An RTF file can contain combinations of the following elements. THE RTF VERSION A entire RTF file is considered a group and must be enclosed in braces. The control word \rtfn must follow the opening brace. The numeric parameter n identifies the version of the RTF standard used. The RTF standard described in this chapter corresponds to version 1. THE CHARACTER SET After specifying the RTF version, you must declare the character set. The control word for the character set must precede any plain text or any table control words. 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 (not implemented in version 1 of Word for OS/2) THE FONT TABLE This group begins with the control word \fonttbl and contains descriptions of fonts. 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 a font number, a font family, and a font name as shown in the following example: A B C D / \ /\ / \ / \ {\fonttbl\f0\froman Tms Rmn;} A Control word C Font family B Font number B Font name Semicolons separate one font from the next. 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, Pica, etc.) \fscript Script fonts (Cursive, etc.) \fdecor Decorative fonts (Old English, ITC Zapf Chancery, 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 n. 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, before any document text. 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 the current style is based (default is 222-no style). \snextn Defines the next style associated with the current style; if omitted, the next style is the current style. An example of an RTF style sheet and styles follows: ... - {\stylesheet{\fs20 \sbasedon222\snext0 Normal;}{\s1\qr\fs20 A-| \sbasedon0\snext1 FLUSHRIGHT;}{\s2\fi-720\li720\fs20\ri2880 - \fs20\sbasedon0\snext2 IND;}} ... - \widowctrl\ftnbj\ftnrestart\sectd\linex0\endnhere | \pard\plain\fs20 This is Normal Style. | \par \pard\plain \s1 B-| 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 } ... 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. A Style sheet B Styles applied to text In this example, PostScript is declared but not used. Some of the control words in this example are discussed in the following sections. 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. Additional control words for red, green, and blue and the foreground and background colors then use parameter values (0-255) corresponding to the color indexes used by Microsoft Windows to define the amount of red, green, and blue that makes up a color. 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 is the index of an entry in the color table, which represents a red/green/blue color combination. ... {\f1\cb1\crf2 This is colored text. The background is color 1 and the foreground is color 2.} ... If the file is translated for software that does not display color, the reader ignores the color-table group. PICTURES An RTF file can include picture files created 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 following table (some measurements in this table are in twips; a twip is one-twentieth of a point): Control word Meaning \brdrs Single picture border. \brdrdb Double picture border. \brdrth Thick picture border. \brdrsh Shadow picture border. \brdrdot Dotted picture border. \brdrhair Hairline picture border. \macpict Source of the picture is QuickDraw. \pmmetafilen Source of the picture is an OS/2 metafile; the n argument identifies the metafile type. \wmetafilen Source of the picture is a Windows metafile; the n argument identifies the metafile type (default is 1-MM_TEXT). \dibitmapn Source of the picture is a Device Independent bitmap; the n argument identifies the bitmap type (default is 0). \wbitmapn Source of the picture is a bitmap; the n argument identifies the bitmap type (default is 0-logical bitmap). \picwn xExt field if the picture is a metafile; picture width in pixels if the picture is a bitmap or from QuickDraw. \pichn yExt field if the picture is a metafile; picture height in pixels if the picture is a bitmap or from QuickDraw. \picwgoaln Desired width of the picture in twips. \pichgoaln Desired height of the picture in twips. \picscalexn Horizontal scaling value; the n argument is a value representing a percentage (default is 100). \picscaleyn Vertical scaling value; the n argument is a value representing a percentage (default is 100). \picscaled Scales the picture to fit within the specified frame; used only with \macpict pictures. \piccroptn Top cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0). \piccropbn Bottom cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0). \piccropln Left cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0). \piccroprn Right cropping value in twips; a positive value crops toward the center of the picture; a negative value crops away from the center, adding a space border around picture (default is 0). \wbmbitspixeln Number of 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; the numeric parameter n is the number of bytes that follow. The control words for picture border patterns (\brdrs, \brdrdb, \brdrth, \brdrsh, \brdrdot, and \brdrhair) are ignored when translating into Microsoft Word for the Macintosh, which uses character properties to make borders. The \wbitmap control word is optional; if neither \wmetafile nor \macpict is specified, the picture is assumed to be a Windows bitmap. If \wmetafile is specified, the n argument can be one of the following types: Type n argument MM_TEXT 1 MM_LOMETRIC 2 MM_HIMETRIC 3 MM_LOENGLISH 4 MM_HIENGLISH 5 MM_TWIPS 6 MM_ISOTROPIC 7 MM_ANISOTROPIC 8 If \pmmetafile is specified, the n argument can be one of the following types: Type n argument PU_ARBITRARY 0x0004L PU_PELS 0x0008L PU_LOMETRIC 0x000CL PU_HIMETRIC 0x0010L PU_LOENGLISH 0x0014L PU_HIENGLISH 0x0018L PU_TWIPS 0x001CL Be careful with spaces following control words when dealing with pictures in binary format. When reading files, RTF considers the first space after a control word the delimiter and subsequent spaces part of the document text. Therefore, any extra spaces are 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. If they do, the CRLF is 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: ___A__ __B__ _C__ _____D_____ ____E___ / \ / \ / \ / \ / \ {\picf\wbitmap0\picw170\pich77\wbmbitspixel1\wbmplanes1 ______F______ ____G____ / \ / \ \wbmwidthbytes22\picwgoal505 H--- \pichgoal221 I--- \picscalex172 J--- \picscaley172 |- 49f2000000000273023d1101a030 | 3901000a000000000273023d98 | 0048000200000275 | 0240000200010275023e000000000 | 273023d000002b90002b90002 K-| b90002b90002b9 | 0002b90002b90002b90002b90002b90002 | b92222b90002b90002b90 | 002b90002b9 | 0002b90002b90002b90002b9000 |_ ... A Source G Desired picture width B Width H Desired picture height C Height I Horizontal scaling value D Bits per pixel J Vertical scaling value E Bitmap planes K Hexadecimal data F Width of picture in bytes 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. ... \ftnbj\ftnrestart\sectd\linemod0\linex0\endhere \pard\plain \ri1170\fs20 {\up6 Mead's landmark study has been amply _ annotated.\chftn | {footnote \pard\plain \s246\fs20 {\up6\chftn }See Sahlins, A-|_ 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 others have _ noted,\chftn | {\footnote \pard\plain \s246\fs20 {\up6\chftn} A complete A-|_ bibliography will be found at the end of this chapter.} this period was a turning point for Margaret Mead.} \par ... 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 others have noted,2 this period was a turning point for Margaret Mead. _________________________________________________________________ 1 See Sahlins, Bateson, and Geertz for a complete bibliography 2 A complete bibliography will be found at the end of this chapter. A Footnotes For other control words relating to footnotes, see the sections entitled "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. The annotation reference character must in turn 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. Different headers and footers can be defined for different sections in the document. If none is defined for a given section, the headers and footers from the previous section (if any) are used. These groups must precede the first plain-text character in the document section to which they apply. The control words \header and \footer begin these groups. These control words can be replaced by the following control words, as appropriate: 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 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. 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, keywords, comments, and other information specific to the file. This information is for use by a document- management utility, if available. This group begins with the control word \info. Some applications, such as Word, ask a user to type this information when saving the document in its native format. If the document is then saved as an RTF file or translated into RTF, the RTF writer specifies this information using the following control words. These control words are destinations and both the control words and the text should be enclosed in braces ({ }). Control word Meaning \title Title of the document \subject Subject of the document \author Author of the document \operator Person who last made changes to the document \keywords Selected keywords for the document \comment Comments; text is ignored \versionn Version number of the document \doccomm Comments displayed in Word's Edit Summary Info dialog box The RTF writer may automatically enter other control words, including: 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 Stephen J. Gould} {\keywords science natural history}} FIELDS The field group contains the text of Word fields. For more detailed information on fields, see Chapter 9, "Fields." The field group begins with the control word \field. These control words can follow the \field control word: Control word Meaning \flddirty Formatting 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, 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: __A_ ______B_______ ________C_________ .../ \ / \ / \ {\field\fldedit{\fldinst author}{\fldrslt Joe Smith}}\par\pard {\field{\fldinst time\\@ "h:mm AM/PM"}{\fldrslt 8:12 AM}} ...\__A_/ \______________B_____________/ \________C______/ A Begins field group B Field intructions C 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 in bold. \ixe Formats the page number or cross-reference in 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 Text argument to be used instead of a page number. \rxe BookmarkName Text argument is a bookmark for the range of page numbers. 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 other optional control words that further define the group. As with index entries, text that is not formatted as hidden with the \v character-formatting control word is 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, which indicates the start of the specified bookmark, and \*\bkmkend, which indicates 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 specifies the attributes of the document, such as margins and footnote placement. These attributes must precede the first plain- text character in the document. The control words that specify document formatting are listed in the following table (measurements are in twips). For omitted control words, RTF uses the default values: Control word Meaning \paperwn Paper width (default is 12,240). \paperhn Paper height (default is 15,840). \margln Left margin (default is 1,800). \margrn Right margin (default is 1,800). \margtn Top margin (default is 1,440). \margbn Bottom margin (default is 1,440). \facingp Facing pages (activates odd/even headers and gutters). \guttern Gutter width (default is 0). \deftabn Default tab width (default is 720). \widowctrl Widow control. \hyphhotz Hyphenation hot zone (amount of space at the right margin in which words are hyphenated). \ftnsep Text argument separates footnotes from the document. \ftnsepc Text argument separates continued footnotes from the document. \ftncn Text argument is a notice for continued footnotes. \endnotes Footnotes at the end of the section (default). \enddoc Footnotes at the end of the document. \ftntj Footnotes beneath text. \ftnbj Footnotes at the bottom of the page. \ftnstartn Beginning footnote number (default is 1). \ftnrestart Footnote numbers restart at each section. \pgnstartn Beginning page number (default is 1). \linestartn Beginning line number (default is 1). \landscape Landscape format. \fracwidth Uses fractional character widths when printing (QuickDraw only). \*\nextfile Destination; the argument is the name of the file to print or index next; must be enclosed in braces. \*\template Destination; the argument is the name of a related template file; must be enclosed in braces. \makebackup Backup copy is made automatically when the document is saved. \defformat Tells the RTF reader that the 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 for no properties shown; 1 for bold; 2 for italic; 3 for underline (default); 4 for double underline. \revbarn Vertical lines mark altered text, based on the argument: 0 for no marking; 1 for left margin; 2 for right margin; 3 for outside (left on left pages, right on right pages; default). \psover Prints PostScript over the text. SECTION-FORMATTING PROPERTIES This group specifies section-formatting properties, which 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. The section-formatting control words are listed in the following table: Control word Meaning \sectd Reset to default section properties. \sbknone No section break. \sbkcol Section break starts a new column. \sbkpage Section break starts a new page (default). \sbkeven Section break starts at an even page. \sbkodd Section break starts at an odd page. \pgnstartsn Beginning page number (default is 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 the right margin (default is 720). \pgnyn Page-number is n twips from the top margin (default is 720). \headeryn Header is n twips from the top of the page (default is 720). \footeryn Footer is n twips from the bottom of the page (default is 720). \linemodn Line-number modulus-amount to increase each line number (default is 1). \linexn Distance from the line number to the left text margin in twips (default is 360). The automatic distance is 0. \linestartsn Beginning line number (default is 1). \linerestart Line numbers restart at \linestarts value. \lineppage Line numbers restart on each page. \linecont Line numbers continue from the 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 for "snaking" (default is 1). \colsxn Space between columns in twips (default is 720). \linebetcol Line between columns. \endnhere Endnotes included in the section. \titlepg Title page has a special format. PARAGRAPH-FORMATTING PROPERTIES This group specifies paragraph-formatting properties. To ensure compatibility with previous versions of RTF, if border properties are specified, the border-segment control word (\brdrt,\brdrb,\brdrl, \brdrr, or \box) must precede the control word(s) that specify the pattern for the border. The paragraph-formatting control words are listed in the following table: 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 (default is 0). \lin Left indent (default is 0). \rin Right indent (default is 0). \sbn Space before (default is 0). \san Space after (default is 0). \sln Space between lines: if this control word is missing or if \s1000 is used, the line spacing is automatically determined by the tallest character in the line; if n is a positive value, uses this size only if it is taller than the tallest character (otherwise uses the tallest character); if n is a negative value, uses the absolute value of n, even if it is shorter than the tallest character. \intbl Paragraph is part of a table. \keep Keep paragraph intact. \keepn Keep paragraph with the next paragraph. \sbys Side-by-side paragraphs. \pagebb Break page before the paragraph. \noline No line numbering. \txn Tab position in twips from the left margin. \tqr Flush-right tab. \tqc Centered tab. \tqdec Decimal tab. \tbn Bar tab position in twips from the left margin. \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 the paragraph (box paragraph). \brdrs Single-thickness border. \brdrth Thick border. \brdrsh Shadowed border. \brdrdb Double border. \brdrdot Dotted border. \brdrhair Hairline border. \brspn Space in twips between borders and an object. \tldot Leader dots. \tlhyph Leader hyphens. \tlul Leader underline. \tlth Leader thick line. ABSOLUTE-POSITIONED OBJECTS The following paragraph-formatting control words specify the location of the paragraph on the page: Control word Meaning \posxn Positions the paragraph n twips from the left edge of the reference frame. \posxc Centers the paragraph horizontally within the reference frame. \posxi Positions the paragraph horizontally inside the reference frame. \posxl Positions the paragraph to the left within the reference frame. \posxo Positions the paragraph horizontally outside the reference frame. \posxr Positions the paragraph to the right within the reference frame. \posyn Positions the paragraph n twips from the top edge of the reference frame. \posyil Positions the paragraph vertically to be in-line. \posyt Positions the paragraph at the top of the reference frame. \posyc Centers the paragraph vertically within the reference frame. \posyb Positions the paragraph at the bottom of the reference frame. \abswn Absolute width of the paragraph text in twips. \dxfrtextn Horizontal distance in twips of an absolute- positioned paragraph from text in the main text flow. \pvmrg Positions the paragraph vertically relative to the margin. \pvpg Positions the paragraph vertically relative to the page. \phmrg Positions the paragraph horizontally relative to the margin. \phpg Positions the paragraph horizontally relative to the page. \phcol Positions the paragraph horizontally relative to the column. The following is an example of absolute-positioned text in a document: ... _____A_____ / \ \par\pard\pvpg\phpg\posxc\posyt\absw5040\dxfrtext173 abs pos para1 \par\pard\phmrg\posxo\posyc\dxfrtext1152 abs pos para2 \_____A_____/ A Text to be positioned TABLES There is no RTF table group. A table is a collection of paragraphs and a table row is a continuous sequence of paragraphs partitioned into cells. The \intbl paragraph-formatting control word identifies the paragraph as part of a table. 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). The following control words further define the 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 a table row with respect to its containing column. \trqr Right-justifies a table row with respect to its containing column. \trqc Centers a table row with respect to its containing column. \trgaphn Half the space between the cells of a table row in twips. \trrhn Height of a table row in twips; when 0, the height is sufficient for all the text in the line; when positive, the 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 the leftmost edge of the 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 the table cell are merged with those of the 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\trgaph 108\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 in the following table 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. The character-formatting control words are listed in the following table: 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 the space 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. To read negative \expnd values from Word for the 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 through 63 as -7 through -1, respectively (the low-order 6 bits of 57 through 63 are the same as -7 through -1). SPECIAL CHARACTERS The RTF standard includes control words for special characters. If a special-character control word 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 special characters to be added for interchange with other software. The special RTF characters are listed in the following table: 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. \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. \emdash Em-dash (long hyphen). \endash En-dash (short hyphen). \bullet Bullet character. \lquote Left single quotation mark. \rquote Right single quotation mark. \ldblquote Left double quotation mark. \rdblquote Right double quotation mark. \| Formula character. \~ Nonbreaking space. \- Optional hyphen. \_ Nonbreaking hyphen. \: Specifies a subentry in an index entry. \* Marks a destination whose text should be ignored if not understood by the RTF reader. \'hh A hexadecimal value, based on the specified character set (may be used to identify 8-bit values). Note that an ASCII 9 is accepted as a tab character, and the code word \ (line feed) or \ (carriage return) is treated the same as the control word \par. You must include the backslashes or RTF ignores 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.) Here are the code values for the following special characters: ANSI Keyword (Word for Windows and OS/2) Apple Macintosh \bullet 149 0xA5 \emdash 150 0xD1 \endash 151 0xD0 \lquote 145 0xD4 \rquote 146 0xD5 \ldblquote 147 0xD2 \rdblquote 148 0xD3