budd@arizona.UUCP (tim budd) (08/22/84)
Recently I put together some Bib macros that can be used to perform automatic address lookup for letters. Those people with a working Bib, the following two files are the description of how to use the macros and the appropriate macros (which should be placed in /usr/lib/bmac or wherever you put your bib macros). enjoy --tim budd ------------------------------------------------------------ : To unbundle, sh this file echo unbundling info 1>&2 cat >info <<'End' .SH Another use for Bib .PP The programs Invert(1), Bib(1) and Lookup(1) can be used not only for formatting bibliographic citations but in many other applications requiring a database of records indexed by simple keywords, for example a database of commonly used names and addresses. This note will illustrate how the \-tl style macros in Bib can be used with such a database to provide the automatic lookup of addresses in generating letters. .PP In producing a database of names and addresses, the following fields should be used. As with reference databases, not every field is applicable in every address, and fields can be listed in any order. .IP %A Individual name. .IP %T Title. (for example: Editor, The Insignificant Journal ) .IP %D Academic Department .IP %I Institution .IP %N Street Address .IP %C City and State .IP %Z Zip code .IP %L Salutation .IP %P Phone number .IP %K Additional Keywords .PP The K field is not used in printing the address, however is convenient for providing additional terms to simplify name lookup (``landlord'', or ``bigcheese'', for example). Similarly the %P field is not used, but is convenient when lookup is used to discover information in the database. .PP The \-tl style macro package defines the following macros: .IP .Dy The current date indented appropriately for a letter. .IP .Ab Address address begin. See explanation below. .IP .Ad Address lookup. See explanation below. .IP .Ae Address end. .IP .De Dear whomever salutation. .IP .Sl Ending salutation start .IP .Se Ending salutation end .IP .Cc Copy to ... .PP Ab and Ae can surround an address placed directly into the letter text, as in the following example: .DS I \&.\&Dy \&.\&Ab \&Sidney J. Slime \&Editor, Journal of Insignificant Results \&Department of Nonsense \&University of North Dakota \&Hople, North Dakota \&.\&Ae \&.De "Professor Slime" \&.PP \&I wish to inquire as to the status of my paper \&"The Philanthropic Behavior of Slugs", submitted \&five years ago to your journal. \&.Sl \&I. M. Furious \&.\&Se \&.\&Cc "C. My Lawyer" "M. Y. Secretary" .DE .PP Alternatively, an imprecise citation (see Bib(1)) can be written as an argument to the \&.\&Ad macro; in this case the \&.\&Ab and \&.\&Ae macros are not required, and if the L field is present in the database no \&.\&De macro either. For example, suppose a bib database contains the following entry: .DS I %A Sidney J. Slime %T Editor, Journal of Insignificant Results %D Department of Nonsense %I University of North Dakota %C Hople, North Dakota %L Professor Slime .DE .PP Then the preceding letter could have been written: .DS \&.\&Dy \&.\&Ad [.slime results.] \&.PP \&I wish to inquire as to the status of my paper \&"The Philanthropic Behavior of Slugs", submitted \&five years ago to your journal. \&.Sl \&I. M. Furious \&.\&Se \&.\&Cc "C. My Lawyer" "M. Y. Secretary" .DE .PP When automatically generated, address fields are listed in the order they are given at the beginning of this note. Other troff formatting commands may be placed in the body of the letter, for example commands to produce a letterhead can be placed before the \&.\&Dy macro, or a postscript after the .Sl or .Cc command. .PP It would be nice if the macros centered the body of the letter vertically in a pleasing manner, but they don't. End echo unbundling bib.l 1>&2 cat >bib.l <<'End' # # form letter format # F I BMACLIB/bibinc.fullnames .ds CH .ds CF .de ][ \" format address automatically .ds CR % .Ab \\*([A .if !~\\*([T~~ \\*([T .if !~\\*([D~~ \\*([D .if !~\\*([I~~ \\*([I .if !~\\*([N~~ \\*([N .if !~\\*([C~~ \\*([C .if !~\\*([Z~~ \\h'1i'\\*([Z .Ae .if !~\\*([L~~ .De \\*([L .. .de Dy .sp 2 .ti 4i \\*(DY .. .de Ab \" Address begin .DS L .. .de Ae \" Address end .DE .. .de De \" Dear John: salutation .LP Dear \\$1: .. .de Sl \" The beginning of the end .DS I 4i .. .de Se \" The end of the end .DE .. .de Cc \" copy to (opps, more after the end) .DS L .if t .ta 2m .if n .ta 4m cc: \\$1 .if !~\\$2~~ \& \\$2 .if !~\\$3~~ \& \\$3 .if !~\\$4~~ \& \\$4 .if !~\\$5~~ \& \\$5 .if !~\\$6~~ \& \\$6 .DE .. End