|
|
1.1 root 1: ###
2: ### att reference formatting style
3: ###
4:
5: BEGIN {
6: PASS = ""; # only one pass thru document
7: sortflag = 0; # reference_placement bibliography is not sorted
8: STYLE = "att";
9: SKEY = "adt";
10: }
11:
12:
13: #######################################################
14: #
15: # Functions required by general awk script
16: #
17: #######################################################
18:
19:
20: ##
21: ## Set author and editor fields
22: ## for reference
23: ## for possible sorting
24: ##
25: func setauthor(b,a) {
26: Afull[b,a] = LastF_M();
27: Asort[b] = Asort[b] Afull[b,a] " ";
28: }
29:
30:
31: func seteditor(b,a) {
32: E[b,a] = LastF_M();
33: Ename[b,a] = F_M_Last();
34: Esort[b] = Esort[b] E[b,a] " ";
35: }
36:
37:
38:
39: ##
40: ## citations
41: ## print a citation list
42: ## troff superscripted numbers
43: ## nroff numbers in square brackets
44: ##
45: func citations(tpunc) {
46:
47: seq = "no";
48: sep = "";
49:
50: # troff citation
51:
52: if(nroff == 0) {
53: tcite = "";
54: begin_super = "\\^\\s-2\\v'-0.4m'\\f1\\&";
55: end_super = "\\fP\\v'0.4m'\\s+2"
56: if(quote(tpunc) || period(tpunc))
57: end_super = end_super "\\ ";
58:
59: # format the list of citations, putting in commas and hypens
60:
61: for(i=1; i<=cites; i++) {
62: seq = sequence(i,cites);
63: if (seq == "in") continue;
64: if (seq == "end") {
65: sep = "-";
66: seq = "no";
67: }
68: tcite = tcite sep makemark(i);
69: sep = ",\\ ";
70: }
71: printf "%s%s%s%s", tpunc, begin_super, tcite, end_super;
72: }
73:
74: # nroff citation
75:
76: else {
77: ncite = "\n";
78: if(quote(tpunc)) {
79: ncite = tpunc " ";
80: tpunc = "\\ ";
81: }
82: else if(tpunc == "(") {
83: ncite = tpunc;
84: tpunc = "";
85: }
86:
87: # format the list of citations, putting in commas and hypens
88:
89: for(i=1; i<=cites; i++) {
90: seq = sequence(i,cites);
91: if (seq == "in") continue;
92: if (seq == "end") {
93: sep = "-";
94: seq = "no";
95: }
96: ncite = ncite sep "[" makemark(i) "]";
97: sep = ", ";
98: }
99: printf "%s%s", ncite, tpunc;
100: }
101: }
102:
103: func quote(punc) {
104: if(tpunc == "\"" || tpunc == "'") return 1;
105: return 0;
106: }
107:
108: func period(punc) {
109: if (tpunc == "." || tpunc == "!" || tpunc == "?") return 1;
110: return 0;
111: }
112:
113:
114: ##
115: ## makemark
116: ## return citation mark: identical citations have the same number
117: ##
118: func makemark(m) {
119: return(uniqno[bibptr[m]]);
120: }
121:
122:
123: ##
124: ## bibindex
125: ## print citation mark for the bibliography;
126: ## return an index for accessing rest of citation
127: ##
128: func bibindex(b) {
129: printf ".sp .5\n.ti -\\w'[" b "]\\ \\ \\ 'u\n";
130: printf "[" b "]\\ \\ \\ " ;
131: if(sortflag) return sortorder[b];
132: else return b;
133: }
134:
135:
136:
137: #############################################
138: #
139: # Reference types
140: #
141: ############################################
142:
143:
144: func book(b) {
145: punc = ""
146: # authorlist,
147: if(authors[b]) {
148: authorlist(b);
149: punc = ",\n";
150: }
151: # italic(title),
152: if (title[b]) {
153: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
154: punc = ",\n";
155: }
156: # volume,
157: if(volstr[b]) {
158: printf "%s%s", punc, volstr[b];
159: punc = ",\n";
160: }
161: else if(volume[b]) {
162: printf "%sVol. %s", punc, volume[b];
163: punc = ",\n";
164: }
165: # pages,
166: if (pages[b]) {
167: if ( pages[b] ~ /[,-]/ )
168: printf "%spp. %s", punc, pages[b];
169: else printf "%sp. %s", punc, pages[b];
170: punc = ",\n";
171: }
172: # publisher,
173: printf "%s%s", punc, issuer[b] ;
174: punc = ",\n";
175: # location
176: if (city[b])
177: printf "%s%s", punc, city[b] ;
178: # (date)
179: printf " (%s)", date[b] ;
180: }
181:
182:
183: func editedbook(b) {
184:
185: punc = "";
186: # authorlist (Eds.),
187: if(authors[b]) {
188: authorlist(b);
189: if(authors[b] <2)
190: printf " (Ed.)";
191: else
192: printf " (Eds.)";
193: punc = ",\n";
194: }
195: # italic(title),
196: if (title[b]) {
197: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
198: punc = ",\n";
199: }
200: # volume,
201: if(volstr[b]) {
202: printf "%s%s", punc, volstr[b];
203: punc = ",\n";
204: }
205: else if(volume[b]) {
206: printf "%sVol. %s", punc, volume[b];
207: punc = ",\n";
208: }
209: # publisher,
210: printf "%s%s", punc, issuer[b] ;
211: punc = ",\n";
212: # location,
213: if (city[b] != "")
214: printf "%s%s", punc, city[b] ;
215: # pages
216: if ( pages[b] != "" ) {
217: if ( pages[b] ~ /[,-]/ )
218: printf "%spp. %s", punc, pages[b];
219: else printf "%sp. %s", punc, pages[b];
220: }
221: # (date)
222: printf " (%s)", date[b] ;
223: }
224:
225: func thesis(b) {
226:
227: punc = ""
228: # authorlist,
229: if(authors[b]) {
230: authorlist(b);
231: punc = ",\n"
232: }
233: # italic(title),
234: if(title[b]) {
235: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
236: punc = ",\n"
237: }
238: # thesis,
239: printf punc;
240: if(reftype[b] == "phdthesis")
241: printf "PhD Thesis";
242: else
243: printf "Master's Thesis";
244: punc = ",\n";
245: # report number,
246: if(report[b])
247: printf "%s%s", punc, report[b];
248: # school
249: printf "%s%s", punc, issuer[b];
250: # (date)
251: printf " (%s)", date[b] ;
252: }
253:
254: func review(b) {
255: article(b);
256: }
257:
258:
259: func article(b) {
260:
261: punc = "";
262: # authorlist,
263: if(authors[b]) {
264: authorlist(b);
265: punc = ",\n"
266: }
267: # ``Title,''
268: if(title[b]) {
269: if(nroff)
270: printf "%s\"%s,\"", punc, title[b] ;
271: else
272: printf "%s``%s,''", punc, title[b] ;
273: punc = "\n";
274: }
275: # Reviewed title and author
276: if(booktitle[b]) {
277: printf "%sReview of \\f2\\&%s\\f1\\&", punc, booktitle[b];
278: if(editors[b]) {
279: printf " by ";
280: enamelist(b);
281: }
282: if (issuer[b]) {
283: printf " %s", issuer[b];
284: }
285: punc = ",\n";
286: }
287: # italics(journal)
288: printf "%s\\f2\\&%s\\f1\\&", punc, journal[b];
289: punc = ",\n";
290: # bold(volume)(number Pt part),
291: if (volstr[b])
292: printf " \\f3\\&%s\\f1\\&", volstr[b] ;
293: else if (volume[b])
294: printf " \\f3\\&%s\\f1\\&", volume[b] ;
295: if (numstr[b]) {
296: printf "(%s", numstr[b];
297: if(partstr[b])
298: printf " %s", partstr[b];
299: else if(part[b])
300: printf " Pt. %s", part[b];
301: printf ")";
302: }
303: else if (number[b]) {
304: printf "(%s", number[b];
305: if(partstr[b])
306: printf " %s", partstr[b];
307: else if(part[b])
308: printf " Pt. %s", part[b];
309: printf ")";
310: }
311: # pages,
312: if ( pages[b]) {
313: if ( pages[b] ~ /[,-]/ )
314: printf "%spp. %s", punc, pages[b];
315: else printf "%sp. %s", punc,pages[b];
316: }
317: # publisher
318: if(issuer[b])
319: if(authors[b] || editors[b])
320: printf "%s%s", punc, issuer[b];
321: # (date)
322: printf " (%s)", date[b];
323: }
324:
325:
326:
327:
328: func incollection(b) {
329:
330: punc = "";
331: # Authorlist
332: if(authors[b]) {
333: authorlist(b);
334: punc = ",\n";
335: }
336: # ``Title,''
337: if(title[b]) {
338: if(nroff)
339: printf "%s\"%s,\"", punc, title[b] ;
340: else
341: printf "%s``%s,''", punc, title[b] ;
342: punc = "\n";
343: }
344: # pages
345: if ( pages[b]) {
346: if ( pages[b] ~ /[,-]/ )
347: printf "%spp. %s ", punc, pages[b];
348: else printf "%sp. %s ", punc, pages[b];
349: punc = "";
350: }
351: # in italics(booktitle),
352: printf "%sin \\f2\\&%s\\f1\\&", punc, booktitle[b];
353: punc = ",\n";
354: # volume,
355: if(volstr[b]) {
356: printf "%s%s", punc, volstr[b];
357: }
358: else if(volume[b]) {
359: printf "%sVol. %s", punc, volume[b];
360: }
361: # editorlist (Ed.),
362: if(editors[b]) {
363: printf punc;
364: editorlist(b);
365: if (editors[b] == 1) printf " (Ed.)"
366: else if (editors[b] > 1) printf " (Eds.)"
367: }
368: # publisher, location,
369: printf "%s%s", punc, issuer[b]
370: if (city[b])
371: printf ", %s", city[b] ;
372: # (date)
373: printf " (%s)", date[b];
374: }
375:
376:
377: func inproceedings(b) {
378:
379: punc = "";
380: # authorlist
381: if(authors[b]) {
382: authorlist(b);
383: punc = ",\n";
384: }
385: # ``Title,''
386: if(title[b]) {
387: if(nroff)
388: printf "%s\"%s,\"", punc,title[b] ;
389: else
390: printf "%s``%s,''", punc,title[b] ;
391: punc = "\n";
392: }
393:
394: # italics(journal)
395: printf "%s\\f2\\&%s\\f1\\&", punc, journal[b];
396: punc = ",\n";
397: # bold(vol)(no Pt. #),
398: if (volstr[b])
399: printf " \\f3\\&%s\\f1\\&", volstr[b] ;
400: else if (volume[b])
401: printf " \\f3\\&%s\\f1\\&", volume[b] ;
402: if (numstr[b]) {
403: printf "(%s", numstr[b];
404: if(partstr[b])
405: printf " %s", partstr[b];
406: else if(part[b])
407: printf " Pt. %s", part[b];
408: printf ")";
409: }
410: else if (number[b]) {
411: printf "(%s", number[b];
412: if(partstr[b])
413: printf " %s", partstr[b];
414: else if(part[b])
415: printf " Pt. %s", part[b];
416: printf ")";
417: }
418: # pages,
419: if ( pages[b]) {
420: if ( pages[b] ~ /[,-]/ )
421: printf "%spp. %s", punc, pages[b];
422: else printf "%sp. %s", punc, pages[b];
423: }
424: # editorlist (Ed.),
425: if(editors[b]) {
426: printf punc;
427: editorlist(b);
428: if (editors[b] == 1) printf " (Ed.)"
429: else if (editors[b] > 1) printf " (Eds.)"
430: }
431: # publisher
432: if(issuer[b])
433: if(authors[b] || editors[b])
434: printf "%s%s", punc, issuer[b];
435: if (city[b])
436: printf "%s%s", punc, city[b] ;
437: # (date)
438: printf " (%s)", date[b];
439: }
440:
441: func proceedings(b) {
442: punc = "";
443: # authorlist,
444: if(authors[b]) {
445: authorlist(b);
446: punc = ",\n";
447: }
448:
449: # editorlist (Ed.),
450: else if(editors[b]) {
451: printf punc;
452: editorlist(b);
453: if (editors[b] == 1) printf " (Ed.)"
454: else if (editors[b] > 1) printf " (Eds.)"
455: punc = ",\n";
456: }
457: # publisher,
458: else if(issuer[b]) {
459: printf "%s%s", punc, issuer[b];
460: punc = ",\n";
461: }
462: # italics(title)
463: if(title[b]) {
464: printf "%s\\f2\\&%s\\f1\\&", punc,title[b];
465: punc = " ";
466: }
467: # bold(vol)(no Pt. #),
468: if (volstr[b]) {
469: printf "%s\\f3\\&%s\\f1\\&", punc,volstr[b];
470: punc = ",\n";
471: }
472: else if (volume[b]) {
473: printf "%s\\f3\\&%s\\f1\\&", punc,volume[b];
474: punc = ",\n";
475: }
476: if (numstr[b]) {
477: printf "(%s", numstr[b];
478: if(partstr[b])
479: printf " %s", partstr[b];
480: else if(part[b])
481: printf " Pt. %s", part[b];
482: printf ")";
483: }
484: else if (number[b]) {
485: printf "(%s", number[b];
486: if(partstr[b])
487: printf " %s", partstr[b];
488: else if(part[b])
489: printf " Pt. %s", part[b];
490: printf ")";
491: }
492: # publisher,
493: if(issuer[b])
494: if(authors[b] != 0 || editors[b] != 0) {
495: printf "%s%s", punc, issuer[b];
496: punc = ",\n";
497: }
498: # location,
499: if (city[b])
500: printf "%s%s", punc, city[b] ;
501: # (date)
502: if (date[b])
503: printf " (%s)", date[b];
504: }
505:
506: func techreport(b) {
507:
508: punc = "";
509: # authorlist,
510: if(authors[b]) {
511: authorlist(b);
512: punc = ",\n";
513: }
514: # ``Title,''
515: if(title[b]) {
516: if(nroff)
517: printf "%s\"%s,\"", punc, title[b] ;
518: else
519: printf "%s``%s,''", punc, title[b] ;
520: punc = "\n";
521: }
522: # report,
523: printf "%s%s", punc, report[b];
524: punc = ",\n";
525: # publisher,
526: if (issuer[b]) printf "%s%s", punc, issuer[b] ;
527: # location
528: if (city[b])
529: printf "%s%s", punc, city[b] ;
530: # (date)
531: printf " (%s)", date[b] ;
532: }
533:
534:
535: func tm(b) {
536:
537: punc = ""
538: # authorlist
539: if(authors[b]) {
540: authorlist(b);
541: punc = ",\n";
542: }
543: # italic(title),
544: if(title[b]) {
545: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
546: punc = ",\n";
547: }
548: # tmno
549: printf punc;
550: if(rp)
551: printf "AT&T Bell Laboratories internal memorandum";
552: else
553: printf "%s", tmno[b]
554: # (date)
555: printf " (%s)", date[b] ;
556: }
557:
558:
559: func manual(b) {
560: punc = "";
561: # authorlist,
562: if(authors[b]) {
563: authorlist(b);
564: punc = ",\n";
565: }
566: # editorlist (Ed.),
567: else if(editors[b] > 0) {
568: printf punc;
569: editorlist(b);
570: if (editors[b] == 1) printf " (Ed.)"
571: else if (editors[b] > 1) printf " (Eds.)"
572: punc = ",\n"
573: }
574: # publisher,
575: else if(issuer[b]) {
576: printf "%s%s", punc, issuer[b];
577: punc = ",\n";
578: }
579: # italic(title),
580: if(title[b]) {
581: printf "%s\\f2\\&%s\\f1\\&", punc, title[b];
582: punc = ",\n";
583: }
584: # volume,
585: if(volstr[b]) {
586: printf "%s%s", punc, volstr[b];
587: }
588: else if(volume[b]) {
589: printf "%sVol. %s", punc, volume[b];
590: }
591: # publisher,
592: if(issuer[b])
593: if(authors[b] || editors[b] ) {
594: printf "%s%s", punc, issuer[b];
595: punc = ",\n";
596: }
597: # location,
598: if (city[b])
599: printf "%s%s", punc, city[b] ;
600: # pages
601: if (pages[b]) {
602: if ( pages[b] ~ /[,-]/ )
603: printf "%spp. %s", punc, pages[b];
604: else
605: printf "%sp. %s", punc, pages[b];
606: }
607: # (date)
608: printf " (%s)", date[b];
609: }
610:
611: func pamphlet(b)
612: {
613: punc = "";
614: # authorlist,
615: if(authors[b]) {
616: authorlist(b);
617: punc = ",\n";
618: }
619:
620: # publisher,
621: else if(issuer[b]) {
622: printf "%s%s", punc, issuer[b];
623: punc = ",\n";
624: }
625: # ``Title,''
626: if(title[b]) {
627: printf "%s\\f2\\&%s\\f1\\&", punc, title[b] ;
628: punc = ",\n";
629: }
630: # publisher,
631: if(issuer[b]) {
632: if(authors[b] || editors[b]) {
633: printf "%s%s", punc, issuer[b];
634: }
635: }
636: # location
637: if (city[b]) {
638: printf "%s%s", punc, city[b] ;
639: }
640: # (date),
641: if (date[b]) {
642: printf " (%s)", date[b];
643: }
644: }
645:
646: func default(b) {
647: punc = "";
648: # authorlist,
649: if(authors[b]) {
650: authorlist(b);
651: punc = ",\n";
652: }
653:
654: # publisher,
655: else if(issuer[b]) {
656: printf "%s%s", punc, issuer[b];
657: punc = ",\n";
658: }
659: # title,
660: if(title[b]) {
661: printf "%s\\f2\\&%s\\f1\\&", punc, title[b] ;
662: punc = ",\n";
663: }
664: # volume,
665: if(volstr[b]) {
666: printf "%s%s", punc, volstr[b];
667: }
668: else if(volume[b]) {
669: printf "%sVol. %s", punc, volume[b];
670: }
671: # publisher,
672: if(issuer[b]) {
673: if(authors[b] || editors[b]) {
674: printf "%s%s", punc, issuer[b];
675: }
676: }
677: # location,
678: if (city[b]) {
679: printf "%s%s", punc, city[b] ;
680: }
681: # pages
682: if (pages[b]) {
683: if ( pages[b] ~ /[,-]/ )
684: printf "%spp. %s", punc, pages[b];
685: else
686: printf "%sp. %s", punc, pages[b];
687: }
688: # (date)
689: if (date[b]) {
690: printf " (%s)", date[b];
691: }
692: }
693:
694:
695:
696: ##
697: ## authorlist
698: ## First
699: ## First and Second
700: ## First, Second,..., and Last
701: ##
702: func authorlist(b) {
703: if ( authors[b] == 0 ) ;
704: else if ( authors[b] == 1 ) {
705: printf Afull[b,1] ;
706: if(aetal[b]) printf ", et al.";
707: }
708: else if ( authors[b] == 2 ) printf Afull[b,1] " and " Afull[b,2];
709: else {
710: for ( j = 1; j < authors[b]; j++ ) print Afull[b,j] ", ";
711: printf "and " Afull[b,authors[b]];
712: }
713: }
714:
715:
716: ##
717: ## editorlist
718: ## First
719: ## First and Second
720: ## First, Second,..., and Last
721: ##
722: func editorlist(b) {
723: if ( editors[b] == 0 ) ;
724: else if ( editors[b] == 1 ) {
725: printf E[b,1] ;
726: if(eetal[b]) printf ", et al.";
727: }
728: else if ( editors[b] == 2 ) printf E[b,1] " and " E[b,2];
729: else {
730: for ( j = 1; j < editors[b]; j++ ) print E[b,j] ", ";
731: printf "and " E[b,editors[b]];
732: }
733: }
734:
735: ##
736: ## enamelist
737: ## First
738: ## First and Second
739: ## First, Second,..., and Last
740: ##
741: func enamelist(b) {
742: if ( editors[b] == 0 ) ;
743: else if ( editors[b] == 1 ) {
744: printf Ename[b,1] ;
745: if(eetal[b]) printf ", et al.";
746: }
747: else if ( editors[b] == 2 ) printf Ename[b,1] " and " Ename[b,2];
748: else {
749: for ( j = 1; j < editors[b]; j++ ) print Ename[b,j] ", ";
750: printf "and " Ename[b,editors[b]];
751: }
752: }
753:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.