1 .\" -*- mode: nroff; coding: iso-latin-1; -*-
5 .\" This is an interface to `refer', originally part of `s.tmac'.
7 .\" Copyright (C) 2011-2014 Free Software Foundation, Inc.
8 .\" Written by Werner Lemberg (wl@gnu.org)
10 .\" This file is part of groff.
12 .\" groff is free software; you can redistribute it and/or modify it under
13 .\" the terms of the GNU General Public License as published by the Free
14 .\" Software Foundation, either version 3 of the License, or
15 .\" (at your option) any later version.
17 .\" groff is distributed in the hope that it will be useful, but WITHOUT ANY
18 .\" WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 .\" You should have received a copy of the GNU General Public License
23 .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
25 .\" Please send comments to groff@gnu.org.
28 .\" The following macros must be defined:
30 .\" ref*error -- print an error message (in arg1)
32 .\" ref*text-label-start -- start a reference in text (formatted
33 .\" reference number in arg1)
34 .\" ref*text-label-end -- end a reference in text
36 .\" ref*biblio-item-start -- a reference item with label (in arg1)
37 .\" in the bibliography block
38 .\" ref*biblio-item-start-nolabel -- a reference item without label in the
39 .\" bibliography block
40 .\" ref*biblio-item-end -- end a reference item in the
41 .\" bibliography block
43 .\" The following macros are optional:
45 .\" ref*item-start-hook -- stuff appended to the ]- macro
46 .\" ref*item-end-hook -- stuff prepended to the ][ macro
47 .\" ref*biblio-start-hook -- stuff appended to the ]< macro
48 .\" ref*biblio-end-hook -- stuff appended to the ]> macro
50 .\" The following strings must be defined:
52 .\" ref*refnum-start -- start reference number formatting in
54 .\" ref*refnum-end -- end reference number formatting in
57 .\" [. -- start reference number in text
58 .\" (directly inserted by `refer')
59 .\" .] -- end reference number in text (directly
60 .\" inserted by `refer')
62 .\" Here is the specification of the five possible reference styles
63 .\" provided by `refer'. The example entries are taken from the ms
66 .\" ref*spec!0 Q A T S V N P I C D O -- other
67 .\" ref*spec!1 Q A T J S V N P I C D O -- journal article
68 .\" ref*spec!2 Q A T S V P I C D O -- book
69 .\" ref*spec!3 Q A T B E S V P I C D O -- article within book
70 .\" ref*spec!4 Q A T R G P I C D O -- technical report
72 .\" Now the setup for the formatting of reference entries. The given example
73 .\" entries for the various strings are taken from the ms macro package.
75 .\" Each string defines five arguments which are passed to a macro, with the
76 .\" meaning as below. Please refer to the man page of `refer' for more
77 .\" details on the fields. To allow fine-tuning, two levels are implemented:
78 .\" For the refer field X and style Y the string `ref*spec!X:Y' is looked up.
79 .\" If it doesn't exist, the string `ref*spec!X' is used instead.
81 .\" arg 1 the punctuation character to use to separate this field from the
83 .\" arg 2 a string to insert after the punctuation character of the
84 .\" previous field (normally a space)
85 .\" arg 3 a string with which to prefix this field
86 .\" arg 4 a string with which to postfix this field
87 .\" arg 5 a string to add after the punctuation character supplied by the
91 .\" ----------------------------------------------------------------------
92 .\" ref*spec!A , " " -- author name
93 .\" ref*spec!B "" " " "in \fI" "" "\fP" -- book title of article
94 .\" ref*spec!D "" " " "(" ")" -- date of publication
95 .\" ref*spec!E , " " "ed. " -- editor
96 .\" ref*spec!G "" " " "(" ")" -- US Gov. ordering number
97 .\" ref*spec!J , " " "\fI" "" "\fP" -- journal name
98 .\" ref*spec!N "" "(" "" ")" -- issue number
99 .\" ref*spec!O . " " -- other information
100 .\" ref*spec!P , " " "p.\~" -- page
101 .\" ref*spec!PP , " " "pp.\~" -- page range
102 .\" ref*spec!T , " " "\\*Q" "" "\\*U" -- journal title
103 .\" ref*spec!T:0 , " " "\fI" "" "\fP" -- book title (other)
104 .\" ref*spec!T:2 , " " "\fI" "" "\fP" -- book title (book)
105 .\" ref*spec!V "" " " "\fB" "\fR" -- volume number
107 .\" ref*spec!dflt , " " -- all other entries
109 .\" start of reference
111 . rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
113 . if d ref*item-start-hook \
114 . ref*item-start-hook
120 . if d ref*item-end-hook \
122 . ie d ref*spec!\\$1 \
123 . ref*build \\$1 \\*[ref*spec!\\$1]
125 . ref*error "unknown reference type `\\$1'"
126 . ref*build 0 \\*[ref*spec!0]
134 .\" period before reference
137 .\" period after reference
140 .\" comma before reference
143 .\" comma after reference
147 .\" start collected references
149 . als ref*print ref*end-print
150 . if d ref*biblio-start-hook \
151 . ref*biblio-start-hook
155 .\" end collected references
157 . als ref*print ref*normal-print
158 . if d ref*biblio-end-hook \
159 . ref*biblio-end-hook
165 . ref*text-label-start \
166 "\\*[ref*refnum-start]\\*([F\\*[ref*refnum-end]"
168 . ref*text-label-start \&
169 . nop \\*[ref*string]
176 . ref*biblio-item-start "\\*([F."
178 . ref*biblio-item-start-nolabel
179 . nop \\*[ref*string]
180 . ref*biblio-item-end
184 .als ref*print ref*normal-print
187 . rm ref*string ref*post-punct
188 . nr ref*suppress-period 1
193 . ie d ref*add-\\$1 \
194 . ref*add-\\$1 \\n[ref*style]
196 . ref*add-dflt \\$1 \\n[ref*style]
200 . \" now add a final period
201 . ie d ref*string \{\
202 . if !\\n[ref*suppress-period] \
204 . if d ref*post-punct \{\
205 . as ref*string "\\*[ref*post-punct]
215 . ie d ref*spec!T:\\$1 \
216 . ref*field T \\*[ref*spec!T:\\$1]
218 . ref*field T \\*[ref*spec!T]
220 . nr ref*suppress-period \\n([T
225 . ie d ref*spec!PP:\\$1 \
226 . ref*field P \\*[ref*spec!PP:\\$1]
228 . ref*field P \\*[ref*spec!PP]
231 . ie d ref*spec!P:\\$1 \
232 . ref*field P \\*[ref*spec!P:\\$1]
234 . ref*field P \\*[ref*spec!P]
239 . ie ref*spec!J:\\$1 \
240 . ref*field J \\*[ref*spec!J:\\$1]
242 . ref*field J \\*[ref*spec!J]
246 . ie ref*spec!D:\\$1 \
247 . ref*field D \\*[ref*spec!D:\\$1]
249 . ref*field D \\*[ref*spec!D]
253 . ie ref*spec!E:\\$1 \
254 . ref*field E \\*[ref*spec!E:\\$1]
256 . ref*field E \\*[ref*spec!E]
260 . ie ref*spec!G:\\$1 \
261 . ref*field G \\*[ref*spec!G:\\$1]
263 . ref*field G \\*[ref*spec!G]
267 . ie ref*spec!B:\\$1 \
268 . ref*field B \\*[ref*spec!B:\\$1]
270 . ref*field B \\*[ref*spec!B]
274 . ie ref*spec!O:\\$1 \
275 . ref*field O \\*[ref*spec!O:\\$1]
277 . ref*field O \\*[ref*spec!O]
279 . nr ref*suppress-period \\n([O
282 .\" nr ref*suppress-period 1
286 . ie ref*spec!A:\\$1 \
287 . ref*field A \\*[ref*spec!A:\\$1]
289 . ref*field A \\*[ref*spec!A]
291 . nr ref*suppress-period \\n([A
295 . ie ref*spec!V:\\$1 \
296 . ref*field V \\*[ref*spec!V:\\$1]
298 . ref*field V \\*[ref*spec!V]
302 . ie ref*spec!N:\\$1 \
303 . ref*field N \\*[ref*spec!N:\\$1]
305 . ref*field N \\*[ref*spec!N]
309 . ie ref*spec!dflt:\\$2 \
310 . ref*field \\$1 \\*[ref*spec!dflt:\\$2]
312 . ref*field \\$1 \\*[ref*spec!dflt]
316 .\" First argument is the field letter.
317 .\" Second argument is the punctuation character to use to separate this
318 .\" field from the previous field.
319 .\" Third argument is a string to insert after the punctuation character of
320 .\" the previous field (normally a space).
321 .\" Fourth argument is a string with which to prefix this field.
322 .\" Fifth argument is a string with which to postfix this field.
323 .\" Sixth argument is a string to add after the punctuation character
324 .\" supplied by the next field.
326 . if d ref*string \{\
327 . ie d ref*post-punct \{\
328 . if !\\n[ref*suppress-period] \
329 . as ref*string "\\$2\"
330 . as ref*string "\\*[ref*post-punct]\\$3\"
334 . as ref*string "\\$2\\$3\"
336 . as ref*string "\\$4\\*([\\$1\\$5
338 . ds ref*post-punct "\\$6\"
339 . nr ref*suppress-period 0