.pg ! ! .lm CMDTAB.nf ________ | | | .SUB | | .SUBD | ! ! |________| .fi.lm LEFTMG .hl 1;SUB and SUBD commands SUB/SUBD define phrases to be substituted during RUNOFF processing. .ix String substitution/setting .ix Phrase dictionary .ix SUB/SUBD .s.lm +7.nf _________ ___________________________________ | .SUB | | | or | variable = "character string" | | .SUBD | | |_________|___________________________________| .fi.lm LEFTMG.s The SUB/SUBD commands set 'variable' to the character string on the righthand side of the equal sign. When RUNOFF processes the input file, every input line ^¬\& beginning with a period in column 1, will be searched for the appearance of 'variable'. If .SUB was specified, the character string equivalent will be substituted for ^&any\& occurence of 'variable'. If .SUBD was specified for this 'variable', only delimited occurences will be substituted. A delimited string is one that is distinguished by punctuation characters, blanks, tabs etc. See the example below. .s 2;.lm LEFTMG Notes: .s;.lm +7 The length of 'variable' can be at most 6 characters. The length of 'string' can be at most 40 characters. 'variable' can be any combination of letters, numbers, special characters etc. Lower/upper case matching are preserved. .b It is possible to make substitutions within substitutions, although recursive substitution is not possible. Usually, the most recent .SUB command is substituted first. The following situtation can take place - .b .lm+7.nf .SUB OK = "this is the first one" .SUB 2nd = "This looks OK" 2nd .f.b .i-7;produces - .b This looks this is the first one .lm-7.b Since substitution does not take place for commands (lines starting with a period), you must use the two line form of commands such as .CENTER for substitution to work. .b There is currently no delete symbol command, so to delete a symbol merely redefine 'variable' to be itself %! .b .i7; .SUB addres = "addres" .b .ix Equation mode Use of the SUB/SUBD commands within .EQ/.EEQ blocks causes any 'variables' defined in the block to be deleted when the .EEQ command is executed. It is useful to set 'variables' to greek symbols within equations, but you don't want the substitution to carry over to normal text - .b .lm+7 .SUB A = "%a" ! small alpha .b .SUB L = "%L" ! large OMEGA .lm-7.b You can create a phase dictionary by making a file with all of your standard substitutions and including the file (.IN) at the beginning of your RUNOFF file. .pg ! ! .lm CMDTAB.nf __________ | | | .SUB | | .SUBD | | | |________| .fi.lm LEFTMG .s 2;.lm LEFTMG Examples: .b.lm+7 .sub dat = "today" .br The date today is dat. .b .i+7;produces - .b The todaye today is today. .b But if we use the .SUBD command - .b .subd dat = "today" .br The date today is dat. .b .i+7;we get - .b The date today is today. .B2 If you are using a Qume letter gothic print wheel, the vertical bar character is represented by an %Y. To make every occurence of %| be produced as vertical bar, create a file ESCAPEY.RNO with the line .b .SUB %| = "%Y" .b and include this file in your main RUNOFF file. .lm LEFTMG