VI/NROFF symbolics question

Bryan Cardoza bryan at iconsys.UUCP
Wed Jan 25 01:56:10 AEST 1989


>From article <108 at mdiva1.uucp>, by fontana at mdiva1.uucp:
> 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

In article <418 at elan.UUCP> jenni at elan.UUCP (Jenni Hufnagel) writes:
>In nroff you can define any string you want in a nterm file.  
>These files are found in /usr/lib/nterm.   Pick the one that is
>correct for your printer.
>In the nterm file an example would be as follows

>charset
>sq 2 []
>+- 1 +\b_

>you  would reference sq in your document by \*(sq.

If you can't write in /usr/lib, or you don't want to clobber characters
in your default character set, you can do the following in any file:

	.ds X "A string with a one character identifier.
	.ds XY "A string with a two character identifier.

The leading double-quote is not required, but it increases clarity.
You would reference the strings as follows:

	\*X
and
	\*(XY

Be sure not to clobber any variables your macro package may use.  If you
use "mm," you should be safe as "mm" uses obscure variable names (such as
"]D," etc.).  For other macro packages, you'll either have to examine
the macro package (for example, the first part of "ms" is in the file
/usr/lib/tmac/tmac.s) or just take pot luck.

If you want to use a "string table" in several documents, you could create
a file with the string definitions, and then include the file in your
documents using the ".so" directive in n/troff.  For example:

	===== file /usr/bryan/docs/strings =====

	.\" Some general strings, for example:
	.\"
	.ds Co "Copyright 19\n(yr Icon International, Inc.
	.ds Rt "is a registered trademark of Icon International, Inc.
	.\"
	.\" Something n/troff specific, for example:
	.\"
	.if n .ds OQ ""
	.if t .ds OQ "``
	.if n .ds CQ ""
	.if t .ds CQ ''

	===== in my file =====

	.so /usr/bryan/docs/strings
	\*(OQThis is a quoted string.\*(CQ
	.br
	DT1200\(rg \*(Rt
	.br
	\*(Co

You get the idea.  The n/troff manual and tutorial has lots of other ideas.

-- 
Bryan Cardoza			uunet!iconsys!bryan
Software Engineer
SANYO/ICON			Telephone: (801) 225-6888
Orem, Utah			FAX: (801) 226-0651



More information about the Comp.unix.questions mailing list