/utphys

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/utphys/
11 by Jacques Distler
Ack! Restore changes from version 2.7
1
% UT Physics bibliographic style, ver. 2.8. Based on:
1 by Jacques Distler
Initial Commits
2
%
3
%X     IEEE Transactions bibliography style (29-Jan-88 version)
4
%X       numeric labels, order-of-reference, IEEE abbreviations,
5
%X       quotes around article titles, commas separate all fields
6
%X       except after book titles and before "notes".  Otherwise,
7
%X       much like the "plain" family, from which this is adapted.
8
%X
9
%X       History
10
%X       9/30/85	(HWT)	Original version, by Howard Trickey.
11
%X       1/29/88	(OP&HWT) Updated for BibTeX version 0.99a, Oren Patashnik;
12
%X       THIS `ieeetr' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
13
%
14
%  Modifications: 1) added hypertex support and "archive", "eprint"
15
%                    and "url" fields.
16
%                 2) parentheses around dates, and no "pp." for article entries
17
%                 3) "publisher, address" instead of "address: publisher"
18
%                 4) added "report" field for article entries.
19
%                 5) particle physics-oriented abbreviations, rather than ieee.
20
%                 6) added "collaboration" field, as per 
21
%                    Jonathan Flynn' suggestion. SPIRES now supports this field.
22
%                 7) Improved output of Proceedings entries
23
%
12 by Jacques Distler
Better (or, at least, DRYer).
24
%    Modified by Jacques Distler, 12/18
1 by Jacques Distler
Initial Commits
25
%           History: ver 1.0  9/96
26
%                    ver 1.1 10/96 - added "collaboration" field
27
%                    ver 1.2  7/97 - added a "\providecommand{\href}[2]{#2}"
28
%                                    to handle case where \href is not defined
29
%                    ver 1.3 12/97 - fixed lousy-looking proceedings output.
30
%                    ver 1.4  1/98 - fixed format.number, address in 
31
%                                    proceedings entries
32
%                    ver 1.5  3/99 - added (nonprinting) CITATION field for
33
%                                    SLAC internal use
34
%                    ver 1.6  4/99 - Fix to ensure %%CITATION output not broken
35
%                                    across lines. Added new.sentence to ensure
36
%                                    previous output properly terminated.
37
%                                    (Moral: test before you release.)
38
%                    ver 1.7 10/99 - "et.~al." should be "et al." Morons!
39
%                    ver 1.8 11/99 - Changed the Web URL to the more portable
40
%                                    arxiv.org. The "archive" field functions as
41
%                                    a true base-URL. This is NOT A
42
%                                    BACKWARDS-COMPATIBLE change!
43
%                   ver 1.8a 12/99 - MACROs for arXiv and cogprints
44
%                                    BaseURL's defined.
45
%                   ver 1.9   6/05 - eprint support for other entry types
46
%                   ver 2.0   4/08 - support "new-style" eprint identifiers
47
%                   ver 2.1   4/08 - support for "url" field
2 by Jacques Distler
Preliminary DOI support
48
%                   ver 2.2   4/08 - support for "doi" field
4 by Jacques Distler
Fix Month Formatting
49
%                   ver 2.3   8/09 - fix month formatting
5 by Jacques Distler
Journal Number
50
%                   ver 2.4   7/10 - remove some deprecated font-constructws.
51
%                                    fix journal number formatting.
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
52
%                   ver 2.5   9/10 - Internationalization and some more journal
53
%                                    MACROs (thanks to Mateus Araujo)
11 by Jacques Distler
Ack! Restore changes from version 2.7
54
%                   ver 2.7   8/11 - Fix "et~al." in format.crossref.editor, too.
55
%                                    (Reported by Blake Stacey)
56
%                   ver 2.8  12/18 - Fix format.title and format.title.p for when the
10 by Jacques Distler
Fix format.title and format.title.p for when
57
%                                    title contains trailing punctuation.
1 by Jacques Distler
Initial Commits
58
%
59
% HyperTeX Wizardry:
60
%
61
% The following are equivalent:
62
%   archive  =  arXiv
63
%   eprint   = "hep-th/9605023"
64
% and
65
%   eprint   = "hep-th/9605023"
66
% both produce 
67
%
5 by Jacques Distler
Journal Number
68
%    \href{http://arxiv.org/abs/hep-th/9605023}{{\ttfamily hep-th/9605023}}
1 by Jacques Distler
Initial Commits
69
%
70
% in the bibliographic output at the appropriate point. More generally,
71
% if the archive field is present, we produce a URL of the form
72
% "archive/eprint" as the first argument of the \href. If absent, the base
73
% URL defaults to "http://arxiv.org/abs"
74
% If you are using a hypertex macropackage, like hyperref.sty, this command
75
% will create a link to the eprint at Los Alamos (or wherever).
76
%
77
% "New-style" arXiv identifiers are also supported.
78
%
5 by Jacques Distler
Journal Number
79
%     archivePrefix = "arXiv",
80
%     eprint    = "0707.3168",
1 by Jacques Distler
Initial Commits
81
%     primaryClass = "hep-th",
82
%
83
% produces
84
%
5 by Jacques Distler
Journal Number
85
%     \href{http://arxiv.org/abs/0707.3168}{{\ttfamily arXiv:0707.3168 [hep-th]}}
1 by Jacques Distler
Initial Commits
86
%
87
% Another (non-arXiv) example:
88
%
89
%     archive = "http://cogprints.org",
90
%     eprint = "5542",
91
%     archivePrefix = "Cogprints",
92
%
93
%  produces
94
%
5 by Jacques Distler
Journal Number
95
%     \href{http://cogprints.org/5542}{{\ttfamily Cogprints:5542}}  
1 by Jacques Distler
Initial Commits
96
%
3 by Jacques Distler
Add DOI support for various entry types
97
%  If a
98
%
99
%       doi = "10.xxxx"
100
%
101
%  field is present, then the journal reference becomes a
5 by Jacques Distler
Journal Number
102
%  clickable hyperlink to the online journal version of the paper.
2 by Jacques Distler
Preliminary DOI support
103
%
1 by Jacques Distler
Initial Commits
104
% The bibtex output produced by SPIRES, while far from perfect, is pretty
105
% suitable for use with this style. Indeed, this style was designed with
106
% SPIRES in mind.
107
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
108
FUNCTION {string.and} {" and "}
109
FUNCTION {string.editors} {", eds."}
110
FUNCTION {string.editor} {", ed."}
111
FUNCTION {string.edition} {"~ed."}
112
FUNCTION {string.volume} {"vol.~"}
113
FUNCTION {string.capsvolume} {"Vol.~"}
114
FUNCTION {string.of} {" of "}
115
FUNCTION {string.number} {"no.~"}
116
FUNCTION {string.capsnumber} {"No.~"}
117
FUNCTION {string.in} {"in "}
118
FUNCTION {string.spacein} {" in "}
119
FUNCTION {string.capsin} {"In "}
120
FUNCTION {string.multipages} {"pp.~"}
121
FUNCTION {string.pages} {"p.~"}
122
FUNCTION {string.chapter} {"ch.~"}
123
FUNCTION {string.techrep} {"Tech. Rep."}
124
FUNCTION {string.mastersthesis} {"Master's thesis"}
125
FUNCTION {string.phdthesis} {"PhD thesis"}
126
127
MACRO {jan} {"Jan."}
128
MACRO {feb} {"Feb."}
129
MACRO {mar} {"Mar."}
130
MACRO {apr} {"Apr."}
131
MACRO {may} {"May"}
132
MACRO {jun} {"June"}
133
MACRO {jul} {"July"}
134
MACRO {aug} {"Aug."}
135
MACRO {sep} {"Sept."}
136
MACRO {oct} {"Oct."}
137
MACRO {nov} {"Nov."}
138
MACRO {dec} {"Dec."}
139
MACRO {am} {"Acta Math."}
140
MACRO {amj} {"Am. J. Phys."}
141
MACRO {ap} {"Ann. Phys."}
142
MACRO {cmp} {"Comm. Math. Phys."}
143
MACRO {ijmp} {"Int. Jour. Mod. Phys."}
144
MACRO {mpl} {"Mod. Phys. Lett."}
145
MACRO {njp} {"New J. Phys"}
146
MACRO {nup} {"Nucl. Phys."}
147
MACRO {pl} {"Phys. Lett."}
148
MACRO {pla} {"Phys. Lett. A"}
149
MACRO {pr} {"Phys. Rev."}
150
MACRO {pra} {"Phys. Rev. A"}
151
MACRO {prl} {"Phys. Rev. Lett."}
152
MACRO {repmp} {"Rep. Math. Phys"}
153
MACRO {rmp} {"Rev. Mod. Phys."}
154
155
MACRO {arXiv}     {"http://arxiv.org/abs"}
156
MACRO {cogprints} {"http://cogprints.org"}
157
MACRO {pubmed}    {"http://www.ncbi.nlm.nih.gov/pubmed"}
158
1 by Jacques Distler
Initial Commits
159
ENTRY
160
  { address
161
    author
162
    booktitle
163
    chapter
164
    edition
165
    editor
166
    howpublished
167
    institution
168
    journal
169
    key
170
    month
171
    note
172
    number
173
    organization
174
    pages
175
    publisher
176
    school
177
    series
178
    title
179
    type
180
    volume
181
    year
182
    archive
183
    eprint
184
    report
185
    collaboration
186
    SLACcitation
187
    archivePrefix
188
    primaryClass
189
    url
2 by Jacques Distler
Preliminary DOI support
190
    doi
1 by Jacques Distler
Initial Commits
191
  }
192
  {}
193
  { label }
194
195
INTEGERS { output.state before.all mid.sentence after.quote after.sentence
196
		after.quoted.block after.block }
197
198
FUNCTION {init.state.consts}
199
{ #0 'before.all :=
200
  #1 'mid.sentence :=
201
  #2 'after.quote :=
202
  #3 'after.sentence :=
203
  #4 'after.quoted.block :=
204
  #5 'after.block :=
205
}
206
207
STRINGS { s t }
208
209
FUNCTION {output.nonnull}
210
{ 's :=
211
  output.state mid.sentence =
212
    { ", " * write$ }
213
    { output.state after.quote =
214
	{ " " * write$ }
215
	{ output.state after.block =
216
	    { add.period$ write$
217
	      newline$
218
	      "\newblock " write$
219
	    }
220
	    { output.state before.all =
221
		'write$
222
		{ output.state after.quoted.block =
223
		    { write$
224
		      newline$
225
		      "\newblock " write$
226
		    }
227
		    { add.period$ " " * write$ }
228
		  if$
229
		}
230
	      if$
231
	    }
232
	  if$
233
	}
234
      if$
235
      mid.sentence 'output.state :=
236
    }
237
  if$
238
  s
239
}
240
241
FUNCTION {output}
242
{ duplicate$ empty$
243
    'pop$
244
    'output.nonnull
245
  if$
246
}
247
248
FUNCTION {output.check}
249
{ 't :=
250
  duplicate$ empty$
251
    { pop$ "empty " t * " in " * cite$ * warning$ }
252
    'output.nonnull
253
  if$
254
}
255
256
FUNCTION {output.bibitem}
257
{ newline$
258
  "\bibitem{" write$
259
  cite$ write$
260
  "}" write$
261
  newline$
262
  ""
263
  before.all 'output.state :=
264
}
265
266
FUNCTION {blank.sep}
267
{ after.quote 'output.state :=
268
}
269
270
FUNCTION {fin.entry}
271
{ output.state after.quoted.block =
272
    'skip$
273
    'add.period$
274
  if$
275
  write$
276
  newline$
277
}
278
279
FUNCTION {new.block}
280
{ output.state before.all =
281
    'skip$
282
    { output.state after.quote =
283
	{ after.quoted.block 'output.state := }
284
	{ after.block 'output.state := }
285
      if$
286
    }
287
  if$
288
}
289
290
FUNCTION {new.sentence}
291
{ output.state after.block =
292
    'skip$
293
    { output.state before.all =
294
	'skip$
295
	{ after.sentence 'output.state := }
296
      if$
297
    }
298
  if$
299
}
300
301
FUNCTION {not}
302
{   { #0 }
303
    { #1 }
304
  if$
305
}
306
307
FUNCTION {and}
308
{   'skip$
309
    { pop$ #0 }
310
  if$
311
}
312
313
FUNCTION {or}
314
{   { pop$ #1 }
315
    'skip$
316
  if$
317
}
318
319
FUNCTION {new.block.checka}
320
{ empty$
321
    'skip$
322
    'new.block
323
  if$
324
}
325
326
FUNCTION {new.block.checkb}
327
{ empty$
328
  swap$ empty$
329
  and
330
    'skip$
331
    'new.block
332
  if$
333
}
334
335
FUNCTION {new.sentence.checka}
336
{ empty$
337
    'skip$
338
    'new.sentence
339
  if$
340
}
341
342
FUNCTION {field.or.null}
343
{ duplicate$ empty$
344
    { pop$ "" }
345
    'skip$
346
  if$
347
}
348
349
FUNCTION {emphasize}
350
{ duplicate$ empty$
351
    { pop$ "" }
352
    { "{\em " swap$ * "}" * }
353
  if$
354
}
355
356
FUNCTION {capitalize}
357
{ "u" change.case$ "t" change.case$ }
358
359
INTEGERS { nameptr namesleft numnames }
360
361
FUNCTION {format.names}
362
{ 's :=
363
  #1 'nameptr :=
364
  s num.names$ 'numnames :=
365
  numnames 'namesleft :=
366
    { namesleft #0 > }
367
    { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
368
      nameptr #1 >
369
	{ namesleft #1 >
370
	    { ", " * t * }
371
	    { numnames #2 >
372
		{ "," * }
373
		'skip$
374
	      if$
375
	      t "others" =
11 by Jacques Distler
Ack! Restore changes from version 2.7
376
		{ " {\em et~al.}" * }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
377
		{ string.and * t * }
1 by Jacques Distler
Initial Commits
378
	      if$
379
	    }
380
	  if$
381
	}
382
	't
383
      if$
384
      nameptr #1 + 'nameptr :=
385
      namesleft #1 - 'namesleft :=
386
    }
387
  while$
388
}
389
390
FUNCTION {format.authors}
391
{ author empty$
392
    { "" }
393
    { author format.names }
394
  if$
395
}
396
397
FUNCTION {format.archive}
398
{
399
  archivePrefix empty$
400
      { "" }
401
      { archivePrefix ":" *}
402
  if$            
403
}
404
405
FUNCTION {format.primaryClass}
406
{
407
  primaryClass empty$
408
      { "" }
409
      { " [" primaryClass * "]" *}
410
  if$            
411
}
412
413
FUNCTION {format.eprint}
414
{ eprint empty$
415
     { ""}
416
     { archive empty$
417
          {"\href{http://arxiv.org/abs/" eprint * "}" * 
5 by Jacques Distler
Journal Number
418
             "{{\ttfamily " * format.archive * eprint *
1 by Jacques Distler
Initial Commits
419
              format.primaryClass * "}}" *}
420
          {"\href{" archive *  "/" * eprint * "}" * 
5 by Jacques Distler
Journal Number
421
             "{{\ttfamily " * format.archive * eprint *
1 by Jacques Distler
Initial Commits
422
              format.primaryClass * "}}" *}
423
       if$
424
     }
425
     if$
426
}
427
428
FUNCTION {format.url}
429
{ url empty$
430
    { "" }
431
    {"\url{" url * "}" *}
432
  if$
433
}
434
3 by Jacques Distler
Add DOI support for various entry types
435
FUNCTION {add.doi}
436
{ duplicate$ empty$
437
    { skip$ }
438
    { doi empty$
439
        {}
440
        {"\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" *}
441
      if$
442
    }
443
  if$
444
}
445
1 by Jacques Distler
Initial Commits
446
FUNCTION {format.report}
447
{ report empty$
448
     { ""}
449
     { report}
450
     if$
451
}
452
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
453
FUNCTION {format.howpublished}
454
{ howpublished empty$
455
    { "" }
456
    { howpublished capitalize
457
    }
458
  if$
459
}
460
1 by Jacques Distler
Initial Commits
461
FUNCTION {format.editors}
462
{ editor empty$
463
    { "" }
464
    { editor format.names
465
      editor num.names$ #1 >
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
466
	{ string.editors * }
467
	{ string.editor * }
1 by Jacques Distler
Initial Commits
468
      if$
469
    }
470
  if$
471
}
472
473
FUNCTION {format.title}
474
{ title empty$
475
    { "" }
12 by Jacques Distler
Better (or, at least, DRYer).
476
    {title title text.length$ #1 substring$ duplicate$ duplicate$ "?" =
477
     swap$ "!" = or
478
     swap$ "." = or
10 by Jacques Distler
Fix format.title and format.title.p for when
479
      { "``" title * "''" * }
480
      { "``" title * ",''" * }
481
    if$
482
   }
1 by Jacques Distler
Initial Commits
483
  if$
484
}
485
486
FUNCTION {format.title.p}
487
{ title empty$
488
    { "" }
10 by Jacques Distler
Fix format.title and format.title.p for when
489
    { "``" title * add.period$ "''" * }
1 by Jacques Distler
Initial Commits
490
  if$
491
}
492
493
FUNCTION {n.dashify}
494
{ 't :=
495
  ""
496
    { t empty$ not }
497
    { t #1 #1 substring$ "-" =
498
	{ t #1 #2 substring$ "--" = not
499
	    { "--" *
500
	      t #2 global.max$ substring$ 't :=
501
	    }
502
	    {   { t #1 #1 substring$ "-" = }
503
		{ "-" *
504
		  t #2 global.max$ substring$ 't :=
505
		}
506
	      while$
507
	    }
508
	  if$
509
	}
510
	{ t #1 #1 substring$ *
511
	  t #2 global.max$ substring$ 't :=
512
	}
513
      if$
514
    }
515
  while$
516
}
517
518
FUNCTION {format.date}
519
{ year empty$
520
    { month empty$
521
	{ "" }
522
	{ "there's a month but no year in " cite$ * warning$
523
	  month
524
	}
525
      if$
526
    }
527
    { month empty$
528
	'year
4 by Jacques Distler
Fix Month Formatting
529
	{ month capitalize ", " * year * }
1 by Jacques Distler
Initial Commits
530
      if$
531
    }
532
  if$
533
}
534
535
FUNCTION {format.date.paren}
536
{ year empty$
537
    { month empty$
538
	{ "" }
539
	{ "there's a month but no year in " cite$ * warning$
540
	  month
541
	}
542
      if$
543
    }
544
    { month empty$
2 by Jacques Distler
Preliminary DOI support
545
	{"(" year * ") " *}
4 by Jacques Distler
Fix Month Formatting
546
	{"(" month capitalize * ", " * year * ") " *}
1 by Jacques Distler
Initial Commits
547
      if$
548
    }
549
  if$
550
}
551
552
FUNCTION {format.collaboration}
553
{ collaboration empty$
554
    { "" }
5 by Jacques Distler
Journal Number
555
    { "{\bfseries " collaboration * "} " * "Collaboration" * }
1 by Jacques Distler
Initial Commits
556
  if$
557
}
558
559
FUNCTION {format.SLACcitation}
560
{ SLACcitation empty$
561
  {""}
562
   { newline$ SLACcitation output "" newline$ }
563
  if$
564
}
565
566
FUNCTION {format.btitle}
567
{ title emphasize
568
}
569
570
FUNCTION {tie.or.space.connect}
571
{ duplicate$ text.length$ #3 <
572
    { "~" }
573
    { " " }
574
  if$
575
  swap$ * *
576
}
577
578
FUNCTION {either.or.check}
579
{ empty$
580
    'pop$
581
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
582
  if$
583
}
584
585
FUNCTION {format.bvolume}
586
{ volume empty$
587
    { "" }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
588
    { string.volume volume *
1 by Jacques Distler
Initial Commits
589
      series empty$
590
	'skip$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
591
	{ string.of * series emphasize * }
1 by Jacques Distler
Initial Commits
592
      if$
593
      "volume and number" number either.or.check
594
    }
595
  if$
596
}
597
598
FUNCTION {format.number.series}
599
{ volume empty$
600
    { number empty$
601
	{ series field.or.null }
602
	{ output.state mid.sentence =
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
603
	    { string.number }
604
	    { string.capsnumber }
1 by Jacques Distler
Initial Commits
605
	  if$
606
	  number *
607
	  series empty$
608
	    { "there's a number but no series in " cite$ * warning$ }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
609
	    { string.spacein * series * }
1 by Jacques Distler
Initial Commits
610
	  if$
611
	}
612
      if$
613
    }
614
    { "" }
615
  if$
616
}
617
618
FUNCTION {format.edition}
619
{ edition empty$
620
    { "" }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
621
    { edition "l" change.case$ string.edition * }
1 by Jacques Distler
Initial Commits
622
  if$
623
}
624
625
INTEGERS { multiresult }
626
627
FUNCTION {multi.page.check}
628
{ 't :=
629
  #0 'multiresult :=
630
    { multiresult not
631
      t empty$ not
632
      and
633
    }
634
    { t #1 #1 substring$
635
      duplicate$ "-" =
636
      swap$ duplicate$ "," =
637
      swap$ "+" =
638
      or or
639
	{ #1 'multiresult := }
640
	{ t #2 global.max$ substring$ 't := }
641
      if$
642
    }
643
  while$
644
  multiresult
645
}
646
647
FUNCTION {format.pages}
648
{ pages empty$
649
    { "" }
650
    { pages multi.page.check
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
651
	{ string.multipages pages n.dashify * }
652
	{ string.pages pages * }
1 by Jacques Distler
Initial Commits
653
      if$
654
    }
655
  if$
656
}
657
658
FUNCTION {format.pages.nopp}
659
{ pages empty$
5 by Jacques Distler
Journal Number
660
    { "empty pages in " cite$ * warning$
661
      ""
662
    }
1 by Jacques Distler
Initial Commits
663
    { pages multi.page.check
664
	{ pages n.dashify  }
665
	{ pages }
666
      if$
667
    }
668
  if$
669
}
670
671
672
FUNCTION {format.volume}
673
{ volume empty$
674
    { "" }
5 by Jacques Distler
Journal Number
675
    { "{\bfseries " volume * "} " * }
1 by Jacques Distler
Initial Commits
676
  if$
677
}
678
679
FUNCTION {format.number}
680
{ number empty$
681
    { "" }
5 by Jacques Distler
Journal Number
682
    { "no.~" number * ", " *}
1 by Jacques Distler
Initial Commits
683
  if$
684
}
685
686
FUNCTION {format.chapter.pages}
687
{ chapter empty$
688
    'format.pages
689
    { type empty$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
690
	{ string.chapter chapter * }
1 by Jacques Distler
Initial Commits
691
	{ type "l" change.case$ chapter tie.or.space.connect }
692
      if$
693
      pages empty$
694
	'skip$
695
	{ ", " * format.pages * }
696
      if$
697
    }
698
  if$
699
}
700
701
FUNCTION {format.in.ed.booktitle}
702
{ booktitle empty$
703
    { "" }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
704
    { string.in booktitle emphasize *
1 by Jacques Distler
Initial Commits
705
      editor empty$
706
	'skip$
707
	{ ", " * format.editors *  }
708
      if$
709
    }
710
  if$
711
}
712
713
FUNCTION {format.thesis.type}
714
{ type empty$
715
    'skip$
716
    { pop$
717
      output.state after.block =
718
	{ type "t" change.case$ }
719
	{ type "l" change.case$ }
720
      if$
721
    }
722
  if$
723
}
724
725
FUNCTION {empty.misc.check}
726
{ author empty$ title empty$ howpublished empty$
727
  month empty$ year empty$ note empty$
728
  and and and and and
729
    { "all relevant fields are empty in " cite$ * warning$ }
730
    'skip$
731
  if$
732
}
733
734
FUNCTION {format.tr.number}
735
{ type empty$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
736
    { string.techrep }
1 by Jacques Distler
Initial Commits
737
    'type
738
  if$
739
  number empty$
740
    { "l" change.case$ }
741
    { number tie.or.space.connect }
742
  if$
743
}
744
745
FUNCTION {format.paddress}
746
{ address empty$
747
    { "" }
748
    { "(" address * ")" * }
749
  if$
750
}
751
752
FUNCTION {format.article.crossref}
753
{ key empty$
754
    { journal empty$
755
	{ "need key or journal for " cite$ * " to crossref " * crossref *
756
	  warning$
757
	  ""
758
	}
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
759
	{ string.in "{\em " * journal * "\/}" * }
1 by Jacques Distler
Initial Commits
760
      if$
761
    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
762
    { string.in key * }
1 by Jacques Distler
Initial Commits
763
  if$
764
  " \cite{" * crossref * "}" *
765
}
766
767
FUNCTION {format.crossref.editor}
768
{ editor #1 "{vv~}{ll}" format.name$
769
  editor num.names$ duplicate$
770
  #2 >
11 by Jacques Distler
Ack! Restore changes from version 2.7
771
    { pop$ " {\em et~al.}" * }
1 by Jacques Distler
Initial Commits
772
    { #2 <
773
	'skip$
774
	{ editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
11 by Jacques Distler
Ack! Restore changes from version 2.7
775
	    { " {\em et~al.}" * }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
776
	    { string.and * editor #2 "{vv~}{ll}" format.name$ * }
1 by Jacques Distler
Initial Commits
777
	  if$
778
	}
779
      if$
780
    }
781
  if$
782
}
783
784
FUNCTION {format.book.crossref}
785
{ volume empty$
786
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
787
      string.capsin
1 by Jacques Distler
Initial Commits
788
    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
789
    { string.capsvolume volume *
790
      string.of *
1 by Jacques Distler
Initial Commits
791
    }
792
  if$
793
  editor empty$
794
  editor field.or.null author field.or.null =
795
  or
796
    { key empty$
797
	{ series empty$
798
	    { "need editor, key, or series for " cite$ * " to crossref " *
799
	      crossref * warning$
800
	      "" *
801
	    }
802
	    { "{\em " * series * "\/}" * }
803
	  if$
804
	}
805
	{ key * }
806
      if$
807
    }
808
    { format.crossref.editor * }
809
  if$
810
  " \cite{" * crossref * "}" *
811
}
812
813
FUNCTION {format.incoll.inproc.crossref}
814
{ editor empty$
815
  editor field.or.null author field.or.null =
816
  or
817
    { key empty$
818
	{ booktitle empty$
819
	    { "need editor, key, or booktitle for " cite$ * " to crossref " *
820
	      crossref * warning$
821
	      ""
822
	    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
823
	    { string.in "{\em " * booktitle * "\/}" * }
1 by Jacques Distler
Initial Commits
824
	  if$
825
	}
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
826
	{ string.in key * }
1 by Jacques Distler
Initial Commits
827
      if$
828
    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
829
    { string.in format.crossref.editor * }
1 by Jacques Distler
Initial Commits
830
  if$
831
  " \cite{" * crossref * "}" *
832
}
833
2 by Jacques Distler
Preliminary DOI support
834
FUNCTION {format.journal}
835
{ journal missing$   
836
    { "" }
837
    {journal emphasize " " *
838
     format.volume *
5 by Jacques Distler
Journal Number
839
     format.number *
2 by Jacques Distler
Preliminary DOI support
840
     format.date.paren *
4 by Jacques Distler
Fix Month Formatting
841
     format.pages.nopp *
2 by Jacques Distler
Preliminary DOI support
842
      }
843
    if$
844
}
845
1 by Jacques Distler
Initial Commits
846
FUNCTION {article}
847
{ output.bibitem
848
  format.collaboration output
849
  format.authors "author" output.check
850
  format.title "title" output.check
851
  blank.sep
852
  crossref missing$
853
  { journal missing$   
3 by Jacques Distler
Add DOI support for various entry types
854
        {}
855
        { format.journal add.doi "journal" output.check}
856
     if$
857
     report missing$
858
        {format.eprint output}
859
        {blank.sep format.report output format.eprint output}
860
       if$
1 by Jacques Distler
Initial Commits
861
    }
862
    { format.article.crossref output.nonnull
863
      format.pages output
864
      format.eprint output
865
    }
866
  if$
867
  new.sentence
868
  format.url output
869
  new.sentence
870
  note output
871
  new.sentence
872
  format.SLACcitation output
873
  fin.entry
874
}
875
876
FUNCTION {book}
877
{ output.bibitem
878
  format.collaboration output
879
  author empty$
880
    { format.editors "author and editor" output.check }
881
    { format.authors output.nonnull
882
      crossref missing$
883
	{ "author and editor" editor either.or.check }
884
	'skip$
885
      if$
886
    }
887
  if$
3 by Jacques Distler
Add DOI support for various entry types
888
  format.btitle add.doi "title" output.check
1 by Jacques Distler
Initial Commits
889
  crossref missing$
890
    { format.bvolume output
891
      new.block
892
      format.number.series output
893
      new.sentence
894
      publisher "publisher" output.check
895
      address output
896
    }
897
    { new.block
898
      format.book.crossref output.nonnull
899
    }
900
  if$
901
  format.edition output
902
  format.date "year" output.check
903
  new.block
904
  format.eprint output
905
  new.block
906
  format.url output
907
  new.block
908
  note output
909
  new.sentence
910
  format.SLACcitation output
911
  fin.entry
912
}
913
914
FUNCTION {booklet}
915
{ output.bibitem
916
  format.collaboration output
917
  format.authors output
918
  title empty$
919
    { "empty title in " cite$ * warning$
920
      howpublished new.sentence.checka
921
    }
922
    { howpublished empty$ not
923
      address empty$ month empty$ year empty$ and and
924
      or
925
	{ format.title.p output.nonnull }
926
	{ format.title output.nonnull }
927
      if$
928
      blank.sep
929
    }
930
  if$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
931
  format.howpublished output
1 by Jacques Distler
Initial Commits
932
  address output
933
  format.date output
934
  new.block
935
  format.eprint output
936
  new.block
937
  format.url output
938
  new.block
939
  note output
940
  new.sentence
941
  format.SLACcitation output
942
  fin.entry
943
}
944
945
FUNCTION {inbook}
946
{ output.bibitem
947
  format.collaboration output
948
  author empty$
949
    { format.editors "author and editor" output.check }
950
    { format.authors output.nonnull
951
      crossref missing$
952
	{ "author and editor" editor either.or.check }
953
	'skip$
954
      if$
955
    }
956
  if$
957
  format.btitle "title" output.check
958
  crossref missing$
959
    { format.bvolume output
3 by Jacques Distler
Add DOI support for various entry types
960
      format.chapter.pages add.doi "chapter and pages" output.check
1 by Jacques Distler
Initial Commits
961
      new.block
962
      format.number.series output
963
      new.block
964
      publisher "publisher" output.check
965
      address output
966
    }
3 by Jacques Distler
Add DOI support for various entry types
967
    { format.chapter.pages add.doi "chapter and pages" output.check
1 by Jacques Distler
Initial Commits
968
      new.block
969
      format.book.crossref output.nonnull
970
    }
971
  if$
972
  format.edition output
973
  format.date "year" output.check
974
  new.block
975
  format.eprint output
976
  new.block
977
  format.url output
978
  new.block
979
  note output
980
  new.sentence
981
  format.SLACcitation output
982
  fin.entry
983
}
984
985
FUNCTION {incollection}
986
{ output.bibitem
987
  format.collaboration output
988
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
989
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
990
  blank.sep
991
  crossref missing$
992
    { format.in.ed.booktitle "booktitle" output.check
993
      format.bvolume output
994
      format.number.series output
995
      format.chapter.pages output
996
      new.block
997
      publisher "publisher" output.check
998
      address output
999
      format.edition output
1000
      format.date "year" output.check
1001
    }
1002
    { format.incoll.inproc.crossref output.nonnull
1003
      format.chapter.pages output
1004
    }
1005
  if$
1006
  new.block
1007
  format.eprint output
1008
  new.block
1009
  format.url output
1010
  new.block
1011
  note output
1012
  new.sentence
1013
  format.SLACcitation output
1014
  fin.entry
1015
}
1016
1017
FUNCTION {inproceedings}
1018
{ output.bibitem
1019
  format.collaboration output
1020
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1021
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1022
  blank.sep
1023
  crossref missing$
1024
    { format.in.ed.booktitle "booktitle" output.check
1025
      format.bvolume output
1026
      format.number.series output
1027
      format.pages output
1028
      organization output
1029
      new.block
1030
      publisher output
1031
      address output
1032
      format.date "year" output.check
1033
    }
1034
    { format.incoll.inproc.crossref output.nonnull
1035
      format.pages output
1036
    }
1037
  if$
1038
  new.block
1039
  format.eprint output
1040
  new.block
1041
  format.url output
1042
  new.block
1043
  note output
1044
  new.sentence
1045
  format.SLACcitation output
1046
  fin.entry
1047
}
1048
1049
FUNCTION {conference} { inproceedings }
1050
1051
FUNCTION {manual}
1052
{ output.bibitem
1053
  format.collaboration output
1054
  author empty$
1055
    { organization empty$
1056
	'skip$
1057
	{ organization output.nonnull
1058
	  address output
1059
	}
1060
      if$
1061
    }
1062
    { format.authors output.nonnull }
1063
  if$
1064
  format.btitle "title" output.check
1065
  author empty$
1066
    { organization empty$
1067
	{ address new.block.checka
1068
	  address output
1069
	}
1070
	'skip$
1071
      if$
1072
    }
1073
    { organization address new.block.checkb
1074
      organization output
1075
      address output
1076
    }
1077
  if$
1078
  format.edition output
1079
  format.date output
1080
  new.block
1081
  format.eprint output
1082
  new.block
1083
  format.url output
1084
  new.block
1085
  note output
1086
  fin.entry
1087
}
1088
1089
FUNCTION {mastersthesis}
1090
{ output.bibitem
1091
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1092
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1093
  blank.sep
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
1094
  string.mastersthesis format.thesis.type output.nonnull
1 by Jacques Distler
Initial Commits
1095
  school "school" output.check
1096
  address output
1097
  format.date "year" output.check
1098
  new.block
1099
  format.url output
1100
  new.block
1101
  note output
1102
  fin.entry
1103
}
1104
1105
FUNCTION {misc}
1106
{ output.bibitem
1107
  format.collaboration output
1108
  format.authors output
1109
  title empty$
1110
    { howpublished new.sentence.checka }
1111
    { howpublished empty$ not
1112
      month empty$ year empty$ and
1113
      or
1114
	{ format.title.p output.nonnull }
1115
	{ format.title output.nonnull }
1116
      if$
1117
      blank.sep
1118
    }
1119
  if$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
1120
  format.howpublished output
1 by Jacques Distler
Initial Commits
1121
  format.date output
1122
  new.block
1123
  format.url output
1124
  new.sentence
1125
  note output
1126
  new.sentence
1127
  fin.entry
1128
  empty.misc.check
1129
}
1130
1131
FUNCTION {phdthesis}
1132
{ output.bibitem
1133
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1134
  format.btitle add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1135
  new.block
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
1136
  string.phdthesis format.thesis.type output.nonnull
1 by Jacques Distler
Initial Commits
1137
  school "school" output.check
1138
  address output
1139
  format.date "year" output.check
1140
  new.block
1141
  format.eprint output
1142
  new.block
1143
  format.url output
1144
  new.block
1145
  note output
1146
  new.sentence
1147
  format.SLACcitation output
1148
  fin.entry
1149
}
1150
1151
FUNCTION {proceedings}
1152
{ output.bibitem
1153
  editor empty$
1154
    { organization output }
1155
    { format.editors output.nonnull }
1156
  if$
3 by Jacques Distler
Add DOI support for various entry types
1157
  format.btitle add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1158
  format.bvolume output
1159
  format.number.series output
1160
  editor empty$
1161
    'skip$
1162
    { organization output }
1163
  if$
1164
  new.block
1165
  publisher output
1166
  address output
1167
  format.date "year" output.check
1168
  new.block
1169
  format.eprint output
1170
  new.block
1171
  format.url output
1172
  new.block
1173
  note output
1174
  new.sentence
1175
  format.SLACcitation output
1176
  fin.entry
1177
}
1178
1179
FUNCTION {techreport}
1180
{ output.bibitem
1181
  format.collaboration output
1182
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1183
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1184
  blank.sep
1185
  format.tr.number output.nonnull
1186
  institution "institution" output.check
1187
  address output
1188
  format.date "year" output.check
1189
  new.block
1190
  format.eprint output
1191
  new.block
1192
  format.url output
1193
  new.block
1194
  note output
1195
  fin.entry
1196
}
1197
1198
FUNCTION {unpublished}
1199
{ output.bibitem
1200
  format.collaboration output
1201
  format.authors "author" output.check
1202
  format.title.p "title" output.check
1203
  blank.sep
1204
  note "note" output.check
1205
  format.date output
1206
  new.sentence
1207
  format.SLACcitation output
1208
  fin.entry
1209
}
1210
1211
FUNCTION {default.type} { misc }
1212
1213
READ
1214
1215
STRINGS { longest.label }
1216
1217
INTEGERS { number.label longest.label.width }
1218
1219
FUNCTION {initialize.longest.label}
1220
{ "" 'longest.label :=
1221
  #1 'number.label :=
1222
  #0 'longest.label.width :=
1223
}
1224
1225
FUNCTION {longest.label.pass}
1226
{ number.label int.to.str$ 'label :=
1227
  number.label #1 + 'number.label :=
1228
  label width$ longest.label.width >
1229
    { label 'longest.label :=
1230
      label width$ 'longest.label.width :=
1231
    }
1232
    'skip$
1233
  if$
1234
}
1235
1236
EXECUTE {initialize.longest.label}
1237
1238
ITERATE {longest.label.pass}
1239
1240
FUNCTION {begin.bib}
1241
{ preamble$ empty$
1242
    'skip$
1243
    { preamble$ write$ newline$ }
1244
  if$
1245
  "\providecommand{\href}[2]{#2}"
1246
  "\begingroup\raggedright\begin{thebibliography}{" * longest.label  * 
1247
  "}" * write$ newline$ }
1248
1249
EXECUTE {begin.bib}
1250
1251
EXECUTE {init.state.consts}
1252
1253
ITERATE {call.type$}
1254
1255
FUNCTION {end.bib}
1256
{ newline$
1257
  "\end{thebibliography}\endgroup" write$ newline$
1258
}
1259
1260
EXECUTE {end.bib}