.PAGE SIZE 60,80 .TITLE ^BESCAPE SEQUENCES\B .LAYOUT 1 .! Titles and page numbers centered .DISPLAY NUMBER "^B","\B" .! Page number boldfaced .SET PARAGRAPH 0 .FLAGS ACCEPT ¨ .! This allows us to use underscores freely .FLAGS SUBSTITUTE .FLAGS INDEX ¢ .AUTOPARAGRAPH .FIGURE 7 .HEADERS ESCAPE SEQUENCES ^6 .FIGURE 1 ^B________________________________________________________________________________\B .FIGURE 2 ^BEscape#Sequences\B allow you to include non-printable sequences of characters in your document. These sequences are commonly used to control and modify the operation of printers and terminals. These sequences often begin with the ASCII control character ESCAPE, hence their name. This document uses ^B\B to denote the ESCAPE character. Each ASCII character has a decimal value; ESCAPE has a decimal value of 27. An example of an escape sequence is the string "^B[7m\B". If you write this string to a VT220 terminal, it causes any text subsequently written to the terminal to appear in reverse video. The escape sequence itself does not appear on the screen. Although many models of terminals accept this particular sequence, the device's documentation must be consulted to be certain. Documentation may also refer to ^Bcontrol sequences\B, and/or ^Bdevice control strings\B; these are synonymous (in RNO) to escape sequences. You can include the string "^B[7m\B" in RNO input (if you can figure out how to enter the ^B\B), and when the output document is typed on a terminal, the document after the string will display in reverse video. However, the spacing of the document will be incorrect, since RNO assumes that the string takes up four columns, but it actually takes up zero columns. RNO has facilities which make the use of escape sequences relatively easy and problem-free. The RNO command DEFINE ESCAPE is used to assign a two-character name to an escape sequence. The first character of a name must be one of the following: .KEEP .NO FILL - The uppercase flag (usually "^B¨^\B" ) - The lowercase flag (usually "^B¨\\B" ) - The escape flag (which you must define first) .FILL .NO KEEP The second character can be any character except "^B¨&\B", "^B¨^\B", "^B¨\\B", or "^B¨<\B". For example, the definition: .FIGURE.INDENT 16;^B.DEFINE ESCAPE "¨^*",27,"[2z"\B gives the name "^B¨^*\B" to the escape sequence "^B[2z\B", which is used on LN03 printers to set the vertical pitch to eight lines per inch. Note that the ^B\B is entered using its decimal value, ^B27\B. The above definition has two main elements: first, the name is specified, in quotation marks (apostrophes can also be used); then, following a comma, the string comprising the escape sequence is specified. The sequence itself is given in two pieces: a decimal ASCII value followed by a string in quotes (apostrophes are also allowed here). RNO concatenates these two pieces to form the escape sequence. You can use any number of pieces to describe the escape sequence string, and can freely intermix decimal ASCII values and quoted strings. The definition above could also have been given as: .FIGURE.INDENT 16;^B.DEF ESC '¨^*',27,"[",'2',122\B since the lower case "^Bz\B" has a decimal ASCII value of ^B122\B. One or more blanks and/or tabs can be used instead of or in addition to each comma between the fields in the DEFINE ESCAPE command. After making the above definition, you place the string "^B¨^*\B" everywhere in your document that you want to set the vertical pitch on your LN03 printer to 8 lines per inch. Other sequences could be defined to set different vertical pitches; these could be interspersed in the document. The escape sequence string is copied to the document without interpretation. Any RNO flag characters in the string are not acted upon; substitutions and escape sequence names are not recognized. If you do not want to begin an escape sequence name with "^B¨^\B" or "^B¨\\B", you must define a character of your choice as the escape flag and use it. For example: .FIGURE.INDENT 16;^B.FLAGS ESCAPE ~\B .INDENT 16 ;^B.DEFINE ESCAPE '~X' 27 '[2z'\B Note that you can only define one escape flag, and the character you choose must not already be a flag character, and must not be alphabetic or numeric. If you decide to change the uppercase flag from its default value of ^B¨^\B, and you decide to define escape sequences with names which begin with the uppercase flag, then you must redefine the flag before defining the escape sequences, and you must use the new flag value in the DEFINE ESCAPE commands. For example: .KEEP.NO FILL INCORRECT: ^B.DEFINE ESCAPE "¨^*",27,"[2z" .FLAGS UPPERCASE +\B CORRECT: ^B.FLAGS UPPERCASE + .DEFINE ESCAPE "+*",27,"[2z"\B .FILL.NO KEEP If you disable or turn off the uppercase flag, using the commands NO FLAGS UPPERCASE or DISABLE FLAGS UPPERCASE, then escape sequences beginning with this flag will not be recognized. The same restrictions apply to the lowercase flag and the escape flag. .FIGURE 1 HORIZONTAL SPACING ^5 By default, RNO assumes that the escape sequence does not appear on the output device; i.e. its displayed width is 0 columns. You can, however, put printable characters in an escape sequence. For example: .FIGURE 1.INDENT 16;^B.DEFINE ESCAPE "¨^¨$","A"\B defines an escape sequence which simply prints the character "^BA\B". If you use printable text in an escape sequence, you must tell RNO how many columns the text uses. You do this by including a ^Bmodifier\B field in the DEFINE ESCAPE command. The correct definition for the above example is: .FIGURE 1.INDENT 16;^B.DEFINE ESCAPE "¨^¨$",HSP,1,"A"\B This tells RNO that the escape sequence "^B¨^¨$\B" takes up one column of horizontal spacing. Modifier fields, like ^BHSP,n\B, must be specified between the name and the escape sequence string. .FIGURE 1 TEXT ATTRIBUTES ^5 One common use of escape sequences is to change the attributes of the text on the output device. For instance, many printers and terminals support ^Bboldfacing\B. On LN03 printers and VT220 terminals, "^B[1m\B" turns on boldfacing, and "^B[22m\B" turns it off. To use boldfacing, you define two escape sequences--one to turn bolding on, and another to turn bolding off. Note the similarity to ^&underlining\&, which is another text attribute (but which is handled by RNO, not by the output device). The sequence "^B¨^¨&\B" turns underlining on, and "^B¨\¨&\B" turns it off. For compatibility with underlining, and for other reasons discussed below, the names for the escape sequences for turning text attributes on and off should begin with "^B¨^\B" and "^B¨\\B" respectively, and should use the same second character. The two escape sequences should also be defined with the ^BLCK\B modifier, as in: .FIGURE.INDENT 16;^B.DEFINE ESCAPE "¨^*",LCK,27,"[1m"\B .INDENT 16 ;^B.DEFINE ESCAPE "¨\*",LCK,27,"[22m"\B This creates a ^Block/unlock pair\B of escape sequences. The first sequence (the one with "^B¨^\B" in the name) ^&locks\& the text attribute ^&on\&, and the second sequence (with "^B¨\\B" in the name) ^&unlocks\& the attribute. If the lock sequence is used twice with no intervening unlock sequence, then the second occurrence of the lock sequence is ignored. If the unlock sequence is used with no matching lock sequence preceding it, it is ignored. If the lock sequence is used in one line, and the matching unlock sequence appears in a later line, then RNO automatically places the lock sequence at the beginning of every included line, and appends the unlock sequence to the end of every included line. One reason this is done is so that if a page break occurs within this region, the page heading is not inadvertently printed with the locked attribute. The above behavior can be used if you specifically need certain sequences to appear at the beginning and/or end of each line. For instance, you may have a printer which requires special vertical positioning information on every line. You can place this information in the lock or unlock sequence as applicable, and use the lock sequence at the beginning of your document. You can define the unused half of the lock/unlock pair to be a do-nothing sequence by specifying no escape sequence string, as in: .FIGURE.INDENT 16;^B.DEFINE ESCAPE "¨^@",LCK\B .INDENT 16 ;^B.DEFINE ESCAPE "¨\@",LCK,13,10,7\B At certain points in a document, RNO automatically unlocks all currently locked escape sequences, and unlocks underlining if it is locked on. RNO commands which cause this to occur have this noted in their description. One command which does this is CHAPTER. There is a restriction that only 16 escape sequences can be defined with the ^BLCK\B modifier. .FIGURE Underlining has one additional feature which lock/unlock pairs do not implement: a "^B¨&\B" appearing alone causes the following character to be underlined. The ^Block/unlock/shift#trio\B does, however, exhibit this behavior. This type of definition uses the ^BCHR\B modifier as well as the ^BLCK\B modifier. For example, the RNO commands: .FIGURE.INDENT 16;^B.DEFINE ESCAPE "¨^~",CHR,LCK,27,"[1m"\B .INDENT 16 ;^B.DEFINE ESCAPE "¨\~",CHR,LCK,27,"[22m"\B .INDENT 16 ;^B.FLAGS SPECIAL ~\B Create the following sequences: "^B¨^~\B" turns on bolding, "^B¨\~\B" turns off bolding, and "^B~\B" by itself bolds the single following character. Note that the character named in the FLAGS SPECIAL command must be the second character in the escape sequence names, must not be an existing flag character, and must not be alphabetic, numeric, or blank. You can define more than one SPECIAL flag; the FLAGS SPECIAL command is the only FLAGS command which allows you to specify multiple flags. For example: .FIGURE.INDENT 16;^B.FLAGS SPECIAL ~*()\B .FIGURE 1 HORIZONTAL PITCH CHANGES ^5 Some printers have several fonts, with the following characteristics: the characters within a single font are all the same width (i.e. the fonts have a ^Bfixed#pitch\B or are ^Bmonospaced\B), but each font has a different character width. For instance, the LA50 normally prints 10 characters per inch. The control sequence "^B[5w\B" causes subsequent text to be printed at five characters per inch, and "^B[1w\B" sets the printer back to the default. You can use, with some restrictions, fonts like this double-wide example, and RNO will keep the margins correct and will correctly center text. The escape sequences must be defined with the ^BPSP\B modifier, as in: .FIGURE.INDENT 16;^B.DEFINE ESCAPE "¨^=",HSP,2,PSP,LCK,27,"[5w"\B .INDENT 16 ;^B.DEFINE ESCAPE "¨\=",HSP,1,PSP,LCK,27,"[1w"\B Note that the ^BHSP\B modifier must also be used, and that its meaning is different when it is used with the ^BPSP\B modifier: it now specifies the width (in multiples of the normal width) of the new font. Only integral multiples can be specified. Note also that the ^BLCK\B modifier must also be used; if it isn't, the margins and underlining may be incorrect. If an entire line uses a width other than 1, RNO does not attempt to justify the line (if FILL and JUSTIFY are in effect), and an error message is issued. If part of a line uses width 1 and part another width, RNO can justify the line without errors if there are spaces in the width 1 part. Under these constraints, wide text can be centered. .FIGURE 1 VERTICAL POSITIONING ^5 On some printers, subscripts and superscripts are printed by using control sequences which cause succeeding characters to be printed slightly lower or higher than the normal position for the line of text. Usually, the vertical space is changed in units of half lines. When specifying an escape sequence which changes the vertical position, you use the ^BVSP,n\B modifier, where ^Bn\B gives the vertical change, in half-line units. Positive values are ^&down\&, negative values are ^&up\&. For example, the following lock/unlock/shift trio of escape sequences can be used to implement subscripts on an LN03 printer: .FIGURE.INDENT 16;^B.DEFINE ESCAPE "¨^!",CHR,LCK,VSP,1,139\B .INDENT 16 ;^B.DEFINE ESCAPE "¨\!",CHR,LCK,VSP,-1,140\B .INDENT 16 ;^B.FLAGS SPECIAL !\B Then, a subscript 0 can be specified by "^B!0\B" in the RNO input. .FIGURE 1 RELATED COMMANDS ^5 The DISABLE ESCAPE command prevents all escape sequences from being output to the document. Any occurrences of defined escape sequence names in the document input are removed. ENABLE ESCAPE reverses the effects of DISABLE ESCAPE. RESET ESCAPE removes all escape sequence definitions. RNO automatically defines some escape sequences; you would do a RESET ESCAPE if these predefined sequences conflict with production of your document. If you define an escape flag or one or more special flags, you can use the commands NO FLAGS, FLAGS, DISABLE FLAGS and ENABLE FLAGS to control them. See the section on FLAGS for more information on these commands. .FIGURE 1 NOTES ^5 A lock/unlock pair, or a lock/unlock/shift trio, should always be used for escape sequences which change text attributes. This includes, for example, sequences which change font, character spacing, or ribbon color, or those which bold, shadow-print, or underline characters. If an escape sequences contains printable characters, the ^BHSP,n\B modifier should be used. The ^BHSP,n\B and ^BPSP\B modifiers must be used in escape sequences which change the horizontal character size. If a character size is used which is not an even multiple of the normal font, you must handle the document margins manually by specifying fudged values for the left and right margins. If underlining is used on the off-width characters, then the ^B/UL=B\B qualifier should be used on the RNO command line. The ^BVSP,n\B modifier should always be used in escape sequences which change the vertical position, unless the position change is smaller than half a line unit. Escape sequences can be used inside substitutions. They are particularly useful inside prefix/postfix strings in the DISPLAY commands. If you define escape sequences with alphabetic characters in the name (for example ^B¨^Z\B or ^B¨\Z\B), this will override use of the uppercase or lower case flag on that letter ("^BZ\B"). If your RNO input is composed on a terminal which has upper and lower case, then you probably don't need to use the uppercase and lowercase flags anyway, and this is not a problem. Certain ASCII characters will cause problems if used in escape sequences. Examples include the XON and XOFF characters (decimal values 17 and 19), which have special meanings to the VMS operating system. Certain characters may work only when the ^B/PASTHRU\B qualifier is used on the RNO command line. When printing on a printer attached to your terminal, you may in some cases need to alter the terminal characteristics (by using the DCL command SET TERMINAL), the terminal setup features, and/or the printer setup features. In most cases, use of the ^B/UL=L\B qualifier on the RNO command line is recommended (this is the default). This is especially true when a font is used which substitutes a different character for the underscore, or when sub- or superscripted characters are to be underlined. Escape sequences and equation formatting can interfere with each other. When ^BVSP\B sequences are used inside equations, the equation formatting algorithm will shift the equations to allow for sub- or superscripts.