Cover V03, I04
Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Listing 1

jul94.tar


A refer Macro Package

Thomas Richter

refer is a preprocessor for the nroff/troff text formatter found on most UNIX systems. It is used to cite bibliographic references -- including journals, books, reports, and other forms of publication -- in documents. On AIX 3.2, however, the macro package dealing with the refer output is not available [IBM88a,IBM93a]. This article presents a macro package (see Listing 1), based on the macro package, that processes the output produced by refer.

refer Input

refer scans its input for keywords surrounded by brackets, as in

.[
richter
.]

refer searches its database for an entry which contains the keyword and replaces the three lines with a label. The label is generated by refer and a set of nroff/troff string and macro definitions. When invoked with flag "-e," refer replaces the above three lines with the label string and appends all bibliographic data to the end of its input, to be printed at the end of the document. If refer encounters several keyword sequences without any intervening text, it generates one label comprising the entire bibliography.

The database used by refer for keyword lookup is an ASCII file. Each line contains a key-letter preceeded by a percent sign (%) and its associated data (see Figure 1).

Only relevant key-letters should be supplied and all key-letters but %A should be supplied just once.

Macro Package

refer places the string definitions and macro invocations shown in Figure 2 in its output. If these macros are not defined, the output generated by refer is completely ignored.

The package uses the register "r?" to distinguish between list mode, where all references are printed at the end of the document, and footnote mode, where all references are printed as footnotes.

Example

The file biblio (Figure 3) contains the database refer uses when processing the sample input file text in Figure 4. The formatting command is shown in Figure 5. In the command the "-p" parameter specifies the database file name and the "-l" parameter instructs refer to generate labels from the author's last name and date of publication. The resultant output is shown in Figure 6. refer.mm (Listing 1) contains the string and macro definitions.

Bibliography

IBM88a. IBM. Text Formatting Guide (IBM RT PC). SC23-0810-0, 1988.

IBM93a. IBM. Text Formatting Reference (IBM RISC System/6000). SC23-2453-00, 1993.

About the Author

Thomas Richter has studied mathematics and Computer Science at the University of Ulm, Germany. He has worked on various UNIX platforms as a software developer and C/C++ as main programming languages. His projects include compiler construction, device drivers, and network programming. He has also administered various UNIX machines for the last 8 years. He has worked for IBM UK since January 1993. He can be reached at richter@vnet.ibm.com.