9 .TH \*GREFER @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
11 \*grefer \- preprocess bibliographic references for groff
15 .in +\w'\fB\*grefer 'u
19 .ie \\n(.$-1 .RI "[\ \fB\\$1\fP" "\\$2" "\ ]"
20 .el .RB "[\ " "\\$1" "\ ]"
33 .RI [\ filename \|.\|.\|.\ ]
38 copies the contents of
39 .IR filename \|.\|.\|.
40 to the standard output,
41 except that lines between
45 are interpreted as citations,
50 are interpreted as commands about how citations are to be processed.
52 Each citation specifies a reference.
53 The citation can specify a reference that is contained in
54 a bibliographic database by giving a set of keywords
55 that only that reference contains.
56 Alternatively it can specify a reference by supplying a database
57 record in the citation.
58 A combination of these alternatives is also possible.
62 can produce a mark in the text.
63 This mark consists of some label which can be separated from
64 the text and from other labels in various ways.
65 For each reference it also outputs
67 commands that can be used by a macro package to produce a formatted
68 reference for each citation.
71 must therefore be processed using a suitable macro package.
76 macros are both suitable.
77 The commands to format a citation's reference can be output immediately after
79 or the references may be accumulated,
80 and the commands output at some later point.
81 If the references are accumulated, then multiple citations of the same
82 reference will produce in a single formatted reference.
84 The interpretation of lines between
88 as commands is a new feature of
90 Documents making use of this feature can still be processed by
91 Unix refer just by adding the lines
102 to the beginning of the document.
105 to ignore everything between
109 The effect of some commands can also be achieved by options.
110 These options are supported mainly for compatibility with Unix refer.
111 It is usually more convenient to use commands.
116 lines so that filenames and line numbers in messages produced
117 by commands that read
119 output will be correct;
120 it also interprets lines beginning with
122 so that filenames and line numbers in the messages and
124 lines that it produces will be accurate even if the input has been
125 preprocessed by a command such as
126 .BR gsoelim (@MAN1EXT@).
129 Most options are equivalent to commands
130 (for a description of these commands see the
136 no-label-in-text; no-label-in-reference
142 .B no-default-database
152 label "(A.n|Q) ', ' (D.y|D)"; bracket-label " (" ) "; "
192 .BI A.n+ m D.y\- n %a
206 These options are equivalent to the following commands with the
207 addition that the filenames specified on the command line are
208 processed as if they were arguments to the
210 command instead of in the normal way:
214 annotate X AP; no-label-in-reference
216 .BI \-B field . macro
220 .B no-label-in-reference
222 The following options have no equivalent commands:
225 Print the version number.
228 Don't recognize lines beginning with
231 .SS Bibliographic databases
232 The bibliographic database is a text file consisting of records
233 separated by one or more blank lines.
234 Within each record fields start with a
236 at the beginning of a line.
237 Each field has a one character name that immediately follows the
239 It is best to use only upper and lower case letters for the names
241 The name of the field should be followed by exactly one space,
242 and then by the contents of the field.
243 Empty fields are ignored.
244 The conventional meaning of each field is as follows:
247 The name of an author.
248 If the name contains a title such as
251 it should be separated from the last name by a comma.
252 There can be multiple occurences of the
255 The order is siginificant.
256 It is a good idea always to supply an
263 For an article that is part of a book, the title of the book
266 The place (city) of publication.
269 The date of publication.
270 The year should be specified in full.
271 If the month is specified, the name rather than the number of the month
272 should be used, but only the first three letters are required.
273 It is a good idea always to supply a
276 if the date is unknown, a value such as
283 For an article that is part of a book, the name of an editor of the book.
284 Where the work has editors and no authors,
285 the names of the editors should be given as
291 should be appended to the last author.
294 US Government ordering number.
297 The publisher (issuer).
300 For an article in a journal, the name of the journal.
303 Keywords to be used for searching.
309 Journal issue number.
313 This is usually printed at the end of the reference.
317 A range of pages can be specified as
321 The name of the author, if the author is not a person.
322 This will only be used if there are no
325 There can only be one
330 Technical report number.
337 For an article in a book or journal,
338 this should be the title of the article.
341 Volume number of the journal or book.
346 For all fields except
350 if there is more than one occurence of a particular field in a record,
351 only the last such field will be used.
353 If accent strings are used, they should follow the charater to be accented.
356 macro must be used with the
359 Accent strings should not be quoted:
364 The format of a citation is
381 components are optional.
386 components need be specified.
390 component says to search the bibliographic databases for a reference
391 that contains all the words in
393 It is an error if more than one reference if found.
397 components specifies additional fields to replace or supplement
398 those specified in the reference.
399 When references are being accumulated and the
401 component is non-empty,
402 then additional fields should be specified only on the first
403 occasion that a particular reference is cited,
404 and will apply to all citations of that reference.
410 component specifies strings to be used to bracket the label instead
411 of the strings specified in the
414 If either of these components is non-empty,
415 the strings specified in the
417 command will not be used;
418 this behaviour can be altered using the
423 Note that leading and trailing spaces are significant for these components.
427 component is a list of
428 non-alphanumeric characters each of which modifies the treatment
429 of this particular citation.
430 Unix refer will treat these flags as part of the keywords and
431 so will ignore them since they are non-alphanumeric.
432 The following flags are currently recognized:
435 This says to use the label specified by the
438 instead of that specified by the
441 If no short label has been specified, the normal label will be used.
442 Typically the short label is used with author-date labels
443 and consists of only the date and possibly a disambiguating letter;
446 is supposed to be suggestive of a numeric type of label.
451 with the first string specified in the
458 with the second string specified in the
462 One advantages of using the
466 flags rather than including the brackets in
471 you can change the style of bracket used in the document just by changing the
474 Another advantage is that sorting and merging of citations
475 will not necessarily be inhibited if the flags are used.
477 If a label is to be inserted into the text,
478 it will be attached to the line preceding the
481 If there is no such line, then an extra line will be inserted before the
483 line and a warning will be given.
485 There is no special notation for making a citation to multiple references.
486 Just use a sequence of citations, one for each reference.
487 Don't put anything between the citations.
488 The labels for all the citations will be attached to the line preceding
490 The labels may also be sorted or merged.
491 See the description of the
493 label expression, and of the
494 .B sort-adjacent-labels
496 .B abbreviate-label-ranges
498 A label will not be merged if its citation has a non-empty
502 However, the labels for a citation using the
506 immediately followed by a citation using the
510 may be sorted and merged
511 even though the first citation's
513 or the second citation's
516 (If you wish to prevent this just make the first citation's
520 Commands are contained between lines starting with
524 Recognition of these lines can be prevented by the
529 line is recognized any accumulated references are flushed out.
535 nor anything between them
538 Commands are separated by newlines or
541 introduces a comment that extends to the end of the line
542 (but does not conceal the newline).
543 Each command is broken up into words.
544 Words are separated by spaces or tabs.
545 A word that begins with
549 that is not followed by another
553 the word extends to the end of the line.
556 in a word beginning with
564 are recognized inside
566 A line can be continued by ending it with
568 this works everywhere except after a
574 that is marked with \*n has an associated negative command
576 that undoes the effect of
580 command specifies that references should not be sorted.
581 The negative commands take no arguments.
583 In the following description each argument must be a single word;
585 is used for a single upper or lower case letter naming a field;
587 is used for a sequence of such letters;
591 are used for a non-negative numbers;
593 is used for an arbitrary string;
595 is used for the name of a file.
596 .TP \w'\fBabbreviate-label-ranges'u+2n
597 .BI abbreviate\*n\ fields\ string1\ string2\ string3\ string4
598 Abbreviate the first names of
600 An initial letter will be separated from another initial letter by
602 from the last name by
604 and from anything else
611 These default to a period followed by a space.
612 In a hyphenated first name,
613 the initial of the first part of the name will be separated from the hyphen by
615 this defaults to a period.
616 No attempt is made to handle any ambiguities that might
617 result from abbreviation.
618 Names are abbreviated before sorting and before
621 .BI abbreviate-label-ranges\*n\ string
622 Three or more adjacent labels that refer to consecutive references
623 will be abbreviated to a label consisting
624 of the first label, followed by
626 followed by the last label.
627 This is mainly useful with numeric labels.
630 is omitted it defaults to
634 Accumulate references instead of writing out each reference
635 as it is encountered.
636 Accumulated references will be written out whenever a reference
647 after all input files hve been processed,
653 .BI annotate\*n\ field\ string
656 print it at the end of the reference as a paragraph preceded by the line
663 is omitted it will default to
667 is also omitted it will default to
669 Only one field can be an annotation.
672 .BI articles\ string \fR\|.\|.\|.
674 are definite or indefinite articles, and should be ignored at the beginning of
682 are recognized as articles.
684 .BI bibliography\ filename \fR\|.\|.\|.
685 Write out all the references contained in the bibliographic databases
686 .IR filename \|.\|.\|.
688 .BI bracket-label\ string1\ string2\ string3
689 In the text, bracket each label
696 immediately followed by
700 The default behaviour is
704 bracket-label \e*([. \e*(.] ", "
707 .BI capitalize\ fields
710 to caps and small caps.
717 even when followed by a character other than space or newline.
719 .BI database\ filename \fR\|.\|.\|.
720 Search the bibligraphic databases
721 .IR filename \|.\|.\|.
725 .IB filename @INDEX_SUFFIX@
727 .BR \*gindxbib (@MAN1EXT@)
728 exists, then it will be searched instead;
729 each index can cover multiple databases.
731 .BI date-as-label\*n\ string
733 is a label expression that specifies a string with which to replace the
735 field after constructing the label.
737 .B "Label expressions"
738 subsection for a description of label expressions.
739 This command is useful if you do not want explicit labels in the
740 reference list, but instead want to handle any necessary
741 disambiguation by qualifying the date in some way.
742 The label used in the text would typically be some combination of the
744 In most cases you should also use the
745 .B no-label-in-reference
751 date-as-label D.+yD.y%a*D.-y
753 would attach a disambiguating letter to the year part of the
755 field in the reference.
758 .B default-database\*n
759 The default database should be searched.
760 This is the default behaviour, so the negative version of
761 this command is more useful.
762 \*grefer determines whether the default database should be searched
763 on the first occasion that it needs to do a search.
765 .B no-default-database
766 command must be given before then,
767 in order to be effective.
769 .BI discard\*n\ fields
770 When the reference is read,
773 no string definitions for
781 .BI et-al\*n\ string\ m\ n
787 expressions in label expressions.
788 If the number of authors needed to make the author sequence
791 and the total number of authors is
795 authors will be replaced by
805 The default behaviour is
812 .BI include\ filename
815 and interpret the contents as commands.
817 .BI join-authors\ string1\ string2\ string3
818 This says how authors should be joined together.
819 When there are exactly two authors, they will be joined with
821 When there are more than two authors, all but the last two will
824 and the last two authors will be joined with
833 is also omitted it will also default to
839 join-authors " and " ", " ", and "
841 will restore the default method for joining authors.
844 .B label-in-reference\*n
845 When outputting the reference,
848 to be the reference's label.
849 This is the default behaviour; so the negative version
850 of this command is more useful.
853 For each reference output a label in the text.
854 The label will be separated from the surrounding text as described in the
857 This is the default behaviour; so the negative version
858 of this command is more useful.
862 is a label expression describing how to label each reference.
864 .BI separate-label-second-parts\ string
865 When merging two-part labels, separate the second part of the second
866 label from the first label with
868 See the description of the
872 .B move-punctuation\*n
873 In the text, move any punctuation at the end of line past the label.
874 It is usually a good idea to give this command unless you are using
875 superscripted numbers as labels.
877 .BI reverse\*n\ string
878 Reverse the fields whose names
881 Each field name can be followed by a number which says
882 how many such fields should be reversed.
883 If no number is given for a field, all such fields will be reversed.
885 .BI search-ignore\*n\ fields
886 While searching for keys in databases for which no index exists,
887 ignore the contents of
893 .BI search-truncate\*n\ n
894 Only require the first
896 characters of keys to be given.
897 In effect when searching for a given key
898 words in the database are truncated to the maximum of
900 and the length of the key.
905 .BI short-label\*n\ string
907 is a label expression that specifies an alternative (usually shorter)
909 This is used when the
911 flag is given in the citation.
912 When using author-date style labels, the identity of the author
913 or authors is sometimes clear from the context, and so it
914 may be desirable to omit the author or authors from the label.
917 command will typically be used to specify a label containing just
918 a date and possibly a disambiguating letter.
921 Sort references according to
923 References will automatically be accumulated.
925 should be a list of field names, each followed by a number,
926 indicating how many fields with the name should be used for sorting.
928 can be used to indicate that all the fields with the name should be used.
931 can be used to indicate the references should be sorted using the
936 subsection describes the concept of a tentative label.)
938 .B sort-adjacent-labels\*n
939 Sort labels that are adjacent in the text according to their
940 position in the reference list.
941 This command should usually be given if the
942 .B abbreviate-label-ranges
943 command has been given,
944 or if the label expression contains a
947 This will have no effect unless references are being accumulated.
948 .SS Label expressions
950 Label expressions can be evaluated both normally and tentatively.
951 The result of normal evaluation is used for output.
952 The result of tentative evaluation, called the
955 is used to gather the information
956 that normal evaluation needs to disambiguate the label.
957 Label expressions specified by the
961 commands are not evaluated tentatively.
962 Normal and tentative evaluation are the same for all types
963 of expression other than
969 The description below applies to normal evaluation,
970 except where otherwise specified.
981 is omitted, it defaults to 1.
989 All the authors joined as specified by the
992 The whole of each author's name will be used.
993 However, if the references are sorted by author
994 (that is the sort specification starts with
996 then authors' last names will be used instead, provided that this does
997 not introduce ambiguity.
998 and also an initial subsequence of the authors may be used
999 instead of all the authors, again provided that this does not
1000 introduce ambiguity.
1001 The use of only the last name for the
1003 author of some reference
1004 is considered to be ambiguous if
1005 there is some other reference,
1008 authors of the references are the same,
1011 authors are not the same,
1014 authors' last names are the same.
1015 A proper initial subsequence of the sequence
1016 of authors for some reference is considered to be ambiguous if there is
1017 a reference with some other sequence of authors which also has
1018 that subsequence as a proper initial subsequence.
1019 When an initial subsequence of authors is used, the remaining
1020 authors are replaced by the string specified by the
1023 this command may also specify additional requirements that must be
1024 met before an initial subsequence can be used.
1026 tentatively evaluates to a canonical representation of the authors,
1027 such that authors that compare equally for sorting purpose
1028 will have the same representation.
1039 The serial number of the reference formatted according to the character
1042 The serial number of a reference is 1 plus the number of earlier references
1043 with same tentative label as this reference.
1044 These expressions tentatively evaluate to an empty string.
1047 If there is another reference with the same tentative label as
1048 this reference, then
1050 otherwise an empty string.
1051 It tentatively evaluates to an empty string.
1061 upper or lower case letters or digits of
1063 Troff special characters (such as
1065 count as a single letter.
1066 Accent strings are retained but do not count towards the total.
1070 converted to lowercase.
1074 converted to uppercase.
1078 converted to caps and small caps.
1082 reversed so that the last name is first.
1086 with first names abbreviated.
1087 Note that fields specified in the
1089 command are abbreviated before any labels are evaluated.
1092 is useful only when you want a field to be abbreviated in a label
1093 but not in a reference.
1102 before the year, or the whole of
1104 if it does not contain a year.
1109 after the year, or an empty string if
1111 does not contain a year.
1114 The last name part of
1117 .IB expr1 \(ti expr2
1119 except that if the last character of
1123 then it will be replaced by
1127 The concatenation of
1146 otherwise an empty string.
1148 .IB expr1 ? expr2 : expr3
1158 The label is in two parts, which are separated by
1160 Two adjacent two-part labels which have the same first part will be
1161 merged by appending the second part of the second label onto the first
1162 label separated by the string specified in the
1163 .B separate-label-second-parts
1164 command (initially, a comma followed by a space); the resulting label
1165 will also be a two-part label with the same first part as before
1166 merging, and so additional labels can be merged into it.
1167 Note that it is permissible for the first part to be empty;
1168 this maybe desirable for expressions used in the
1177 The above expressions are listed in order of precedence
1182 have the same precedence.
1184 Each reference starts with a call to the macro
1188 will be defined to be the label for this reference,
1190 .B no-label-in-reference
1191 command has been given.
1192 There then follows a series of string definitions,
1196 corresponds to field
1202 field contains a range of pages.
1208 number registers are set to 1 according as the
1213 fields end with one of the characters
1217 number register will be set to 1 if the
1219 string contains more than one name.
1220 The reference is followed by a call to the
1223 The first argument to this macro gives a number representing
1224 the type of the reference.
1225 If a reference contains a
1227 field, it will be classified as type 1,
1228 otherwise if it contains a
1230 field, it will type 3,
1231 otherwise if it contains a
1235 field it will be type 4,
1236 otherwise if contains a
1238 field it will be type 2,
1239 otherwise it will be type 0.
1240 The second argument is a symbolic name for the type:
1242 .BR journal-article ,
1247 Groups of references that have been accumulated
1248 or are produced by the
1250 command are preceded by a call to the
1252 macro and followed by a call to the
1256 .TP \w'\fB@DEFAULT_INDEX@'u+2n
1260 .IB file @INDEX_SUFFIX@
1263 .BR \*gindxbib (@MAN1EXT@),
1264 .BR \*glookbib (@MAN1EXT@),
1265 .BR \*glkbib (@MAN1EXT@)
1268 In label expressions,
1270 expressions are ignored inside