.TH REFER 1 .SH NAME refer/refer, refer/pubindex, refer/lookbib, refer/roffbib \- find and insert literature references in documents; make complete bibliography .SH SYNOPSIS .B refer [ .BI -a r ] [ .B -b ] [ .BI -c string ] [ .B -e ] [ .BI -k x ] [ .BI -l m , n ] [ .BI -p " database" ] [ .BI -s keys ] \&... [ .I file \&... ] .PP .B pubindex [ .BI -h hsize ] [ .B -n ncom ] [ .I file \&... ] .PP .B lookbib [ .I file \&... ] .PP .B roffbib [ .I file \&... ] .SH DESCRIPTION .I Refer is a preprocessor for .IR troff (1) that finds and formats references. The references are stored in text files, in the format described below, and indexed by .IR pubindex . The input files (standard input default) are copied to the standard output, except for lines between .B .[ and .B .] command lines, which are assumed to contain keywords as for .IR lookbib , and are replaced by information from the bibliographic data base. The user may avoid the search, override fields from it, or add new fields. The reference data, from whatever source, are assigned to a set of .I troff strings. Macro packages such as .IR ms (6) print the finished reference text from these strings. A flag is placed in the text at the point of reference; by default the references are indicated by numbers. .br .sp The following options are available: .TP 6 .BI \-a r Reverse the first .I r author names (Jones, J. A. instead of J. A. Jones). If .I r is omitted all author names are reversed. .TP .BI \-B Bibliography mode: make complete bibliography listing from the database, see roffbib script for a hint. Needs -mbib macro invocation with troff. .I r author names (Jones, J. A. instead of J. A. Jones). If .I r is omitted all author names are reversed. .TP .B -b Bare mode: do not put any flags in text (neither numbers nor labels). .TP .BI -c string Capitalize (with C\s-2APS\s0 S\s-2MALL\s+2 C\s-2APS\s0) the fields whose key-letters are in .IR string . .TP .B -e Instead of leaving the references where encountered, accumulate them until a sequence of the form .RS .IP .EX .[ $LIST$ .] .EE .RE .IP is encountered, and then write out all references collected so far. Collapse references to the same source. .TP .BI -k x Instead of numbering references, use labels as specified in a reference data line beginning .BI % x, by default .I x is .B L. .TP .BI -l m , n Instead of numbering references, use labels made from the senior author's last name and the year of publication. Only the first .I m letters of the last name and the last .I n digits of the date are used. If either .I m or .BI , n is omitted the entire name or date respectively is used. .TP .BI -p " database" Include .I database as a file of references to be searched. It must have been processed by .I pubindex (below). .TP .BI -s keys Sort references by fields whose key-letters are in the .I keys string; permute reference numbers in text accordingly. Implies .BR -e . The key-letters in .I keys may be followed by a number to indicate how many such fields are used, with .B + taken as a very large number. The default is .B AD which sorts on the senior author and then date; to sort, for example, on all authors and then title use .BR -sA+T . .PD .PP When .I refer is used with .IR eqn (1) or .IR tbl (1), .I refer should be first, to minimize the volume of data passed through pipes. .PP .I Pubindex makes a hashed inverted index to the named .I files for use by .IR refer . The .I files contain bibliographic references separated by blank lines. A bibliographic reference is a set of lines that contain bibliographic information fields. Each field starts on a line beginning with a .BR % , followed by a key-letter, followed by a blank, and followed by the contents of the field, which continues until the next line starting with .BR % . The most common key-letters and the corresponding fields are: .RS .TF x .TP .B A Author name .PD0 .TP .B B Title of book containing article referenced .TP .B C City .TP .B D Date .TP .B d Alternate date .TP .B E Editor of book containing article referenced .TP .B G Government (CFSTI) order number .TP .B I Issuer (publisher) .TP .B J Journal .TP .B K Other keywords to use in locating reference .TP .B M Technical memorandum number .TP .B N Issue number within volume .TP .B O Other commentary to be printed at end of reference .TP .B P Page numbers .TP .B R Report number .TP .B r Alternate report number .TP .B T Title of article, book, etc. .TP .B V Volume number .TP .B X Commentary unused by \fIpubindex\fR .RE .PD .PP Except for .BR %A , each field should only be given once. Only relevant fields should be supplied. An example is: .IP .EX %T 5-by-5 Palindromic Word Squares %A M. D. McIlroy %J Word Ways %V 9 %P 199-202 %D 1976 .EE .PP By default, .I pubindex ignores the 100 most common English words (read from .BR /lib/eign ); the .B -n option restrictions that to .IR ncom . The default hash table size (256) is fine for databases of moderate size; the .B -h option can change that. .PP .I Lookbib accepts keywords from the standard input and searches a bibliographic .IR file , which must have been indexed by .I pubindex (see below) for references that contain those keywords anywhere in title, author, journal name, etc. Matching references are printed on the standard output. Blank lines are taken as delimiters between queries. .PP .I Roffbib prints out a complete bibliography from a bibliographic .IR file , or standard input . .SH SOURCE .B /sys/src/cmd/refer .SH FILES .TF /bin/refer .TP .B /bin/refer directory of programs .TP .B /lib/eign common english words .TP .IB x .i[abc] index files for a file of references .I x .SH SEE ALSO .IR eqn (1), .IR tbl (1), .IR troff (1), .IR ms (6)