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