Sat, 07 Dec 2024 14:04:26 -0500
Zenodo packaging hacks
59 | 1 | %% jnsao.bst |
2 | %% Copyright (c) Christian Clason and Tuomo Valkonen, 2019. | |
3 | % | |
4 | % BibTeX style corresponding to the LaTeX class for the | |
5 | % | |
6 | % Journal of Nonsmooth Analysis and Optimization | |
7 | % | |
8 | % Web: http://jnsao.episciences.org | |
9 | % E-mail: jnsao@episciences.org | |
10 | % | |
11 | % This work may be distributed and/or modified under the | |
12 | % conditions of the LaTeX Project Public License, either version 1.3c | |
13 | % of this license or (at your option) any later version. | |
14 | % The latest version of this license is in the file | |
15 | % | |
16 | % http://www.latex-project.org/lppl.txt | |
17 | % | |
18 | % This file is part of the "JNSAO journal template" (The work in LPPL) | |
19 | % and all files in that bundle must be distributed together. | |
20 | % | |
21 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
22 | % | |
23 | % Version 0.8 (2019-06-19). | |
24 | % Based on BibTeX standard bibliography style `abbrv'. | |
25 | % | |
26 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
27 | ||
28 | ||
29 | ENTRY | |
30 | { address | |
31 | author | |
32 | booktitle | |
33 | chapter | |
34 | edition | |
35 | editor | |
36 | howpublished | |
37 | institution | |
38 | journal | |
39 | key | |
40 | month | |
41 | note | |
42 | number | |
43 | organization | |
44 | pages | |
45 | publisher | |
46 | school | |
47 | series | |
48 | title | |
49 | type | |
50 | volume | |
51 | year | |
52 | doi % only doi; https://dx.doi.org is added later | |
53 | eprinttype % repository: currently, arxiv or hal are supported | |
54 | eprint % eprint ID as in repository URL | |
55 | version % eprint version, appended as, e.g., `v1` to URL | |
56 | url % external URL if neither doi nor eprint is available | |
57 | urldate % date visited (for web pages etc.) | |
58 | date % futureproof: biblatex uses date over year | |
59 | journaltitle % futureproof: biblatex uses journaltitle over journal | |
60 | } | |
61 | {} | |
62 | { label } | |
63 | ||
64 | INTEGERS { output.state before.all mid.sentence after.sentence after.block } | |
65 | ||
66 | FUNCTION {init.state.consts} | |
67 | { #0 'before.all := | |
68 | #1 'mid.sentence := | |
69 | #2 'after.sentence := | |
70 | #3 'after.block := | |
71 | } | |
72 | ||
73 | STRINGS { s t } | |
74 | ||
75 | FUNCTION {output.nonnull} | |
76 | { 's := | |
77 | output.state mid.sentence = | |
78 | { ", " * write$ } | |
79 | { output.state after.block = | |
80 | { add.period$ write$ | |
81 | newline$ | |
82 | "\newblock " write$ | |
83 | } | |
84 | { output.state before.all = | |
85 | 'write$ | |
86 | { add.period$ " " * write$ } | |
87 | if$ | |
88 | } | |
89 | if$ | |
90 | mid.sentence 'output.state := | |
91 | } | |
92 | if$ | |
93 | s | |
94 | } | |
95 | ||
96 | FUNCTION {output} | |
97 | { duplicate$ empty$ | |
98 | 'pop$ | |
99 | 'output.nonnull | |
100 | if$ | |
101 | } | |
102 | ||
103 | FUNCTION {output.check} | |
104 | { 't := | |
105 | duplicate$ empty$ | |
106 | { pop$ "empty " t * " in " * cite$ * warning$ } | |
107 | 'output.nonnull | |
108 | if$ | |
109 | } | |
110 | ||
111 | FUNCTION {add.blank} | |
112 | { " " * before.all 'output.state := | |
113 | } | |
114 | ||
115 | FUNCTION {output.bibitem} | |
116 | { newline$ | |
117 | "\bibitem{" write$ | |
118 | cite$ write$ | |
119 | "}" write$ | |
120 | newline$ | |
121 | "" | |
122 | before.all 'output.state := | |
123 | } | |
124 | ||
125 | FUNCTION {fin.entry} | |
126 | { add.period$ | |
127 | write$ | |
128 | newline$ | |
129 | } | |
130 | ||
131 | FUNCTION {new.block} | |
132 | { output.state before.all = | |
133 | 'skip$ | |
134 | { after.block 'output.state := } | |
135 | if$ | |
136 | } | |
137 | ||
138 | FUNCTION {new.sentence} | |
139 | { output.state after.block = | |
140 | 'skip$ | |
141 | { output.state before.all = | |
142 | 'skip$ | |
143 | { after.sentence 'output.state := } | |
144 | if$ | |
145 | } | |
146 | if$ | |
147 | } | |
148 | ||
149 | FUNCTION {not} | |
150 | { { #0 } | |
151 | { #1 } | |
152 | if$ | |
153 | } | |
154 | ||
155 | FUNCTION {and} | |
156 | { 'skip$ | |
157 | { pop$ #0 } | |
158 | if$ | |
159 | } | |
160 | ||
161 | FUNCTION {or} | |
162 | { { pop$ #1 } | |
163 | 'skip$ | |
164 | if$ | |
165 | } | |
166 | ||
167 | FUNCTION {new.block.checka} | |
168 | { empty$ | |
169 | 'skip$ | |
170 | 'new.block | |
171 | if$ | |
172 | } | |
173 | ||
174 | FUNCTION {new.block.checkb} | |
175 | { empty$ | |
176 | swap$ empty$ | |
177 | and | |
178 | 'skip$ | |
179 | 'new.block | |
180 | if$ | |
181 | } | |
182 | ||
183 | FUNCTION {new.sentence.checka} | |
184 | { empty$ | |
185 | 'skip$ | |
186 | 'new.sentence | |
187 | if$ | |
188 | } | |
189 | ||
190 | FUNCTION {new.sentence.checkb} | |
191 | { empty$ | |
192 | swap$ empty$ | |
193 | and | |
194 | 'skip$ | |
195 | 'new.sentence | |
196 | if$ | |
197 | } | |
198 | ||
199 | FUNCTION {field.or.null} | |
200 | { duplicate$ empty$ | |
201 | { pop$ "" } | |
202 | 'skip$ | |
203 | if$ | |
204 | } | |
205 | ||
206 | FUNCTION {smallcaps} | |
207 | { duplicate$ empty$ | |
208 | { pop$ "" } | |
209 | { "\textsc{" swap$ * "}" * } | |
210 | if$ | |
211 | } | |
212 | ||
213 | FUNCTION {emphasize} | |
214 | { duplicate$ empty$ | |
215 | { pop$ "" } | |
216 | { "\emph{" swap$ * "}" * } | |
217 | if$ | |
218 | } | |
219 | ||
220 | INTEGERS { nameptr namesleft numnames } | |
221 | ||
222 | FUNCTION {format.names} | |
223 | { 's := | |
224 | #1 'nameptr := | |
225 | s num.names$ 'numnames := | |
226 | numnames 'namesleft := | |
227 | { namesleft #0 > } | |
228 | { s nameptr "{f{.\,}{.\nobreak\kern 0.33333em}}{vv~}{ll}{, jj}" format.name$ 't := | |
229 | nameptr #1 > | |
230 | { namesleft #1 > | |
231 | { ", " * t * } | |
232 | { numnames #2 > | |
233 | { "," * } | |
234 | 'skip$ | |
235 | if$ | |
236 | t "others" = | |
237 | { " et~al." * } | |
238 | { " and " * t * } | |
239 | if$ | |
240 | } | |
241 | if$ | |
242 | } | |
243 | 't | |
244 | if$ | |
245 | nameptr #1 + 'nameptr := | |
246 | namesleft #1 - 'namesleft := | |
247 | } | |
248 | while$ | |
249 | } | |
250 | ||
251 | FUNCTION {format.authors} | |
252 | { author empty$ | |
253 | { "" } | |
254 | { author format.names } | |
255 | if$ | |
256 | } | |
257 | ||
258 | FUNCTION {format.editors} | |
259 | { editor empty$ | |
260 | { "" } | |
261 | { editor format.names | |
262 | editor num.names$ #1 > | |
263 | { " (eds.)" * } | |
264 | { " (ed.)" * } | |
265 | if$ | |
266 | } | |
267 | if$ | |
268 | } | |
269 | ||
270 | FUNCTION {format.title} | |
271 | { title empty$ | |
272 | { "" } | |
273 | { title} | |
274 | if$ | |
275 | } | |
276 | ||
277 | FUNCTION {n.dashify} | |
278 | { 't := | |
279 | "" | |
280 | { t empty$ not } | |
281 | { t #1 #1 substring$ "-" = | |
282 | { t #1 #2 substring$ "--" = not | |
283 | { "--" * | |
284 | t #2 global.max$ substring$ 't := | |
285 | } | |
286 | { { t #1 #1 substring$ "-" = } | |
287 | { "-" * | |
288 | t #2 global.max$ substring$ 't := | |
289 | } | |
290 | while$ | |
291 | } | |
292 | if$ | |
293 | } | |
294 | { t #1 #1 substring$ * | |
295 | t #2 global.max$ substring$ 't := | |
296 | } | |
297 | if$ | |
298 | } | |
299 | while$ | |
300 | } | |
301 | ||
302 | FUNCTION {year.or.date} | |
303 | { | |
304 | year empty$ | |
305 | {date} | |
306 | {year} | |
307 | if$ | |
308 | } | |
309 | ||
310 | FUNCTION {format.journal} | |
311 | { | |
312 | journal empty$ | |
313 | {journaltitle} | |
314 | {journal} | |
315 | if$ | |
316 | emphasize | |
317 | } | |
318 | ||
319 | FUNCTION {format.date} | |
320 | { | |
321 | "" | |
322 | duplicate$ empty$ | |
323 | year.or.date duplicate$ empty$ | |
324 | { swap$ 'skip$ | |
325 | { "there's a month but no year in " cite$ * warning$ } | |
326 | if$ | |
327 | * | |
328 | } | |
329 | { swap$ 'skip$ | |
330 | { | |
331 | swap$ | |
332 | " " * swap$ | |
333 | } | |
334 | if$ | |
335 | * | |
336 | } | |
337 | if$ | |
338 | } | |
339 | ||
340 | FUNCTION {format.vol.year} | |
341 | { volume field.or.null | |
342 | " (" format.date * ")" * * | |
343 | } | |
344 | ||
345 | ||
346 | FUNCTION {format.btitle} | |
347 | { title emphasize | |
348 | } | |
349 | ||
350 | FUNCTION {tie.or.space.connect} | |
351 | { duplicate$ text.length$ #3 < | |
352 | { "~" } | |
353 | { " " } | |
354 | if$ | |
355 | swap$ * * | |
356 | } | |
357 | ||
358 | FUNCTION {either.or.check} | |
359 | { empty$ | |
360 | 'pop$ | |
361 | { "can't use both " swap$ * " fields in " * cite$ * warning$ } | |
362 | if$ | |
363 | } | |
364 | ||
365 | FUNCTION {format.bvolume} | |
366 | { volume empty$ | |
367 | { "" } | |
368 | { "volume" volume tie.or.space.connect | |
369 | series empty$ | |
370 | 'skip$ | |
371 | { " of " * series * } | |
372 | if$ | |
373 | "volume and number" number either.or.check | |
374 | } | |
375 | if$ | |
376 | } | |
377 | ||
378 | FUNCTION {format.number.series} | |
379 | { volume empty$ | |
380 | { number empty$ | |
381 | { series field.or.null } | |
382 | { output.state mid.sentence = | |
383 | { "number" } | |
384 | { "Number" } | |
385 | if$ | |
386 | number tie.or.space.connect | |
387 | series empty$ | |
388 | { "there's a number but no series in " cite$ * warning$ } | |
389 | { " in " * series * } | |
390 | if$ | |
391 | } | |
392 | if$ | |
393 | } | |
394 | { "" } | |
395 | if$ | |
396 | } | |
397 | ||
398 | FUNCTION {format.edition} | |
399 | { edition empty$ | |
400 | { "" } | |
401 | { output.state mid.sentence = | |
402 | { edition "l" change.case$ " edition" * } | |
403 | { edition "t" change.case$ " edition" * } | |
404 | if$ | |
405 | } | |
406 | if$ | |
407 | } | |
408 | ||
409 | INTEGERS { multiresult } | |
410 | ||
411 | FUNCTION {multi.page.check} | |
412 | { 't := | |
413 | #0 'multiresult := | |
414 | { multiresult not | |
415 | t empty$ not | |
416 | and | |
417 | } | |
418 | { t #1 #1 substring$ | |
419 | duplicate$ "-" = | |
420 | swap$ duplicate$ "," = | |
421 | swap$ "+" = | |
422 | or or | |
423 | { #1 'multiresult := } | |
424 | { t #2 global.max$ substring$ 't := } | |
425 | if$ | |
426 | } | |
427 | while$ | |
428 | multiresult | |
429 | } | |
430 | ||
431 | FUNCTION {format.pages} | |
432 | { pages empty$ | |
433 | { "" } | |
434 | { pages multi.page.check | |
435 | { "" pages n.dashify tie.or.space.connect } | |
436 | { "" pages tie.or.space.connect } | |
437 | if$ | |
438 | } | |
439 | if$ | |
440 | } | |
441 | ||
442 | FUNCTION {format.vol.num.pages} | |
443 | { volume field.or.null | |
444 | number empty$ | |
445 | 'skip$ | |
446 | { "(" number * ")" * * | |
447 | volume empty$ | |
448 | { "there's a number but no volume in " cite$ * warning$ } | |
449 | 'skip$ | |
450 | if$ | |
451 | } | |
452 | if$ | |
453 | pages empty$ | |
454 | 'skip$ | |
455 | { duplicate$ empty$ | |
456 | { pop$ format.pages } | |
457 | { ":" * pages n.dashify * } | |
458 | if$ | |
459 | } | |
460 | if$ | |
461 | } | |
462 | ||
463 | FUNCTION {format.chapter.pages} | |
464 | { chapter empty$ | |
465 | 'format.pages | |
466 | { type empty$ | |
467 | { "chapter" } | |
468 | { type "l" change.case$ } | |
469 | if$ | |
470 | chapter tie.or.space.connect | |
471 | pages empty$ | |
472 | 'skip$ | |
473 | { ", " * format.pages * } | |
474 | if$ | |
475 | } | |
476 | if$ | |
477 | } | |
478 | ||
479 | FUNCTION {format.in.ed.booktitle} | |
480 | { booktitle empty$ | |
481 | { "" } | |
482 | { editor empty$ | |
483 | { "in " booktitle emphasize * } | |
484 | { "in " booktitle emphasize * ", " * format.editors * } | |
485 | if$ | |
486 | } | |
487 | if$ | |
488 | } | |
489 | ||
490 | FUNCTION {empty.misc.check} | |
491 | { author empty$ title empty$ howpublished empty$ | |
492 | month empty$ year empty$ note empty$ | |
493 | and and and and and | |
494 | key empty$ not and | |
495 | { "all relevant fields are empty in " cite$ * warning$ } | |
496 | 'skip$ | |
497 | if$ | |
498 | } | |
499 | ||
500 | FUNCTION {format.thesis.type} | |
501 | { type empty$ | |
502 | 'skip$ | |
503 | { pop$ | |
504 | type "t" change.case$ | |
505 | } | |
506 | if$ | |
507 | } | |
508 | ||
509 | FUNCTION {format.tr.number} | |
510 | { type empty$ | |
511 | { "Technical Report" } | |
512 | 'type | |
513 | if$ | |
514 | number empty$ | |
515 | { "t" change.case$ } | |
516 | { number tie.or.space.connect } | |
517 | if$ | |
518 | } | |
519 | ||
520 | FUNCTION {format.article.crossref} | |
521 | { key empty$ | |
522 | { journal empty$ | |
523 | { "need key or journal for " cite$ * " to crossref " * crossref * | |
524 | warning$ | |
525 | "" | |
526 | } | |
527 | { "in \emph{" journal * "\/}" * } | |
528 | if$ | |
529 | } | |
530 | { "in " key * } | |
531 | if$ | |
532 | " \cite{" * crossref * "}" * | |
533 | } | |
534 | ||
535 | FUNCTION {format.crossref.editor} | |
536 | { editor #1 "{vv~}{ll}" format.name$ | |
537 | editor num.names$ duplicate$ | |
538 | #2 > | |
539 | { pop$ " et~al." * } | |
540 | { #2 < | |
541 | 'skip$ | |
542 | { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = | |
543 | { " et~al." * } | |
544 | { " and " * editor #2 "{vv~}{ll}" format.name$ * } | |
545 | if$ | |
546 | } | |
547 | if$ | |
548 | } | |
549 | if$ | |
550 | } | |
551 | ||
552 | FUNCTION {format.book.crossref} | |
553 | { volume empty$ | |
554 | { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ | |
555 | "in " | |
556 | } | |
557 | { "Volume" volume tie.or.space.connect | |
558 | " of " * | |
559 | } | |
560 | if$ | |
561 | editor empty$ | |
562 | editor field.or.null author field.or.null = | |
563 | or | |
564 | { key empty$ | |
565 | { series empty$ | |
566 | { "need editor, key, or series for " cite$ * " to crossref " * | |
567 | crossref * warning$ | |
568 | "" * | |
569 | } | |
570 | { "\emph{" * series * "\/}" * } | |
571 | if$ | |
572 | } | |
573 | { key * } | |
574 | if$ | |
575 | } | |
576 | { format.crossref.editor * } | |
577 | if$ | |
578 | " \cite{" * crossref * "}" * | |
579 | } | |
580 | ||
581 | FUNCTION {format.incoll.inproc.crossref} | |
582 | { editor empty$ | |
583 | editor field.or.null author field.or.null = | |
584 | or | |
585 | { key empty$ | |
586 | { booktitle empty$ | |
587 | { "need editor, key, or booktitle for " cite$ * " to crossref " * | |
588 | crossref * warning$ | |
589 | "" | |
590 | } | |
591 | { "in \emph{" booktitle * "\/}" * } | |
592 | if$ | |
593 | } | |
594 | { "in " key * } | |
595 | if$ | |
596 | } | |
597 | { "in " format.crossref.editor * } | |
598 | if$ | |
599 | " \cite{" * crossref * "}" * | |
600 | } | |
601 | ||
602 | FUNCTION {eprint.version} | |
603 | { | |
604 | eprint empty$ | |
605 | { "" } | |
606 | { version empty$ | |
607 | { eprint } | |
608 | { eprint "v" * version * } | |
609 | if$ | |
610 | } | |
611 | if$ | |
612 | } | |
613 | ||
614 | FUNCTION {format.hal} | |
615 | { eprint empty$ | |
616 | { "" } | |
617 | { "\href{https://hal.archives-ouvertes.fr/" eprint.version * | |
618 | "}{\nolinkurl{hal-" * eprint.version "L" change.case$ * "}}" * | |
619 | } | |
620 | if$ | |
621 | } | |
622 | ||
623 | FUNCTION {format.arxiv} | |
624 | { eprint empty$ | |
625 | { "" } | |
626 | { "\href{https://arxiv.org/abs/" eprint.version * | |
627 | "}{\nolinkurl{arXiv:" * eprint.version * "}}" * | |
628 | } | |
629 | if$ | |
630 | } | |
631 | ||
632 | FUNCTION {format.eprint} | |
633 | { eprinttype empty$ | |
634 | { "" } | |
635 | { eprinttype "l" change.case$ "hal" = | |
636 | { format.hal } | |
637 | { format.arxiv } | |
638 | if$ | |
639 | } | |
640 | if$ | |
641 | } | |
642 | ||
643 | FUNCTION {format.doi} | |
644 | { doi empty$ | |
645 | { "" } | |
646 | { "\href{https://dx.doi.org/" doi * "}{\nolinkurl{doi:" * doi "l" change.case$ * "}}" * } | |
647 | if$ | |
648 | } | |
649 | ||
650 | FUNCTION {format.url} | |
651 | { url empty$ | |
652 | { "" } | |
653 | { urldate empty$ | |
654 | { "\url{" url * "}" * } | |
655 | { "\url{" url * "} (visited " * urldate * ")" * } | |
656 | if$ | |
657 | } | |
658 | if$ | |
659 | } | |
660 | ||
661 | FUNCTION {article} | |
662 | { output.bibitem | |
663 | format.authors "author" output.check | |
664 | format.title "title" output.check | |
665 | format.journal "journal" output.check add.blank | |
666 | format.vol.year output | |
667 | format.pages output | |
668 | format.doi output | |
669 | format.eprint output | |
670 | format.url output | |
671 | new.block | |
672 | note output | |
673 | fin.entry | |
674 | } | |
675 | ||
676 | FUNCTION {book} | |
677 | { output.bibitem | |
678 | author empty$ | |
679 | { format.editors "author and editor" output.check } | |
680 | { format.authors output.nonnull | |
681 | "author and editor" editor either.or.check | |
682 | } | |
683 | if$ | |
684 | format.btitle "title" output.check | |
685 | format.bvolume output | |
686 | format.number.series output | |
687 | publisher "publisher" output.check | |
688 | address output | |
689 | format.edition output | |
690 | format.date output | |
691 | format.doi output | |
692 | new.block | |
693 | note output | |
694 | fin.entry | |
695 | } | |
696 | ||
697 | FUNCTION {booklet} | |
698 | { output.bibitem | |
699 | format.authors output | |
700 | format.title "title" output.check | |
701 | howpublished address new.block.checkb | |
702 | howpublished output | |
703 | address output | |
704 | format.date output | |
705 | format.doi output | |
706 | format.url output | |
707 | new.block | |
708 | note output | |
709 | fin.entry | |
710 | } | |
711 | ||
712 | FUNCTION {inbook} | |
713 | { output.bibitem | |
714 | author empty$ | |
715 | { format.editors "author and editor" output.check } | |
716 | { format.authors output.nonnull | |
717 | crossref missing$ | |
718 | { "author and editor" editor either.or.check } | |
719 | 'skip$ | |
720 | if$ | |
721 | } | |
722 | if$ | |
723 | format.title "title" output.check | |
724 | crossref missing$ | |
725 | { format.in.ed.booktitle "booktitle" output.check | |
726 | format.bvolume output | |
727 | format.number.series output | |
728 | publisher "publisher" output.check | |
729 | address output | |
730 | } | |
731 | { format.book.crossref output.nonnull } | |
732 | if$ | |
733 | format.edition output | |
734 | format.date "year" output.check | |
735 | format.chapter.pages "chapter and pages" output.check | |
736 | format.doi output | |
737 | format.eprint output | |
738 | format.url output | |
739 | new.block | |
740 | note output | |
741 | fin.entry | |
742 | } | |
743 | ||
744 | FUNCTION {incollection} | |
745 | { output.bibitem | |
746 | format.authors "author" output.check | |
747 | format.title "title" output.check | |
748 | crossref missing$ | |
749 | { format.in.ed.booktitle "booktitle" output.check | |
750 | format.bvolume output | |
751 | format.number.series output | |
752 | publisher "publisher" output.check | |
753 | address output | |
754 | format.edition output | |
755 | format.date "year" output.check | |
756 | } | |
757 | { format.incoll.inproc.crossref output.nonnull | |
758 | format.chapter.pages output | |
759 | } | |
760 | if$ | |
761 | format.chapter.pages output | |
762 | format.doi output | |
763 | format.eprint output | |
764 | format.url output | |
765 | new.block | |
766 | note output | |
767 | fin.entry | |
768 | } | |
769 | ||
770 | FUNCTION {proceedings} | |
771 | { output.bibitem | |
772 | editor empty$ | |
773 | { organization output } | |
774 | { format.editors output.nonnull } | |
775 | if$ | |
776 | format.btitle "title" output.check | |
777 | format.bvolume output | |
778 | format.number.series output | |
779 | address empty$ | |
780 | { editor empty$ | |
781 | 'skip$ | |
782 | { organization output } | |
783 | if$ | |
784 | publisher output | |
785 | format.date "year" output.check | |
786 | } | |
787 | { address output.nonnull | |
788 | format.date "year" output.check | |
789 | editor empty$ | |
790 | 'skip$ | |
791 | { organization output } | |
792 | if$ | |
793 | publisher output | |
794 | } | |
795 | if$ | |
796 | format.doi output | |
797 | format.eprint output | |
798 | format.url output | |
799 | new.block | |
800 | note output | |
801 | fin.entry | |
802 | } | |
803 | ||
804 | FUNCTION {inproceedings} | |
805 | { output.bibitem | |
806 | format.authors "author" output.check | |
807 | format.title "title" output.check | |
808 | crossref missing$ | |
809 | { format.in.ed.booktitle "booktitle" output.check | |
810 | format.bvolume output | |
811 | format.number.series output | |
812 | publisher "publisher" output.check | |
813 | address output | |
814 | format.edition output | |
815 | format.date output | |
816 | } | |
817 | { format.incoll.inproc.crossref output.nonnull } | |
818 | if$ | |
819 | format.pages output | |
820 | format.doi output | |
821 | format.eprint output | |
822 | format.url output | |
823 | new.block | |
824 | note output | |
825 | fin.entry | |
826 | } | |
827 | ||
828 | FUNCTION {conference} { inproceedings } | |
829 | ||
830 | FUNCTION {manual} | |
831 | { output.bibitem | |
832 | author empty$ | |
833 | { organization empty$ | |
834 | 'skip$ | |
835 | { organization output.nonnull } | |
836 | if$ | |
837 | } | |
838 | { format.authors output.nonnull } | |
839 | if$ | |
840 | format.btitle "title" output.check | |
841 | author empty$ | |
842 | 'skip$ | |
843 | { organization output } | |
844 | if$ | |
845 | address output | |
846 | format.edition output | |
847 | format.date output | |
848 | format.doi output | |
849 | format.eprint output | |
850 | format.url output | |
851 | new.block | |
852 | note output | |
853 | fin.entry | |
854 | } | |
855 | ||
856 | FUNCTION {mastersthesis} | |
857 | { output.bibitem | |
858 | format.authors "author" output.check | |
859 | format.btitle "title" output.check | |
860 | "Master's thesis" format.thesis.type output.nonnull | |
861 | school "school" output.check | |
862 | address output | |
863 | format.date "year" output.check | |
864 | format.doi output | |
865 | format.eprint output | |
866 | format.url output | |
867 | new.block | |
868 | note output | |
869 | fin.entry | |
870 | } | |
871 | ||
872 | FUNCTION {phdthesis} | |
873 | { output.bibitem | |
874 | format.authors "author" output.check | |
875 | format.btitle "title" output.check | |
876 | "PhD thesis" format.thesis.type output.nonnull | |
877 | school "school" output.check | |
878 | address output | |
879 | format.date "year" output.check | |
880 | format.doi output | |
881 | format.eprint output | |
882 | format.url output | |
883 | new.block | |
884 | note output | |
885 | fin.entry | |
886 | } | |
887 | ||
888 | FUNCTION {techreport} | |
889 | { output.bibitem | |
890 | format.authors "author" output.check | |
891 | format.title "title" output.check | |
892 | format.tr.number output.nonnull | |
893 | institution "institution" output.check | |
894 | address output | |
895 | format.date "year" output.check | |
896 | format.url output | |
897 | new.block | |
898 | note output | |
899 | fin.entry | |
900 | } | |
901 | ||
902 | FUNCTION {unpublished} | |
903 | { output.bibitem | |
904 | format.authors "author" output.check | |
905 | format.title "title" output.check add.blank | |
906 | format.vol.year output | |
907 | format.eprint output | |
908 | format.url output | |
909 | new.block | |
910 | note output | |
911 | fin.entry | |
912 | } | |
913 | ||
914 | FUNCTION {misc} | |
915 | { output.bibitem | |
916 | format.authors output | |
917 | format.title output | |
918 | howpublished output | |
919 | format.date output | |
920 | format.doi output | |
921 | format.eprint output | |
922 | format.url output | |
923 | new.block | |
924 | note output | |
925 | fin.entry | |
926 | empty.misc.check | |
927 | } | |
928 | ||
929 | FUNCTION {default.type} { misc } | |
930 | ||
931 | MACRO {jan} {"Jan."} | |
932 | ||
933 | MACRO {feb} {"Feb."} | |
934 | ||
935 | MACRO {mar} {"Mar."} | |
936 | ||
937 | MACRO {apr} {"Apr."} | |
938 | ||
939 | MACRO {may} {"May"} | |
940 | ||
941 | MACRO {jun} {"June"} | |
942 | ||
943 | MACRO {jul} {"July"} | |
944 | ||
945 | MACRO {aug} {"Aug."} | |
946 | ||
947 | MACRO {sep} {"Sept."} | |
948 | ||
949 | MACRO {oct} {"Oct."} | |
950 | ||
951 | MACRO {nov} {"Nov."} | |
952 | ||
953 | MACRO {dec} {"Dec."} | |
954 | ||
955 | READ | |
956 | ||
957 | FUNCTION {sortify} | |
958 | { purify$ | |
959 | "l" change.case$ | |
960 | } | |
961 | ||
962 | INTEGERS { len } | |
963 | ||
964 | FUNCTION {chop.word} | |
965 | { 's := | |
966 | 'len := | |
967 | s #1 len substring$ = | |
968 | { s len #1 + global.max$ substring$ } | |
969 | 's | |
970 | if$ | |
971 | } | |
972 | ||
973 | FUNCTION {sort.format.names} | |
974 | { 's := | |
975 | #1 'nameptr := | |
976 | "" | |
977 | s num.names$ 'numnames := | |
978 | numnames 'namesleft := | |
979 | { namesleft #0 > } | |
980 | { nameptr #1 > | |
981 | { " " * } | |
982 | 'skip$ | |
983 | if$ | |
984 | s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := | |
985 | nameptr numnames = t "others" = and | |
986 | { "et al" * } | |
987 | { t sortify * } | |
988 | if$ | |
989 | nameptr #1 + 'nameptr := | |
990 | namesleft #1 - 'namesleft := | |
991 | } | |
992 | while$ | |
993 | } | |
994 | ||
995 | FUNCTION {sort.format.title} | |
996 | { 't := | |
997 | "A " #2 | |
998 | "An " #3 | |
999 | "The " #4 t chop.word | |
1000 | chop.word | |
1001 | chop.word | |
1002 | sortify | |
1003 | #1 global.max$ substring$ | |
1004 | } | |
1005 | ||
1006 | FUNCTION {author.sort} | |
1007 | { author empty$ | |
1008 | { key empty$ | |
1009 | { "to sort, need author or key in " cite$ * warning$ | |
1010 | "" | |
1011 | } | |
1012 | { key sortify } | |
1013 | if$ | |
1014 | } | |
1015 | { author sort.format.names } | |
1016 | if$ | |
1017 | } | |
1018 | ||
1019 | FUNCTION {author.editor.sort} | |
1020 | { author empty$ | |
1021 | { editor empty$ | |
1022 | { key empty$ | |
1023 | { "to sort, need author, editor, or key in " cite$ * warning$ | |
1024 | "" | |
1025 | } | |
1026 | { key sortify } | |
1027 | if$ | |
1028 | } | |
1029 | { editor sort.format.names } | |
1030 | if$ | |
1031 | } | |
1032 | { author sort.format.names } | |
1033 | if$ | |
1034 | } | |
1035 | ||
1036 | FUNCTION {author.organization.sort} | |
1037 | { author empty$ | |
1038 | { organization empty$ | |
1039 | { key empty$ | |
1040 | { "to sort, need author, organization, or key in " cite$ * warning$ | |
1041 | "" | |
1042 | } | |
1043 | { key sortify } | |
1044 | if$ | |
1045 | } | |
1046 | { "The " #4 organization chop.word sortify } | |
1047 | if$ | |
1048 | } | |
1049 | { author sort.format.names } | |
1050 | if$ | |
1051 | } | |
1052 | ||
1053 | FUNCTION {editor.organization.sort} | |
1054 | { editor empty$ | |
1055 | { organization empty$ | |
1056 | { key empty$ | |
1057 | { "to sort, need editor, organization, or key in " cite$ * warning$ | |
1058 | "" | |
1059 | } | |
1060 | { key sortify } | |
1061 | if$ | |
1062 | } | |
1063 | { "The " #4 organization chop.word sortify } | |
1064 | if$ | |
1065 | } | |
1066 | { editor sort.format.names } | |
1067 | if$ | |
1068 | } | |
1069 | ||
1070 | FUNCTION {presort} | |
1071 | { type$ "book" = | |
1072 | type$ "inbook" = | |
1073 | or | |
1074 | 'author.editor.sort | |
1075 | { type$ "proceedings" = | |
1076 | 'editor.organization.sort | |
1077 | { type$ "manual" = | |
1078 | 'author.organization.sort | |
1079 | 'author.sort | |
1080 | if$ | |
1081 | } | |
1082 | if$ | |
1083 | } | |
1084 | if$ | |
1085 | " " | |
1086 | * | |
1087 | year field.or.null sortify | |
1088 | * | |
1089 | " " | |
1090 | * | |
1091 | title field.or.null | |
1092 | sort.format.title | |
1093 | * | |
1094 | #1 entry.max$ substring$ | |
1095 | 'sort.key$ := | |
1096 | } | |
1097 | ||
1098 | ITERATE {presort} | |
1099 | ||
1100 | SORT | |
1101 | ||
1102 | STRINGS { longest.label } | |
1103 | ||
1104 | INTEGERS { number.label longest.label.width } | |
1105 | ||
1106 | FUNCTION {initialize.longest.label} | |
1107 | { "" 'longest.label := | |
1108 | #1 'number.label := | |
1109 | #0 'longest.label.width := | |
1110 | } | |
1111 | ||
1112 | FUNCTION {longest.label.pass} | |
1113 | { number.label int.to.str$ 'label := | |
1114 | number.label #1 + 'number.label := | |
1115 | label width$ longest.label.width > | |
1116 | { label 'longest.label := | |
1117 | label width$ 'longest.label.width := | |
1118 | } | |
1119 | 'skip$ | |
1120 | if$ | |
1121 | } | |
1122 | ||
1123 | EXECUTE {initialize.longest.label} | |
1124 | ||
1125 | ITERATE {longest.label.pass} | |
1126 | ||
1127 | FUNCTION {begin.bib} | |
1128 | { preamble$ empty$ | |
1129 | 'skip$ | |
1130 | { preamble$ write$ newline$ } | |
1131 | if$ | |
1132 | "\begin{thebibliography}{" longest.label * "}" * write$ newline$ | |
1133 | } | |
1134 | ||
1135 | EXECUTE {begin.bib} | |
1136 | ||
1137 | EXECUTE {init.state.consts} | |
1138 | ||
1139 | ITERATE {call.type$} | |
1140 | ||
1141 | FUNCTION {end.bib} | |
1142 | { newline$ | |
1143 | "\end{thebibliography}" write$ newline$ | |
1144 | } | |
1145 | ||
1146 | EXECUTE {end.bib} |