3 .\" This is an interface to 'refer', originally part of 's.tmac'.
5 .\" Copyright (C) 2011-2018 Free Software Foundation, Inc.
6 .\" Written by Werner Lemberg (wl@gnu.org)
8 .\" This file is part of groff.
10 .\" groff is free software; you can redistribute it and/or modify it
11 .\" under the terms of the GNU General Public License as published by
12 .\" the Free Software Foundation, either version 3 of the License, or
13 .\" (at your option) any later version.
15 .\" groff is distributed in the hope that it will be useful, but WITHOUT
16 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 .\" or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 .\" License for more details.
20 .\" You should have received a copy of the GNU General Public License
21 .\" along with this program. If not, see
22 .\" <http://www.gnu.org/licenses/>.
24 .\" Please send comments to groff@gnu.org.
27 .\" The following macros must be defined:
29 .\" ref*error -- print an error message (in $1)
31 .\" ref*text-label-start -- start a reference in text
32 .\" (formatted reference # in $1)
33 .\" ref*text-label-end -- end a reference in text
35 .\" ref*biblio-item-start -- a reference item with label
36 .\" (in $1) in the bibliography block
37 .\" ref*biblio-item-start-nolabel -- a reference item without label in
38 .\" the bibliography block
39 .\" ref*biblio-item-end -- end a reference item in the
40 .\" bibliography block
42 .\" The following macros are optional:
44 .\" ref*item-start-hook -- stuff appended to the ]- macro
45 .\" ref*item-end-hook -- stuff prepended to the ][ macro
46 .\" ref*biblio-start-hook -- stuff appended to the ]< macro
47 .\" ref*biblio-end-hook -- stuff appended to the ]> macro
49 .\" The following strings must be defined:
51 .\" ref*refnum-start -- start reference number formatting
53 .\" ref*refnum-end -- end reference number formatting
56 .\" [. -- start reference number in text
57 .\" (directly inserted by 'refer')
58 .\" .] -- end reference number in text
59 .\" (directly inserted by 'refer')
61 .\" Here is the specification of the five possible reference styles
62 .\" provided by 'refer'. The example entries are taken from the ms
65 .\" ref*spec!0 Q A T S V N P I C D O -- other
66 .\" ref*spec!1 Q A T J S V N P I C D O -- journal article
67 .\" ref*spec!2 Q A T S V P I C D O -- book
68 .\" ref*spec!3 Q A T B E S V P I C D O -- article within book
69 .\" ref*spec!4 Q A T R G P I C D O -- technical report
71 .\" Now the setup for the formatting of reference entries. The given
72 .\" example entries for the various strings are taken from the ms macro
75 .\" Each string defines five arguments which are passed to a macro, with
76 .\" the meaning as below. Please refer to the man page of 'refer' for
77 .\" more details on the fields. To allow fine-tuning, two levels are
78 .\" implemented: For the refer field X and style Y the string
79 .\" 'ref*spec!X:Y' is looked up. If it doesn't exist, the string
80 .\" 'ref*spec!X' is used instead.
82 .\" arg 1 the punctuation character to use to separate this field
83 .\" from the previous field
84 .\" arg 2 a string to insert after the punctuation character of the
85 .\" previous field (normally a space)
86 .\" arg 3 a string with which to prefix this field
87 .\" arg 4 a string with which to postfix this field
88 .\" arg 5 a string to add after the punctuation character supplied
92 .\" ------------------------------------------------------------------
93 .\" ref*spec!A , " " -- author name
94 .\" ref*spec!B "" " " "in \fI" "" "\fP" -- bk title of article
95 .\" ref*spec!D "" " " "(" ")" -- date of publication
96 .\" ref*spec!E , " " "ed. " -- editor
97 .\" ref*spec!G "" " " "(" ")" -- US Gov. ordering #
98 .\" ref*spec!J , " " "\fI" "" "\fP" -- journal name
99 .\" ref*spec!N "" "(" "" ")" -- issue number
100 .\" ref*spec!O . " " -- other information
101 .\" ref*spec!P , " " "p.\~" -- page
102 .\" ref*spec!PP , " " "pp.\~" -- page range
103 .\" ref*spec!T , " " "\\*Q" "" "\\*U" -- journal title
104 .\" ref*spec!T:0 , " " "\fI" "" "\fP" -- book title (other)
105 .\" ref*spec!T:2 , " " "\fI" "" "\fP" -- book title (book)
106 .\" ref*spec!V "" " " "\fB" "\fR" -- volume number
108 .\" ref*spec!dflt , " " -- all other entries
110 .\" start of reference
112 . rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
114 . if d ref*item-start-hook \
115 . ref*item-start-hook
121 . if d ref*item-end-hook \
123 . ie d ref*spec!\\$1 \
124 . ref*build \\$1 \\*[ref*spec!\\$1]
126 . ref*error "unknown reference type '\\$1'"
127 . ref*build 0 \\*[ref*spec!0]
135 .\" period before reference
138 .\" period after reference
141 .\" comma before reference
144 .\" comma after reference
148 .\" start collected references
150 . als ref*print ref*end-print
151 . if d ref*biblio-start-hook \
152 . ref*biblio-start-hook
156 .\" end collected references
158 . als ref*print ref*normal-print
159 . if d ref*biblio-end-hook \
160 . ref*biblio-end-hook
166 . ref*text-label-start \
167 "\\*[ref*refnum-start]\\*([F\\*[ref*refnum-end]"
169 . ref*text-label-start \&
170 . nop \\*[ref*string]
177 . ref*biblio-item-start "\\*([F."
179 . ref*biblio-item-start-nolabel
180 . nop \\*[ref*string]
181 . ref*biblio-item-end
185 .als ref*print ref*normal-print
188 . rm ref*string ref*post-punct
189 . nr ref*suppress-period 1
194 . ie d ref*add-\\$1 \
195 . ref*add-\\$1 \\n[ref*style]
197 . ref*add-dflt \\$1 \\n[ref*style]
201 . \" now add a final period
202 . ie d ref*string \{\
203 . if !\\n[ref*suppress-period] \
205 . if d ref*post-punct \{\
206 . as ref*string "\\*[ref*post-punct]
216 . ie d ref*spec!T:\\$1 \
217 . ref*field T \\*[ref*spec!T:\\$1]
219 . ref*field T \\*[ref*spec!T]
221 . nr ref*suppress-period \\n([T
226 . ie d ref*spec!PP:\\$1 \
227 . ref*field P \\*[ref*spec!PP:\\$1]
229 . ref*field P \\*[ref*spec!PP]
232 . ie d ref*spec!P:\\$1 \
233 . ref*field P \\*[ref*spec!P:\\$1]
235 . ref*field P \\*[ref*spec!P]
240 . ie ref*spec!J:\\$1 \
241 . ref*field J \\*[ref*spec!J:\\$1]
243 . ref*field J \\*[ref*spec!J]
247 . ie ref*spec!D:\\$1 \
248 . ref*field D \\*[ref*spec!D:\\$1]
250 . ref*field D \\*[ref*spec!D]
254 . ie ref*spec!E:\\$1 \
255 . ref*field E \\*[ref*spec!E:\\$1]
257 . ref*field E \\*[ref*spec!E]
261 . ie ref*spec!G:\\$1 \
262 . ref*field G \\*[ref*spec!G:\\$1]
264 . ref*field G \\*[ref*spec!G]
268 . ie ref*spec!B:\\$1 \
269 . ref*field B \\*[ref*spec!B:\\$1]
271 . ref*field B \\*[ref*spec!B]
275 . ie ref*spec!O:\\$1 \
276 . ref*field O \\*[ref*spec!O:\\$1]
278 . ref*field O \\*[ref*spec!O]
280 . nr ref*suppress-period \\n([O
283 .\" nr ref*suppress-period 1
287 . ie ref*spec!A:\\$1 \
288 . ref*field A \\*[ref*spec!A:\\$1]
290 . ref*field A \\*[ref*spec!A]
292 . nr ref*suppress-period \\n([A
296 . ie ref*spec!V:\\$1 \
297 . ref*field V \\*[ref*spec!V:\\$1]
299 . ref*field V \\*[ref*spec!V]
303 . ie ref*spec!N:\\$1 \
304 . ref*field N \\*[ref*spec!N:\\$1]
306 . ref*field N \\*[ref*spec!N]
310 . ie ref*spec!dflt:\\$2 \
311 . ref*field \\$1 \\*[ref*spec!dflt:\\$2]
313 . ref*field \\$1 \\*[ref*spec!dflt]
317 .\" First argument is the field letter.
318 .\" Second argument is the punctuation character to use to separate this
319 .\" field from the previous field.
320 .\" Third argument is a string to insert after the punctuation character
321 .\" of the previous field (normally a space).
322 .\" Fourth argument is a string with which to prefix this field.
323 .\" Fifth argument is a string with which to postfix this field.
324 .\" Sixth argument is a string to add after the punctuation character
325 .\" supplied by the next field.
327 . if d ref*string \{\
328 . ie d ref*post-punct \{\
329 . if !\\n[ref*suppress-period] \
330 . as ref*string "\\$2\"
331 . as ref*string "\\*[ref*post-punct]\\$3\"
335 . as ref*string "\\$2\\$3\"
337 . as ref*string "\\$4\\*([\\$1\\$5
339 . ds ref*post-punct "\\$6\"
340 . nr ref*suppress-period 0
344 .\" ====================================================================
346 .\" ====================================================================
352 .\" vim: set filetype=groff textwidth=72: