/utphys

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/utphys/
10 by Jacques Distler
Fix format.title and format.title.p for when
1
% UT Physics bibliographic style, ver. 2.5. 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
%
8 by Jacques Distler
Fix captialization of titles
24
%    Modified by Jacques Distler, 2/11
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)
10 by Jacques Distler
Fix format.title and format.title.p for when
56
%                   ver 2.7  12/18 - Fix format.title and format.title.p for when the
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}}
2 by Jacques Distler
Preliminary DOI support
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.
1 by Jacques Distler
Initial Commits
103
%
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" =
10 by Jacques Distler
Fix format.title and format.title.p for when
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
    { "" }
10 by Jacques Distler
Fix format.title and format.title.p for when
476
    {title title text.length$ #1 substring$ "?" =
477
     title title text.length$ #1 substring$ "!" =
478
     title title text.length$ #1 substring$ "." =
479
     or or
480
      { "``" title "t" change.case$ * "''" * }
481
      { "``" title "t" change.case$ * ",''" * }
482
    if$
483
   }
1 by Jacques Distler
Initial Commits
484
  if$
485
}
486
487
FUNCTION {format.title.p}
488
{ title empty$
489
    { "" }
10 by Jacques Distler
Fix format.title and format.title.p for when
490
    { "``" title "t" change.case$ * add.period$ "''" * }
1 by Jacques Distler
Initial Commits
491
  if$
492
}
493
494
FUNCTION {n.dashify}
495
{ 't :=
496
  ""
497
    { t empty$ not }
498
    { t #1 #1 substring$ "-" =
499
	{ t #1 #2 substring$ "--" = not
500
	    { "--" *
501
	      t #2 global.max$ substring$ 't :=
502
	    }
503
	    {   { t #1 #1 substring$ "-" = }
504
		{ "-" *
505
		  t #2 global.max$ substring$ 't :=
506
		}
507
	      while$
508
	    }
509
	  if$
510
	}
511
	{ t #1 #1 substring$ *
512
	  t #2 global.max$ substring$ 't :=
513
	}
514
      if$
515
    }
516
  while$
517
}
518
519
FUNCTION {format.date}
520
{ year empty$
521
    { month empty$
522
	{ "" }
523
	{ "there's a month but no year in " cite$ * warning$
524
	  month
525
	}
526
      if$
527
    }
528
    { month empty$
529
	'year
4 by Jacques Distler
Fix Month Formatting
530
	{ month capitalize ", " * year * }
1 by Jacques Distler
Initial Commits
531
      if$
532
    }
533
  if$
534
}
535
536
FUNCTION {format.date.paren}
537
{ year empty$
538
    { month empty$
539
	{ "" }
540
	{ "there's a month but no year in " cite$ * warning$
541
	  month
542
	}
543
      if$
544
    }
545
    { month empty$
2 by Jacques Distler
Preliminary DOI support
546
	{"(" year * ") " *}
4 by Jacques Distler
Fix Month Formatting
547
	{"(" month capitalize * ", " * year * ") " *}
1 by Jacques Distler
Initial Commits
548
      if$
549
    }
550
  if$
551
}
552
553
FUNCTION {format.collaboration}
554
{ collaboration empty$
555
    { "" }
5 by Jacques Distler
Journal Number
556
    { "{\bfseries " collaboration * "} " * "Collaboration" * }
1 by Jacques Distler
Initial Commits
557
  if$
558
}
559
560
FUNCTION {format.SLACcitation}
561
{ SLACcitation empty$
562
  {""}
563
   { newline$ SLACcitation output "" newline$ }
564
  if$
565
}
566
567
FUNCTION {format.btitle}
568
{ title emphasize
569
}
570
571
FUNCTION {tie.or.space.connect}
572
{ duplicate$ text.length$ #3 <
573
    { "~" }
574
    { " " }
575
  if$
576
  swap$ * *
577
}
578
579
FUNCTION {either.or.check}
580
{ empty$
581
    'pop$
582
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
583
  if$
584
}
585
586
FUNCTION {format.bvolume}
587
{ volume empty$
588
    { "" }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
589
    { string.volume volume *
1 by Jacques Distler
Initial Commits
590
      series empty$
591
	'skip$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
592
	{ string.of * series emphasize * }
1 by Jacques Distler
Initial Commits
593
      if$
594
      "volume and number" number either.or.check
595
    }
596
  if$
597
}
598
599
FUNCTION {format.number.series}
600
{ volume empty$
601
    { number empty$
602
	{ series field.or.null }
603
	{ output.state mid.sentence =
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
604
	    { string.number }
605
	    { string.capsnumber }
1 by Jacques Distler
Initial Commits
606
	  if$
607
	  number *
608
	  series empty$
609
	    { "there's a number but no series in " cite$ * warning$ }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
610
	    { string.spacein * series * }
1 by Jacques Distler
Initial Commits
611
	  if$
612
	}
613
      if$
614
    }
615
    { "" }
616
  if$
617
}
618
619
FUNCTION {format.edition}
620
{ edition empty$
621
    { "" }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
622
    { edition "l" change.case$ string.edition * }
1 by Jacques Distler
Initial Commits
623
  if$
624
}
625
626
INTEGERS { multiresult }
627
628
FUNCTION {multi.page.check}
629
{ 't :=
630
  #0 'multiresult :=
631
    { multiresult not
632
      t empty$ not
633
      and
634
    }
635
    { t #1 #1 substring$
636
      duplicate$ "-" =
637
      swap$ duplicate$ "," =
638
      swap$ "+" =
639
      or or
640
	{ #1 'multiresult := }
641
	{ t #2 global.max$ substring$ 't := }
642
      if$
643
    }
644
  while$
645
  multiresult
646
}
647
648
FUNCTION {format.pages}
649
{ pages empty$
650
    { "" }
651
    { pages multi.page.check
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
652
	{ string.multipages pages n.dashify * }
653
	{ string.pages pages * }
1 by Jacques Distler
Initial Commits
654
      if$
655
    }
656
  if$
657
}
658
659
FUNCTION {format.pages.nopp}
660
{ pages empty$
5 by Jacques Distler
Journal Number
661
    { "empty pages in " cite$ * warning$
662
      ""
663
    }
1 by Jacques Distler
Initial Commits
664
    { pages multi.page.check
665
	{ pages n.dashify  }
666
	{ pages }
667
      if$
668
    }
669
  if$
670
}
671
672
673
FUNCTION {format.volume}
674
{ volume empty$
675
    { "" }
5 by Jacques Distler
Journal Number
676
    { "{\bfseries " volume * "} " * }
1 by Jacques Distler
Initial Commits
677
  if$
678
}
679
680
FUNCTION {format.number}
681
{ number empty$
682
    { "" }
5 by Jacques Distler
Journal Number
683
    { "no.~" number * ", " *}
1 by Jacques Distler
Initial Commits
684
  if$
685
}
686
687
FUNCTION {format.chapter.pages}
688
{ chapter empty$
689
    'format.pages
690
    { type empty$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
691
	{ string.chapter chapter * }
1 by Jacques Distler
Initial Commits
692
	{ type "l" change.case$ chapter tie.or.space.connect }
693
      if$
694
      pages empty$
695
	'skip$
696
	{ ", " * format.pages * }
697
      if$
698
    }
699
  if$
700
}
701
702
FUNCTION {format.in.ed.booktitle}
703
{ booktitle empty$
704
    { "" }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
705
    { string.in booktitle emphasize *
1 by Jacques Distler
Initial Commits
706
      editor empty$
707
	'skip$
708
	{ ", " * format.editors *  }
709
      if$
710
    }
711
  if$
712
}
713
714
FUNCTION {format.thesis.type}
715
{ type empty$
716
    'skip$
717
    { pop$
718
      output.state after.block =
719
	{ type "t" change.case$ }
720
	{ type "l" change.case$ }
721
      if$
722
    }
723
  if$
724
}
725
726
FUNCTION {empty.misc.check}
727
{ author empty$ title empty$ howpublished empty$
728
  month empty$ year empty$ note empty$
729
  and and and and and
730
    { "all relevant fields are empty in " cite$ * warning$ }
731
    'skip$
732
  if$
733
}
734
735
FUNCTION {format.tr.number}
736
{ type empty$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
737
    { string.techrep }
1 by Jacques Distler
Initial Commits
738
    'type
739
  if$
740
  number empty$
741
    { "l" change.case$ }
742
    { number tie.or.space.connect }
743
  if$
744
}
745
746
FUNCTION {format.paddress}
747
{ address empty$
748
    { "" }
749
    { "(" address * ")" * }
750
  if$
751
}
752
753
FUNCTION {format.article.crossref}
754
{ key empty$
755
    { journal empty$
756
	{ "need key or journal for " cite$ * " to crossref " * crossref *
757
	  warning$
758
	  ""
759
	}
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
760
	{ string.in "{\em " * journal * "\/}" * }
1 by Jacques Distler
Initial Commits
761
      if$
762
    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
763
    { string.in key * }
1 by Jacques Distler
Initial Commits
764
  if$
765
  " \cite{" * crossref * "}" *
766
}
767
768
FUNCTION {format.crossref.editor}
769
{ editor #1 "{vv~}{ll}" format.name$
770
  editor num.names$ duplicate$
771
  #2 >
10 by Jacques Distler
Fix format.title and format.title.p for when
772
    { pop$ " {\em et.~al.}" * }
1 by Jacques Distler
Initial Commits
773
    { #2 <
774
	'skip$
775
	{ editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
10 by Jacques Distler
Fix format.title and format.title.p for when
776
	    { " {\em et.~al.}" * }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
777
	    { string.and * editor #2 "{vv~}{ll}" format.name$ * }
1 by Jacques Distler
Initial Commits
778
	  if$
779
	}
780
      if$
781
    }
782
  if$
783
}
784
785
FUNCTION {format.book.crossref}
786
{ volume empty$
787
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
788
      string.capsin
1 by Jacques Distler
Initial Commits
789
    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
790
    { string.capsvolume volume *
791
      string.of *
1 by Jacques Distler
Initial Commits
792
    }
793
  if$
794
  editor empty$
795
  editor field.or.null author field.or.null =
796
  or
797
    { key empty$
798
	{ series empty$
799
	    { "need editor, key, or series for " cite$ * " to crossref " *
800
	      crossref * warning$
801
	      "" *
802
	    }
803
	    { "{\em " * series * "\/}" * }
804
	  if$
805
	}
806
	{ key * }
807
      if$
808
    }
809
    { format.crossref.editor * }
810
  if$
811
  " \cite{" * crossref * "}" *
812
}
813
814
FUNCTION {format.incoll.inproc.crossref}
815
{ editor empty$
816
  editor field.or.null author field.or.null =
817
  or
818
    { key empty$
819
	{ booktitle empty$
820
	    { "need editor, key, or booktitle for " cite$ * " to crossref " *
821
	      crossref * warning$
822
	      ""
823
	    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
824
	    { string.in "{\em " * booktitle * "\/}" * }
1 by Jacques Distler
Initial Commits
825
	  if$
826
	}
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
827
	{ string.in key * }
1 by Jacques Distler
Initial Commits
828
      if$
829
    }
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
830
    { string.in format.crossref.editor * }
1 by Jacques Distler
Initial Commits
831
  if$
832
  " \cite{" * crossref * "}" *
833
}
834
2 by Jacques Distler
Preliminary DOI support
835
FUNCTION {format.journal}
836
{ journal missing$   
837
    { "" }
838
    {journal emphasize " " *
839
     format.volume *
5 by Jacques Distler
Journal Number
840
     format.number *
2 by Jacques Distler
Preliminary DOI support
841
     format.date.paren *
4 by Jacques Distler
Fix Month Formatting
842
     format.pages.nopp *
2 by Jacques Distler
Preliminary DOI support
843
      }
844
    if$
845
}
846
1 by Jacques Distler
Initial Commits
847
FUNCTION {article}
848
{ output.bibitem
849
  format.collaboration output
850
  format.authors "author" output.check
851
  format.title "title" output.check
852
  blank.sep
853
  crossref missing$
854
  { journal missing$   
3 by Jacques Distler
Add DOI support for various entry types
855
        {}
856
        { format.journal add.doi "journal" output.check}
1 by Jacques Distler
Initial Commits
857
      if$
3 by Jacques Distler
Add DOI support for various entry types
858
    report missing$
2 by Jacques Distler
Preliminary DOI support
859
        {format.eprint output}
860
        {blank.sep format.report output format.eprint output}
3 by Jacques Distler
Add DOI support for various entry types
861
      if$
1 by Jacques Distler
Initial Commits
862
    }
863
    { format.article.crossref output.nonnull
864
      format.pages output
865
      format.eprint output
866
    }
867
  if$
868
  new.sentence
869
  format.url output
870
  new.sentence
871
  note output
872
  new.sentence
873
  format.SLACcitation output
874
  fin.entry
875
}
876
877
FUNCTION {book}
878
{ output.bibitem
879
  format.collaboration output
880
  author empty$
881
    { format.editors "author and editor" output.check }
882
    { format.authors output.nonnull
883
      crossref missing$
884
	{ "author and editor" editor either.or.check }
885
	'skip$
886
      if$
887
    }
888
  if$
3 by Jacques Distler
Add DOI support for various entry types
889
  format.btitle add.doi "title" output.check
1 by Jacques Distler
Initial Commits
890
  crossref missing$
891
    { format.bvolume output
892
      new.block
893
      format.number.series output
894
      new.sentence
895
      publisher "publisher" output.check
896
      address output
897
    }
898
    { new.block
899
      format.book.crossref output.nonnull
900
    }
901
  if$
902
  format.edition output
903
  format.date "year" output.check
904
  new.block
905
  format.eprint output
906
  new.block
907
  format.url output
908
  new.block
909
  note output
910
  new.sentence
911
  format.SLACcitation output
912
  fin.entry
913
}
914
915
FUNCTION {booklet}
916
{ output.bibitem
917
  format.collaboration output
918
  format.authors output
919
  title empty$
920
    { "empty title in " cite$ * warning$
921
      howpublished new.sentence.checka
922
    }
923
    { howpublished empty$ not
924
      address empty$ month empty$ year empty$ and and
925
      or
926
	{ format.title.p output.nonnull }
927
	{ format.title output.nonnull }
928
      if$
929
      blank.sep
930
    }
931
  if$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
932
  format.howpublished output
1 by Jacques Distler
Initial Commits
933
  address output
934
  format.date output
935
  new.block
936
  format.eprint output
937
  new.block
938
  format.url output
939
  new.block
940
  note output
941
  new.sentence
942
  format.SLACcitation output
943
  fin.entry
944
}
945
946
FUNCTION {inbook}
947
{ output.bibitem
948
  format.collaboration output
949
  author empty$
950
    { format.editors "author and editor" output.check }
951
    { format.authors output.nonnull
952
      crossref missing$
953
	{ "author and editor" editor either.or.check }
954
	'skip$
955
      if$
956
    }
957
  if$
958
  format.btitle "title" output.check
959
  crossref missing$
960
    { format.bvolume output
3 by Jacques Distler
Add DOI support for various entry types
961
      format.chapter.pages add.doi "chapter and pages" output.check
1 by Jacques Distler
Initial Commits
962
      new.block
963
      format.number.series output
964
      new.block
965
      publisher "publisher" output.check
966
      address output
967
    }
3 by Jacques Distler
Add DOI support for various entry types
968
    { format.chapter.pages add.doi "chapter and pages" output.check
1 by Jacques Distler
Initial Commits
969
      new.block
970
      format.book.crossref output.nonnull
971
    }
972
  if$
973
  format.edition output
974
  format.date "year" output.check
975
  new.block
976
  format.eprint output
977
  new.block
978
  format.url output
979
  new.block
980
  note output
981
  new.sentence
982
  format.SLACcitation output
983
  fin.entry
984
}
985
986
FUNCTION {incollection}
987
{ output.bibitem
988
  format.collaboration output
989
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
990
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
991
  blank.sep
992
  crossref missing$
993
    { format.in.ed.booktitle "booktitle" output.check
994
      format.bvolume output
995
      format.number.series output
996
      format.chapter.pages output
997
      new.block
998
      publisher "publisher" output.check
999
      address output
1000
      format.edition output
1001
      format.date "year" output.check
1002
    }
1003
    { format.incoll.inproc.crossref output.nonnull
1004
      format.chapter.pages output
1005
    }
1006
  if$
1007
  new.block
1008
  format.eprint output
1009
  new.block
1010
  format.url output
1011
  new.block
1012
  note output
1013
  new.sentence
1014
  format.SLACcitation output
1015
  fin.entry
1016
}
1017
1018
FUNCTION {inproceedings}
1019
{ output.bibitem
1020
  format.collaboration output
1021
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1022
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1023
  blank.sep
1024
  crossref missing$
1025
    { format.in.ed.booktitle "booktitle" output.check
1026
      format.bvolume output
1027
      format.number.series output
1028
      format.pages output
1029
      organization output
1030
      new.block
1031
      publisher output
1032
      address output
1033
      format.date "year" output.check
1034
    }
1035
    { format.incoll.inproc.crossref output.nonnull
1036
      format.pages output
1037
    }
1038
  if$
1039
  new.block
1040
  format.eprint output
1041
  new.block
1042
  format.url output
1043
  new.block
1044
  note output
1045
  new.sentence
1046
  format.SLACcitation output
1047
  fin.entry
1048
}
1049
1050
FUNCTION {conference} { inproceedings }
1051
1052
FUNCTION {manual}
1053
{ output.bibitem
1054
  format.collaboration output
1055
  author empty$
1056
    { organization empty$
1057
	'skip$
1058
	{ organization output.nonnull
1059
	  address output
1060
	}
1061
      if$
1062
    }
1063
    { format.authors output.nonnull }
1064
  if$
1065
  format.btitle "title" output.check
1066
  author empty$
1067
    { organization empty$
1068
	{ address new.block.checka
1069
	  address output
1070
	}
1071
	'skip$
1072
      if$
1073
    }
1074
    { organization address new.block.checkb
1075
      organization output
1076
      address output
1077
    }
1078
  if$
1079
  format.edition output
1080
  format.date output
1081
  new.block
1082
  format.eprint output
1083
  new.block
1084
  format.url output
1085
  new.block
1086
  note output
1087
  fin.entry
1088
}
1089
1090
FUNCTION {mastersthesis}
1091
{ output.bibitem
1092
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1093
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1094
  blank.sep
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
1095
  string.mastersthesis format.thesis.type output.nonnull
1 by Jacques Distler
Initial Commits
1096
  school "school" output.check
1097
  address output
1098
  format.date "year" output.check
1099
  new.block
1100
  format.url output
1101
  new.block
1102
  note output
1103
  fin.entry
1104
}
1105
1106
FUNCTION {misc}
1107
{ output.bibitem
1108
  format.collaboration output
1109
  format.authors output
1110
  title empty$
1111
    { howpublished new.sentence.checka }
1112
    { howpublished empty$ not
1113
      month empty$ year empty$ and
1114
      or
1115
	{ format.title.p output.nonnull }
1116
	{ format.title output.nonnull }
1117
      if$
1118
      blank.sep
1119
    }
1120
  if$
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
1121
  format.howpublished output
1 by Jacques Distler
Initial Commits
1122
  format.date output
1123
  new.block
1124
  format.url output
1125
  new.sentence
1126
  note output
1127
  new.sentence
1128
  fin.entry
1129
  empty.misc.check
1130
}
1131
1132
FUNCTION {phdthesis}
1133
{ output.bibitem
1134
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1135
  format.btitle add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1136
  new.block
7 by Jacques Distler
Utphys 2.5: Internationalization and some more journal MACROs
1137
  string.phdthesis format.thesis.type output.nonnull
1 by Jacques Distler
Initial Commits
1138
  school "school" output.check
1139
  address output
1140
  format.date "year" output.check
1141
  new.block
1142
  format.eprint output
1143
  new.block
1144
  format.url output
1145
  new.block
1146
  note output
1147
  new.sentence
1148
  format.SLACcitation output
1149
  fin.entry
1150
}
1151
1152
FUNCTION {proceedings}
1153
{ output.bibitem
1154
  editor empty$
1155
    { organization output }
1156
    { format.editors output.nonnull }
1157
  if$
3 by Jacques Distler
Add DOI support for various entry types
1158
  format.btitle add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1159
  format.bvolume output
1160
  format.number.series output
1161
  editor empty$
1162
    'skip$
1163
    { organization output }
1164
  if$
1165
  new.block
1166
  publisher output
1167
  address output
1168
  format.date "year" output.check
1169
  new.block
1170
  format.eprint output
1171
  new.block
1172
  format.url output
1173
  new.block
1174
  note output
1175
  new.sentence
1176
  format.SLACcitation output
1177
  fin.entry
1178
}
1179
1180
FUNCTION {techreport}
1181
{ output.bibitem
1182
  format.collaboration output
1183
  format.authors "author" output.check
3 by Jacques Distler
Add DOI support for various entry types
1184
  format.title add.doi "title" output.check
1 by Jacques Distler
Initial Commits
1185
  blank.sep
1186
  format.tr.number output.nonnull
1187
  institution "institution" output.check
1188
  address output
1189
  format.date "year" output.check
1190
  new.block
1191
  format.eprint output
1192
  new.block
1193
  format.url output
1194
  new.block
1195
  note output
1196
  fin.entry
1197
}
1198
1199
FUNCTION {unpublished}
1200
{ output.bibitem
1201
  format.collaboration output
1202
  format.authors "author" output.check
1203
  format.title.p "title" output.check
1204
  blank.sep
1205
  note "note" output.check
1206
  format.date output
1207
  new.sentence
1208
  format.SLACcitation output
1209
  fin.entry
1210
}
1211
1212
FUNCTION {default.type} { misc }
1213
1214
READ
1215
1216
STRINGS { longest.label }
1217
1218
INTEGERS { number.label longest.label.width }
1219
1220
FUNCTION {initialize.longest.label}
1221
{ "" 'longest.label :=
1222
  #1 'number.label :=
1223
  #0 'longest.label.width :=
1224
}
1225
1226
FUNCTION {longest.label.pass}
1227
{ number.label int.to.str$ 'label :=
1228
  number.label #1 + 'number.label :=
1229
  label width$ longest.label.width >
1230
    { label 'longest.label :=
1231
      label width$ 'longest.label.width :=
1232
    }
1233
    'skip$
1234
  if$
1235
}
1236
1237
EXECUTE {initialize.longest.label}
1238
1239
ITERATE {longest.label.pass}
1240
1241
FUNCTION {begin.bib}
1242
{ preamble$ empty$
1243
    'skip$
1244
    { preamble$ write$ newline$ }
1245
  if$
1246
  "\providecommand{\href}[2]{#2}"
1247
  "\begingroup\raggedright\begin{thebibliography}{" * longest.label  * 
1248
  "}" * write$ newline$ }
1249
1250
EXECUTE {begin.bib}
1251
1252
EXECUTE {init.state.consts}
1253
1254
ITERATE {call.type$}
1255
1256
FUNCTION {end.bib}
1257
{ newline$
1258
  "\end{thebibliography}\endgroup" write$ newline$
1259
}
1260
1261
EXECUTE {end.bib}