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