Imported Upstream version 1.22.4
[platform/upstream/groff.git] / src / preproc / refer / refer.1.man
1 .TH @G@REFER @MAN1EXT@ "@MDATE@" "groff @VERSION@"
2 .SH NAME
3 @g@refer \- preprocess bibliographic references for groff
4 .
5 .
6 .\" ====================================================================
7 .\" Legal Terms
8 .\" ====================================================================
9 .\"
10 .\" Copyright (C) 1989-2018 Free Software Foundation, Inc.
11 .\"
12 .\" Permission is granted to make and distribute verbatim copies of this
13 .\" manual provided the copyright notice and this permission notice are
14 .\" preserved on all copies.
15 .\"
16 .\" Permission is granted to copy and distribute modified versions of
17 .\" this manual under the conditions for verbatim copying, provided that
18 .\" the entire resulting derived work is distributed under the terms of
19 .\" a permission notice identical to this one.
20 .\"
21 .\" Permission is granted to copy and distribute translations of this
22 .\" manual into another language, under the above conditions for
23 .\" modified versions, except that this permission notice may be
24 .\" included in translations approved by the Free Software Foundation
25 .\" instead of in the original English.
26 .
27 .
28 .\" ====================================================================
29 .SH SYNOPSIS
30 .\" ====================================================================
31 .
32 .SY @g@refer
33 .OP \-benCPRS
34 .OP \-a n
35 .OP \-c fields
36 .OP \-f n
37 .OP \-i fields
38 .OP \-k field
39 .OP \-l m,n
40 .OP \-p filename
41 .OP \-s fields
42 .OP \-t n
43 .BI "\-B " field . macro
44 .RI [ file
45 \&.\|.\|.\&]
46 .YS
47 .
48 .SY @g@refer
49 .B \-\-help
50 .YS
51 .
52 .SY @g@refer
53 .B \-v
54 .SY @g@refer
55 .B \-\-version
56 .YS
57 .
58 .
59 .\" ====================================================================
60 .SH DESCRIPTION
61 .\" ====================================================================
62 .
63 This file documents the GNU version of
64 .BR refer ,
65 which is part of the groff document formatting system.
66 .
67 .B refer
68 copies the contents of
69 .IR filename \|.\|.\|.\&
70 to the standard output,
71 except that lines between
72 .B .[
73 and
74 .B .]\&
75 are interpreted as citations,
76 and lines between
77 .B .R1
78 and
79 .B .R2
80 are interpreted as commands about how citations are to be processed.
81 .
82 .
83 .LP
84 Each citation specifies a reference.
85 .
86 The citation can specify a reference that is contained in
87 a bibliographic database by giving a set of keywords
88 that only that reference contains.
89 .
90 Alternatively it can specify a reference by supplying a database
91 record in the citation.
92 .
93 A combination of these alternatives is also possible.
94 .
95 .
96 .LP
97 For each citation,
98 .B refer
99 can produce a mark in the text.
100 .
101 This mark consists of some label which can be separated from
102 the text and from other labels in various ways.
103 .
104 For each reference it also outputs
105 .B groff
106 commands that can be used by a macro package to produce a formatted
107 reference for each citation.
108 .
109 The output of
110 .B refer
111 must therefore be processed using a suitable macro package.
112 .
113 The
114 .B \-ms
115 and
116 .B \-me
117 macros are both suitable.
118 .
119 The commands to format a citation's reference can be output immediately after
120 the citation,
121 or the references may be accumulated,
122 and the commands output at some later point.
123 .
124 If the references are accumulated, then multiple citations of the same
125 reference will produce a single formatted reference.
126 .
127 .
128 .LP
129 The interpretation of lines between
130 .B .R1
131 and
132 .B .R2
133 as commands is a new feature of GNU
134 .BR refer .
135 .
136 Documents making use of this feature can still be processed by
137 Unix refer just by adding the lines
138 .
139 .RS
140 .LP
141 .nf
142 .ft B
143 \&.de R1
144 \&.ig R2
145 \&..
146 .ft
147 .fi
148 .RE
149 .
150 to the beginning of the document.
151 .
152 This will cause
153 .B troff
154 to ignore everything between
155 .B .R1
156 and
157 .BR .R2 .
158 .
159 The effect of some commands can also be achieved by options.
160 .
161 These options are supported mainly for compatibility with Unix refer.
162 .
163 It is usually more convenient to use commands.
164 .
165 .
166 .LP
167 .B refer
168 generates
169 .B .lf
170 lines so that filenames and line numbers in messages produced
171 by commands that read
172 .B refer
173 output will be correct;
174 it also interprets lines beginning with
175 .B .lf
176 so that filenames and line numbers in the messages and
177 .B .lf
178 lines that it produces will be accurate even if the input has been
179 preprocessed by a command such as
180 .BR @g@soelim (@MAN1EXT@).
181 .
182 .
183 .\" ====================================================================
184 .SH OPTIONS
185 .\" ====================================================================
186 .
187 Whitespace is permitted between a command-line option and its argument.
188 .
189 .
190 .LP
191 Most options are equivalent to commands
192 (for a description of these commands,
193 see subsection \(lqCommands\(rq below).
194 .
195 .
196 .nr a \n(.j
197 .ad l
198 .TP
199 .B \-b
200 .B "no-label-in-text; no-label-in-reference"
201 .
202 .
203 .TP
204 .B \-e
205 .B accumulate
206 .
207 .
208 .TP
209 .B \-n
210 .B no-default-database
211 .
212 .
213 .TP
214 .B \-C
215 .B compatible
216 .
217 .
218 .TP
219 .B \-P
220 .B move-punctuation
221 .
222 .
223 .TP
224 .B \-S
225 .B
226 label\ "(A.n|Q)\ ',\ '\ (D.y|D)"; \%bracket-label\ "\ ("\ )\ ";\ "
227 .
228 .
229 .TP
230 .BI \-a n
231 .B reverse
232 .BI A n
233 .
234 .
235 .TP
236 .BI \-c fields
237 .B capitalize
238 .I fields
239 .
240 .
241 .TP
242 .BI \-f n
243 .B label
244 .BI % n
245 .
246 .
247 .TP
248 .BI \-i fields
249 .B search-ignore
250 .I fields
251 .
252 .
253 .TP
254 .B \-k
255 .B label
256 .B L\(ti%a
257 .
258 .
259 .TP
260 .BI \-k field
261 .B label
262 .IB field \(ti%a
263 .
264 .
265 .TP
266 .B \-l
267 .B label
268 .B A.nD.y%a
269 .
270 .
271 .TP
272 .BI \-l m
273 .B label
274 .BI A.n+ m D.y%a
275 .
276 .
277 .TP
278 .BI \-l, n
279 .B label
280 .BI A.nD.y\- n %a
281 .
282 .
283 .TP
284 .BI \-l m , n
285 .B label
286 .BI A.n+ m D.y\- n %a
287 .
288 .
289 .TP
290 .BI \-p filename
291 .B database
292 .I filename
293 .
294 .
295 .TP
296 .BI \-s spec
297 .B sort
298 .I spec
299 .
300 .
301 .TP
302 .BI \-t n
303 .B search-truncate
304 .I n
305 .ad \na
306 .
307 .
308 .LP
309 These options are equivalent to the following commands with the
310 addition that the filenames specified on the command line are
311 processed as if they were arguments to the
312 .B bibliography
313 command instead of in the normal way:
314 .
315 .
316 .TP
317 .B \-B
318 .B "annotate X AP; no-label-in-reference"
319 .
320 .
321 .TP
322 .BI \-B field . macro
323 .B annotate
324 .I field
325 .IB macro ;
326 .B no-label-in-reference
327 .
328 .
329 .LP
330 The following options have no equivalent commands:
331 .
332 .
333 .TP
334 .B \-v
335 Print the version number.
336 .
337 .
338 .TP
339 .B \-R
340 Don't recognize lines beginning with
341 .BR .R1 / .R2 .
342 .
343 .
344 .\" ====================================================================
345 .SH USAGE
346 .\" ====================================================================
347 .
348 .\" ====================================================================
349 .SS Bibliographic databases
350 .\" ====================================================================
351 .
352 The bibliographic database is a text file consisting of records
353 separated by one or more blank lines.
354 .
355 Within each record fields start with a
356 .B %
357 at the beginning of a line.
358 .
359 Each field has a one character name that immediately follows the
360 .BR % .
361 It is best to use only upper and lower case letters for the names
362 of fields.
363 .
364 The name of the field should be followed by exactly one space,
365 and then by the contents of the field.
366 .
367 Empty fields are ignored.
368 .
369 The conventional meaning of each field is as follows:
370 .
371 .
372 .TP
373 .B %A
374 The name of an author.
375 .
376 If the name contains a title such as
377 .B Jr.\&
378 at the end,
379 it should be separated from the last name by a comma.
380 .
381 There can be multiple occurrences of the
382 .B %A
383 field.
384 .
385 The order is significant.
386 .
387 It is a good idea always to supply an
388 .B %A
389 field or a
390 .B %Q
391 field.
392 .
393 .
394 .TP
395 .B %B
396 For an article that is part of a book, the title of the book.
397 .
398 .
399 .TP
400 .B %C
401 The place (city) of publication.
402 .
403 .
404 .TP
405 .B %D
406 The date of publication.
407 .
408 The year should be specified in full.
409 .
410 If the month is specified, the name rather than the number of the month
411 should be used, but only the first three letters are required.
412 .
413 It is a good idea always to supply a
414 .B %D
415 field;
416 if the date is unknown, a value such as
417 .B in press
418 or
419 .B unknown
420 can be used.
421 .
422 .
423 .TP
424 .B %E
425 For an article that is part of a book, the name of an editor of the book.
426 .
427 Where the work has editors and no authors,
428 the names of the editors should be given as
429 .B %A
430 fields and
431 .B ,\ (ed)
432 or
433 .B ,\ (eds)
434 should be appended to the last author.
435 .
436 .
437 .TP
438 .B %G
439 US Government ordering number.
440 .
441 .
442 .TP
443 .B %I
444 The publisher (issuer).
445 .
446 .
447 .TP
448 .B %J
449 For an article in a journal,
450 the name of the journal.
451 .
452 .
453 .TP
454 .B %K
455 Keywords to be used for searching.
456 .
457 .
458 .TP
459 .B %L
460 Label.
461 .
462 .
463 .TP
464 .B %N
465 Journal issue number.
466 .
467 .
468 .TP
469 .B %O
470 Other information.
471 .
472 This is usually printed at the end of the reference.
473 .
474 .
475 .TP
476 .B %P
477 Page number.
478 A range of pages can be specified as
479 .IB m \- n\fR.
480 .
481 .
482 .TP
483 .B %Q
484 The name of the author, if the author is not a person.
485 .
486 This will only be used if there are no
487 .B %A
488 fields.
489 .
490 There can only be one
491 .B %Q
492 field.
493 .
494 .
495 .TP
496 .B %R
497 Technical report number.
498 .
499 .
500 .TP
501 .B %S
502 Series name.
503 .
504 .
505 .TP
506 .B %T
507 Title.
508 .
509 For an article in a book or journal,
510 this should be the title of the article.
511 .
512 .
513 .TP
514 .B %V
515 Volume number of the journal or book.
516 .
517 .
518 .TP
519 .B %X
520 Annotation.
521 .
522 .
523 .LP
524 For all fields except
525 .B %A
526 and
527 .BR %E ,
528 if there is more than one occurrence of a particular field in a record,
529 only the last such field will be used.
530 .
531 .
532 .LP
533 If accent strings are used, they should follow the character to be accented.
534 This means that the
535 .B AM
536 macro must be used with the
537 .B \-ms
538 macros.
539 .
540 Accent strings should not be quoted:
541 use one
542 .B \e
543 rather than two.
544 .
545 .
546 .\" ====================================================================
547 .SS Citations
548 .\" ====================================================================
549 .
550 The format of a citation is
551 .
552 .RS
553 .BI .[ opening-text
554 .br
555 .I "flags keywords"
556 .br
557 .I fields
558 .br
559 .BI .] closing-text
560 .RE
561 .
562 .
563 .LP
564 The
565 .IR opening-text ,
566 .IR closing-text ,
567 and
568 .I flags
569 components are optional.
570 .
571 Only one of the
572 .I keywords
573 and
574 .I fields
575 components need be specified.
576 .
577 .
578 .LP
579 The
580 .I keywords
581 component says to search the bibliographic databases for a reference
582 that contains all the words in
583 .IR keywords .
584 .
585 It is an error if more than one reference if found.
586 .
587 .
588 .LP
589 The
590 .I fields
591 components specifies additional fields to replace or supplement
592 those specified in the reference.
593 .
594 When references are being accumulated and the
595 .I keywords
596 component is non-empty,
597 then additional fields should be specified only on the first
598 occasion that a particular reference is cited,
599 and will apply to all citations of that reference.
600 .
601 .
602 .LP
603 The
604 .I opening-text
605 and
606 .I closing-text
607 component specifies strings to be used to bracket the label instead
608 of the strings specified in the
609 .B bracket-label
610 command.
611 .
612 If either of these components is non-empty,
613 the strings specified in the
614 .B bracket-label
615 command will not be used;
616 this behaviour can be altered using the
617 .B [
618 and
619 .B ]
620 flags.
621 Note that leading and trailing spaces are significant for these components.
622 .
623 .
624 .LP
625 The
626 .I flags
627 component is a list of
628 non-alphanumeric characters each of which modifies the treatment
629 of this particular citation.
630 .
631 Unix refer will treat these flags as part of the keywords and
632 so will ignore them since they are non-alphanumeric.
633 .
634 The following flags are currently recognized:
635 .
636 .
637 .TP
638 .B #
639 This says to use the label specified by the
640 .B short-label
641 command,
642 instead of that specified by the
643 .B label
644 command.
645 .
646 If no short label has been specified, the normal label will be used.
647 .
648 Typically the short label is used with author-date labels
649 and consists of only the date and possibly a disambiguating letter;
650 the
651 .B #
652 is supposed to be suggestive of a numeric type of label.
653 .
654 .
655 .TP
656 .B [
657 Precede
658 .I opening-text
659 with the first string specified in the
660 .B bracket-label
661 command.
662 .
663 .
664 .TP
665 .B ]
666 Follow
667 .I closing-text
668 with the second string specified in the
669 .B bracket-label
670 command.
671 .
672 .
673 .LP
674 One advantages of using the
675 .B [
676 and
677 .B ]
678 flags rather than including the brackets in
679 .I opening-text
680 and
681 .I closing-text
682 is that
683 you can change the style of bracket used in the document just by changing the
684 .B bracket-label
685 command.
686 .
687 Another advantage is that sorting and merging of citations
688 will not necessarily be inhibited if the flags are used.
689 .
690 .
691 .LP
692 If a label is to be inserted into the text,
693 it will be attached to the line preceding the
694 .B .[
695 line.
696 .
697 If there is no such line, then an extra line will be inserted before the
698 .B .[
699 line and a warning will be given.
700 .
701 .
702 .LP
703 There is no special notation for making a citation to multiple references.
704 Just use a sequence of citations, one for each reference.
705 .
706 Don't put anything between the citations.
707 .
708 The labels for all the citations will be attached to the line preceding
709 the first citation.
710 .
711 The labels may also be sorted or merged.
712 .
713 See the description of the
714 .B <>
715 label expression, and of the
716 .B sort-adjacent-labels
717 and
718 .B abbreviate-label-ranges
719 command.
720 A label will not be merged if its citation has a non-empty
721 .I opening-text
722 or
723 .IR closing-text .
724 .
725 However,
726 the labels for a citation using the
727 .B ]
728 flag and without any
729 .I closing-text
730 immediately followed by a citation using the
731 .B [
732 flag and without any
733 .I opening-text
734 may be sorted and merged
735 even though the first citation's
736 .I opening-text
737 or the second citation's
738 .I closing-text
739 is non-empty.
740 .
741 (If you wish to prevent this just make the first citation's
742 .I closing-text
743 .BR \e& .)
744 .
745 .
746 .\" ====================================================================
747 .SS Commands
748 .\" ====================================================================
749 .
750 Commands are contained between lines starting with
751 .B .R1
752 and
753 .BR .R2 .
754 .
755 Recognition of these lines can be prevented by the
756 .B \-R
757 option.
758 .
759 When a
760 .B .R1
761 line is recognized any accumulated references are flushed out.
762 .
763 Neither
764 .B .R1
765 nor
766 .B .R2
767 lines,
768 nor anything between them
769 is output.
770 .
771 .
772 .LP
773 Commands are separated by newlines or
774 .BR ; s.
775 .B #
776 introduces a comment that extends to the end of the line
777 (but does not conceal the newline).
778 .
779 Each command is broken up into words.
780 .
781 Words are separated by spaces or tabs.
782 .
783 A word that begins with
784 .B \[dq]
785 extends to the next
786 .B \[dq]
787 that is not followed by another
788 .BR \[dq] .
789 .
790 If there is no such
791 .B \[dq]
792 the word extends to the end of the line.
793 .
794 Pairs of
795 .B \[dq]
796 in a word beginning with
797 .B \[dq]
798 collapse to a single
799 .BR \[dq] .
800 .
801 Neither
802 .B #
803 nor
804 .B ;
805 are recognized inside
806 .BR \[dq] s.
807 .
808 A line can be continued by ending it with
809 .BR \e ;
810 this works everywhere except after a
811 .BR # .
812 .
813 .
814 .LP
815 .ds n \fR*
816 Each command
817 .I name
818 that is marked with \*n has an associated negative command
819 .BI no- name
820 that undoes the effect of
821 .IR name .
822 .
823 For example, the
824 .B no-sort
825 command specifies that references should not be sorted.
826 .
827 The negative commands take no arguments.
828 .
829 .
830 .LP
831 In the following description each argument must be a single word;
832 .I field
833 is used for a single upper or lower case letter naming a field;
834 .I fields
835 is used for a sequence of such letters;
836 .I m
837 and
838 .I n
839 are used for a non-negative numbers;
840 .I string
841 is used for an arbitrary string;
842 .I filename
843 is used for the name of a file.
844 .
845 .
846 .TP
847 .BI abbreviate\*n\  fields\ string1\ string2\ string3\ string4
848 Abbreviate the first names of
849 .IR fields .
850 .
851 An initial letter will be separated from another initial letter by
852 .IR string1 ,
853 from the last name by
854 .IR string2 ,
855 and from anything else
856 (such as a
857 .B von
858 or
859 .BR de )
860 by
861 .IR string3 .
862 .
863 These default to a period followed by a space.
864 .
865 In a hyphenated first name,
866 the initial of the first part of the name will be separated from the
867 hyphen by
868 .IR string4 ;
869 this defaults to a period.
870 .
871 No attempt is made to handle any ambiguities that might
872 result from abbreviation.
873 .
874 Names are abbreviated before sorting and before label construction.
875 .
876 .
877 .TP
878 .BI abbreviate-label-ranges\*n\  string
879 .
880 Three or more adjacent labels that refer to consecutive references
881 will be abbreviated to a label consisting of the first label,
882 followed by
883 .I string
884 followed by the last label.
885 .
886 This is mainly useful with numeric labels.
887 .
888 If
889 .I string
890 is omitted it defaults to
891 .BR \- .
892 .
893 .
894 .TP
895 .B accumulate\*n
896 Accumulate references instead of writing out each reference
897 as it is encountered.
898 .
899 Accumulated references will be written out whenever a reference
900 of the form
901 .
902 .RS
903 .IP
904 .B .[
905 .br
906 .B $LIST$
907 .br
908 .B .]
909 .
910 .
911 .LP
912 is encountered,
913 after all input files have been processed,
914 and whenever
915 .B .R1
916 line is recognized.
917 .RE
918 .
919 .
920 .TP
921 .BI annotate\*n\  field\ string
922 .I field
923 is an annotation;
924 print it at the end of the reference as a paragraph preceded by the line
925 .
926 .RS
927 .IP
928 .BI . string
929 .
930 .
931 .LP
932 If
933 .I string
934 is omitted it will default to
935 .BR AP ;
936 if
937 .I field
938 is also omitted it will default to
939 .BR X .
940 .
941 Only one field can be an annotation.
942 .RE
943 .
944 .
945 .TP
946 .BI articles\  string \fR\|.\|.\|.
947 .IR string \|.\|.\|.\&
948 are definite or indefinite articles, and should be ignored at the beginning of
949 .B T
950 fields when sorting.
951 .
952 Initially,
953 .BR the ,
954 .B a
955 and
956 .B an
957 are recognized as articles.
958 .
959 .
960 .TP
961 .BI bibliography\  filename \fR\|.\|.\|.
962 .
963 Write out all the references contained in the bibliographic databases
964 .IR filename \|.\|.\|.
965 .
966 This command should come last in a
967 .BR .R1 / .R2
968 block.
969 .
970 .
971 .TP
972 .BI bracket-label\  string1\ string2\ string3
973 In the text, bracket each label
974 with
975 .I string1
976 and
977 .IR string2 .
978 .
979 An occurrence of
980 .I string2
981 immediately followed by
982 .I string1
983 will be turned into
984 .IR string3 .
985 .
986 The default behaviour is
987 .
988 .RS
989 .IP
990 .B
991 bracket-label \e*([. \e*(.] ", "
992 .RE
993 .
994 .
995 .TP
996 .BI capitalize\  fields
997 Convert
998 .I fields
999 to caps and small caps.
1000 .
1001 .
1002 .TP
1003 .B compatible\*n
1004 Recognize
1005 .B .R1
1006 and
1007 .B .R2
1008 even when followed by a character other than space or newline.
1009 .
1010 .
1011 .TP
1012 .BI database\  filename \fR\|.\|.\|.
1013 Search the bibliographic databases
1014 .IR filename \|.\|.\|.
1015 .
1016 For each
1017 .I filename
1018 if an index
1019 .IB filename @INDEX_SUFFIX@
1020 created by
1021 .BR @g@indxbib (@MAN1EXT@)
1022 exists, then it will be searched instead;
1023 each index can cover multiple databases.
1024 .
1025 .
1026 .TP
1027 .BI date-as-label\*n\  string
1028 .I string
1029 is a label expression that specifies a string with which to replace the
1030 .B D
1031 field after constructing the label.
1032 .
1033 See subsection \(lqLabel expressions\(rq below for a description of
1034 label expressions.
1035 .
1036 This command is useful if you do not want explicit labels in the
1037 reference list,
1038 but instead want to handle any necessary disambiguation by qualifying
1039 the date in some way.
1040 .
1041 The label used in the text would typically be some combination of the
1042 author and date.
1043 .
1044 In most cases you should also use the
1045 .B no-label-in-reference
1046 command.
1047 For example,
1048 .
1049 .RS
1050 .IP
1051 .B "date-as-label D.+yD.y%a*D.-y"
1052 .
1053 .
1054 .LP
1055 would attach a disambiguating letter to the year part of the
1056 .B D
1057 field in the reference.
1058 .RE
1059 .
1060 .
1061 .TP
1062 .B default-database\*n
1063 The default database should be searched.
1064 .
1065 This is the default behaviour,
1066 so the negative version of this command is more useful.
1067 .
1068 .B refer
1069 determines whether the default database should be searched
1070 on the first occasion that it needs to do a search.
1071 .
1072 Thus a
1073 .B no-default-database
1074 command must be given before then,
1075 in order to be effective.
1076 .
1077 .
1078 .TP
1079 .BI discard\*n\  fields
1080 When the reference is read,
1081 .I fields
1082 should be discarded;
1083 no string definitions for
1084 .I fields
1085 will be output.
1086 .
1087 Initially,
1088 .I fields
1089 are
1090 .BR XYZ .
1091 .
1092 .
1093 .TP
1094 .BI et-al\*n\  string\ m\ n
1095 Control use of
1096 .B "et al"
1097 in the evaluation of
1098 .B @
1099 expressions in label expressions.
1100 .
1101 If the number of authors needed to make the author sequence
1102 unambiguous is
1103 .I u
1104 and the total number of authors is
1105 .I t
1106 then the last
1107 .IR t \|\-\| u
1108 authors will be replaced by
1109 .I string
1110 provided that
1111 .IR t \|\-\| u
1112 is not less than
1113 .I m
1114 and
1115 .I t
1116 is not less than
1117 .IR n .
1118 .
1119 The default behaviour is
1120 .
1121 .RS
1122 .IP
1123 .B
1124 et-al " et al" 2 3
1125 .RE
1126 .
1127 .
1128 .TP
1129 .BI include\  filename
1130 Include
1131 .I filename
1132 and interpret the contents as commands.
1133 .
1134 .
1135 .TP
1136 .BI join-authors\  string1\ string2\ string3
1137 This says how authors should be joined together.
1138 .
1139 When there are exactly two authors, they will be joined with
1140 .IR string1 .
1141 .
1142 When there are more than two authors,
1143 all but the last two will be joined with
1144 .IR string2 ,
1145 and the last two authors will be joined with
1146 .IR string3 .
1147 .
1148 If
1149 .I string3
1150 is omitted,
1151 it will default to
1152 .IR string1 ;
1153 if
1154 .I string2
1155 is also omitted it will also default to
1156 .IR string1 .
1157 .
1158 For example,
1159 .
1160 .RS
1161 .IP
1162 .B
1163 join-authors " and " ", " ", and "
1164 .
1165 .
1166 .LP
1167 will restore the default method for joining authors.
1168 .RE
1169 .
1170 .
1171 .TP
1172 .B label-in-reference\*n
1173 When outputting the reference,
1174 define the string
1175 .B [F
1176 to be the reference's label.
1177 .
1178 This is the default behaviour; so the negative version
1179 of this command is more useful.
1180 .
1181 .
1182 .TP
1183 .B label-in-text\*n
1184 For each reference output a label in the text.
1185 .
1186 The label will be separated from the surrounding text as described in the
1187 .B bracket-label
1188 command.
1189 .
1190 This is the default behaviour; so the negative version
1191 of this command is more useful.
1192 .
1193 .
1194 .TP
1195 .BI label\  string
1196 .I string
1197 is a label expression describing how to label each reference.
1198 .
1199 .
1200 .TP
1201 .BI separate-label-second-parts\  string
1202 When merging two-part labels, separate the second part of the second
1203 label from the first label with
1204 .IR string .
1205 .
1206 See the description of the
1207 .B <>
1208 label expression.
1209 .
1210 .
1211 .TP
1212 .B move-punctuation\*n
1213 In the text,
1214 move any punctuation at the end of line past the label.
1215 .
1216 It is usually a good idea to give this command unless you are using
1217 superscripted numbers as labels.
1218 .
1219 .
1220 .TP
1221 .BI reverse\*n\  string
1222 Reverse the fields whose names
1223 are in
1224 .IR string .
1225 .
1226 Each field name can be followed by a number which says
1227 how many such fields should be reversed.
1228 .
1229 If no number is given for a field, all such fields will be reversed.
1230 .
1231 .
1232 .TP
1233 .BI search-ignore\*n\  fields
1234 While searching for keys in databases for which no index exists,
1235 ignore the contents of
1236 .IR fields .
1237 .
1238 Initially, fields
1239 .B XYZ
1240 are ignored.
1241 .
1242 .
1243 .TP
1244 .BI search-truncate\*n\  n
1245 Only require the first
1246 .I n
1247 characters of keys to be given.
1248 .
1249 In effect when searching for a given key words in the database are
1250 truncated to the maximum of
1251 .I n
1252 and the length of the key.
1253 .
1254 Initially
1255 .I n
1256 is\ 6.
1257 .
1258 .
1259 .TP
1260 .BI short-label\*n\  string
1261 .I string
1262 is a label expression that specifies an alternative (usually shorter)
1263 style of label.
1264 .
1265 This is used when the
1266 .B #
1267 flag is given in the citation.
1268 .
1269 When using author-date style labels, the identity of the author
1270 or authors is sometimes clear from the context, and so it
1271 may be desirable to omit the author or authors from the label.
1272 .
1273 The
1274 .B short-label
1275 command will typically be used to specify a label containing just
1276 a date and possibly a disambiguating letter.
1277 .
1278 .
1279 .TP
1280 .BI sort\*n\  string
1281 Sort references according to
1282 .BR string .
1283 .
1284 References will automatically be accumulated.
1285 .
1286 .I string
1287 should be a list of field names,
1288 each followed by a number,
1289 indicating how many fields with the name should be used for sorting.
1290 .
1291 .B +
1292 can be used to indicate that all the fields with the name should be used.
1293 .
1294 Also
1295 .B .\&
1296 can be used to indicate the references should be sorted using the
1297 (tentative) label.
1298 .
1299 (Subsection \(lqLabel expressions\(rq below describes the concept of a
1300 tentative label.)
1301 .
1302 .
1303 .TP
1304 .B sort-adjacent-labels\*n
1305 Sort labels that are adjacent in the text according to their position
1306 in the reference list.
1307 .
1308 This command should usually be given if the
1309 .B abbreviate-label-ranges
1310 command has been given,
1311 or if the label expression contains a
1312 .B <>
1313 expression.
1314 .
1315 This will have no effect unless references are being accumulated.
1316 .
1317 .
1318 .\" ====================================================================
1319 .SS Label expressions
1320 .\" ====================================================================
1321 .
1322 Label expressions can be evaluated both normally and tentatively.
1323 .
1324 The result of normal evaluation is used for output.
1325 .
1326 The result of tentative evaluation, called the
1327 .IR "tentative label" ,
1328 is used to gather the information that normal evaluation needs to
1329 disambiguate the label.
1330 .
1331 Label expressions specified by the
1332 .B date-as-label
1333 and
1334 .B short-label
1335 commands are not evaluated tentatively.
1336 .
1337 Normal and tentative evaluation are the same for all types of
1338 expression other than
1339 .BR @ ,
1340 .BR * ,
1341 and
1342 .B %
1343 expressions.
1344 .
1345 The description below applies to normal evaluation,
1346 except where otherwise specified.
1347 .
1348 .
1349 .TP
1350 .I field
1351 .TQ
1352 .I field\ n
1353 The
1354 .IR n -th
1355 part of
1356 .IR field .
1357 .
1358 If
1359 .I n
1360 is omitted, it defaults to\ 1.
1361 .
1362 .
1363 .TP
1364 .BI ' string '
1365 The characters in
1366 .I string
1367 literally.
1368 .
1369 .
1370 .TP
1371 .B @
1372 All the authors joined as specified by the
1373 .B join-authors
1374 command.
1375 .
1376 The whole of each author's name will be used.
1377 .
1378 However, if the references are sorted by author (that is the sort
1379 specification starts with
1380 .BR A+ ),
1381 then authors last names will be used instead,
1382 provided that this does not introduce ambiguity,
1383 and also an initial subsequence of the authors may be used instead of
1384 all the authors,
1385 again provided that this does not introduce ambiguity.
1386 .
1387 The use of only the last name for the
1388 .IR i -th
1389 author of some reference
1390 is considered to be ambiguous if
1391 there is some other reference,
1392 such that the first
1393 .IR i \|\-\|1
1394 authors of the references are the same,
1395 the
1396 .IR i -th
1397 authors are not the same,
1398 but the
1399 .IR i -th
1400 authors last names are the same.
1401 .
1402 A proper initial subsequence of the sequence of authors for some
1403 reference is considered to be ambiguous if there is a reference with
1404 some other sequence of authors which also has that subsequence as a
1405 proper initial subsequence.
1406 .
1407 When an initial subsequence of authors is used, the remaining authors
1408 are replaced by the string specified by the
1409 .B et-al
1410 command;
1411 this command may also specify additional requirements that must be
1412 met before an initial subsequence can be used.
1413 .
1414 .B @
1415 tentatively evaluates to a canonical representation of the authors,
1416 such that authors that compare equally for sorting purpose will have
1417 the same representation.
1418 .
1419 .
1420 .TP
1421 .BI % n
1422 .TQ
1423 .B %a
1424 .TQ
1425 .B %A
1426 .TQ
1427 .B %i
1428 .TQ
1429 .B %I
1430 The serial number of the reference formatted according to the
1431 character following the
1432 .BR % .
1433 The serial number of a reference is\ 1 plus the number of earlier
1434 references with same tentative label as this reference.
1435 .
1436 These expressions tentatively evaluate to an empty string.
1437 .
1438 .TP
1439 .IB expr *
1440 If there is another reference with the same tentative label as this
1441 reference,
1442 then
1443 .IR expr ,
1444 otherwise an empty string.
1445 .
1446 It tentatively evaluates to an empty string.
1447 .
1448 .
1449 .TP
1450 .IB expr + n
1451 .TQ
1452 .IB expr \- n
1453 The first
1454 .RB ( + )
1455 or last
1456 .RB ( \- )
1457 .I n
1458 upper or lower case letters or digits of
1459 .IR expr .
1460 .
1461 Troff special characters (such as
1462 .BR \e('a )
1463 count as a single letter.
1464 .
1465 Accent strings are retained but do not count towards the total.
1466 .
1467 .
1468 .TP
1469 .IB expr .l
1470 .I expr
1471 converted to lowercase.
1472 .
1473 .
1474 .TP
1475 .IB expr .u
1476 .I expr
1477 converted to uppercase.
1478 .
1479 .
1480 .TP
1481 .IB expr .c
1482 .I expr
1483 converted to caps and small caps.
1484 .
1485 .
1486 .TP
1487 .IB expr .r
1488 .I expr
1489 reversed so that the last name is first.
1490 .
1491 .
1492 .TP
1493 .IB expr .a
1494 .I expr
1495 with first names abbreviated.
1496 .
1497 Note that fields specified in the
1498 .B abbreviate
1499 command are abbreviated before any labels are evaluated.
1500 .
1501 Thus
1502 .B .a
1503 is useful only when you want a field to be abbreviated in a label
1504 but not in a reference.
1505 .
1506 .
1507 .TP
1508 .IB expr .y
1509 The year part of
1510 .IR expr .
1511 .
1512 .
1513 .TP
1514 .IB expr .+y
1515 The part of
1516 .I expr
1517 before the year,
1518 or the whole of
1519 .I expr
1520 if it does not contain a year.
1521 .
1522 .
1523 .TP
1524 .IB expr .\-y
1525 The part of
1526 .I expr
1527 after the year,
1528 or an empty string if
1529 .I expr
1530 does not contain a year.
1531 .
1532 .
1533 .TP
1534 .IB expr .n
1535 The last name part of
1536 .IR expr .
1537 .
1538 .
1539 .TP
1540 .IB expr1 \(ti expr2
1541 .I expr1
1542 except that if the last character of
1543 .I expr1
1544 is
1545 .B \-
1546 then it will be replaced by
1547 .IR expr2 .
1548 .
1549 .
1550 .TP
1551 .I expr1\ expr2
1552 The concatenation of
1553 .I expr1
1554 and
1555 .IR expr2 .
1556 .
1557 .
1558 .TP
1559 .IB expr1 | expr2
1560 If
1561 .I expr1
1562 is non-empty then
1563 .I expr1
1564 otherwise
1565 .IR expr2 .
1566 .
1567 .
1568 .TP
1569 .IB expr1 & expr2
1570 If
1571 .I expr1
1572 is non-empty
1573 then
1574 .I expr2
1575 otherwise an empty string.
1576 .
1577 .
1578 .TP
1579 .IB expr1 ? expr2 : expr3
1580 If
1581 .I expr1
1582 is non-empty
1583 then
1584 .I expr2
1585 otherwise
1586 .IR expr3 .
1587 .
1588 .
1589 .TP
1590 .BI < expr >
1591 The label is in two parts, which are separated by
1592 .IR expr .
1593 .
1594 Two adjacent two-part labels which have the same first part will be
1595 merged by appending the second part of the second label onto the first
1596 label separated by the string specified in the
1597 .B separate-label-second-parts
1598 command (initially,
1599 a comma followed by a space);
1600 the resulting label will also be a two-part label with the same first
1601 part as before merging,
1602 and so additional labels can be merged into it.
1603 .
1604 Note that it is permissible for the first part to be empty;
1605 this maybe desirable for expressions used in the
1606 .B short-label
1607 command.
1608 .
1609 .
1610 .TP
1611 .BI ( expr )
1612 The same as
1613 .IR expr .
1614 .
1615 Used for grouping.
1616 .
1617 .
1618 .LP
1619 The above expressions are listed in order of precedence
1620 (highest first);
1621 .B &
1622 and
1623 .B |
1624 have the same precedence.
1625 .
1626 .
1627 .\" ====================================================================
1628 .SS Macro interface
1629 .\" ====================================================================
1630 .
1631 Each reference starts with a call to the macro
1632 .BR ]- .
1633 .
1634 The string
1635 .B [F
1636 will be defined to be the label for this reference,
1637 unless the
1638 .B no-label-in-reference
1639 command has been given.
1640 .
1641 There then follows a series of string definitions,
1642 one for each field:
1643 string
1644 .BI [ X
1645 corresponds to field
1646 .IR X .
1647 .
1648 The number register
1649 .B [P
1650 is set to\ 1 if the
1651 .B P
1652 field contains a range of pages.
1653 .
1654 The
1655 .BR [T ,
1656 .B [A
1657 and
1658 .B [O
1659 number registers are set to\ 1 according as the
1660 .BR T ,
1661 .B A
1662 and
1663 .B O
1664 fields end with one of the characters
1665 .BR .?! .
1666 .
1667 The
1668 .B [E
1669 number register will be set to\ 1 if the
1670 .B [E
1671 string contains more than one name.
1672 .
1673 The reference is followed by a call to the
1674 .B ][
1675 macro.
1676 .
1677 The first argument to this macro gives a number representing
1678 the type of the reference.
1679 .
1680 If a reference contains a
1681 .B J
1682 field, it will be classified as type\ 1,
1683 otherwise if it contains a
1684 .B B
1685 field, it will type\ 3,
1686 otherwise if it contains a
1687 .B G
1688 or
1689 .B R
1690 field it will be type\ 4,
1691 otherwise if it contains an
1692 .B I
1693 field it will be type\ 2,
1694 otherwise it will be type\ 0.
1695 .
1696 The second argument is a symbolic name for the type:
1697 .BR other ,
1698 .BR journal-article ,
1699 .BR book ,
1700 .B article-in-book
1701 or
1702 .BR tech-report .
1703 .
1704 Groups of references that have been accumulated or are produced by the
1705 .B bibliography
1706 command are preceded by a call to the
1707 .B ]<
1708 macro and followed by a call to the
1709 .B ]>
1710 macro.
1711 .
1712 .
1713 .\" ====================================================================
1714 .SH FILES
1715 .\" ====================================================================
1716 .
1717 .TP
1718 .I @DEFAULT_INDEX@
1719 Default database.
1720 .
1721 .
1722 .TP
1723 .RI file @INDEX_SUFFIX@
1724 Index files.
1725 .
1726 .
1727 .LP
1728 .B refer
1729 uses temporary files.
1730 .
1731 See the
1732 .BR groff (@MAN1EXT@)
1733 man page for details where such files are created.
1734 .
1735 .
1736 .\" ====================================================================
1737 .SH ENVIRONMENT
1738 .\" ====================================================================
1739 .
1740 .TP
1741 .I REFER
1742 If set, overrides the default database.
1743 .
1744 .
1745 .\" ====================================================================
1746 .SH "SEE ALSO"
1747 .\" ====================================================================
1748 .
1749 .BR @g@indxbib (@MAN1EXT@),
1750 .BR @g@lookbib (@MAN1EXT@),
1751 .BR lkbib (@MAN1EXT@)
1752 .br
1753 .
1754 .
1755 .\" ====================================================================
1756 .SH BUGS
1757 .\" ====================================================================
1758 .
1759 In label expressions,
1760 .B <>
1761 expressions are ignored inside
1762 .BI . char
1763 expressions.
1764 .
1765 .
1766 .\" Local Variables:
1767 .\" mode: nroff
1768 .\" End:
1769 .\" vim: set filetype=groff: