2 Copyright (C) 1989-2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4 Permission is granted to make and distribute verbatim copies of
5 this manual provided the copyright notice and this permission notice
6 are preserved on all copies.
8 Permission is granted to copy and distribute modified versions of this
9 manual under the conditions for verbatim copying, provided that the
10 entire resulting derived work is distributed under the terms of a
11 permission notice identical to this one.
13 Permission is granted to copy and distribute translations of this
14 manual into another language, under the above conditions for modified
15 versions, except that this permission notice may be included in
16 translations approved by the Free Software Foundation instead of in
24 .\" Like TP, but if specified indent is more than half
25 .\" the current line-length - indent, use the default indent.
27 .ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
30 .\" The BSD man macros can't handle " in arguments to font change macros,
31 .\" so use \(ts instead of ".
33 .TH @G@REFER @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
35 @g@refer \- preprocess bibliographic references for groff
40 .in +\w'\fB@g@refer 'u
44 .ie \\n(.$-1 .RI "[\ \fB\\$1\fP" "\\$2" "\ ]"
45 .el .RB "[\ " "\\$1" "\ ]"
58 .RI [\ filename \|.\|.\|.\ ]
62 It is possible to have whitespace between a command line option and its
65 This file documents the GNU version of
67 which is part of the groff document formatting system.
69 copies the contents of
70 .IR filename \|.\|.\|.\&
71 to the standard output,
72 except that lines between
76 are interpreted as citations,
81 are interpreted as commands about how citations are to be processed.
83 Each citation specifies a reference.
84 The citation can specify a reference that is contained in
85 a bibliographic database by giving a set of keywords
86 that only that reference contains.
87 Alternatively it can specify a reference by supplying a database
88 record in the citation.
89 A combination of these alternatives is also possible.
93 can produce a mark in the text.
94 This mark consists of some label which can be separated from
95 the text and from other labels in various ways.
96 For each reference it also outputs
98 commands that can be used by a macro package to produce a formatted
99 reference for each citation.
102 must therefore be processed using a suitable macro package.
107 macros are both suitable.
108 The commands to format a citation's reference can be output immediately after
110 or the references may be accumulated,
111 and the commands output at some later point.
112 If the references are accumulated, then multiple citations of the same
113 reference will produce a single formatted reference.
115 The interpretation of lines between
119 as commands is a new feature of GNU refer.
120 Documents making use of this feature can still be processed by
121 Unix refer just by adding the lines
132 to the beginning of the document.
135 to ignore everything between
139 The effect of some commands can also be achieved by options.
140 These options are supported mainly for compatibility with Unix refer.
141 It is usually more convenient to use commands.
146 lines so that filenames and line numbers in messages produced
147 by commands that read
149 output will be correct;
150 it also interprets lines beginning with
152 so that filenames and line numbers in the messages and
154 lines that it produces will be accurate even if the input has been
155 preprocessed by a command such as
156 .BR @g@soelim (@MAN1EXT@).
159 Most options are equivalent to commands
160 (for a description of these commands see the
166 no-label-in-text; no-label-in-reference
172 .B no-default-database
182 label "(A.n|Q) ', ' (D.y|D)"; bracket-label " (" ) "; "
222 .BI A.n+ m D.y\- n %a
236 These options are equivalent to the following commands with the
237 addition that the filenames specified on the command line are
238 processed as if they were arguments to the
240 command instead of in the normal way:
244 annotate X AP; no-label-in-reference
246 .BI \-B field . macro
250 .B no-label-in-reference
252 The following options have no equivalent commands:
255 Print the version number.
258 Don't recognize lines beginning with
261 .SS Bibliographic databases
262 The bibliographic database is a text file consisting of records
263 separated by one or more blank lines.
264 Within each record fields start with a
266 at the beginning of a line.
267 Each field has a one character name that immediately follows the
269 It is best to use only upper and lower case letters for the names
271 The name of the field should be followed by exactly one space,
272 and then by the contents of the field.
273 Empty fields are ignored.
274 The conventional meaning of each field is as follows:
277 The name of an author.
278 If the name contains a title such as
281 it should be separated from the last name by a comma.
282 There can be multiple occurrences of the
285 The order is significant.
286 It is a good idea always to supply an
293 For an article that is part of a book, the title of the book.
296 The place (city) of publication.
299 The date of publication.
300 The year should be specified in full.
301 If the month is specified, the name rather than the number of the month
302 should be used, but only the first three letters are required.
303 It is a good idea always to supply a
306 if the date is unknown, a value such as
313 For an article that is part of a book, the name of an editor of the book.
314 Where the work has editors and no authors,
315 the names of the editors should be given as
321 should be appended to the last author.
324 US Government ordering number.
327 The publisher (issuer).
330 For an article in a journal, the name of the journal.
333 Keywords to be used for searching.
339 Journal issue number.
343 This is usually printed at the end of the reference.
347 A range of pages can be specified as
351 The name of the author, if the author is not a person.
352 This will only be used if there are no
355 There can only be one
360 Technical report number.
367 For an article in a book or journal,
368 this should be the title of the article.
371 Volume number of the journal or book.
376 For all fields except
380 if there is more than one occurrence of a particular field in a record,
381 only the last such field will be used.
383 If accent strings are used, they should follow the character to be accented.
386 macro must be used with the
389 Accent strings should not be quoted:
394 The format of a citation is
411 components are optional.
416 components need be specified.
420 component says to search the bibliographic databases for a reference
421 that contains all the words in
423 It is an error if more than one reference if found.
427 components specifies additional fields to replace or supplement
428 those specified in the reference.
429 When references are being accumulated and the
431 component is non-empty,
432 then additional fields should be specified only on the first
433 occasion that a particular reference is cited,
434 and will apply to all citations of that reference.
440 component specifies strings to be used to bracket the label instead
441 of the strings specified in the
444 If either of these components is non-empty,
445 the strings specified in the
447 command will not be used;
448 this behaviour can be altered using the
453 Note that leading and trailing spaces are significant for these components.
457 component is a list of
458 non-alphanumeric characters each of which modifies the treatment
459 of this particular citation.
460 Unix refer will treat these flags as part of the keywords and
461 so will ignore them since they are non-alphanumeric.
462 The following flags are currently recognized:
465 This says to use the label specified by the
468 instead of that specified by the
471 If no short label has been specified, the normal label will be used.
472 Typically the short label is used with author-date labels
473 and consists of only the date and possibly a disambiguating letter;
476 is supposed to be suggestive of a numeric type of label.
481 with the first string specified in the
488 with the second string specified in the
492 One advantages of using the
496 flags rather than including the brackets in
501 you can change the style of bracket used in the document just by changing the
504 Another advantage is that sorting and merging of citations
505 will not necessarily be inhibited if the flags are used.
507 If a label is to be inserted into the text,
508 it will be attached to the line preceding the
511 If there is no such line, then an extra line will be inserted before the
513 line and a warning will be given.
515 There is no special notation for making a citation to multiple references.
516 Just use a sequence of citations, one for each reference.
517 Don't put anything between the citations.
518 The labels for all the citations will be attached to the line preceding
520 The labels may also be sorted or merged.
521 See the description of the
523 label expression, and of the
524 .B sort-adjacent-labels
526 .B abbreviate-label-ranges
528 A label will not be merged if its citation has a non-empty
532 However, the labels for a citation using the
536 immediately followed by a citation using the
540 may be sorted and merged
541 even though the first citation's
543 or the second citation's
546 (If you wish to prevent this just make the first citation's
550 Commands are contained between lines starting with
554 Recognition of these lines can be prevented by the
559 line is recognized any accumulated references are flushed out.
565 nor anything between them
568 Commands are separated by newlines or
571 introduces a comment that extends to the end of the line
572 (but does not conceal the newline).
573 Each command is broken up into words.
574 Words are separated by spaces or tabs.
575 A word that begins with
579 that is not followed by another
583 the word extends to the end of the line.
586 in a word beginning with
594 are recognized inside
596 A line can be continued by ending it with
598 this works everywhere except after a
604 that is marked with \*n has an associated negative command
606 that undoes the effect of
610 command specifies that references should not be sorted.
611 The negative commands take no arguments.
613 In the following description each argument must be a single word;
615 is used for a single upper or lower case letter naming a field;
617 is used for a sequence of such letters;
621 are used for a non-negative numbers;
623 is used for an arbitrary string;
625 is used for the name of a file.
626 .Tp \w'\fBabbreviate-label-ranges'u+2n
627 .BI abbreviate\*n\ fields\ string1\ string2\ string3\ string4
628 Abbreviate the first names of
630 An initial letter will be separated from another initial letter by
632 from the last name by
634 and from anything else
641 These default to a period followed by a space.
642 In a hyphenated first name,
643 the initial of the first part of the name will be separated from the hyphen by
645 this defaults to a period.
646 No attempt is made to handle any ambiguities that might
647 result from abbreviation.
648 Names are abbreviated before sorting and before
651 .BI abbreviate-label-ranges\*n\ string
652 Three or more adjacent labels that refer to consecutive references
653 will be abbreviated to a label consisting
654 of the first label, followed by
656 followed by the last label.
657 This is mainly useful with numeric labels.
660 is omitted it defaults to
664 Accumulate references instead of writing out each reference
665 as it is encountered.
666 Accumulated references will be written out whenever a reference
677 after all input files hve been processed,
683 .BI annotate\*n\ field\ string
686 print it at the end of the reference as a paragraph preceded by the line
693 is omitted it will default to
697 is also omitted it will default to
699 Only one field can be an annotation.
702 .BI articles\ string \fR\|.\|.\|.
704 are definite or indefinite articles, and should be ignored at the beginning of
712 are recognized as articles.
714 .BI bibliography\ filename \fR\|.\|.\|.
715 Write out all the references contained in the bibliographic databases
716 .IR filename \|.\|.\|.
717 This command should come last in a
721 .BI bracket-label\ string1\ string2\ string3
722 In the text, bracket each label
729 immediately followed by
733 The default behaviour is
737 bracket-label \e*([. \e*(.] ", "
740 .BI capitalize\ fields
743 to caps and small caps.
750 even when followed by a character other than space or newline.
752 .BI database\ filename \fR\|.\|.\|.
753 Search the bibliographic databases
754 .IR filename \|.\|.\|.
758 .IB filename @INDEX_SUFFIX@
760 .BR @g@indxbib (@MAN1EXT@)
761 exists, then it will be searched instead;
762 each index can cover multiple databases.
764 .BI date-as-label\*n\ string
766 is a label expression that specifies a string with which to replace the
768 field after constructing the label.
770 .B "Label expressions"
771 subsection for a description of label expressions.
772 This command is useful if you do not want explicit labels in the
773 reference list, but instead want to handle any necessary
774 disambiguation by qualifying the date in some way.
775 The label used in the text would typically be some combination of the
777 In most cases you should also use the
778 .B no-label-in-reference
784 date-as-label D.+yD.y%a*D.-y
786 would attach a disambiguating letter to the year part of the
788 field in the reference.
791 .B default-database\*n
792 The default database should be searched.
793 This is the default behaviour, so the negative version of
794 this command is more useful.
795 refer determines whether the default database should be searched
796 on the first occasion that it needs to do a search.
798 .B no-default-database
799 command must be given before then,
800 in order to be effective.
802 .BI discard\*n\ fields
803 When the reference is read,
806 no string definitions for
814 .BI et-al\*n\ string\ m\ n
820 expressions in label expressions.
821 If the number of authors needed to make the author sequence
824 and the total number of authors is
828 authors will be replaced by
838 The default behaviour is
845 .BI include\ filename
848 and interpret the contents as commands.
850 .BI join-authors\ string1\ string2\ string3
851 This says how authors should be joined together.
852 When there are exactly two authors, they will be joined with
854 When there are more than two authors, all but the last two will
857 and the last two authors will be joined with
866 is also omitted it will also default to
872 join-authors " and " ", " ", and "
874 will restore the default method for joining authors.
877 .B label-in-reference\*n
878 When outputting the reference,
881 to be the reference's label.
882 This is the default behaviour; so the negative version
883 of this command is more useful.
886 For each reference output a label in the text.
887 The label will be separated from the surrounding text as described in the
890 This is the default behaviour; so the negative version
891 of this command is more useful.
895 is a label expression describing how to label each reference.
897 .BI separate-label-second-parts\ string
898 When merging two-part labels, separate the second part of the second
899 label from the first label with
901 See the description of the
905 .B move-punctuation\*n
906 In the text, move any punctuation at the end of line past the label.
907 It is usually a good idea to give this command unless you are using
908 superscripted numbers as labels.
910 .BI reverse\*n\ string
911 Reverse the fields whose names
914 Each field name can be followed by a number which says
915 how many such fields should be reversed.
916 If no number is given for a field, all such fields will be reversed.
918 .BI search-ignore\*n\ fields
919 While searching for keys in databases for which no index exists,
920 ignore the contents of
926 .BI search-truncate\*n\ n
927 Only require the first
929 characters of keys to be given.
930 In effect when searching for a given key
931 words in the database are truncated to the maximum of
933 and the length of the key.
938 .BI short-label\*n\ string
940 is a label expression that specifies an alternative (usually shorter)
942 This is used when the
944 flag is given in the citation.
945 When using author-date style labels, the identity of the author
946 or authors is sometimes clear from the context, and so it
947 may be desirable to omit the author or authors from the label.
950 command will typically be used to specify a label containing just
951 a date and possibly a disambiguating letter.
954 Sort references according to
956 References will automatically be accumulated.
958 should be a list of field names, each followed by a number,
959 indicating how many fields with the name should be used for sorting.
961 can be used to indicate that all the fields with the name should be used.
964 can be used to indicate the references should be sorted using the
969 subsection describes the concept of a tentative label.)
971 .B sort-adjacent-labels\*n
972 Sort labels that are adjacent in the text according to their
973 position in the reference list.
974 This command should usually be given if the
975 .B abbreviate-label-ranges
976 command has been given,
977 or if the label expression contains a
980 This will have no effect unless references are being accumulated.
981 .SS Label expressions
983 Label expressions can be evaluated both normally and tentatively.
984 The result of normal evaluation is used for output.
985 The result of tentative evaluation, called the
988 is used to gather the information
989 that normal evaluation needs to disambiguate the label.
990 Label expressions specified by the
994 commands are not evaluated tentatively.
995 Normal and tentative evaluation are the same for all types
996 of expression other than
1002 The description below applies to normal evaluation,
1003 except where otherwise specified.
1014 is omitted, it defaults to 1.
1022 All the authors joined as specified by the
1025 The whole of each author's name will be used.
1026 However, if the references are sorted by author
1027 (that is the sort specification starts with
1029 then authors' last names will be used instead, provided that this does
1030 not introduce ambiguity,
1031 and also an initial subsequence of the authors may be used
1032 instead of all the authors, again provided that this does not
1033 introduce ambiguity.
1034 The use of only the last name for the
1036 author of some reference
1037 is considered to be ambiguous if
1038 there is some other reference,
1041 authors of the references are the same,
1044 authors are not the same,
1047 authors' last names are the same.
1048 A proper initial subsequence of the sequence
1049 of authors for some reference is considered to be ambiguous if there is
1050 a reference with some other sequence of authors which also has
1051 that subsequence as a proper initial subsequence.
1052 When an initial subsequence of authors is used, the remaining
1053 authors are replaced by the string specified by the
1056 this command may also specify additional requirements that must be
1057 met before an initial subsequence can be used.
1059 tentatively evaluates to a canonical representation of the authors,
1060 such that authors that compare equally for sorting purpose
1061 will have the same representation.
1072 The serial number of the reference formatted according to the character
1075 The serial number of a reference is 1 plus the number of earlier references
1076 with same tentative label as this reference.
1077 These expressions tentatively evaluate to an empty string.
1080 If there is another reference with the same tentative label as
1081 this reference, then
1083 otherwise an empty string.
1084 It tentatively evaluates to an empty string.
1094 upper or lower case letters or digits of
1096 Troff special characters (such as
1098 count as a single letter.
1099 Accent strings are retained but do not count towards the total.
1103 converted to lowercase.
1107 converted to uppercase.
1111 converted to caps and small caps.
1115 reversed so that the last name is first.
1119 with first names abbreviated.
1120 Note that fields specified in the
1122 command are abbreviated before any labels are evaluated.
1125 is useful only when you want a field to be abbreviated in a label
1126 but not in a reference.
1135 before the year, or the whole of
1137 if it does not contain a year.
1142 after the year, or an empty string if
1144 does not contain a year.
1147 The last name part of
1150 .IB expr1 \(ti expr2
1152 except that if the last character of
1156 then it will be replaced by
1160 The concatenation of
1179 otherwise an empty string.
1181 .IB expr1 ? expr2 : expr3
1191 The label is in two parts, which are separated by
1193 Two adjacent two-part labels which have the same first part will be
1194 merged by appending the second part of the second label onto the first
1195 label separated by the string specified in the
1196 .B separate-label-second-parts
1197 command (initially, a comma followed by a space); the resulting label
1198 will also be a two-part label with the same first part as before
1199 merging, and so additional labels can be merged into it.
1200 Note that it is permissible for the first part to be empty;
1201 this maybe desirable for expressions used in the
1210 The above expressions are listed in order of precedence
1215 have the same precedence.
1217 Each reference starts with a call to the macro
1221 will be defined to be the label for this reference,
1223 .B no-label-in-reference
1224 command has been given.
1225 There then follows a series of string definitions,
1229 corresponds to field
1235 field contains a range of pages.
1241 number registers are set to 1 according as the
1246 fields end with one of the characters
1250 number register will be set to 1 if the
1252 string contains more than one name.
1253 The reference is followed by a call to the
1256 The first argument to this macro gives a number representing
1257 the type of the reference.
1258 If a reference contains a
1260 field, it will be classified as type 1,
1261 otherwise if it contains a
1263 field, it will type 3,
1264 otherwise if it contains a
1268 field it will be type 4,
1269 otherwise if contains a
1271 field it will be type 2,
1272 otherwise it will be type 0.
1273 The second argument is a symbolic name for the type:
1275 .BR journal-article ,
1280 Groups of references that have been accumulated
1281 or are produced by the
1283 command are preceded by a call to the
1285 macro and followed by a call to the
1289 .Tp \w'\fB@DEFAULT_INDEX@'u+2n
1293 .IB file @INDEX_SUFFIX@
1296 .Tp \w'\fBREFER'u+2n
1298 If set, overrides the default database.
1300 .BR @g@indxbib (@MAN1EXT@),
1301 .BR @g@lookbib (@MAN1EXT@),
1302 .BR lkbib (@MAN1EXT@)
1305 In label expressions,
1307 expressions are ignored inside
1311 .\" Local Variables: