├── example.png ├── README.md └── aa_url.bst /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yangcht/AA-bibstyle-with-hyperlink/HEAD/example.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction: A&A-bibstyle-with-hyperlink 2 | - modified `aa.bst` with clickable url links in the bibliography 3 | - bst file for Astronomy & Astrophysical Journal 4 | - modified based on the `aa.bst` file from http://ftp.edpsciences.org/pub/aa/readme.html 5 | - it is recommended to **use the bibtex record generated from NASA/ADS** in order to include `doi` and `adsurl` properly 6 | 7 | # How to use: 8 | - Put this `aa_rul.bst` in your project folder and reference this with `\bibliographystyle{folder/aa_url.bst}` 9 | - For making the links and colors work, **MAKE SURE** to add something like the following in the preamble of your .TeX file 10 | 11 | ``` 12 | %---------- Add the clickable link function ---------- 13 | \usepackage{color} 14 | \usepackage{natbib,twoopt} 15 | \usepackage[hyphenbreaks]{breakurl} 16 | \usepackage[breaklinks]{hyperref} %% to avoid \citeads line fills, add "draft" 17 | %% to avoid the PDFTK error (broken links) 18 | \bibpunct{(}{)}{;}{a}{}{,} %% natbib format for A&A and ApJ 19 | \definecolor{cobalt}{rgb}{0.06, 0.2, 0.65} 20 | \hypersetup{ 21 | colorlinks, 22 | citecolor=cobalt, 23 | linkcolor=[rgb]{0.8, 0.2, 1.0}, 24 | urlcolor=cobalt, 25 | } 26 | \makeatletter 27 | \newcommandtwoopt{\citeads}[3][][]{\href{http://adsabs.harvard.edu/abs/#3}% 28 | {\def\hyper@linkstart##1##2{}% 29 | \let\hyper@linkend\@empty\citealp[#1][#2]{#3}}} 30 | \newcommandtwoopt{\citepads}[3][][]{\href{http://adsabs.harvard.edu/abs/#3}% 31 | {\def\hyper@linkstart##1##2{}% 32 | \let\hyper@linkend\@empty\citep[#1][#2]{#3}}} 33 | \newcommandtwoopt{\citetads}[3][][]{\href{http://adsabs.harvard.edu/abs/#3}% 34 | {\def\hyper@linkstart##1##2{}% 35 | \let\hyper@linkend\@empty\citet[#1][#2]{#3}}} 36 | \newcommandtwoopt{\citeyearads}[3][][]% 37 | {\href{http://adsabs.harvard.edu/abs/#3} 38 | {\def\hyper@linkstart##1##2{}% 39 | \let\hyper@linkend\@empty\citeyear[#1][#2]{#3}}} 40 | \makeatother 41 | ``` 42 | 43 | # Examples: 44 | This is a demo of the function of this bibstyle. 45 | 46 | ![example](./example.png) 47 | 48 | 49 | ## Notes: 50 | - Some users report that the `color` package generates some warning and switch to `xcolor` might help. 51 | -------------------------------------------------------------------------------- /aa_url.bst: -------------------------------------------------------------------------------- 1 | %% 2019/01 Chentao Yang 2 | %% mailto:yangcht@gmail.com 3 | %% Enabling the ADSURL and DOI entry to create clickable links in ref. 4 | 5 | %% 2001/06/10 EDP Sciences 6 | %% APJ, corrected by hand to get results for A&A, using Natbib 7 | 8 | %% 1998/08/12 J Baker 9 | %% Tweaked by hand to get correct results for ApJ. Added functions from 10 | %% astrobib. 11 | 12 | %% $Log: apj.bst,v $ 13 | %% Revision 1.3 2000/04/20 22:17:50 jbaker 14 | %% Fixed INBOOK bug, now works essentially like BOOK. 15 | %% 16 | %% Revision 1.2 1998/08/30 22:35:45 jbaker 17 | %% Added RCS keywords. 18 | %% 19 | 20 | %% 21 | %% This is file `apj.bst`, 22 | %% generated with the docstrip utility. 23 | %% 24 | %% The original source files were: 25 | %% 26 | %% merlin.mbs (with options: `,ay,nat,nm-rev,nmdash,dt-beg,yr-per,note-yr,atit-u,jtit-x,jttl-rm,thtit-a,vnum-x,volp-com,jpg-1,pp-last,btit-rm,add-pub,pub-par,pre-edn,edby,edbyx,blk-com,fin-bare,ppx,ed,abr,ord,jabr,eprint,amper,em-x`) 27 | %% ---------------------------------------- 28 | %% *** Bibliographic Style for ApJ *** 29 | %% 30 | %------------------------------------------------------------------- 31 | % The original source file contains the following version information: 32 | % \ProvidesFile{merlin.mbs}[1998/02/25 3.85a (PWD)] 33 | % 34 | % NOTICE: 35 | % This file may be used for non-profit purposes. 36 | % It may not be distributed in exchange for money, 37 | % other than distribution costs. 38 | % 39 | % The author provides it `as is` and does not guarantee it in any way. 40 | % 41 | % Copyright (C) 1994-98 Patrick W. Daly 42 | %------------------------------------------------------------------- 43 | % For use with BibTeX version 0.99a or later 44 | %------------------------------------------------------------------- 45 | % This bibliography style file is intended for texts in ENGLISH 46 | % This is an author-year citation style bibliography. As such, it is 47 | % non-standard LaTeX, and requires a special package file to function properly. 48 | % Such a package is natbib.sty by Patrick W. Daly 49 | % The form of the \bibitem entries is 50 | % \bibitem[Jones et al.(1990)]{key}... 51 | % \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}... 52 | % The essential feature is that the label (the part in brackets) consists 53 | % of the author names, as they should appear in the citation, with the year 54 | % in parentheses following. There must be no space before the opening 55 | % parenthesis! 56 | % With natbib v5.3, a full list of authors may also follow the year. 57 | % In natbib.sty, it is possible to define the type of enclosures that is 58 | % really wanted (brackets or parentheses), but in either case, there must 59 | % be parentheses in the label. 60 | % The \cite command functions as follows: 61 | % \citet{key} ==>> Jones et al. (1990) 62 | % \citet*{key} ==>> Jones, Baker, and Smith (1990) 63 | % \citep{key} ==>> (Jones et al., 1990) 64 | % \citep*{key} ==>> (Jones, Baker, and Smith, 1990) 65 | % \citep[chap. 2]{key} ==>> (Jones et al., 1990, chap. 2) 66 | % \citep[e.g.][]{key} ==>> (e.g. Jones et al., 1990) 67 | % \citep[e.g.][p. 32]{key} ==>> (e.g. Jones et al., p. 32) 68 | % \citeauthor{key} ==>> Jones et al. 69 | % \citeauthor*{key} ==>> Jones, Baker, and Smith 70 | % \citeyear{key} ==>> 1990 71 | %--------------------------------------------------------------------- 72 | 73 | 74 | ENTRY 75 | { address 76 | archiveprefix 77 | author 78 | booktitle 79 | chapter 80 | edition 81 | editor 82 | howpublished 83 | institution 84 | eprint 85 | doi 86 | url 87 | journal 88 | key 89 | month 90 | note 91 | number 92 | organization 93 | pages 94 | publisher 95 | school 96 | series 97 | title 98 | type 99 | volume 100 | year 101 | adsurl 102 | } 103 | {} 104 | { label extra.label sort.label short.list } 105 | 106 | INTEGERS { output.state before.all mid.sentence after.sentence after.block } 107 | 108 | FUNCTION {init.state.consts} 109 | { #0 'before.all := 110 | #1 'mid.sentence := 111 | #2 'after.sentence := 112 | #3 'after.block := 113 | } 114 | 115 | STRINGS { s t } 116 | 117 | FUNCTION {output.nonnull} 118 | { 's := 119 | output.state mid.sentence = 120 | { ", " * write$ } 121 | { output.state after.block = 122 | { add.period$ write$ 123 | newline$ 124 | "\newblock " write$ 125 | } 126 | { output.state before.all = 127 | 'write$ 128 | { add.period$ " " * write$ } 129 | if$ 130 | } 131 | if$ 132 | mid.sentence 'output.state := 133 | } 134 | if$ 135 | s 136 | } 137 | 138 | FUNCTION {output.eprint} 139 | { 's := 140 | output.state mid.sentence = 141 | { " " * write$ } 142 | { output.state after.block = 143 | { add.period$ write$ 144 | newline$ 145 | "\newblock " write$ 146 | } 147 | { output.state before.all = 148 | 'write$ 149 | { add.period$ " " * write$ } 150 | if$ 151 | } 152 | if$ 153 | mid.sentence 'output.state := 154 | } 155 | if$ 156 | s 157 | } 158 | 159 | FUNCTION {output} 160 | { duplicate$ empty$ 161 | 'pop$ 162 | 'output.nonnull 163 | if$ 164 | } 165 | 166 | FUNCTION {outputeprint} 167 | { duplicate$ empty$ 168 | 'pop$ 169 | 'output.eprint 170 | if$ 171 | } 172 | 173 | FUNCTION {output.check} 174 | { 't := 175 | duplicate$ empty$ 176 | { pop$ "empty " t * " in " * cite$ * warning$ } 177 | 'output.nonnull 178 | if$ 179 | } 180 | 181 | FUNCTION {fin.entry} 182 | { duplicate$ empty$ 183 | 'pop$ 184 | 'write$ 185 | if$ 186 | newline$ 187 | } 188 | 189 | FUNCTION {new.block} 190 | { output.state before.all = 191 | 'skip$ 192 | { after.block 'output.state := } 193 | if$ 194 | } 195 | 196 | FUNCTION {new.sentence} 197 | { output.state after.block = 198 | 'skip$ 199 | { output.state before.all = 200 | 'skip$ 201 | { after.sentence 'output.state := } 202 | if$ 203 | } 204 | if$ 205 | } 206 | 207 | FUNCTION {add.blank} 208 | { " " * before.all 'output.state := 209 | } 210 | 211 | FUNCTION {date.block} 212 | { skip$ } 213 | 214 | FUNCTION {not} 215 | { { #0 } 216 | { #1 } 217 | if$ 218 | } 219 | 220 | FUNCTION {and} 221 | { 'skip$ 222 | { pop$ #0 } 223 | if$ 224 | } 225 | 226 | FUNCTION {or} 227 | { { pop$ #1 } 228 | 'skip$ 229 | if$ 230 | } 231 | 232 | FUNCTION {new.block.checkb} 233 | { empty$ 234 | swap$ empty$ 235 | and 236 | 'skip$ 237 | 'new.block 238 | if$ 239 | } 240 | 241 | FUNCTION {field.or.null} 242 | { duplicate$ empty$ 243 | { pop$ "" } 244 | 'skip$ 245 | if$ 246 | } 247 | 248 | FUNCTION {emphasize} 249 | { skip$ } 250 | 251 | FUNCTION {capitalize} 252 | { "u" change.case$ "t" change.case$ } 253 | 254 | FUNCTION {space.word} 255 | { " " swap$ * " " * } 256 | 257 | FUNCTION {bbl.and} 258 | { "and" } 259 | 260 | FUNCTION {bbl.editors} 261 | { "eds." } 262 | 263 | FUNCTION {bbl.editor} 264 | { "ed." } 265 | 266 | FUNCTION {bbl.edby} 267 | { "edited by" } 268 | 269 | FUNCTION {bbl.edition} 270 | { "edn." } 271 | 272 | FUNCTION {bbl.volume} 273 | { "Vol." } 274 | 275 | FUNCTION {bbl.of} 276 | { "of" } 277 | 278 | FUNCTION {bbl.number} 279 | { "no." } 280 | 281 | FUNCTION {bbl.nr} 282 | { "no." } 283 | 284 | FUNCTION {bbl.in} 285 | { "in" } 286 | 287 | FUNCTION {bbl.pages} 288 | { "" } 289 | 290 | FUNCTION {bbl.page} 291 | { "" } 292 | 293 | FUNCTION {bbl.chapter} 294 | { "Ch." } 295 | 296 | FUNCTION {bbl.techrep} 297 | { "Tech. Rep." } 298 | 299 | FUNCTION {bbl.mthesis} 300 | { "Master's thesis" } 301 | 302 | FUNCTION {bbl.phdthesis} 303 | { "PhD thesis" } 304 | 305 | FUNCTION {bbl.first} 306 | { "1st" } 307 | 308 | FUNCTION {bbl.second} 309 | { "2nd" } 310 | 311 | FUNCTION {bbl.third} 312 | { "3rd" } 313 | 314 | FUNCTION {bbl.fourth} 315 | { "4th" } 316 | 317 | FUNCTION {bbl.fifth} 318 | { "5th" } 319 | 320 | FUNCTION {bbl.st} 321 | { "st" } 322 | 323 | FUNCTION {bbl.nd} 324 | { "nd" } 325 | 326 | FUNCTION {bbl.rd} 327 | { "rd" } 328 | 329 | FUNCTION {bbl.th} 330 | { "th" } 331 | 332 | MACRO {jan} {"Jan."} 333 | 334 | MACRO {feb} {"Feb."} 335 | 336 | MACRO {mar} {"Mar."} 337 | 338 | MACRO {apr} {"Apr."} 339 | 340 | MACRO {may} {"May"} 341 | 342 | MACRO {jun} {"Jun."} 343 | 344 | MACRO {jul} {"Jul."} 345 | 346 | MACRO {aug} {"Aug."} 347 | 348 | MACRO {sep} {"Sep."} 349 | 350 | MACRO {oct} {"Oct."} 351 | 352 | MACRO {nov} {"Nov."} 353 | 354 | MACRO {dec} {"Dec."} 355 | 356 | FUNCTION {eng.ord} 357 | { duplicate$ "1" swap$ * 358 | #-2 #1 substring$ "1" = 359 | { bbl.th * } 360 | { duplicate$ #-1 #1 substring$ 361 | duplicate$ "1" = 362 | { pop$ bbl.st * } 363 | { duplicate$ "2" = 364 | { pop$ bbl.nd * } 365 | { "3" = 366 | { bbl.rd * } 367 | { bbl.th * } 368 | if$ 369 | } 370 | if$ 371 | } 372 | if$ 373 | } 374 | if$ 375 | } 376 | 377 | MACRO {acmcs} {"ACM Comput. Surv."} 378 | 379 | MACRO {acta} {"Acta Inf."} 380 | 381 | MACRO {cacm} {"Commun. ACM"} 382 | 383 | MACRO {ibmjrd} {"IBM J. Res. Dev."} 384 | 385 | MACRO {ibmsj} {"IBM Syst.~J."} 386 | 387 | MACRO {ieeese} {"IEEE Trans. Softw. Eng."} 388 | 389 | MACRO {ieeetc} {"IEEE Trans. Comput."} 390 | 391 | MACRO {ieeetcad} 392 | {"IEEE Trans. Comput.-Aided Design Integrated Circuits"} 393 | 394 | MACRO {ipl} {"Inf. Process. Lett."} 395 | 396 | MACRO {jacm} {"J.~ACM"} 397 | 398 | MACRO {jcss} {"J.~Comput. Syst. Sci."} 399 | 400 | MACRO {scp} {"Sci. Comput. Programming"} 401 | 402 | MACRO {sicomp} {"SIAM J. Comput."} 403 | 404 | MACRO {tocs} {"ACM Trans. Comput. Syst."} 405 | 406 | MACRO {tods} {"ACM Trans. Database Syst."} 407 | 408 | MACRO {tog} {"ACM Trans. Gr."} 409 | 410 | MACRO {toms} {"ACM Trans. Math. Softw."} 411 | 412 | MACRO {toois} {"ACM Trans. Office Inf. Syst."} 413 | 414 | MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."} 415 | 416 | MACRO {tcs} {"Theoretical Comput. Sci."} 417 | 418 | INTEGERS { nameptr namesleft numnames } 419 | 420 | FUNCTION {format.names} 421 | { 's := 422 | #1 'nameptr := 423 | s num.names$ 'numnames := 424 | numnames 'namesleft := 425 | { namesleft #0 > } 426 | { s nameptr 427 | "{vv~}{ll}{, jj}{, f.}" format.name$ 428 | 't := 429 | numnames #5 > 430 | { 431 | nameptr #1 > 432 | { 433 | nameptr #4 = 434 | { 435 | ", {et~al.}" * 436 | } 437 | { 438 | nameptr #4 > 439 | { "" * } 440 | { ", " * t * } 441 | if$ 442 | } 443 | if$ 444 | } 445 | 't 446 | if$ 447 | } 448 | { 449 | nameptr #1 > 450 | { 451 | namesleft #1 > 452 | { ", " * t * } 453 | { 454 | numnames #2 > 455 | { "," * } 456 | 'skip$ 457 | if$ 458 | s nameptr "{ll}" format.name$ duplicate$ "others" = 459 | { 't := } 460 | { pop$ } 461 | if$ 462 | t "others" = 463 | { 464 | " {et~al.}" * 465 | } 466 | { " \& " * t * } 467 | if$ 468 | } 469 | if$ 470 | } 471 | 't 472 | if$ 473 | } if$ 474 | nameptr #1 + 'nameptr := 475 | namesleft #1 - 'namesleft := 476 | } 477 | while$ 478 | } 479 | 480 | FUNCTION {format.names.ed} 481 | { 482 | format.names 483 | } 484 | 485 | FUNCTION {format.key} 486 | { empty$ 487 | { key field.or.null } 488 | { "" } 489 | if$ 490 | } 491 | 492 | FUNCTION {format.authors} 493 | { author empty$ 494 | { "" } 495 | { author format.names } 496 | if$ 497 | } 498 | 499 | FUNCTION {format.editors} 500 | { editor empty$ 501 | { "" } 502 | { editor format.names 503 | editor num.names$ #1 > 504 | { ", " * bbl.editors * } 505 | { ", " * bbl.editor * } 506 | if$ 507 | } 508 | if$ 509 | } 510 | 511 | FUNCTION {format.in.editors} 512 | { editor empty$ 513 | { "" } 514 | { editor format.names.ed 515 | } 516 | if$ 517 | } 518 | 519 | FUNCTION {format.note} 520 | { note empty$ 521 | { "" } 522 | { note #1 #1 substring$ 523 | duplicate$ "{" = 524 | 'skip$ 525 | { output.state mid.sentence = 526 | { "l" } 527 | { "u" } 528 | if$ 529 | change.case$ 530 | } 531 | if$ 532 | note #2 global.max$ substring$ * 533 | } 534 | if$ 535 | } 536 | 537 | FUNCTION {format.eprint} 538 | { eprint duplicate$ empty$ 539 | 'skip$ 540 | { "[\eprint" 541 | archiveprefix empty$ 542 | 'skip$ 543 | { "[" * archiveprefix * "]" * } 544 | if$ 545 | "{" * swap$ * "}]" * 546 | } 547 | if$ 548 | } 549 | 550 | FUNCTION {format.title} 551 | { title empty$ 552 | { "" } 553 | { title } 554 | if$ 555 | } 556 | 557 | FUNCTION {format.full.names} 558 | { 's := 559 | #1 'nameptr := 560 | s num.names$ 'numnames := 561 | numnames 'namesleft := 562 | { namesleft #0 > } 563 | { s nameptr 564 | "{vv~}{ll}" format.name$ 565 | 't := 566 | nameptr #1 > 567 | { 568 | namesleft #1 > 569 | { ", " * t * } 570 | { 571 | numnames #2 > 572 | { "," * } 573 | 'skip$ 574 | if$ 575 | s nameptr "{ll}" format.name$ duplicate$ "others" = 576 | { 't := } 577 | { pop$ } 578 | if$ 579 | t "others" = 580 | { 581 | " {et~al.}" * 582 | } 583 | { " \& " * t * } 584 | if$ 585 | } 586 | if$ 587 | } 588 | 't 589 | if$ 590 | nameptr #1 + 'nameptr := 591 | namesleft #1 - 'namesleft := 592 | } 593 | while$ 594 | } 595 | 596 | FUNCTION {author.editor.key.full} 597 | { author empty$ 598 | { editor empty$ 599 | { key empty$ 600 | { cite$ #1 #3 substring$ } 601 | 'key 602 | if$ 603 | } 604 | { editor format.full.names } 605 | if$ 606 | } 607 | { author format.full.names } 608 | if$ 609 | } 610 | 611 | FUNCTION {author.key.full} 612 | { author empty$ 613 | { key empty$ 614 | { cite$ #1 #3 substring$ } 615 | 'key 616 | if$ 617 | } 618 | { author format.full.names } 619 | if$ 620 | } 621 | 622 | FUNCTION {editor.key.full} 623 | { editor empty$ 624 | { key empty$ 625 | { cite$ #1 #3 substring$ } 626 | 'key 627 | if$ 628 | } 629 | { editor format.full.names } 630 | if$ 631 | } 632 | 633 | FUNCTION {make.full.names} 634 | { type$ "book" = 635 | type$ "inbook" = 636 | or 637 | 'author.editor.key.full 638 | { type$ "proceedings" = 639 | 'editor.key.full 640 | 'author.key.full 641 | if$ 642 | } 643 | if$ 644 | } 645 | 646 | FUNCTION {output.bibitem} 647 | { newline$ 648 | "\bibitem[{" write$ 649 | label write$ 650 | ")" make.full.names duplicate$ short.list = 651 | { pop$ } 652 | { * } 653 | if$ 654 | "}]{" * write$ 655 | cite$ write$ 656 | "}" write$ 657 | newline$ 658 | "" 659 | before.all 'output.state := 660 | } 661 | 662 | FUNCTION {n.dashify} 663 | { 664 | 't := 665 | "" 666 | { t empty$ not } 667 | { t #1 #1 substring$ "-" = 668 | { t #1 #2 substring$ "--" = not 669 | { "--" * 670 | t #2 global.max$ substring$ 't := 671 | } 672 | { { t #1 #1 substring$ "-" = } 673 | { "-" * 674 | t #2 global.max$ substring$ 't := 675 | } 676 | while$ 677 | } 678 | if$ 679 | } 680 | { t #1 #1 substring$ * 681 | t #2 global.max$ substring$ 't := 682 | } 683 | if$ 684 | } 685 | while$ 686 | } 687 | 688 | FUNCTION {word.in} 689 | { bbl.in 690 | " " * } 691 | 692 | FUNCTION {format.date} 693 | { year duplicate$ empty$ 694 | { "empty year in " cite$ * "; set to ????" * warning$ 695 | pop$ "????" } 696 | 'skip$ 697 | if$ 698 | extra.label * 699 | before.all 'output.state := 700 | after.sentence 'output.state := 701 | } 702 | 703 | FUNCTION {format.btitle} 704 | { title } 705 | 706 | FUNCTION {tie.or.space.connect} 707 | { duplicate$ text.length$ #3 < 708 | { "~" } 709 | { " " } 710 | if$ 711 | swap$ * * 712 | } 713 | 714 | FUNCTION {either.or.check} 715 | { empty$ 716 | 'pop$ 717 | { "can't use both " swap$ * " fields in " * cite$ * warning$ } 718 | if$ 719 | } 720 | 721 | FUNCTION {format.bvolume} 722 | { volume empty$ 723 | { "" } 724 | { bbl.volume volume tie.or.space.connect 725 | series empty$ 726 | 'skip$ 727 | { bbl.of space.word * series emphasize * } 728 | if$ 729 | "volume and number" number either.or.check 730 | } 731 | if$ 732 | } 733 | 734 | FUNCTION {format.number.series} 735 | { volume empty$ 736 | { number empty$ 737 | { series field.or.null } 738 | { output.state mid.sentence = 739 | { bbl.number } 740 | { bbl.number capitalize } 741 | if$ 742 | number tie.or.space.connect 743 | series empty$ 744 | { "there's a number but no series in " cite$ * warning$ } 745 | { bbl.in space.word * series * } 746 | if$ 747 | } 748 | if$ 749 | } 750 | { "" } 751 | if$ 752 | } 753 | 754 | FUNCTION {is.num} 755 | { chr.to.int$ 756 | duplicate$ "0" chr.to.int$ < not 757 | swap$ "9" chr.to.int$ > not and 758 | } 759 | 760 | FUNCTION {extract.num} 761 | { duplicate$ 't := 762 | "" 's := 763 | { t empty$ not } 764 | { t #1 #1 substring$ 765 | t #2 global.max$ substring$ 't := 766 | duplicate$ is.num 767 | { s swap$ * 's := } 768 | { pop$ "" 't := } 769 | if$ 770 | } 771 | while$ 772 | s empty$ 773 | 'skip$ 774 | { pop$ s } 775 | if$ 776 | } 777 | 778 | FUNCTION {convert.edition} 779 | { edition extract.num "l" change.case$ 's := 780 | s "first" = s "1" = or 781 | { bbl.first 't := } 782 | { s "second" = s "2" = or 783 | { bbl.second 't := } 784 | { s "third" = s "3" = or 785 | { bbl.third 't := } 786 | { s "fourth" = s "4" = or 787 | { bbl.fourth 't := } 788 | { s "fifth" = s "5" = or 789 | { bbl.fifth 't := } 790 | { s #1 #1 substring$ is.num 791 | { s eng.ord 't := } 792 | { edition 't := } 793 | if$ 794 | } 795 | if$ 796 | } 797 | if$ 798 | } 799 | if$ 800 | } 801 | if$ 802 | } 803 | if$ 804 | t 805 | } 806 | 807 | FUNCTION {format.edition} 808 | { edition empty$ 809 | { "" } 810 | { output.state mid.sentence = 811 | { convert.edition "l" change.case$ " " * bbl.edition * } 812 | { convert.edition "t" change.case$ " " * bbl.edition * } 813 | if$ 814 | } 815 | if$ 816 | } 817 | 818 | INTEGERS { multiresult } 819 | 820 | FUNCTION {multi.page.check} 821 | { 't := 822 | #0 'multiresult := 823 | { multiresult not 824 | t empty$ not 825 | and 826 | } 827 | { t #1 #1 substring$ 828 | duplicate$ "-" = 829 | swap$ duplicate$ "," = 830 | swap$ "+" = 831 | or or 832 | { #1 'multiresult := } 833 | { t #2 global.max$ substring$ 't := } 834 | if$ 835 | } 836 | while$ 837 | multiresult 838 | } 839 | 840 | FUNCTION {format.pages} 841 | { pages empty$ 842 | { "" } 843 | { pages multi.page.check 844 | { pages n.dashify } 845 | { pages } 846 | if$ 847 | } 848 | if$ 849 | } 850 | 851 | FUNCTION {first.page} 852 | { 't := 853 | "" 854 | { t empty$ not t #1 #1 substring$ "-" = not and } 855 | { t #1 #1 substring$ * 856 | t #2 global.max$ substring$ 't := 857 | } 858 | while$ 859 | } 860 | 861 | FUNCTION {format.journal.pages} 862 | { pages empty$ 863 | { format.eprint outputeprint } 864 | { duplicate$ empty$ 865 | { pop$ format.pages } 866 | { 867 | ", " * 868 | pages first.page * 869 | } 870 | if$ 871 | } 872 | if$ 873 | } 874 | 875 | FUNCTION {format.vol.num.pages} 876 | { volume field.or.null } 877 | 878 | FUNCTION {format.chapter.pages} 879 | { chapter empty$ 880 | { "" } 881 | { type empty$ 882 | { bbl.chapter } 883 | { type "l" change.case$ } 884 | if$ 885 | chapter tie.or.space.connect 886 | } 887 | if$ 888 | } 889 | 890 | FUNCTION {format.in.ed.booktitle} 891 | { booktitle empty$ 892 | { "" } 893 | { editor empty$ 894 | { word.in booktitle emphasize * } 895 | { word.in booktitle emphasize * 896 | ", " * 897 | editor num.names$ #1 > 898 | { bbl.editors } 899 | { bbl.editor } 900 | if$ 901 | * " " * 902 | format.in.editors * 903 | } 904 | if$ 905 | } 906 | if$ 907 | } 908 | 909 | FUNCTION {format.thesis.type} 910 | { type empty$ 911 | 'skip$ 912 | { pop$ 913 | type "t" change.case$ 914 | } 915 | if$ 916 | } 917 | 918 | FUNCTION {format.tr.number} 919 | { type empty$ 920 | { bbl.techrep } 921 | 'type 922 | if$ 923 | number empty$ 924 | { "t" change.case$ } 925 | { number tie.or.space.connect } 926 | if$ 927 | } 928 | 929 | FUNCTION {format.article.crossref} 930 | { 931 | word.in 932 | " \cite{" * crossref * "}" * 933 | } 934 | 935 | FUNCTION {format.book.crossref} 936 | { volume empty$ 937 | { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ 938 | word.in 939 | } 940 | { bbl.volume volume tie.or.space.connect 941 | bbl.of space.word * 942 | } 943 | if$ 944 | " \cite{" * crossref * "}" * 945 | } 946 | 947 | FUNCTION {format.incoll.inproc.crossref} 948 | { 949 | word.in 950 | " \cite{" * crossref * "}" * 951 | } 952 | 953 | FUNCTION {format.publisher} 954 | { publisher empty$ 955 | { "empty publisher in " cite$ * warning$ } 956 | 'skip$ 957 | if$ 958 | "" 959 | address empty$ publisher empty$ and 960 | 'skip$ 961 | { 962 | add.blank "(" * 963 | address empty$ 964 | 'skip$ 965 | { address * } 966 | if$ 967 | publisher empty$ 968 | 'skip$ 969 | { address empty$ 970 | 'skip$ 971 | { ": " * } 972 | if$ 973 | publisher * 974 | } 975 | if$ 976 | ")" * 977 | } 978 | if$ 979 | output 980 | } 981 | 982 | STRINGS {oldname} 983 | 984 | FUNCTION {format.edn.btitle} 985 | { duplicate$ empty$ edition empty$ or 986 | 'skip$ 987 | { ", " * format.edition * } 988 | if$ 989 | } 990 | 991 | FUNCTION {format.ed.booktitle} 992 | { duplicate$ empty$ 993 | { "no book title in " cite$ * warning$ "" pop$ } 994 | { editor empty$ 995 | author empty$ or 996 | 'format.edn.btitle 997 | { format.edn.btitle ", " * bbl.editor * " " * format.in.editors * } 998 | if$ 999 | } 1000 | if$ 1001 | } 1002 | 1003 | FUNCTION {format.full.book.spec} 1004 | { series empty$ 1005 | { format.ed.booktitle 1006 | volume empty$ 1007 | { number empty$ 1008 | 'skip$ 1009 | { " there's a number but no series in " cite$ * warning$ 1010 | " No." number tie.or.space.connect * } 1011 | if$ 1012 | } 1013 | { ", Vol." volume tie.or.space.connect * 1014 | number empty$ 1015 | 'skip$ 1016 | {"Both volume and number fields in " * cite$ * warning$ } 1017 | if$ 1018 | } 1019 | if$ 1020 | } 1021 | { volume empty$ 1022 | { format.ed.booktitle ", " * series * 1023 | number empty$ 1024 | 'skip$ 1025 | { " No." number tie.or.space.connect * } 1026 | if$ 1027 | } 1028 | { series ", Vol." volume tie.or.space.connect * 1029 | ", " * swap$ format.ed.booktitle * 1030 | number empty$ 1031 | 'skip$ 1032 | {"Both volume and number fields in " * cite$ * warning$ } 1033 | if$ 1034 | } 1035 | if$ 1036 | } 1037 | if$ 1038 | } 1039 | 1040 | FUNCTION {make.href.hyperref} 1041 | { 1042 | "\href{" swap$ * "}{" * swap$ * "}" * 1043 | } 1044 | 1045 | FUNCTION {format.journal} 1046 | { journal empty$ 1047 | { "" } 1048 | { doi empty$ 1049 | { journal } 1050 | { "\href{http://dx.doi.org/" doi * "}{\color{magenta}" * journal * "}" * } 1051 | if$ 1052 | } 1053 | if$ 1054 | } 1055 | 1056 | FUNCTION {article} 1057 | { output.bibitem 1058 | format.authors "author" output.check 1059 | author format.key output 1060 | format.date "year" output.check 1061 | date.block 1062 | crossref missing$ 1063 | { format.journal output 1064 | format.vol.num.pages output 1065 | } 1066 | { format.article.crossref output.nonnull 1067 | format.pages output 1068 | } 1069 | if$ 1070 | adsurl empty$ 1071 | { format.journal.pages } 1072 | { format.journal.pages adsurl make.href.hyperref } 1073 | if$ 1074 | format.note output 1075 | fin.entry 1076 | } 1077 | 1078 | FUNCTION {book} 1079 | { output.bibitem 1080 | author empty$ 1081 | { format.editors "author and editor" output.check 1082 | editor format.key output 1083 | } 1084 | { format.authors output.nonnull 1085 | crossref missing$ 1086 | { "author and editor" editor either.or.check } 1087 | 'skip$ 1088 | if$ 1089 | } 1090 | if$ 1091 | format.date "year" output.check 1092 | date.block 1093 | title format.full.book.spec output 1094 | format.publisher 1095 | format.pages output 1096 | format.note output 1097 | fin.entry 1098 | } 1099 | 1100 | FUNCTION {booklet} 1101 | { output.bibitem 1102 | format.authors output 1103 | author format.key output 1104 | format.date "year" output.check 1105 | date.block 1106 | format.title "title" output.check 1107 | howpublished output 1108 | address output 1109 | format.note output 1110 | fin.entry 1111 | } 1112 | 1113 | FUNCTION {inbook} 1114 | { output.bibitem 1115 | author empty$ 1116 | { format.editors "author and editor" output.check 1117 | editor format.key output 1118 | } 1119 | { format.authors output.nonnull 1120 | crossref missing$ 1121 | { "author and editor" editor either.or.check } 1122 | 'skip$ 1123 | if$ 1124 | } 1125 | if$ 1126 | format.date "year" output.check 1127 | date.block 1128 | title format.full.book.spec output 1129 | format.publisher 1130 | format.pages "pages" output.check 1131 | format.note output 1132 | fin.entry 1133 | } 1134 | 1135 | FUNCTION {incollection} 1136 | { output.bibitem 1137 | format.authors "author" output.check 1138 | author format.key output 1139 | format.date "year" output.check 1140 | date.block 1141 | bbl.in " " * booktitle format.full.book.spec * output 1142 | format.publisher 1143 | format.pages "pages" output.check 1144 | format.note output 1145 | fin.entry 1146 | } 1147 | 1148 | FUNCTION {inproceedings} 1149 | { output.bibitem 1150 | format.authors "author" output.check 1151 | author format.key output 1152 | format.date "year" output.check 1153 | date.block 1154 | bbl.in " " * booktitle format.full.book.spec * output 1155 | publisher empty$ 1156 | { organization output 1157 | address output 1158 | } 1159 | { organization output 1160 | format.publisher 1161 | } 1162 | if$ 1163 | format.pages output 1164 | adsurl make.href.hyperref 1165 | format.note output 1166 | fin.entry 1167 | } 1168 | 1169 | FUNCTION {conference} { inproceedings } 1170 | 1171 | FUNCTION {manual} 1172 | { output.bibitem 1173 | format.authors output 1174 | author format.key output 1175 | format.date "year" output.check 1176 | date.block 1177 | format.btitle "title" output.check 1178 | format.edition output 1179 | organization output 1180 | address output 1181 | format.note output 1182 | fin.entry 1183 | } 1184 | 1185 | FUNCTION {mastersthesis} 1186 | { output.bibitem 1187 | format.authors "author" output.check 1188 | author format.key output 1189 | format.date "year" output.check 1190 | date.block 1191 | bbl.mthesis format.thesis.type output.nonnull 1192 | school "school" output.check 1193 | address output 1194 | format.note output 1195 | fin.entry 1196 | } 1197 | 1198 | FUNCTION {misc} 1199 | { output.bibitem 1200 | format.authors output 1201 | author format.key output 1202 | format.date "year" output.check 1203 | date.block 1204 | format.title output 1205 | howpublished output 1206 | format.note output 1207 | fin.entry 1208 | } 1209 | 1210 | FUNCTION {format.phdtitle} 1211 | { title empty$ 1212 | { "" } 1213 | { doi empty$ 1214 | { title } 1215 | { "\href{" adsurl * "}{\color{magenta}" * title * "}" * } 1216 | if$ 1217 | } 1218 | if$ 1219 | } 1220 | 1221 | FUNCTION {phdthesis} 1222 | { output.bibitem 1223 | format.authors "author" output.check 1224 | author format.key output 1225 | format.date "year" output.check 1226 | date.block 1227 | format.phdtitle adsurl make.href.hyperref output 1228 | bbl.phdthesis format.thesis.type output.nonnull 1229 | school "school" output.check 1230 | address output 1231 | format.note output 1232 | fin.entry 1233 | } 1234 | 1235 | FUNCTION {proceedings} 1236 | { output.bibitem 1237 | editor empty$ 1238 | { organization output 1239 | organization format.key output } 1240 | { format.editors output } 1241 | if$ 1242 | format.date "year" output.check 1243 | date.block 1244 | title format.full.book.spec output 1245 | publisher empty$ not 1246 | { format.publisher } 1247 | { editor empty$ 1248 | 'skip$ 1249 | { organization output } 1250 | if$ 1251 | address output 1252 | } 1253 | if$ 1254 | format.pages output 1255 | adsurl make.href.hyperref 1256 | format.note output 1257 | fin.entry 1258 | } 1259 | 1260 | FUNCTION {techreport} 1261 | { output.bibitem 1262 | format.authors "author" output.check 1263 | author format.key output 1264 | format.date "year" output.check 1265 | date.block 1266 | format.title "title" output.check 1267 | format.tr.number output.nonnull 1268 | institution "institution" output.check 1269 | address output 1270 | format.note output 1271 | fin.entry 1272 | } 1273 | 1274 | FUNCTION {unpublished} 1275 | { output.bibitem 1276 | format.authors "author" output.check 1277 | author format.key output 1278 | format.date "year" output.check 1279 | date.block 1280 | format.note "note" output.check 1281 | fin.entry 1282 | } 1283 | 1284 | FUNCTION {default.type} { misc } 1285 | 1286 | READ 1287 | 1288 | FUNCTION {sortify} 1289 | { purify$ 1290 | "l" change.case$ 1291 | } 1292 | 1293 | INTEGERS { len } 1294 | 1295 | FUNCTION {chop.word} 1296 | { 's := 1297 | 'len := 1298 | s #1 len substring$ = 1299 | { s len #1 + global.max$ substring$ } 1300 | 's 1301 | if$ 1302 | } 1303 | 1304 | FUNCTION {format.lab.names} 1305 | { 's := 1306 | s #1 "{vv~}{ll}" format.name$ 1307 | s num.names$ duplicate$ 1308 | #2 > 1309 | { pop$ 1310 | " {et~al.}" * 1311 | } 1312 | { #2 < 1313 | 'skip$ 1314 | { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = 1315 | { 1316 | " {et~al.}" * 1317 | } 1318 | { " \& " * s #2 "{vv~}{ll}" format.name$ 1319 | * } 1320 | if$ 1321 | } 1322 | if$ 1323 | } 1324 | if$ 1325 | } 1326 | 1327 | FUNCTION {author.key.label} 1328 | { author empty$ 1329 | { key empty$ 1330 | { cite$ #1 #3 substring$ } 1331 | 'key 1332 | if$ 1333 | } 1334 | { author format.lab.names } 1335 | if$ 1336 | } 1337 | 1338 | FUNCTION {author.editor.key.label} 1339 | { author empty$ 1340 | { editor empty$ 1341 | { key empty$ 1342 | { cite$ #1 #3 substring$ } 1343 | 'key 1344 | if$ 1345 | } 1346 | { editor format.lab.names } 1347 | if$ 1348 | } 1349 | { author format.lab.names } 1350 | if$ 1351 | } 1352 | 1353 | FUNCTION {editor.key.label} 1354 | { editor empty$ 1355 | { key empty$ 1356 | { cite$ #1 #3 substring$ } 1357 | 'key 1358 | if$ 1359 | } 1360 | { editor format.lab.names } 1361 | if$ 1362 | } 1363 | 1364 | FUNCTION {calc.short.authors} 1365 | { type$ "book" = 1366 | type$ "inbook" = 1367 | or 1368 | 'author.editor.key.label 1369 | { type$ "proceedings" = 1370 | 'editor.key.label 1371 | 'author.key.label 1372 | if$ 1373 | } 1374 | if$ 1375 | 'short.list := 1376 | } 1377 | 1378 | FUNCTION {calc.label} 1379 | { calc.short.authors 1380 | short.list 1381 | "(" 1382 | * 1383 | year duplicate$ empty$ 1384 | { pop$ "????" } 1385 | 'skip$ 1386 | if$ 1387 | * 1388 | 'label := 1389 | } 1390 | 1391 | FUNCTION {sort.format.names} 1392 | { 's := 1393 | #1 'nameptr := 1394 | "" 1395 | s num.names$ 'numnames := 1396 | numnames 'namesleft := 1397 | { namesleft #0 > } 1398 | { s nameptr 1399 | "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" 1400 | format.name$ 't := 1401 | nameptr #1 > 1402 | { 1403 | " " * 1404 | namesleft #1 = t "others" = and 1405 | { "zzzzz" * } 1406 | { t sortify * } 1407 | if$ 1408 | } 1409 | { t sortify * } 1410 | if$ 1411 | nameptr #1 + 'nameptr := 1412 | namesleft #1 - 'namesleft := 1413 | } 1414 | while$ 1415 | } 1416 | 1417 | FUNCTION {sort.format.title} 1418 | { 't := 1419 | "A " #2 1420 | "An " #3 1421 | "The " #4 t chop.word 1422 | chop.word 1423 | chop.word 1424 | sortify 1425 | #1 global.max$ substring$ 1426 | } 1427 | 1428 | FUNCTION {author.sort} 1429 | { author empty$ 1430 | { key empty$ 1431 | { "to sort, need author or key in " cite$ * warning$ 1432 | "" 1433 | } 1434 | { key sortify } 1435 | if$ 1436 | } 1437 | { author sort.format.names } 1438 | if$ 1439 | } 1440 | 1441 | FUNCTION {author.editor.sort} 1442 | { author empty$ 1443 | { editor empty$ 1444 | { key empty$ 1445 | { "to sort, need author, editor, or key in " cite$ * warning$ 1446 | "" 1447 | } 1448 | { key sortify } 1449 | if$ 1450 | } 1451 | { editor sort.format.names } 1452 | if$ 1453 | } 1454 | { author sort.format.names } 1455 | if$ 1456 | } 1457 | 1458 | FUNCTION {editor.sort} 1459 | { editor empty$ 1460 | { key empty$ 1461 | { "to sort, need editor or key in " cite$ * warning$ 1462 | "" 1463 | } 1464 | { key sortify } 1465 | if$ 1466 | } 1467 | { editor sort.format.names } 1468 | if$ 1469 | } 1470 | 1471 | FUNCTION {presort} 1472 | { calc.label 1473 | label sortify 1474 | " " 1475 | * 1476 | type$ "book" = 1477 | type$ "inbook" = 1478 | or 1479 | 'author.editor.sort 1480 | { type$ "proceedings" = 1481 | 'editor.sort 1482 | 'author.sort 1483 | if$ 1484 | } 1485 | if$ 1486 | #1 entry.max$ substring$ 1487 | 'sort.label := 1488 | sort.label 1489 | * 1490 | " " 1491 | * 1492 | title field.or.null 1493 | sort.format.title 1494 | * 1495 | #1 entry.max$ substring$ 1496 | 'sort.key$ := 1497 | } 1498 | 1499 | ITERATE {presort} 1500 | 1501 | SORT 1502 | 1503 | STRINGS { last.label next.extra } 1504 | 1505 | INTEGERS { last.extra.num number.label } 1506 | 1507 | FUNCTION {initialize.extra.label.stuff} 1508 | { #0 int.to.chr$ 'last.label := 1509 | "" 'next.extra := 1510 | #0 'last.extra.num := 1511 | #0 'number.label := 1512 | } 1513 | 1514 | FUNCTION {forward.pass} 1515 | { last.label label = 1516 | { last.extra.num #1 + 'last.extra.num := 1517 | last.extra.num int.to.chr$ 'extra.label := 1518 | } 1519 | { "a" chr.to.int$ 'last.extra.num := 1520 | "" 'extra.label := 1521 | label 'last.label := 1522 | } 1523 | if$ 1524 | number.label #1 + 'number.label := 1525 | } 1526 | 1527 | FUNCTION {reverse.pass} 1528 | { next.extra "b" = 1529 | { "a" 'extra.label := } 1530 | 'skip$ 1531 | if$ 1532 | extra.label 'next.extra := 1533 | extra.label 1534 | duplicate$ empty$ 1535 | 'skip$ 1536 | { "{\natexlab{" swap$ * "}}" * } 1537 | if$ 1538 | 'extra.label := 1539 | label extra.label * 'label := 1540 | } 1541 | 1542 | EXECUTE {initialize.extra.label.stuff} 1543 | 1544 | ITERATE {forward.pass} 1545 | 1546 | REVERSE {reverse.pass} 1547 | 1548 | FUNCTION {bib.sort.order} 1549 | { sort.label 1550 | " " 1551 | * 1552 | year field.or.null sortify 1553 | * 1554 | " " 1555 | * 1556 | title field.or.null 1557 | sort.format.title 1558 | * 1559 | #1 entry.max$ substring$ 1560 | 'sort.key$ := 1561 | } 1562 | 1563 | ITERATE {bib.sort.order} 1564 | 1565 | SORT 1566 | 1567 | FUNCTION {begin.bib} 1568 | { preamble$ empty$ 1569 | 'skip$ 1570 | { preamble$ write$ newline$ } 1571 | if$ 1572 | "\begin{thebibliography}{" number.label int.to.str$ * "}" * 1573 | write$ newline$ 1574 | "\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi" 1575 | write$ newline$ 1576 | } 1577 | 1578 | EXECUTE {begin.bib} 1579 | 1580 | EXECUTE {init.state.consts} 1581 | 1582 | ITERATE {call.type$} 1583 | 1584 | FUNCTION {end.bib} 1585 | { newline$ 1586 | "\end{thebibliography}" write$ newline$ 1587 | } 1588 | 1589 | EXECUTE {end.bib} 1590 | %% End of customized bst file 1591 | %% 1592 | %% End of file `apj.bst`. 1593 | --------------------------------------------------------------------------------