VI/NROFF symbolics question

Guy Harris guy at auspex.UUCP
Wed Jan 25 06:21:12 AEST 1989


 >> I am a IBM SCRIPT and GGML user.  I need to know how to
 >> do a symbolic reference in VI and NROFF. (i.e. I want to
 >> be able to define a table of symbolic strings and their
 >> expanded names or string.  Then I want to only type the
 >> symbolics in the text and have the system input the expanded
 >> names when I run off the text.)

 >In nroff you can define any string you want in a nterm file.  
 >These files are found in /usr/lib/nterm.

I think you meant to say "in the DWB X.y version of 'nroff', you can
define any string you want...", or perhaps "in the Elan Computer Group
version of 'nroff'...".  I sure don't remember that feature being
present in older versions of "nroff"; I do know that in some DWB release
(2.0, I think) "nroff" was "modernized" (merged back into the
"modernized" (whatever)-Independent TROFF, and upgraded to read ASCII
printer-specification files).

While this may *work* in his case, I don't think it's necessarily what
he *wanted*.  I think he basically wanted what, as I remember from a
brief scan of the SCRIPT documentation, are basically "variables", so
that you can say (NOTE: this is not SCRIPT syntax, I don't know what
that is; it's a pseudo-syntax intended to give the general idea)

	.set variable "FOO" to "Hi, mom!"

	...
	And now, the variable "FOO" is set to "\{FOO\}".

and have it print

	And now, the variable "FOO" is set to "Hi, mom!".

Well, "vi" doesn't do any of that; it's just a dumb editor and knows
relatively little of "nroff".  The way you do that with "nroff" and
"troff", though, is with "strings":

	.ds FO "Hi, mom!"

	...

	And now, the string "FO" is set to \*FO.

Unfortunately, in vanilla versions of "nroff"/"troff", strings can have
only one-character or two-character names, although as a consolation
prize you can use non-alphanumeric characters in those names.  However,
you have to be careful to avoid using names also used by whatever macro
package you're using; the macro package documentation *might* list all
the names (or classes of names) it uses, but if it doesn't, you'll have
to look it up in the source for the macro package....



More information about the Comp.unix.questions mailing list