├── compile.sh ├── LICENSE ├── AnnoBib.tex ├── README.md ├── AnnoBibMyBDA.bib └── apacannx.bst /compile.sh: -------------------------------------------------------------------------------- 1 | # Makefile for NAR formatted annotated bibliography. 2 | # 3 | # Author: Titus Barik (titus@barik.net) 4 | # 5 | # Modified by Blaine Mooers 6 | # 7 | # Has to be run in the main directory with the main.aux generated after the full running of the compile.sh script. 8 | # bibtool -x main.aux -o ./AnnotatedBibliography/AnnoBibMyBDA.bib 9 | cd ../ 10 | bibtool -x main.aux -o ./annotatedBibliography/AnnoBibMain.bib 11 | cd ./annotatedBibliography 12 | pdflatex AnnoBibMain 13 | bibtex AnnoBibMain 14 | pdflatex AnnoBibMain 15 | pdflatex AnnoBibMain 16 | open -a "Preview.app" AnnoBibMain.pdf 17 | echo "================================================" 18 | echo "All done! AnnoBibMyBDA.pdf has been created. - Blaine" 19 | echo "================================================" 20 | 21 | # clean: 22 | rm -rf AnnoBibMain.log AnnoBibMain.blg AnnoBibMain.bbl AnnoBibMain.aux 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Blaine Mooers and the Board of Regents of the University of Oklahoma 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /AnnoBib.tex: -------------------------------------------------------------------------------- 1 | %% This is AnnoBib.tex. 2 | %% It works only with bibtex files, not biblatex. 3 | %% 4 | %% You'll need to change the title and author fields to reflect your 5 | %% information. 6 | %% 7 | %% Author: Titus Barik (titus@barik.net) 8 | %% Homepage: http://www.barik.net/sw/ieee/ 9 | %% Reference: http://www.ctan.org/tex-archive/info/simplified-latex/ 10 | %% bibtool -x ../main.aux -o AnnoBibMyBDA.bib 11 | \documentclass[11pt]{article} 12 | \usepackage[letterpaper, total={7in, 9in}]{geometry} 13 | \usepackage{apacite} 14 | 15 | % Add running titles to avoid mixing up paper versions of two or more unstapled documents stored together. 16 | \usepackage{fancyhdr} 17 | \pagestyle{fancy} 18 | \usepackage{lastpage} 19 | \fancyhf{} % Clear header/footer 20 | \fancyhead[L]{Student, ..., and Mooers} 21 | \fancyhead[C]{Manuscript template in LaTeX, printed: \today} 22 | \fancyhead[R]{\thepage\ / \pageref{LastPage}} 23 | \renewcommand{\headrulewidth}{1pt} % set to 0pt to hide headrule 24 | 25 | 26 | \begin{document} 27 | 28 | \begin{center} 29 | { 30 | \Large\textbf{Annotated Bibliography} 31 | \medskip 32 | 33 | { \large Blaine H. M. Mooers, Ph.D. \\ 34 | \medskip 35 | Department of Biochemistry and Physiology \\ 36 | \medskip 37 | University of Oklahoma Health Sciences \\ 38 | \medskip 39 | \today} 40 | } 41 | \end{center} 42 | 43 | \nocite{*} 44 | \bibliographystyle{apacannx} 45 | \bibliography{AnnoBibMyBDA} 46 | \end{document} 47 | 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Version](https://img.shields.io/static/v1?label=annotatedBibliography&message=0.6&color=brightcolor) 2 | [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) 3 | 4 | # Annotated bibliography template in LaTeX for specific writing projects 5 | 6 | ## Purpose 7 | Generate lists of cited papers with annotations following each citation. This document is useful when writing review articles. 8 | 9 | ## How it works 10 | 11 | These files support the automated generation of an annotated bibliography in LaTeX using bibliographic information in a BibTeX file (NOT BibLaTeX). 12 | The *AnnoBib.tex* file is the master file. 13 | It uses the *annote* field in the BibTeX entry in *cited.bib*. 14 | Its style is set by *apacannx.bst*, which must be present unless this file is stored in your library of files for LaTeX on your local computer. 15 | 16 | 17 | ## Generate a bib file with only cited references 18 | 19 | To write out the cited bib entries in a manuscript from *global.bib*, use the command line program **bibtool** with the main.tex file's corresponding main.aux file: 20 | 21 | Run the following code to generate a bib file of the papers cited in a manuscript. 22 | Note that main.tex is the manuscript file. 23 | The *main.aux* file is hidden on Overleaf. 24 | Find it under the "Logs and outputs" pulldown menu. 25 | 26 | The following command will preserve the letter case in the cite key. 27 | The default behavior is to lower the case. 28 | 29 | ```bash 30 | bibtool --preserve.key.case=on -x main.aux > cited.bib 31 | ``` 32 | 33 | Bibtool is distributed with LaTeX. 34 | 35 | ## Writing the annotations 36 | 37 | If you are using BibTeX, manually add `annote` fields to the *AnnoBibMyBDA.bib* file and enter your annotations. 38 | Or, if you are more disciplined, you can add the *annote* fields in a *global.bib* file and repeat the extraction of the cited entries when you are finished. 39 | All entries in `cited.bib` will be used to create the annotated bibliography regardless of whether the *annote* field is present. 40 | 41 | The annote field does not have to be limited to a single paragraph summary like in the one you made in the sixth grade. 42 | The annotation field can contain figures, tables, coding listings, and equations. 43 | 44 | I store these files in an *annotatedBibliography* subfolder in my writing project's folder. 45 | These files work on Overleaf, too. 46 | 47 | If you are using BibLaTeX, manually add `annotation` fields to the *AnnoBibMyBDA.bib*. 48 | 49 | For journal article entries, the difference from BibTeX is that BibLaTeX uses a `journaltitle` field insead of a `journal` field. 50 | 51 | Note that you can use JabRef to export a BibTeX library to a BibLaTeX library. 52 | Use can also use the R statistical package for this purpose. 53 | See below. 54 | 55 | ## Protocol for BibTeX to BibLaTeX library conversion with R 56 | 57 | Note that you must supply the full file paths. 58 | Also, note the order of the arguments to bibConvert. 59 | The third argument is the file type of the first. 60 | The fourth argument is the file type of the second argument. 61 | 62 | 63 | 1. Start R-Studio 64 | 2. Run the following code after editing the file paths: 65 | 66 | 67 | ```R 68 | library(devtools) 69 | install_github("GeoBosh/rbibutils") 70 | library(rbibutils) 71 | bibConvert("/Users/blaine/Documents/global.bib", "/Users/blaine/Documents/globalBiblatex.bib", "bibtex", "biblatex") 72 | ```` 73 | 74 | Of course, flip the order of the arguments to convert from BibLaTeX to BibTeX. 75 | 76 | ## Alternative bibliographic styles 77 | 78 | Alternatively, you can use the *IEEEannot.bst* bibliography style file that returns numbered entries in alphabetic order. 79 | 80 | ## Annote fields with multiple paragraphs in BibTeX 81 | 82 | I have found no support for blank lines between paragraphs in the annotation stored in the annote field of BibTeX entries. 83 | I wrap each paragraph in `\par{\noindent .... }` to have the paragraphs printed in block format. 84 | I insert `\vspace{10pt}` between paragraphs to generate a blank line between paragraphs. 85 | The result is visually pleasing to me. 86 | Space will flank display math, figures, code listings, and tables. 87 | 88 | ## Annotation fields with multiple paragraphs in BibLaTeX 89 | You may be using BibLaTeX if you use typst because typst does not support BibTeX. 90 | BibLaTeX uses different tools then BibTeX to generate the bibliography. 91 | Its tool `biber` converts blank lines into whitespace early in the processing of the bib file. 92 | You can start new paragraphs separated by blank lines in an [imported tex file](https://tex.stackexchange.com/questions/488913/how-to-embed-a-review-in-biblatex) that stores a single annotation. 93 | However, the blank line will be lost in the exported PDF. 94 | 95 | You can use the biblatex-chicago package, which has added support for [annotated bibliographies](https://tex.stackexchange.com/questions/183743/why-cant-i-get-annotations-in-the-bibliography-here/183917#183917). 96 | You can add `\par` after each paragraph to break the text into paragraphs, but there will be no spacing between paragraphs. 97 | The result is visually displeasing to me. 98 | par 99 | 100 | A work around is to replace the `\par` with display `$$ $$`. 101 | This will give a wider than desired paragraph spacing, but it is better than no blank lines. 102 | 103 | emptyDisplayMath 104 | 105 | 106 | ## Colored annotations 107 | 108 | You can color the annotation blue. 109 | 110 | - Load the *color* or *xcolor* package with the `\usepackage{xcolor}` macro in the preamble of the *main.tex* file. 111 | - Add the macro `\color{blue}` to the line in the `*.bst` file that describes the format of the *annote* field. 112 | 113 | You could also print the annotation in bold or italics. 114 | 115 | ## Support beyond text 116 | 117 | Your annotated bibliography can be spiced up: 118 | You can include lists, display math, computer code blocks, figures, and tables in the *annote* fields. 119 | 120 | 121 | ## Related projects of possible interest 122 | 123 | - [LaTeX manuscript template](https://github.com/MooersLab/manuscriptInLaTeX/edit/main/README.md) 124 | - [Writing log template](https://github.com/MooersLab/writingLogTemplate) 125 | - [Slideshow Template](https://github.com/MooersLab/slideshowTemplateLaTeX) 126 | - [Diary for 2022 in LaTeX](https://github.com/MooersLab/diary2022inLaTeX) 127 | - [Diary for 2023 in LaTeX](https://github.com/MooersLab/diary2023inLaTeX) 128 | - [latex-emacs profile](https://github.com/MooersLab/latex-emacs) 129 | - [snippets for latex-mode in Emacs](https://github.com/MooersLab/snippet-latex-mode) 130 | - [Quizzes about Emacs to improve recall of keybindings](https://github.com/MooersLab/qemacs) 131 | - [Slides from talk about LaTeX in Emacs at the Berlin Emacs Meetup Aug 31, 2022](https://github.com/MooersLab/BerlinEmacsAugust2022) 132 | - [Slides from talk about GhostText, Data Science Workshop, July 2022](https://github.com/MooersLab/DSW22ghosttext) 133 | - [Video link to talk about GhostText, Data Science Workshop, July 2022](https://mediasite.ouhsc.edu/Mediasite/Channel/python/watch/4da0872f028c4255ae12935655e911321d) 134 | - [The writer's law](https://github.com/MooersLab/thewriterslaw) 135 | 136 | ## Version History 137 | 138 | |Version | Changes | Date | 139 | |:------------|:------------------------------------------------------|:----------------| 140 | | Version 0.2 | Added Update table to README.md | 2024 April 7 | 141 | | Version 0.3 | Edit the README.md heavily. | 2024 April 17 | 142 | | Version 0.4 | Edit the README.md heavily. | 2024 October 8 | 143 | | Version 0.5 | Edit the README.md heavily. | 2024 October 16 | 144 | | Version 0.6 | Added running title to header of AnnoBib.tex. | 2024 October 24 | 145 | 146 | 147 | ## Sources of Funding 148 | 149 | - NIH: R01 CA242845 150 | - NIH: R01 AI088011 151 | - NIH: P30 CA225520 (PI: R. Mannel) 152 | - NIH P20GM103640 and P30GM145423 (PI: A. West) 153 | 154 | 155 | -------------------------------------------------------------------------------- /AnnoBibMyBDA.bib: -------------------------------------------------------------------------------- 1 | @Book{ albert2009bayesiancomputationwithr, 2 | title = {Bayesian computation with R}, 3 | publisher = {Springer Science \& Business Media}, 4 | year = {2009}, 5 | author = {Albert, Jim}, 6 | annote = {This is a concise book for someone with a strong 7 | background in math and statistics. A biologist may view 8 | this an intermediate-level book. It would be worth reading 9 | after mastering Kery 2010 in order to deepen your 10 | understanding of Bayesian statistics and to realize that 11 | you do not have to use WinBUGS or Stan with every 12 | problem.}, 13 | endnotereftype= {Book}, 14 | owner = {blaine-mooers}, 15 | shorttitle = {Bayesian computation with R} 16 | } 17 | 18 | @Article{ chaloner1995bayesianexperimentaldesignareview, 19 | author = {Chaloner, Kathryn and Verdinelli, Isabella}, 20 | title = {Bayesian experimental design: A review}, 21 | journal = {Statistical Science}, 22 | year = {1995}, 23 | volume = {10}, 24 | pages = {273-304}, 25 | endnotereftype= {Journal Article}, 26 | owner = {blaine-mooers}, 27 | shorttitle = {Bayesian experimental design: A review} 28 | } 29 | 30 | @Article{ kass1995bayesfactors, 31 | author = {Kass, Robert E. and Raftery, Adrian E.}, 32 | title = {Bayes factors}, 33 | journal = {Journal of the american statistical association}, 34 | year = {1995}, 35 | volume = {90}, 36 | number = {430}, 37 | pages = {773-795}, 38 | endnotereftype= {Journal Article}, 39 | owner = {blaine-mooers}, 40 | publisher = {Taylor \& Francis Group}, 41 | shorttitle = {Bayes factors} 42 | } 43 | 44 | @Book{ kery2010introductiontowinbugsforecologists, 45 | title = {Introduction to WinBUGS for ecologists: Bayesian approach 46 | to regression, ANOVA, mixed models and related analyses}, 47 | publisher = {Academic Press}, 48 | year = {2010}, 49 | author = {K{\'e}ry, Marc}, 50 | annote = {I have this book. It is unique in that is presents data 51 | simulations along with linear models using Bayesian and 52 | frequentist approaches. This parts that I have read I like 53 | very much. The book is very well organized.} 54 | } 55 | 56 | @Book{ lesaffre2012bayesianbiostatisticsa, 57 | title = {Bayesian biostatistics}, 58 | publisher = {John Wiley \& Sons}, 59 | year = {2012}, 60 | author = {Lesaffre, Emmanuel and Lawson, Andrew B.}, 61 | annote = {I have a copy of this book. I have written a brief review 62 | of it for myself.}, 63 | endnotereftype= {Book}, 64 | owner = {blaine-mooers}, 65 | shorttitle = {Bayesian biostatistics} 66 | } 67 | 68 | @Book{ mcgrayne2011theorythatwouldnotdie, 69 | title = {The theory that would not die: how Bayes' rule cracked the 70 | enigma code, hunted down Russian submarines, \& emerged 71 | triumphant from two centuries of controversy}, 72 | publisher = {Yale University Press}, 73 | year = {2011}, 74 | author = {McGrayne, Sharon Bertsch} 75 | } 76 | 77 | @Book{ lunn2012thebugsbook, 78 | title = {The {BUGS} Book: A Practical Introduction to {B}ayesian 79 | Analysis}, 80 | publisher = {Chapman \& Hall/CRC Press}, 81 | year = {2012}, 82 | author = {Lunn, David}, 83 | series = {Chapman \& Hall/CRC Texts in Statistical Science series}, 84 | address = {Boca Raton, FL}, 85 | abstract = {Bayesian statistical methods have become widely used for 86 | data analysis and modelling in recent years, and the BUGS 87 | software has become the most popular software for Bayesian 88 | analysis worldwide. Authored by the team that originally 89 | developed this software, The BUGS Book provides a practical 90 | introduction to this program and its use. The text presents 91 | complete coverage of all the functionalities of BUGS, 92 | including prediction, missing data, model criticism, and 93 | prior sensitivity. It also features a large number of 94 | worked examples and a wide range of applications from 95 | various disciplines. The book introduces regression models, 96 | techniques for criticism and comparison, and a wide range 97 | of modelling issues before going into the vital area of 98 | hierarchical models, one of the most common applications of 99 | Bayesian methods. It deals with essentials of modelling 100 | without getting bogged down in complexity. The book 101 | emphasises model criticism, model comparison, sensitivity 102 | analysis to alternative priors, and thoughtful choice of 103 | prior distributions---all those aspects of the ``art'' of 104 | modelling that are easily overlooked in more theoretical 105 | expositions. More pragmatic than ideological, the authors 106 | systematically work through the large range of ``tricks'' 107 | that reveal the real power of the BUGS software, for 108 | example, dealing with missing data, censoring, grouped 109 | data, prediction, ranking, parameter constraints, and so 110 | on. Many of the examples are biostatistical, but they do 111 | not require domain knowledge and are generalisable to a 112 | wide range of other application areas. Full code and data 113 | for examples, exercises, and some solutions can be found on 114 | the book's website.}, 115 | isbn = {978-1-5848-8849-9}, 116 | orderinfo = {crcpress.txt}, 117 | owner = {blaine-mooers}, 118 | timestamp = {2016.08.03}, 119 | url = {http://www.crcpress.com/product/isbn/9781584888499} 120 | } 121 | 122 | @Article{ gelfand1990illustrationofbayesianinferenceinnormaldatamodelsusinggibbssampling, 123 | author = {Gelfand, Alan E and Hills, Susan E and Racine-Poon, Amy 124 | and Smith, Adrian FM}, 125 | title = {Illustration of Bayesian inference in normal data models 126 | using Gibbs sampling}, 127 | journal = {Journal of the American Statistical Association}, 128 | year = {1990}, 129 | volume = {85}, 130 | number = {412}, 131 | pages = {972--985}, 132 | annnote = {This is the first article about using Gibbs sampling. It 133 | has been cited 1068 times according to Google Scholar. It 134 | includes the Rat growth example. In this example, the 135 | gorwth of 30 rats were monitored for five weeks. Larger 136 | Rats are assumed to gain weight faster. In other words, the 137 | slope and intercept of their growth data are correlated. 138 | This statistical model was a multivariate model that 139 | allowed for the correlation betwen the slope and intercept. 140 | }, 141 | publisher = {Taylor \& Francis Group}, 142 | url = {http://people.umass.edu/bioep740/yr2009/topics/gelfand-1990-jasa.pdf} 143 | } 144 | 145 | @Article{ carpenter2016stanaprobabilisticprogramminglanguage, 146 | author = {Carpenter, Bob and Gelman, Andrew and Hoffman, Matt and 147 | Lee, Daniel and Goodrich, Ben and Betancourt, Michael and 148 | Brubaker, Michael A and Guo, Jiqiang and Li, Peter and 149 | Riddell, Allen}, 150 | title = {Stan: A probabilistic programming language}, 151 | journal = {J Stat Softw}, 152 | year = {2016}, 153 | volume = {0}, 154 | pages = {000-000} 155 | } 156 | 157 | @Book{ gelman2014bayesiandataanalysis, 158 | title = {Bayesian data analysis}, 159 | publisher = {Chapman \& Hall/CRC Boca Raton, FL, USA}, 160 | year = {2014}, 161 | author = {Gelman, Andrew and Carlin, John B and Stern, Hal S and 162 | Rubin, Donald B}, 163 | volume = {2}, 164 | annote = {This is the third edition. Its shorthand reference is 165 | BDA3. It has been cited over 17000 times in two years! 166 | Appendix C introduces using R and STAN together.} 167 | } 168 | 169 | @Book{ kruschke2014doingbayesiandatanalysisatutorrialwithrjagsstan, 170 | title = {Doing Bayesian data analysis: A tutorial with R, JAGS, and 171 | Stan}, 172 | publisher = {Academic Press}, 173 | year = {2015}, 174 | author = {Kruschke, John}, 175 | edition = {2nd}, 176 | annote = {This is the second edition of the Puppy Dog book. The 177 | author is a Mr. Rodgers kind of guy, judging from the 178 | videos that he posted that explain the annalysis behind 179 | Bayesian t-tests. Contrary to the title of the book, most 180 | of the examples are in JAGS. I bought this book for 181 | Victoria. It starts off slow and simple but looks are 182 | decieving. It rises to a high level of sophistication.} 183 | } 184 | 185 | @Book{ davidson2015bayesianmethodsforhackers, 186 | title = {Bayesian Methods for Hackers: Probabilistic Programming 187 | and Bayesian Inference}, 188 | publisher = {Addison-Wesley Professional}, 189 | year = {2015}, 190 | author = {Davidson-Pilon, Cameron}, 191 | annote = {This book was a 2015 Christmas gift from my father. It is 192 | meant to be introductory but it does reach into advanced 193 | topics. It relies on the PyMC package.} 194 | } 195 | 196 | @Book{ marin2014bayesianessentialwithr, 197 | title = {Bayesian essentials with R}, 198 | publisher = {Springer}, 199 | year = {2014}, 200 | author = {Marin, Jean-Michel and Robert, Christian P}, 201 | annote = {I have a pdf of this book. This book looks really good as 202 | a second book on bayesian computation because it has more 203 | math while still having examples from R. It was written for 204 | scientists who have to apply Bayesian statistics. However, 205 | it was written by two statisticians. They may have included 206 | too much math.} 207 | } 208 | 209 | @Book{ sivia2006dataanalaysis, 210 | title = {Data analysis: a Bayesian tutorial}, 211 | publisher = {OUP Oxford}, 212 | year = {2006}, 213 | author = {Sivia, Devinderjit and Skilling, John} 214 | } 215 | 216 | @Book{ hamelryck2012bayesianmethodsinstructuralbioinformatics, 217 | title = {Bayesian methods in structural bioinformatics}, 218 | publisher = {Springer Science \& Business Media}, 219 | year = {2012}, 220 | author = {Hamelryck, Thomas and Mardia, Kanti and Ferkinghoff-Borg, 221 | Jesper}, 222 | annote = {I have this book. This is the first book to take a 223 | probablistic approach statistical structural 224 | bioinformatics. You need to a an advanced beginner or 225 | higher in Bayesian data analysis to get much out of this 226 | book. The book is not self-contained and there is no 227 | associated softeware. It is out a tutorial.} 228 | } 229 | 230 | @Book{ rupp2009biomolecularcrystallography, 231 | title = {Biomolecular crystallography: principles, practice, and 232 | application to structural biology}, 233 | publisher = {Garland Science}, 234 | year = {2009}, 235 | author = {Rupp, Bernhard}, 236 | annote = {I have this book. It has a nice discussion of Bayesian 237 | statistics in crystallography.} 238 | } 239 | 240 | @Book{ korner2015bayesiandataanalysisinecology, 241 | title = {Bayesian data analysis in ecology using linear models with 242 | R, BUGS, and Stan}, 243 | publisher = {Academic Press}, 244 | year = {2015}, 245 | author = {Korner-Nievergelt, Franzi and Roth, Tobias and von Felten, 246 | Stefanie and Gu{\'e}lat, J{\'e}r{\^o}me and Almasi, Bettina 247 | and Korner-Nievergelt, Pius}, 248 | annote = {This is a very accessbile book on using cutting edge BDA 249 | without a lot of math.} 250 | } 251 | 252 | @Article{ monnahan2016fasterestimatesofmodelswithstan, 253 | author = {Monnahan, Cole C and Thorson, James T and Branch, Trevor 254 | A}, 255 | title = {Faster estimation of Bayesian models in ecology using 256 | Hamiltonian Monte Carlo}, 257 | journal = {Methods in Ecology and Evolution}, 258 | year = {2016}, 259 | volume = {0}, 260 | annote = {This looks like a good evaluatoin of Stan. This paper is a 261 | must read.}, 262 | publisher = {Wiley Online Library} 263 | } 264 | 265 | @Manual{ su2012r2jags, 266 | title = {R2jags: A Package for Running jags from R}, 267 | author = {Su, Yu-Sung and Yajima, Masanao}, 268 | year = {2012}, 269 | journal = {R package version 0.03-08, URL http://CRAN. R-project. 270 | org/package= R2jags} 271 | } 272 | 273 | @Book{ andreon2015bayesianmethodsforthephysicalscienceslearningfromexamplesinastronomyandphysics, 274 | title = {Bayesian Methods for the Physical Sciences: Learning from 275 | Examples in Astronomy and Physics}, 276 | publisher = {Springer}, 277 | year = {2015}, 278 | author = {Andreon, Stefano and Weaver, Brian}, 279 | annote = {This is a concise book for someone with a strong 280 | background in math and statistics. A biologist may view 281 | this an intermediate-level book. It would be worth reading 282 | after mastering Kery 2010 and Albert (2009) in order to 283 | deepen your understanding of Bayesian statistics and to 284 | realize that you do not have to use WinBUGS or Stan with 285 | every problem.} 286 | } 287 | 288 | @Article{ sturtz2005r2winbugs, 289 | author = {Sibylle Sturtz and Uwe Ligges and Andrew Gelman}, 290 | title = {R2WinBUGS: A Package for Running WinBUGS from R}, 291 | journal = {Journal of Statistical Software}, 292 | year = {2005}, 293 | volume = {12}, 294 | number = {3}, 295 | pages = {1--16}, 296 | url = {http://www.jstatsoft.org} 297 | } 298 | 299 | @Article{ gilks1994bugslanguage, 300 | author = {Gilks, Wally R and Thomas, Andrew and Spiegelhalter, David 301 | J}, 302 | title = {A language and program for complex Bayesian modelling}, 303 | journal = {The Statistician}, 304 | year = {1994}, 305 | volume = {0}, 306 | pages = {169--177}, 307 | publisher = {JSTOR} 308 | } 309 | 310 | @Article{ smith1987applyingmcmctobayesiancomputation, 311 | author = {Smith, AFM and Skene, AM and Shaw, JEH and Naylor, JC}, 312 | title = {Progress with numerical and graphical methods for 313 | practical Bayesian statistics}, 314 | journal = {The Statistician}, 315 | year = {1987}, 316 | volume = {0}, 317 | pages = {75--82}, 318 | annote = {I got this article from JSTOR. It is a key reference in 319 | computational Bayesian statistics.} 320 | } 321 | 322 | @InBook{ gilks1996introducingmcmc, 323 | chapter = {1}, 324 | pages = {1-19}, 325 | title = {Introducing markov chain monte carlo}, 326 | publisher = {Chapman and Hall}, 327 | year = {1996}, 328 | author = {Gilks, Walter R and Richardson, Sylvia and Spiegelhalter, 329 | David J}, 330 | address = {London}, 331 | annote = {I have a pdf of this chapter.}, 332 | book = {Markov chain Monte Carlo in practice} 333 | } 334 | 335 | @Book{ spiegelhalter2004bayesianapproachestoclinicaltrialsandhealth-careevaluation, 336 | title = {Bayesian Approaches to Clinical Trials and Health-Care 337 | Evaluation}, 338 | publisher = {Wiley}, 339 | year = {2004}, 340 | author = {Spiegelhalter, D. J. and Abrams, K. R. and Myles, J. P.}, 341 | volume = {13}, 342 | series = {Statistics in Practice}, 343 | note = {QA 279.5 .S65 2004}, 344 | annote = {OU Library}, 345 | endnotereftype= {Book}, 346 | isbn = {9780471499756}, 347 | owner = {blaine-mooers}, 348 | shorttitle = {Bayesian Approaches to Clinical Trials and Health-Care 349 | Evaluation}, 350 | url = {https://books.google.com/books?id=eZdRL53PuWsC} 351 | } 352 | 353 | @TechReport{ dreyfus1980fivestagemodel, 354 | author = {Dreyfus, Stuart E and Dreyfus, Hubert L}, 355 | title = {A five-stage model of the mental activities involved in 356 | directed skill acquisition}, 357 | institution = {DTIC Document}, 358 | year = {1980}, 359 | annote = {The famous Dreyfus and Dreyfus model of expertise. I have 360 | a pdf of this somewhere.}, 361 | owner = {blaine-mooers}, 362 | timestamp = {2012.09.01} 363 | } 364 | 365 | @Article{ skilling2006nestedsampling, 366 | author = {Skilling, John}, 367 | title = {Nested sampling for general Bayesian computation}, 368 | journal = {Bayesian analysis}, 369 | year = {2006}, 370 | volume = {1}, 371 | number = {4}, 372 | pages = {833--859}, 373 | abstract = {Nested sampling estimates directly how the likelihood 374 | function relates to prior mass. The evidence (alternatively 375 | the marginal likelihood, marginal density of the data, or 376 | the prior predictive) is immediately obtained by summation. 377 | It is the prime result of the computation, and is 378 | accompanied by an estimate of numerical uncertainty. 379 | Samples from the posterior distribution are an optional 380 | byproduct, obtainable for any temperature. The method 381 | relies on sampling within a hard constraint on likelihood 382 | value, as opposed to the softened likelihood of annealing 383 | methods. Progress depends only on the shape of the 384 | “nested” contours of likelihood, and not on the 385 | likelihood values. This invariance (over monotonic 386 | relabelling) allows the method to deal with a class of 387 | phase-change problems which effectively defeat thermal 388 | annealing.}, 389 | publisher = {International Society for Bayesian Analysis} 390 | } 391 | 392 | @Article{ feroz2009multinest, 393 | author = {Feroz, F and Hobson, MP and Bridges, M}, 394 | title = {MultiNest: an efficient and robust Bayesian inference tool 395 | for cosmology and particle physics}, 396 | journal = {Monthly Notices of the Royal Astronomical Society}, 397 | year = {2009}, 398 | volume = {398}, 399 | number = {4}, 400 | pages = {1601--1614}, 401 | annote = {Cited it the BMC paper as the feference for multitest.}, 402 | publisher = {Oxford University Press} 403 | } 404 | 405 | @Article{ johansen2009smctcsequentialmontecarloincpp, 406 | author = {Adam M. Johansen}, 407 | title = {SMCTC: Sequential Monte Carlo in C++}, 408 | journal = {Journal of Statistical Software}, 409 | year = {2009}, 410 | volume = {30}, 411 | number = {6}, 412 | pages = {1--41}, 413 | month = {4}, 414 | issn = {1548-7660}, 415 | annote = {I have the pdf. There is a R package RcppSMC that talks 416 | between R and SMCTC. I have the key book on the subject by 417 | Doucet in 2001: Sequential Monte Carlo Methods in 418 | Practice.}, 419 | coden = {JSSOBK}, 420 | url = {http://www.jstatsoft.org/v30/i06} 421 | } 422 | 423 | @Article{ johnson2013revisedstandardsforstatisticalevidencej, 424 | author = {Johnson, Valen E.}, 425 | title = {Revised standards for statistical evidence}, 426 | journal = {Proceedings of the National Academy of Sciences}, 427 | year = {2013}, 428 | volume = {110}, 429 | number = {48}, 430 | pages = {19313-19317}, 431 | endnotereftype= {Journal Article}, 432 | owner = {blaine-mooers}, 433 | publisher = {National Acad Sciences}, 434 | shorttitle = {Revised standards for statistical evidence} 435 | } 436 | 437 | @Article{ johnson2013revisedstandardsforstatisticalevidence, 438 | author = {Johnson, Valen E}, 439 | title = {Revised standards for statistical evidence}, 440 | journal = {Proceedings of the National Academy of Sciences}, 441 | year = {2013}, 442 | volume = {110}, 443 | number = {48}, 444 | pages = {19313--19317}, 445 | publisher = {National Acad Sciences} 446 | } 447 | -------------------------------------------------------------------------------- /apacannx.bst: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file `apacannx.bst', 3 | %% generated with the docstrip utility. 4 | %% 5 | %% The original source files were: 6 | %% 7 | %% apacite.dtx (with options: `xbibstyle,annotated') 8 | %% 9 | %% This is a generated file. 10 | %% 11 | %% Copyright (C) 1994-2013 Erik Meijer and any individual authors listed 12 | %% elsewhere in this file. 13 | %% 14 | %% This file is part of the `apacite' package. 15 | %% ------------------------------------------- 16 | %% 17 | %% It may be distributed and/or modified under the 18 | %% conditions of the LaTeX Project Public License, either 19 | %% version 1.3 of this license or (at your option) any later 20 | %% version. The latest version of this license is in: 21 | %% 22 | %% http://www.latex-project.org/lppl.txt 23 | %% 24 | %% and version 1.3 or later is part of all distributions of 25 | %% LaTeX version 2005/12/01 or later. 26 | %% 27 | %% The `apacite' package consists of the files apacite.dtx and 28 | %% apacite.ins, and the following generated files: 29 | %% apacite.sty, apacdoc.sty, apacite.drv, 30 | %% apacite.bst, apacitex.bst, apacann.bst, apacannx.bst, 31 | %% apa5ex.bib, apacxmpl.tex, 32 | %% english.apc, dutch.apc, finnish.apc, french.apc, 33 | %% german.apc, ngerman.apc, greek.apc, norsk.apc, 34 | %% spanish.apc, swedish.apc. 35 | %% 36 | %% This work has the LPPL maintenance status `maintained' 37 | %% 38 | %% The Current Maintainer of this work is Erik Meijer 39 | %% 40 | %% This file may only be distributed together with a copy of the 41 | %% source files of the apacite package, i.e., apacite.dtx and 42 | %% apacite.ins. You may however distribute the apacite package without 43 | %% the generated files. 44 | %% 45 | %% apacannx.bst 46 | %% [2013/07/21 v6.03 APA annotated bibl. style with author index info] 47 | %% apacannx.bst : reference list according to APA manual 48 | %% with annotations and author indexing information 49 | %% Written by Erik Meijer 50 | 51 | FUNCTION {identify.apacite.version} 52 | { % Put identifying string in the .blg file 53 | "apacannx.bst" 54 | " [2013/07/21 v6.03 APA annotated bibl. style with author index info]" 55 | * top$ 56 | } 57 | ENTRY 58 | { address 59 | annote 60 | annotate 61 | author 62 | booktitle 63 | chair 64 | chapter 65 | day 66 | doi 67 | edition 68 | editor 69 | englishtitle 70 | firstkey 71 | howpublished 72 | institution 73 | journal 74 | key 75 | lastchecked 76 | month 77 | nihms 78 | note 79 | number 80 | organization 81 | originaladdress 82 | originalbooktitle 83 | originaledition 84 | originaleditor 85 | originaljournal 86 | originalnumber 87 | originalpages 88 | originalpublisher 89 | originalvolume 90 | originalyear 91 | pages 92 | pmcid 93 | publisher 94 | school 95 | series 96 | symposium 97 | text 98 | title 99 | translator 100 | type 101 | url 102 | urldate 103 | volume 104 | year 105 | } 106 | { cite.order %% order of first citation 107 | title.number %% for sorting titles 108 | cite.initials %% dummy (0-1) indicating whether or not 109 | %% initials of the 1st author must 110 | %% be used for citing 111 | cite.num.names.full %% number of names to be cited for full and 112 | cite.num.names.short %% short cite 113 | add.to.year %% For a, b, c, etc. after year 114 | %% in multiple citations with same author-year 115 | } 116 | { year.label %% For sorting entries by year 117 | author.year.sort.label %% For sorting entries and checking whether 118 | %% initials should be added, how many authors 119 | %% should be cited and whether a, b, etc. 120 | %% after year is necessary 121 | title.sort.label %% for sorting titles 122 | citeorder.sort.label %% for sorting by citation order 123 | type.2 %% Replacement for type with misc entries and 124 | %% entries that revert to misc. 125 | } 126 | INTEGERS { len pos name.max old.number numnames numnames.old 127 | nameptr lastname format.num.names cite.initials.old 128 | cite.num.names.old add.to.year.old forward 129 | multiresult dot brace.level 130 | } 131 | 132 | STRINGS { s t u old.label field 133 | aut1f aut1s aut1f.old aut1s.old 134 | aut2 aut2.old 135 | aut3 aut3.old 136 | aut4 aut4.old 137 | aut5 aut5.old 138 | aut6 aut6.old 139 | year.label.old 140 | } 141 | FUNCTION {test} { #0 } 142 | FUNCTION {dump.stack} 143 | { "---- STACK {" cite$ * "} ----" * top$ 144 | stack$ 145 | "---- END STACK {" cite$ * "} ----" * top$ 146 | } 147 | FUNCTION {make.index} { #1 } 148 | FUNCTION {unsorted} { #0 } 149 | MACRO {jan} {"{\APACmonth{01}}"} 150 | MACRO {feb} {"{\APACmonth{02}}"} 151 | MACRO {mar} {"{\APACmonth{03}}"} 152 | MACRO {apr} {"{\APACmonth{04}}"} 153 | MACRO {may} {"{\APACmonth{05}}"} 154 | MACRO {jun} {"{\APACmonth{06}}"} 155 | MACRO {jul} {"{\APACmonth{07}}"} 156 | MACRO {aug} {"{\APACmonth{08}}"} 157 | MACRO {sep} {"{\APACmonth{09}}"} 158 | MACRO {oct} {"{\APACmonth{10}}"} 159 | MACRO {nov} {"{\APACmonth{11}}"} 160 | MACRO {dec} {"{\APACmonth{12}}"} 161 | MACRO {winter} {"{\APACmonth{13}}"} 162 | MACRO {spring} {"{\APACmonth{14}}"} 163 | MACRO {summer} {"{\APACmonth{15}}"} 164 | MACRO {fall} {"{\APACmonth{16}}"} 165 | FUNCTION {not} 166 | { { #0 } 167 | { #1 } 168 | if$ 169 | } 170 | 171 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 172 | 173 | FUNCTION {and} 174 | { 'skip$ 175 | { pop$ #0 } 176 | if$ 177 | } 178 | 179 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 180 | 181 | FUNCTION {or} 182 | { { pop$ #1 } 183 | 'skip$ 184 | if$ 185 | } 186 | 187 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 188 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 189 | 190 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 191 | % issues warning if field is empty 192 | % call with 193 | % "field" field warning.if.empty 194 | % Note that the first field must be between quotes 195 | % because it is the fieldname for use in the warning message. 196 | % 197 | FUNCTION {warning.if.empty} 198 | { empty$ 199 | { "No " swap$ * " in " * cite$ * warning$ } 200 | { pop$ } 201 | if$ 202 | } 203 | 204 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 205 | % 206 | % issues warning if title, type, and howpublished are empty 207 | % 208 | FUNCTION {check.relevant.fields} 209 | { title empty$ 210 | type empty$ and 211 | howpublished empty$ and 212 | { "No title, type, and howpublished in " cite$ * warning$ } 213 | 'skip$ 214 | if$ 215 | } 216 | 217 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 218 | % 219 | % delivers 1 if (both editor and translator 220 | % not empty and not equal to each other) 221 | % 0 if (editor or translator empty) or 222 | % (editor = translator) 223 | % 224 | FUNCTION {editor.ne.trans} 225 | { translator empty$ 226 | { #0 } 227 | { editor empty$ 228 | { #0 } 229 | { translator editor = 230 | { #0 } 231 | { #1 } 232 | if$ 233 | } 234 | if$ 235 | } 236 | if$ 237 | } 238 | 239 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 240 | 241 | FUNCTION {conv.int.to.str} 242 | { duplicate$ #10 < 243 | { "0000" swap$ int.to.str$ * } 244 | { duplicate$ #100 < 245 | { "000" swap$ int.to.str$ * } 246 | { duplicate$ #1000 < 247 | { "00" swap$ int.to.str$ * } 248 | { duplicate$ #10000 < 249 | { "0" swap$ int.to.str$ * } 250 | { int.to.str$ } 251 | if$ 252 | } 253 | if$ 254 | } 255 | if$ 256 | } 257 | if$ 258 | } 259 | 260 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 261 | 262 | FUNCTION {ref.type} 263 | { type$ "article" = 264 | type$ "magazine" = 265 | type$ "newspaper" = 266 | type$ "book" = 267 | type$ "techreport" = 268 | type$ "unpublished" = 269 | type$ "misc" = 270 | type$ "booklet" = 271 | type$ "manual" = 272 | type$ "proceedings" = 273 | or 274 | or 275 | or 276 | or 277 | or 278 | or 279 | or 280 | or 281 | or 282 | { #1 } 283 | { type$ "incollection" = 284 | type$ "phdthesis" = 285 | type$ "mastersthesis" = 286 | type$ "lecture" = 287 | type$ "inbook" = 288 | type$ "inproceedings" = 289 | type$ "conference" = 290 | type$ "intechreport" = 291 | or 292 | or 293 | or 294 | or 295 | or 296 | or 297 | or 298 | { #2 } 299 | { type$ "literal" = 300 | { #3 } 301 | { #0 } 302 | if$ 303 | } 304 | if$ 305 | } 306 | if$ 307 | } 308 | 309 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 310 | 311 | FUNCTION {is.atype} 312 | { type$ "article" = 313 | type$ "magazine" = 314 | type$ "newspaper" = 315 | type$ "incollection" = 316 | type$ "inbook" = 317 | type$ "inproceedings" = 318 | type$ "conference" = 319 | type$ "intechreport" = 320 | type$ "manual" = 321 | or 322 | or 323 | or 324 | or 325 | or 326 | or 327 | or 328 | or 329 | { #1 } 330 | { journal empty$ not 331 | % 332 | type$ "phdthesis" = 333 | type$ "mastersthesis" = 334 | or 335 | % 336 | and 337 | { #1 } 338 | { type$ "misc" = 339 | type empty$ not and 340 | { type "\bibmessage" = 341 | type "\bibcomputerprogram" = 342 | type "\bibcomputerprogrammanual" = 343 | type "\bibcomputerprogramandmanual" = 344 | type "\bibcomputersoftware" = 345 | type "\bibcomputersoftwaremanual" = 346 | type "\bibcomputersoftwareandmanual" = 347 | type "\bibprogramminglanguage" = 348 | or 349 | or 350 | or 351 | or 352 | or 353 | or 354 | or 355 | { #1 } 356 | { #0 } 357 | if$ 358 | } 359 | { #0 } 360 | if$ 361 | } 362 | if$ 363 | } 364 | if$ 365 | } 366 | 367 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 368 | % 369 | % connects two strings with connect string 370 | % if one of them empty, then connect string 371 | % is left out 372 | % 373 | % call with S1 S2 connectstring connect.check 374 | % 375 | FUNCTION {connect.check} 376 | { 'u := 377 | % 378 | % if S2 = "" 379 | % 380 | duplicate$ empty$ 381 | % 382 | % then remove S2 383 | % 384 | { pop$ 385 | % 386 | % S1 is on top of stack. 387 | % if it is empty, it is replaced by the empty string "" 388 | % 389 | duplicate$ empty$ 390 | { pop$ "" } 391 | 'skip$ 392 | if$ 393 | } 394 | % 395 | % else swap S1 and S2 so that S1 can be checked 396 | % 397 | { swap$ 398 | % 399 | % if S1 is empty, remove S1 so that S2 is left on the 400 | % stack and is the result is given 401 | % 402 | duplicate$ empty$ 403 | { pop$ } 404 | % 405 | % now the real work starts: 406 | % push the connect string "C" 407 | % so that top of stack is "C" "S1" "S2" 408 | % concatenate, so that top of stack is 409 | % "S1+C" "S2" 410 | % 411 | { u * 412 | % 413 | % swap and concatenate 414 | % 415 | swap$ * 416 | } 417 | if$ 418 | } 419 | if$ 420 | } 421 | 422 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 423 | % 424 | % connects two strings with space ("\ ") 425 | % if length of second is 4 or larger, 426 | % connects them with non-breaking space ("tie", "~") 427 | % if length of second smaller than 4 428 | % 429 | % call with S1 S2 tie.or.space.connect 430 | % result: "S1\ S2" or "S1~S2" 431 | % 432 | FUNCTION {tie.or.space.connect} 433 | { duplicate$ text.length$ #4 < 434 | { "~" } 435 | { "\ " } 436 | if$ 437 | swap$ * * 438 | } 439 | 440 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 441 | % 442 | % connects two strings with comma (", ") 443 | % if one of them is empty, the comma is left out 444 | % 445 | % call with S1 S2 connect.with.comma.check 446 | % result: "S1, S2" 447 | % 448 | FUNCTION {connect.with.comma.check} 449 | { ", " connect.check } 450 | 451 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 452 | % 453 | % connects two strings with semicolon ("; ") 454 | % if one of them is empty, semicolon is left out 455 | % 456 | % call with S1 S2 connect.with.semicolon.check 457 | % result: "S1; S2" 458 | % 459 | FUNCTION {connect.with.semicolon.check} 460 | { "; " connect.check } 461 | 462 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 463 | % 464 | % connects two strings with colon (": ") 465 | % if one of them is empty, colon is left out 466 | % 467 | % call with S1 S2 connect.with.colon.check 468 | % result: "S1: S2" 469 | % 470 | FUNCTION {connect.with.colon.check} 471 | { ": " connect.check } 472 | 473 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 474 | % 475 | % connects two strings with space ("\ ") 476 | % 477 | % call with S1 S2 connect.with.space.check 478 | % result: "S1\ S2" 479 | % 480 | FUNCTION {connect.with.space.check} 481 | { "\ " connect.check } 482 | 483 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 484 | % 485 | % encloses string in pre- and postfix string 486 | % call with 487 | % prefix postfix S enclose.check 488 | % delivers empty string if S empty 489 | % 490 | FUNCTION {enclose.check} 491 | { duplicate$ empty$ 492 | { pop$ pop$ pop$ 493 | "" 494 | } 495 | { swap$ * * } 496 | if$ 497 | } 498 | 499 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 500 | % 501 | % emphasizes top of stack 502 | % call with 503 | % "string" emphasize.check 504 | % 505 | FUNCTION {emphasize.check} 506 | { "\Bem{" swap$ 507 | "}" swap$ 508 | enclose.check 509 | } 510 | 511 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 512 | % 513 | % brackets top of stack 514 | % call with 515 | % "string" bracket 516 | % 517 | FUNCTION {bracket.check} 518 | { "[" swap$ 519 | "]" swap$ 520 | enclose.check 521 | } 522 | 523 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 524 | % 525 | % parenthesizes top of stack 526 | % call with 527 | % "string" parenthesize 528 | % 529 | FUNCTION {parenthesize.check} 530 | { "(" swap$ 531 | ")" swap$ 532 | enclose.check 533 | } 534 | 535 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 536 | % 537 | % checks whether argument is "multiresult": 538 | % whether it contains '-', '+', or ',' characters 539 | % used with pages to check whether pp. or p. must be used 540 | % 541 | FUNCTION {multi.result.check} 542 | { 't := 543 | #0 'multiresult := 544 | % 545 | % while (not multiresult) and (length(t) > 1) do 546 | % 547 | { multiresult not 548 | t text.length$ #1 > 549 | and 550 | } 551 | % 552 | % if t(1-2) = "--" or t(1) = "+" or "," 553 | % then multiresult = 1 554 | % else t = t(2-last) 555 | % 556 | { t #1 #2 substring$ 's := 557 | "--" s = 558 | { #1 'multiresult := } 559 | { t #1 #1 substring$ 's := 560 | "+" s = 561 | "," s = 562 | or 563 | { #1 'multiresult := } 564 | { t #2 global.max$ substring$ 't := } 565 | if$ 566 | } 567 | if$ 568 | } 569 | while$ 570 | multiresult 571 | } 572 | 573 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 574 | % 575 | % Checks whether an author is a corporate author, i.e., 576 | % whether the field starts with "{\bibcorporate". 577 | % Call with 578 | % field is.bibcorporate 579 | % 580 | FUNCTION {is.bibcorporate} 581 | { #1 #14 substring$ "{\bibcorporate" = } 582 | 583 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 584 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 585 | 586 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 587 | 588 | FUNCTION {sortify} 589 | { purify$ 590 | "l" change.case$ 591 | } 592 | 593 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 594 | 595 | FUNCTION {remove.spaces} 596 | { % Remove spaces from string. 597 | % Works best if string only contains alphanumeric characters and spaces. 598 | 's := % The original string 599 | s text.length$ 'len := % Its length (no. of characters) 600 | "" 't := % Initialize the transformed string 601 | #0 'pos := 602 | % 603 | % while (pos < len) do 604 | % 605 | { pos len < } 606 | { pos #1 + 'pos := 607 | s pos #1 substring$ 'u := 608 | % 609 | % u is the pos-th character in s 610 | % If it is a space, move to next character, 611 | % else copy character to output. 612 | % 613 | u " " = 614 | 'skip$ 615 | { t u * 't := } 616 | if$ 617 | } 618 | while$ 619 | % 620 | % Now push the result back on the stack 621 | t 622 | } 623 | 624 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 625 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 626 | 627 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 628 | % 629 | % end block by writing what's left on the stack and 630 | % starting a new line 631 | % 632 | FUNCTION {output.end.block} 633 | { write$ 634 | newline$ 635 | } 636 | 637 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 638 | % 639 | % end block by adding a period and writing what's left 640 | % on the stack and starting a new line 641 | % 642 | FUNCTION {output.dot.end.block} 643 | { add.period$ 644 | output.end.block 645 | } 646 | 647 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 648 | % 649 | % starting new block by writing what's left on the stack, 650 | % starting a new line and adding some extra space or 651 | % whatever is more defined in \newblock 652 | % 653 | FUNCTION {output.new.block} 654 | { output.end.block 655 | "\newblock" write$ newline$ 656 | } 657 | 658 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 659 | % 660 | % starting new block by writing what's left on the stack, 661 | % starting a new line and adding some extra space or 662 | % whatever is more defined in \newblock 663 | % 664 | FUNCTION {output.dot.new.block} 665 | { add.period$ 666 | output.new.block 667 | } 668 | 669 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 670 | 671 | FUNCTION {start.new.block} 672 | { "\unskip\ " write$ newline$ 673 | "\newblock " write$ newline$ 674 | } 675 | 676 | FUNCTION {sort.name.format.classic} { "{ll{}}{ f{}}{ vv{}}{ jj{}}" } 677 | 678 | FUNCTION {cite.name.format.classic} { "{ll}" } 679 | 680 | FUNCTION {author.name.format.classic} { "{ll}{, f{\BPBI }.}{ vv}{, jj}" } 681 | 682 | FUNCTION {index.name.format.classic} { "{ll}{, f{\BPBI }.}{ vv}{, jj}" } 683 | 684 | FUNCTION {sort.name.format} { "{vv{}}{ll{}}{ f{}}{ jj{}}" } 685 | 686 | FUNCTION {cite.name.format} { "{vv }{ll}" } 687 | 688 | FUNCTION {cite.initials.name.format} { "{f{\BPBI }.~~}{vv }{ll}{ jj}" } 689 | 690 | FUNCTION {author.name.format} { "{vv }{ll}{, f{\BPBI }.}{, jj}" } 691 | 692 | FUNCTION {editor.name.format} { "{f{\BPBI }.~~}{vv }{ll}{ jj}" } 693 | 694 | FUNCTION {index.name.format} { "{vv }{ll}{, f{\BPBI }.}{, jj}" } 695 | 696 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 697 | 698 | FUNCTION {init.initials} 699 | { "yyyyy" 'aut1f.old := 700 | "yyyyy" 'aut1s.old := 701 | #0 'cite.initials.old := 702 | } 703 | 704 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 705 | 706 | FUNCTION {update.no.initials} 707 | { 'field := 708 | field 'aut1f.old := 709 | field 'aut1s.old := 710 | #0 'cite.initials.old := 711 | } 712 | 713 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 714 | 715 | FUNCTION {check.add.initials.aut} 716 | { % 717 | % If last name is equal to previous last name 718 | % but initials are different, then initials should 719 | % be cited. If initials are also the same, initials 720 | % should be cited if that is the case for the previous 721 | % author . 722 | % 723 | aut1s aut1s.old = 724 | { aut1f aut1f.old = 725 | { cite.initials.old 'cite.initials := } 726 | { #1 'cite.initials := 727 | aut1f 'aut1f.old := 728 | aut1s 'aut1s.old := 729 | cite.initials 'cite.initials.old := 730 | } 731 | if$ 732 | } 733 | { % 734 | % Different last name. 735 | aut1f 'aut1f.old := 736 | aut1s 'aut1s.old := 737 | cite.initials 'cite.initials.old := 738 | } 739 | if$ 740 | } 741 | 742 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 743 | 744 | FUNCTION {check.add.initials.field} 745 | { 'field := 746 | field #1 cite.initials.name.format format.name$ 'aut1f := 747 | field #1 cite.name.format format.name$ 'aut1s := 748 | % 749 | % Now do the actual work 750 | % 751 | check.add.initials.aut 752 | } 753 | 754 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 755 | 756 | FUNCTION {check.add.initials} 757 | { % 758 | % Check whether author or editor or other field acts as author. 759 | % Initials are only relevant with author or editor. 760 | % 761 | firstkey empty$ not 762 | { key empty$ not 763 | { % 764 | % Both key and firstkey are nonempty. 765 | % Then, key is treated as last name of first author, 766 | % and firstkey is treated as last name + initials of 767 | % first author . 768 | % 769 | firstkey sortify remove.spaces 'aut1f := 770 | key sortify remove.spaces 'aut1s := 771 | check.add.initials.aut 772 | } 773 | { firstkey sortify remove.spaces update.no.initials } 774 | if$ 775 | } 776 | { key empty$ not 777 | { key sortify remove.spaces update.no.initials } 778 | { % 779 | % No key or firstkey, so find out which field 780 | % to use as author. 781 | % 782 | % Check reference type: 783 | % if result is 1 then possibly editor acts as author 784 | % 2 then editor does not act as author 785 | % 3 then key should have been used 786 | % 0 then unknown reference type 787 | ref.type #2 = 788 | { % 789 | % Format first author with and without initials 790 | author empty$ 791 | { title.sort.label update.no.initials } 792 | { author check.add.initials.field } 793 | if$ 794 | } 795 | { % 796 | % Format first author with and without initials 797 | author empty$ 798 | { editor empty$ 799 | { title.sort.label update.no.initials } 800 | { editor check.add.initials.field } 801 | if$ 802 | } 803 | { author check.add.initials.field } 804 | if$ 805 | } 806 | if$ 807 | } 808 | if$ 809 | } 810 | if$ 811 | } 812 | 813 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 814 | 815 | FUNCTION {tentative.cite.num.names.field} 816 | { 'field := 817 | field num.names$ 'numnames := 818 | numnames #3 < 819 | { % 820 | % 1 or 2 names: always cite all of them. 821 | numnames 'cite.num.names.full := 822 | numnames 'cite.num.names.short := 823 | } 824 | { numnames #6 < 825 | { % 826 | % 3-5 names: cite all of them the first time, 827 | % only the first name later times 828 | numnames 'cite.num.names.full := 829 | #1 'cite.num.names.short := 830 | } 831 | { % 832 | % 6 or more names: cite only the first name 833 | #1 'cite.num.names.full := 834 | #1 'cite.num.names.short := 835 | } 836 | if$ 837 | } 838 | if$ 839 | } 840 | 841 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 842 | 843 | FUNCTION {tentative.cite.num.names} 844 | { % 845 | % Check whether author or editor or other field acts as author. 846 | % Number of names is only relevant with author or editor. 847 | % 848 | firstkey empty$ not 849 | { 850 | #1 'cite.num.names.full := 851 | #1 'cite.num.names.short := 852 | } 853 | { key empty$ not 854 | { 855 | #1 'cite.num.names.full := 856 | #1 'cite.num.names.short := 857 | } 858 | { % 859 | % No key or firstkey, so find out which field 860 | % to use as author. 861 | % 862 | % Check reference type: 863 | % if result is 1 then possibly editor acts as author 864 | % 2 then editor does not act as author 865 | % 3 then key should have been used 866 | % 0 then unknown reference type 867 | ref.type #2 = 868 | { % 869 | % Format first author with and without initials 870 | author empty$ 871 | { 872 | #1 'cite.num.names.full := 873 | #1 'cite.num.names.short := 874 | } 875 | { author tentative.cite.num.names.field } 876 | if$ 877 | } 878 | { % 879 | % Format first author with and without initials 880 | author empty$ 881 | { editor empty$ 882 | { 883 | #1 'cite.num.names.full := 884 | #1 'cite.num.names.short := 885 | } 886 | { editor tentative.cite.num.names.field } 887 | if$ 888 | } 889 | { author tentative.cite.num.names.field } 890 | if$ 891 | } 892 | if$ 893 | } 894 | if$ 895 | } 896 | if$ 897 | } 898 | 899 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 900 | 901 | FUNCTION {init.cite.num.names} 902 | { #0 'cite.num.names.old := 903 | #0 'numnames.old := 904 | "yyyy" 'year.label.old := 905 | #0 'add.to.year.old := 906 | "" 'aut1f.old := 907 | "" 'aut2.old := 908 | "" 'aut3.old := 909 | "" 'aut4.old := 910 | "" 'aut5.old := 911 | "" 'aut6.old := 912 | } 913 | 914 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 915 | 916 | FUNCTION {update.cite.num.names} 917 | { cite.num.names.short 'cite.num.names.old := 918 | numnames 'numnames.old := 919 | year.label 'year.label.old := 920 | add.to.year 'add.to.year.old := 921 | aut1f 'aut1f.old := 922 | aut2 'aut2.old := 923 | aut3 'aut3.old := 924 | aut4 'aut4.old := 925 | aut5 'aut5.old := 926 | aut6 'aut6.old := 927 | } 928 | 929 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 930 | 931 | FUNCTION {format.6.authors} 932 | { % 933 | % First author: with initials. 934 | % 935 | field #1 cite.initials.name.format format.name$ 'aut1f := 936 | % 937 | % Second and later authors: without initials. 938 | % 939 | numnames #1 > 940 | name.max #1 > 941 | and 942 | { % 943 | % 2nd author 944 | field #2 cite.name.format format.name$ 'aut2 := 945 | % 946 | numnames #2 > 947 | name.max #2 > 948 | and 949 | { % 950 | % 3nd author 951 | field #3 cite.name.format format.name$ 'aut3 := 952 | % 953 | numnames #3 > 954 | name.max #3 > 955 | and 956 | { % 957 | % 4th author 958 | field #4 cite.name.format format.name$ 'aut4 := 959 | % 960 | numnames #4 > 961 | name.max #4 > 962 | and 963 | { % 964 | % 5th author 965 | field #5 cite.name.format format.name$ 'aut5 := 966 | % 967 | numnames #5 > 968 | name.max #5 > 969 | and 970 | { % 971 | % 6th author 972 | field #6 cite.name.format format.name$ 'aut6 := 973 | } 974 | { % 975 | % 5 authors: 6 is empty 976 | % 977 | "" 'aut6 := 978 | } 979 | if$ 980 | } 981 | { % 982 | % 4 authors: 5-6 are empty 983 | % 984 | "" 'aut5 := 985 | "" 'aut6 := 986 | } 987 | if$ 988 | } 989 | { % 990 | % 3 authors: 4-6 are empty 991 | % 992 | "" 'aut4 := 993 | "" 'aut5 := 994 | "" 'aut6 := 995 | } 996 | if$ 997 | } 998 | { % 999 | % 2 authors: 3-6 are empty 1000 | % 1001 | "" 'aut3 := 1002 | "" 'aut4 := 1003 | "" 'aut5 := 1004 | "" 'aut6 := 1005 | } 1006 | if$ 1007 | } 1008 | { % 1009 | % Only 1 author: 2-6 are empty 1010 | % 1011 | "" 'aut2 := 1012 | "" 'aut3 := 1013 | "" 'aut4 := 1014 | "" 'aut5 := 1015 | "" 'aut6 := 1016 | } 1017 | if$ 1018 | } 1019 | 1020 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1021 | 1022 | FUNCTION {change.add.to.year} 1023 | { 1024 | forward #1 = 1025 | { % 1026 | % Moving forward: this add.to.year number must be 1 higher than 1027 | % previous. 1028 | % 1029 | add.to.year.old #0 > 1030 | { add.to.year.old #1 + 'add.to.year := } 1031 | { #2 'add.to.year := } 1032 | if$ 1033 | } 1034 | { % 1035 | % Moving backward: this add.to.year number must be 1 lower than 1036 | % previous. 1037 | % 1038 | add.to.year.old #1 - 'add.to.year := 1039 | } 1040 | if$ 1041 | } 1042 | 1043 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1044 | 1045 | FUNCTION {definitive.cite.num.names.1.or.2} 1046 | { % 1047 | numnames numnames.old = 1048 | { % 1049 | % Same number of names: ambiguity could arise. Check whether current 1050 | % and previous have the same author(s). 1051 | % 1052 | aut1f aut1f.old = 1053 | { % 1054 | % Same first author: if the second author is also the same or if 1055 | % there is only one author, a's and b's should be added. 1056 | % 1057 | aut2 aut2.old = 1058 | numnames #2 = 1059 | and 1060 | % 1061 | numnames #1 = 1062 | or 1063 | { % 1064 | % Same author(s): add to year. 1065 | % 1066 | change.add.to.year 1067 | } 1068 | { % 1069 | % Different second author: no ambiguity possible. 1070 | % 1071 | skip$ 1072 | } 1073 | if$ 1074 | } 1075 | { % 1076 | % Different first author: no ambiguity possible. 1077 | % 1078 | skip$ 1079 | } 1080 | if$ 1081 | } 1082 | { % 1083 | % Different number of names: no ambiguity possible. 1084 | % 1085 | skip$ 1086 | } 1087 | if$ 1088 | } 1089 | 1090 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1091 | 1092 | FUNCTION {definitive.cite.num.names.3.or.more} 1093 | { % 1094 | % Check whether current and previous have the same first author. 1095 | % 1096 | aut1f aut1f.old = 1097 | { % 1098 | % Same first author: check second author 1099 | % 1100 | aut2 aut2.old = 1101 | { % 1102 | % Same 1st & 2nd author: check 3rd. 1103 | % 1104 | aut3 aut3.old = 1105 | { % 1106 | % Same 1st-3rd authors: check 4th. 1107 | % 1108 | numnames.old #3 = 1109 | { numnames #3 = 1110 | { % 1111 | % Both current and previous have 3 authors, which are 1112 | % the same, so both have identical author-year 1113 | % combinations, so ambiguity should be resolved by 1114 | % a's and b's. Check whether more authors were 1115 | % necessary for previous one. 1116 | % 1117 | change.add.to.year 1118 | cite.num.names.short cite.num.names.old < 1119 | { cite.num.names.old 1120 | 'cite.num.names.short := 1121 | } 1122 | 'skip$ 1123 | if$ 1124 | } 1125 | { % 1126 | % Previous has 3 authors, current has more, with same 1127 | % first 3, so at least 4 must be used for current to 1128 | % make a difference. 1129 | % 1130 | cite.num.names.short #4 < 1131 | { #4 'cite.num.names.short := } 1132 | 'skip$ 1133 | if$ 1134 | } 1135 | if$ 1136 | } 1137 | { numnames #3 = 1138 | { % 1139 | % Current has 3 authors, previous has more, with same 1140 | % first 3, so all 3 of current must be used. 1141 | % 1142 | numnames 'cite.num.names.short := 1143 | } 1144 | { % 1145 | % Same 1st-3rd author and both current and previous 1146 | % have at least 4 authors: check 4th. 1147 | % 1148 | aut4 aut4.old = 1149 | { % 1150 | % Same 1st-4th authors: check 5th. 1151 | % 1152 | numnames.old #4 = 1153 | { numnames #4 = 1154 | { % 1155 | % Both current and previous have 4 authors, 1156 | % which are the same, so both have 1157 | % identical author-year combinations, so 1158 | % ambiguity should be resolved by a's and 1159 | % b's. Check whether more authors were 1160 | % necessary for previous one. 1161 | % 1162 | change.add.to.year 1163 | cite.num.names.short cite.num.names.old < 1164 | { cite.num.names.old 1165 | 'cite.num.names.short := 1166 | } 1167 | 'skip$ 1168 | if$ 1169 | } 1170 | { % 1171 | % Previous has 4 authors, current has more, 1172 | % with same first 4, so at least 5 must be 1173 | % used for current to make a difference. 1174 | % 1175 | cite.num.names.short #5 < 1176 | { #5 'cite.num.names.short := } 1177 | 'skip$ 1178 | if$ 1179 | } 1180 | if$ 1181 | } 1182 | { numnames #4 = 1183 | { % 1184 | % Current has 4 authors, previous has more, 1185 | % with same first 4, so all 4 of current 1186 | % must be used. 1187 | % 1188 | numnames 'cite.num.names.short := 1189 | } 1190 | { % 1191 | % Same 1st-4th author and both current and 1192 | % previous have at least 5 authors: check 1193 | % 5th. 1194 | % 1195 | aut5 aut5.old = 1196 | { % 1197 | % Same 1st-5th authors: check 6th. 1198 | % 1199 | numnames.old #5 = 1200 | { numnames #5 = 1201 | { % 1202 | % Both current and previous 1203 | % have 5 authors, which are the 1204 | % same, so both have identical 1205 | % author-year combinations, so 1206 | % ambiguity should be resolved 1207 | % by a's and b's. Check whether 1208 | % more authors were necessary 1209 | % for previous one. 1210 | % 1211 | change.add.to.year 1212 | cite.num.names.short 1213 | cite.num.names.old < 1214 | { cite.num.names.old 1215 | 'cite.num.names.short := 1216 | } 1217 | 'skip$ 1218 | if$ 1219 | } 1220 | { % 1221 | % Previous has 5 authors, 1222 | % current has more, with same 1223 | % first 5, so at least 6 must 1224 | % be used for current to make 1225 | % a difference. 1226 | % 1227 | cite.num.names.short #6 < 1228 | { #6 'cite.num.names.short := } 1229 | 'skip$ 1230 | if$ 1231 | } 1232 | if$ 1233 | } 1234 | { numnames #5 = 1235 | { % 1236 | % Current has 5 authors, 1237 | % previous has more, with same 1238 | % first 5, so all 5 of current 1239 | % must be used. 1240 | % 1241 | numnames 'cite.num.names.short := 1242 | } 1243 | { % 1244 | % Same 1st-5th author and both 1245 | % current and previous have at 1246 | % least 6 authors. If one has 1247 | % 6 authors and the other has 1248 | % more or the 6th is different, 1249 | % 6 should be used (which is 1250 | % the maximum). 1251 | % 1252 | numnames #6 > 1253 | numnames.old #6 = 1254 | and 1255 | % 1256 | numnames #6 = 1257 | numnames.old #6 > 1258 | and 1259 | % 1260 | or 1261 | % 1262 | aut6 aut6.old = 1263 | not 1264 | % 1265 | or 1266 | { #6 cite.num.names.short < 1267 | { #6 1268 | 'cite.num.names.short 1269 | := 1270 | } 1271 | 'skip$ 1272 | if$ 1273 | } 1274 | { % 1275 | % The first 6 authors are 1276 | % the same and either both 1277 | % have 6 or both have more. 1278 | % So for all practical 1279 | % purposes they have 1280 | % identical author-year 1281 | % combination, so ambiguity 1282 | % should be resolved by a's 1283 | % and b's. Check whether 1284 | % more authors were 1285 | % necessary for previous 1286 | % one. 1287 | % 1288 | change.add.to.year 1289 | cite.num.names.short 1290 | cite.num.names.old 1291 | < 1292 | { cite.num.names.old 1293 | 'cite.num.names.short 1294 | := 1295 | } 1296 | 'skip$ 1297 | if$ 1298 | } 1299 | if$ 1300 | } 1301 | if$ 1302 | } 1303 | if$ 1304 | } 1305 | { % 1306 | % Different 5th author: citing 5 authors is 1307 | % sufficient for this comparison. 1308 | % 1309 | cite.num.names.short #5 < 1310 | { #5 'cite.num.names.short := } 1311 | 'skip$ 1312 | if$ 1313 | } 1314 | if$ 1315 | } 1316 | if$ 1317 | } 1318 | if$ 1319 | } 1320 | { % 1321 | % Different 4th author: citing 4 authors is 1322 | % sufficient for this comparison. 1323 | % 1324 | cite.num.names.short #4 < 1325 | { #4 'cite.num.names.short := } 1326 | 'skip$ 1327 | if$ 1328 | } 1329 | if$ 1330 | } 1331 | if$ 1332 | } 1333 | if$ 1334 | } 1335 | { % 1336 | % Different 3rd author: citing 3 authors is sufficient for this 1337 | % comparison. 1338 | % 1339 | cite.num.names.short #3 < 1340 | { #3 'cite.num.names.short := } 1341 | 'skip$ 1342 | if$ 1343 | } 1344 | if$ 1345 | } 1346 | { % 1347 | % Different 2nd author: citing 2 authors is sufficient for this 1348 | % comparison. 1349 | % 1350 | cite.num.names.short #2 < 1351 | { #2 'cite.num.names.short := } 1352 | 'skip$ 1353 | if$ 1354 | } 1355 | if$ 1356 | } 1357 | { % 1358 | % Different first author: no ambiguity, move to next entry. 1359 | % 1360 | skip$ 1361 | } 1362 | if$ 1363 | } 1364 | 1365 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1366 | 1367 | FUNCTION {definitive.cite.num.names.field} 1368 | { 'field := 1369 | field num.names$ 'numnames := 1370 | % 1371 | % Format authors 1372 | % 1373 | format.6.authors 1374 | % 1375 | % Now compare authors with authors of previous entry. 1376 | % 1377 | cite.num.names.short numnames.old > 1378 | { % 1379 | % The previous entry has less authors than already defined 1380 | % necessary to be cited. No ambiguity is possible and we're ready. 1381 | % 1382 | skip$ 1383 | } 1384 | { % 1385 | % Both previous and current entry have at least one author . 1386 | % 1387 | year.label year.label.old = 1388 | { % 1389 | % Same year label: possibly ambiguous citation. 1390 | % 1391 | % First check: current and/or previous have 1 or 1392 | % 2 authors. 1393 | % 1394 | numnames #3 < 1395 | numnames.old #3 < 1396 | or 1397 | % 1398 | { definitive.cite.num.names.1.or.2 } 1399 | { definitive.cite.num.names.3.or.more } 1400 | if$ 1401 | } 1402 | { % 1403 | % Different year label: everything's fine, 1404 | % move to next entry. 1405 | % 1406 | skip$ 1407 | } 1408 | if$ 1409 | } 1410 | if$ 1411 | % 1412 | % If during the previous process the name maximum is exceeded 1413 | % (which was not checked), correct this. NOTE: If the name 1414 | % maximum is smaller than 6, this could lead to ambiguous 1415 | % citations if, e.g., the year and the first 5 authors are 1416 | % the same, but the 6th author is different. 1417 | % 1418 | cite.num.names.short name.max > 1419 | { name.max 'cite.num.names.short := } 1420 | 'skip$ 1421 | if$ 1422 | % 1423 | % For a "full" cite, the number of names should always be at least 1424 | % as large as for a "short" cite. 1425 | % 1426 | cite.num.names.full cite.num.names.short < 1427 | { cite.num.names.short 'cite.num.names.full := } 1428 | 'skip$ 1429 | if$ 1430 | % 1431 | % Update "old" variables for next entry. 1432 | % 1433 | update.cite.num.names 1434 | } 1435 | 1436 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1437 | 1438 | FUNCTION {definitive.cite.no.names} 1439 | { % 1440 | % The formatted field that acts as author is on top 1441 | % of the stack. 1442 | 'aut1f := 1443 | "" 'aut2 := 1444 | "" 'aut3 := 1445 | "" 'aut4 := 1446 | "" 'aut5 := 1447 | "" 'aut6 := 1448 | #1 'numnames := 1449 | % 1450 | year.label year.label.old = 1451 | { % 1452 | % Same year label: possibly ambiguous citation. 1453 | % 1454 | definitive.cite.num.names.1.or.2 1455 | } 1456 | { % 1457 | % Different year label: everything's fine, 1458 | % move to next entry. 1459 | % 1460 | skip$ 1461 | } 1462 | if$ 1463 | % 1464 | % Update "old" variables for next entry. 1465 | % 1466 | update.cite.num.names 1467 | } 1468 | 1469 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1470 | 1471 | FUNCTION {definitive.cite.num.names} 1472 | { % 1473 | % Check whether author or editor or other field acts as author. 1474 | % Number of names is only relevant with author or editor. 1475 | % 1476 | firstkey empty$ not 1477 | { firstkey sortify remove.spaces definitive.cite.no.names } 1478 | { key empty$ not 1479 | { key sortify remove.spaces definitive.cite.no.names } 1480 | { % 1481 | % No key or firstkey, so find out which field 1482 | % to use as author. 1483 | % 1484 | % Check reference type: 1485 | % if result is 1 then possibly editor acts as author 1486 | % 2 then editor does not act as author 1487 | % 3 then key should have been used 1488 | % 0 then unknown reference type 1489 | ref.type #2 = 1490 | { % 1491 | % Format first author with and without initials 1492 | author empty$ 1493 | { title.sort.label definitive.cite.no.names } 1494 | { author definitive.cite.num.names.field } 1495 | if$ 1496 | } 1497 | { % 1498 | % Format first author with and without initials 1499 | author empty$ 1500 | { editor empty$ 1501 | { title.sort.label definitive.cite.no.names } 1502 | { editor definitive.cite.num.names.field } 1503 | if$ 1504 | } 1505 | { author definitive.cite.num.names.field } 1506 | if$ 1507 | } 1508 | if$ 1509 | } 1510 | if$ 1511 | } 1512 | if$ 1513 | } 1514 | 1515 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1516 | 1517 | FUNCTION {make.tentative.year.sort.label} 1518 | { % 1519 | % Implicit or explicit ``no date'' is put at the front 1520 | % (the year zero; years B.C. will imply complications) 1521 | % because these are possibly old works. 1522 | % ``In press'' is put at the end. 1523 | % 1524 | year empty$ 1525 | { "0000" 'year.label := } 1526 | { year "\bibnodate" = 1527 | year "l" change.case$ "no date" = or 1528 | year "l" change.case$ "n.d." = or 1529 | { "0000" 'year.label := } 1530 | { year "\BIP" = 1531 | year "l" change.case$ "in press" = or 1532 | year "l" change.case$ "forthcoming" = or 1533 | { "9999" 'year.label := } 1534 | { % It is not checked whether the year field 1535 | % makes sense. 1536 | year sortify remove.spaces 'year.label := 1537 | } 1538 | if$ 1539 | } 1540 | if$ 1541 | } 1542 | if$ 1543 | % 1544 | % Push year sort label on the stack 1545 | year.label 1546 | } 1547 | 1548 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1549 | 1550 | FUNCTION {month.number.day} 1551 | { month empty$ 1552 | { "" } 1553 | { month sortify remove.spaces 1554 | % 1555 | % Add the day when available. 1556 | day empty$ 1557 | 'skip$ 1558 | { "/" * 1559 | day sortify remove.spaces * 1560 | } 1561 | if$ 1562 | } 1563 | if$ 1564 | } 1565 | 1566 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1567 | 1568 | FUNCTION {make.name.sort.label} 1569 | { % 1570 | % Author or editor-acting-as-author available. 1571 | % => Make tentative "short cite with initials" author 1572 | % label (L1) of one of the forms 1573 | % "Last1 F1" 1574 | % "Last1 F1 Last2" 1575 | % "Last1 F1 zzzz" ("zzzz" representing et al.) 1576 | % => If more than 2 'authors': make label (L2) for 2nd-6th authors 1577 | % of one of the forms 1578 | % "Last2 Last3" 1579 | % "Last2 Last3 Last4" 1580 | % "Last2 Last3 Last4 Last5" 1581 | % "Last2 Last3 Last4 Last5 Last6" 1582 | % "Last2 Last3 Last4 Last5 Last6 zzzz" 1583 | % 1584 | % Then format year label (L3) of one of the forms: 1585 | % "0000" (missing year or explicit 'no date') 1586 | % "9999" ('in press') 1587 | % year (otherwise; don't use originalyear here yet) 1588 | % 1589 | % From earlier sorting of titles, we have title number. Convert 1590 | % to string, which gives title label (L4) . 1591 | % 1592 | % Then tentative sorting label (author.year.sort.label) is a 1593 | % concatenation of 1594 | % L1 1595 | % " " 1596 | % L3 1597 | % " " 1598 | % L2 1599 | % " " 1600 | % L4 1601 | % 1602 | % The name field is on top of the stack. 1603 | 'field := 1604 | % 1605 | % numnames is the total number of names contained in field 1606 | field num.names$ 'numnames := 1607 | % 1608 | % Format first author 1609 | field #1 sort.name.format format.name$ 1610 | % 1611 | % Format the second author if there are two, or else "zzzz" = et al. 1612 | numnames #1 = 1613 | 'skip$ 1614 | { numnames #2 = 1615 | { % 1616 | % Two authors: format second author 1617 | field #2 "{ll{}}" format.name$ 's := 1618 | s "others" = 1619 | { " zzzz" * } % Add "et al."-substitute 1620 | { " " * s * } % Add second author 1621 | if$ 1622 | } 1623 | { " zzzz" * } % 3 or more authors: add "et al."-substitute 1624 | if$ 1625 | } 1626 | if$ 1627 | " " * % Add spaces 1628 | make.tentative.year.sort.label * % Add year (L3). 1629 | " " * % Add spaces 1630 | % 1631 | % Now build up L2 if applicable 1632 | numnames #3 < 1633 | 'skip$ 1634 | { % 1635 | % Treat last author slightly differently 1636 | numnames name.max > 1637 | { name.max 'lastname := 1638 | " zzzz" % Push "et al."-substitute on stack 1639 | } 1640 | { numnames 'lastname := 1641 | "" % Push empty string on stack 1642 | } 1643 | if$ 1644 | % 1645 | % Names 2 to "last" - 1 1646 | "" % Push empty string on stack 1647 | #2 'nameptr := 1648 | { nameptr lastname < } 1649 | { % Add name no. nameptr 1650 | field nameptr "{ll{}}" format.name$ * 1651 | " " * 1652 | nameptr #1 + 'nameptr := 1653 | } 1654 | while$ 1655 | % 1656 | % "Last" author 1657 | field lastname "{ll{}}" format.name$ 's := 1658 | s "others" = 1659 | { "zzzz" * } % Add "et al."-substitute 1660 | { s * } % Add last author 1661 | if$ 1662 | % 1663 | swap$ * % Add the previously formatted empty string or 1664 | % "et al."-substitute if there are many authors. 1665 | * % Add L2 to the earlier labels. 1666 | } 1667 | if$ 1668 | % 1669 | " " * % Add spaces 1670 | title.number conv.int.to.str * % Add sorted title number (L4). 1671 | sortify % Clean up and convert to lowercase 1672 | " " * % Add spaces 1673 | month.number.day * % Add month and day when available 1674 | 'author.year.sort.label := % Assign result to sort label. 1675 | } 1676 | 1677 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1678 | 1679 | FUNCTION {make.field.year.sort.label} 1680 | { % 1681 | % 'field' acts as first author (L1), subsequent authors 1682 | % are empty (L2). 1683 | % 1684 | % Then format year label (L3) of one of the forms: 1685 | % "0000" (missing year or explicit 'no date') 1686 | % "9999" ('in press') 1687 | % year (otherwise; don't use originalyear here yet) 1688 | % 1689 | % From earlier sorting of titles, we have title number. Convert 1690 | % to string, which gives title label (L4) . 1691 | % 1692 | % Then tentative sorting label (author.year.sort.label) is a 1693 | % concatenation of 1694 | % L1 1695 | % " " 1696 | % L3 1697 | % " " 1698 | % L2 1699 | % " " 1700 | % L4 1701 | % 1702 | % 'field' is on top of the stack. It is already supposed to be cleaned 1703 | % (i.e., sortified and space-removed), so this is already L1. 1704 | " " * % Add spaces to L1 1705 | make.tentative.year.sort.label * % Add year (L3). 1706 | " " * % Add spaces 1707 | " " * % L2 is empty, add spaces 1708 | title.number conv.int.to.str * % Add sorted title number (L4). 1709 | sortify % Clean up and convert to lowercase 1710 | " " * % Add spaces 1711 | month.number.day * % Add month and day when available 1712 | 'author.year.sort.label := % Assign result to sort label. 1713 | } 1714 | 1715 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1716 | 1717 | FUNCTION {make.author.editor.sort.label} 1718 | { author empty$ 1719 | { editor empty$ 1720 | { % 1721 | % Use what has previously been stored in title.sort.label 1722 | % as author substitute . 1723 | title.sort.label make.field.year.sort.label 1724 | } 1725 | { editor make.name.sort.label } 1726 | if$ 1727 | } 1728 | { author make.name.sort.label } 1729 | if$ 1730 | } 1731 | 1732 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1733 | 1734 | FUNCTION {make.author.sort.label} 1735 | { author empty$ 1736 | { % 1737 | % Use what has previously been stored in title.sort.label 1738 | % as author substitute . 1739 | title.sort.label make.field.year.sort.label 1740 | } 1741 | { author make.name.sort.label } 1742 | if$ 1743 | } 1744 | 1745 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1746 | 1747 | FUNCTION {make.tentative.sort.label} 1748 | { % 1749 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1750 | % General strategy: 1751 | % 1752 | % Ordinary situation: author or editor-acting-as-author 1753 | % available. 1754 | % => Make tentative "short cite with initials" author 1755 | % label (L1) of one of the forms 1756 | % "Last1 F1" 1757 | % "Last1 F1 Last2" 1758 | % "Last1 F1 zzzz" ("zzzz" representing et al.) 1759 | % => If more than 2 'authors': make label (L2) for 2nd-6th authors 1760 | % of one of the forms 1761 | % "Last2 Last3" 1762 | % "Last2 Last3 Last4" 1763 | % "Last2 Last3 Last4 Last5" 1764 | % "Last2 Last3 Last4 Last5 Last6" 1765 | % "Last2 Last3 Last4 Last5 Last6 zzzz" 1766 | % When key is available (overrules author and editor fields): 1767 | % => L1 = key, L2 = "" 1768 | % No author, editor, and key: define title or substitute as key 1769 | % and format as key. 1770 | % 1771 | % Then format year label (L3) of one of the forms: 1772 | % "0000" (missing year or explicit 'no date') 1773 | % "9999" ('in press') 1774 | % year (otherwise; don't use originalyear here yet) 1775 | % 1776 | % From earlier sorting of titles, we have title number. Convert 1777 | % to string, which gives title label (L4) . 1778 | % 1779 | % Then tentative sorting label (author.year.sort.label) is a 1780 | % concatenation of 1781 | % L1 1782 | % " " 1783 | % L3 1784 | % " " 1785 | % L2 1786 | % " " 1787 | % L4 1788 | % 1789 | % This can then be sorted, from which it can be derived 1790 | % whether initials are necessary, how many names must 1791 | % be used for short and full citations, and whether "a"'s and 1792 | % "b"'s etc. are necessary behind the year labels. 1793 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1794 | % 1795 | % key and firstkey overrule author information 1796 | % 1797 | firstkey empty$ not 1798 | { key empty$ not 1799 | { % 1800 | % Both key and firstkey available: 1801 | % for sorting and checking initials, treat key as last 1802 | % name and firstkey as initials. 1803 | % 1804 | key sortify remove.spaces 1805 | " " * 1806 | firstkey sortify remove.spaces * 1807 | make.field.year.sort.label 1808 | } 1809 | { firstkey sortify remove.spaces make.field.year.sort.label } 1810 | if$ 1811 | } 1812 | { key empty$ not 1813 | { key sortify remove.spaces make.field.year.sort.label } 1814 | { % 1815 | % No key or firstkey, so find out which field 1816 | % to use as author. 1817 | % 1818 | % Check reference type: 1819 | % if result is 1 then possibly editor acts as author 1820 | % 2 then editor does not act as author 1821 | % 3 then key should have been used 1822 | % 0 then unknown reference type 1823 | ref.type 1824 | duplicate$ #1 = 1825 | { pop$ 1826 | make.author.editor.sort.label 1827 | } 1828 | { duplicate$ #2 = 1829 | { pop$ 1830 | make.author.sort.label 1831 | } 1832 | { #3 = 1833 | { "no key in " cite$ * warning$ 1834 | make.author.editor.sort.label 1835 | } 1836 | { make.author.editor.sort.label } 1837 | if$ 1838 | } 1839 | if$ 1840 | } 1841 | if$ 1842 | } 1843 | if$ 1844 | } 1845 | if$ 1846 | % 1847 | author.year.sort.label 'sort.key$ := 1848 | } 1849 | 1850 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1851 | 1852 | FUNCTION {make.definitive.name.sort.label} 1853 | { % 1854 | % Author or editor-acting-as-author available. 1855 | % => Make author-with-initials label (L1) of one of the forms 1856 | % "Last1 F1 Last2 F2 ... LastN FN" 1857 | % "Last1 F1 Last2 F2 ... Last6 F6 zzzz" 1858 | % (where N <= 6 is the total number of authors, and 1859 | % "zzzz" represents et al. if there are more than 6 authors) 1860 | % No author, editor, and key: define title or substitute as sort key. 1861 | % 1862 | % The name field is on top of the stack. 1863 | 'field := 1864 | % 1865 | % numnames is the total number of names contained in field 1866 | field num.names$ 'numnames := 1867 | % 1868 | % If there are more than 6 authors, only 6 are mentioned. 1869 | numnames name.max > 1870 | { name.max 'format.num.names := } 1871 | { numnames 'format.num.names := } 1872 | if$ 1873 | % Initialize stack with empty string 1874 | "" 1875 | % 1876 | % Cycle over authors. 1877 | #1 'nameptr := 1878 | { nameptr format.num.names < } 1879 | { % Format author and add spaces 1880 | field nameptr sort.name.format format.name$ * 1881 | " " * 1882 | nameptr #1 + 'nameptr := 1883 | } 1884 | while$ 1885 | % Format last author that must be formatted 1886 | field nameptr sort.name.format format.name$ * 1887 | % Add et al. if necessary 1888 | nameptr numnames < 1889 | { " zzzz" * } 1890 | 'skip$ 1891 | if$ 1892 | sortify % Clean up and change case 1893 | " " * % Add spaces 1894 | year.label * % Add year 1895 | " " * % Add spaces 1896 | title.number conv.int.to.str * % Add sorted title number 1897 | " " * % Add spaces 1898 | month.number.day * % Add month and day when available 1899 | 'author.year.sort.label := % Assign result to sort label. 1900 | } 1901 | 1902 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1903 | 1904 | FUNCTION {make.definitive.field.year.sort.label} 1905 | { % 1906 | % 'field' acts as author (L1). 1907 | % 1908 | % Then format year label (L2) of one of the forms: 1909 | % "0000" (missing year or explicit `no date') 1910 | % "9999" (`in press') 1911 | % year (otherwise; don't use originalyear here yet) 1912 | % 1913 | % From earlier sorting of titles, we have title number. Convert 1914 | % to string, which gives title label (L3) . 1915 | % 1916 | % Then tentative sorting label (author.year.sort.label) is a 1917 | % concatenation of 1918 | % L1 1919 | % " " 1920 | % L2 1921 | % " " 1922 | % L3 1923 | % 1924 | % 'field' is on top of the stack. It is already supposed to be cleaned 1925 | % (i.e., sortified and space-removed), so this is already L1. 1926 | " " * % Add spaces 1927 | year.label * % Add year 1928 | " " * % Add spaces 1929 | title.number conv.int.to.str * % Add sorted title number 1930 | " " * % Add spaces 1931 | month.number.day * % Add month and day when available 1932 | 'author.year.sort.label := % Assign result to sort label. 1933 | } 1934 | 1935 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1936 | 1937 | FUNCTION {make.definitive.author.editor.sort.label} 1938 | { author empty$ 1939 | { editor empty$ 1940 | { % 1941 | % Use what has previously been stored in title.sort.label 1942 | % as author substitute . 1943 | title.sort.label make.definitive.field.year.sort.label 1944 | } 1945 | { editor make.definitive.name.sort.label } 1946 | if$ 1947 | } 1948 | { author make.definitive.name.sort.label } 1949 | if$ 1950 | } 1951 | 1952 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1953 | 1954 | FUNCTION {make.definitive.author.sort.label} 1955 | { author empty$ 1956 | { % 1957 | % Use what has previously been stored in title.sort.label 1958 | % as author substitute . 1959 | title.sort.label make.definitive.field.year.sort.label 1960 | } 1961 | { author make.definitive.name.sort.label } 1962 | if$ 1963 | } 1964 | FUNCTION {make.final.sort.key} 1965 | { ref.type #2 = 1966 | { make.definitive.author.sort.label } 1967 | { make.definitive.author.editor.sort.label } 1968 | if$ 1969 | unsorted 1970 | { citeorder.sort.label 'sort.key$ := } 1971 | { author.year.sort.label 'sort.key$ := } 1972 | if$ 1973 | } 1974 | 1975 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1976 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1977 | 1978 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1979 | 1980 | FUNCTION {chop.word} 1981 | { 's := 1982 | 'len := 1983 | s #1 len substring$ = 1984 | { s len #1 + global.max$ substring$ } 1985 | { s } 1986 | if$ 1987 | } 1988 | 1989 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1990 | 1991 | FUNCTION {chop.articles} 1992 | { 's := 1993 | "a " #2 1994 | "an " #3 1995 | "the " #4 1996 | s 1997 | chop.word 1998 | chop.word 1999 | chop.word 2000 | } 2001 | 2002 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2003 | 2004 | FUNCTION {format.sort.title} 2005 | { % 2006 | % Remove non-alphanumeric characters and change to lower case . 2007 | sortify 2008 | % 2009 | % Remove "a ", "an ", and "the " from the front . 2010 | chop.articles #1 entry.max$ substring$ 2011 | } 2012 | 2013 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2014 | 2015 | FUNCTION {make.sort.title} 2016 | { title empty$ 2017 | { text empty$ 2018 | { type empty$ 2019 | { howpublished empty$ 2020 | { note empty$ 2021 | { url empty$ 2022 | { " " } 2023 | { url format.sort.title } 2024 | if$ 2025 | } 2026 | { note format.sort.title } 2027 | if$ 2028 | } 2029 | { howpublished format.sort.title } 2030 | if$ 2031 | } 2032 | { type format.sort.title } 2033 | if$ 2034 | } 2035 | { text format.sort.title } 2036 | if$ 2037 | } 2038 | { title format.sort.title } 2039 | if$ 2040 | remove.spaces 2041 | 'title.sort.label := 2042 | title.sort.label 'sort.key$ := 2043 | } 2044 | FUNCTION {make.title.number} 2045 | { title.sort.label old.label = 2046 | { 2047 | old.number 'title.number := 2048 | } 2049 | { 2050 | old.number #1 + 'title.number := 2051 | title.number 'old.number := 2052 | title.sort.label 'old.label := 2053 | } 2054 | if$ 2055 | } 2056 | FUNCTION {make.citeorder.number} 2057 | { old.number #1 + 'cite.order := 2058 | cite.order 'old.number := 2059 | cite.order conv.int.to.str 'citeorder.sort.label := 2060 | } 2061 | 2062 | FUNCTION {last.part.name.format.classic} { "{ll}" } 2063 | 2064 | FUNCTION {von.junior.name.format.classic} { "{ vv}{, jj}" } 2065 | 2066 | FUNCTION {last.part.name.format} { "{vv }{ll}" } 2067 | 2068 | FUNCTION {initials.with.space.name.format} { "{f.}" } 2069 | 2070 | FUNCTION {von.last.junior.name.format} { "{vv }{ll}{ jj}" } 2071 | 2072 | FUNCTION {von.junior.name.format} { "{, jj}" } 2073 | 2074 | FUNCTION {one.complete.name.format} { "{vv }{ll}{, jj}{, ff}" } 2075 | 2076 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2077 | 2078 | FUNCTION {string.length} 2079 | { #0 'pos := 2080 | % If the next character exists, i.e., is not empty, 2081 | % add 1 to the string length. 2082 | % We cannot use empty$ because " " empty$ is true. 2083 | { duplicate$ pos #1 + #1 substring$ "" = not } 2084 | { pos #1 + 'pos := } 2085 | while$ 2086 | pop$ pos 2087 | } 2088 | 2089 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2090 | 2091 | FUNCTION {transform.spaces.and.hyphens} 2092 | { 's := % The original string 2093 | s string.length 'len := % Its length (no. of characters) 2094 | "" 't := % Initialize the transformed string 2095 | #1 'pos := 2096 | #0 'brace.level := 2097 | % 2098 | % while (pos < len) do 2099 | % 2100 | { pos len < } 2101 | { % First, check whether we are at brace level 0 2102 | brace.level #0 = 2103 | { 2104 | % At least two characters left: check for ". ", ".~", and ".-". 2105 | % If so, replace and shift two positions. 2106 | s pos #2 substring$ ". " = 2107 | s pos #2 substring$ ".~" = or 2108 | { t "\BPBI " * 't := 2109 | pos #2 + 'pos := 2110 | } 2111 | { s pos #2 substring$ ".-" = 2112 | { t "\BHBI " * 't := 2113 | pos #2 + 'pos := 2114 | } 2115 | { % neither is true, copy one character and shift one position 2116 | t s pos #1 substring$ * 't := 2117 | % Check whether we need to increase brace level. 2118 | % Note that this is not sophisticated: it does not capture 2119 | % \{, \verb+}+, etc. 2120 | % Note also that unbalanced braces cause problems. 2121 | s pos #1 substring$ "{" = 2122 | { brace.level #1 + 'brace.level := } 2123 | 'skip$ 2124 | if$ 2125 | pos #1 + 'pos := 2126 | } 2127 | if$ 2128 | } 2129 | if$ 2130 | } 2131 | { % Not at brace level 0: copy result literally 2132 | t s pos #1 substring$ * 't := 2133 | % Check whether we need to increase or decrease brace level. 2134 | % Note that this is not sophisticated: it does not capture 2135 | % \{, \verb+}+, etc. 2136 | s pos #1 substring$ "{" = 2137 | { brace.level #1 + 'brace.level := } 2138 | { s pos #1 substring$ "}" = 2139 | { brace.level #1 - 'brace.level := } 2140 | 'skip$ 2141 | if$ 2142 | } 2143 | if$ 2144 | pos #1 + 'pos := 2145 | } 2146 | if$ 2147 | } 2148 | while$ 2149 | % 2150 | pos len = 2151 | { % Last character, copy 2152 | t s pos #1 substring$ * 't := 2153 | } 2154 | { % pos = len + 1, so s ends with ". " or ".-" 2155 | % This should not have happened, but make the best out of it. 2156 | % Push last two characters of s on the stack, i.e., ". " or ".-". 2157 | s len #1 - #2 substring$ 2158 | % Remove "\BPBI " or "\BHBI " from t 2159 | t text.length$ 'len := % Length of t (no. of characters) 2160 | t #1 len #6 - substring$ 2161 | % Concatenate and assign to t 2162 | swap$ * 't := 2163 | } 2164 | if$ 2165 | % 2166 | % Now push the result back on the stack 2167 | t 2168 | } 2169 | 2170 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2171 | 2172 | FUNCTION {format.initials.with.hyphen} 2173 | { % Format initials. 2174 | % Call with 2175 | % field authornumber format.initials.with.hyphen 2176 | % e.g. 2177 | % author #1 format.initials.with.hyphen 2178 | % Instead of field, a string may also be used. 2179 | % 2180 | % First, format initials in the default way, retaining spaces 2181 | % and hyphens. 2182 | initials.with.space.name.format format.name$ 2183 | transform.spaces.and.hyphens 2184 | } 2185 | 2186 | FUNCTION {format.last.part.name} 2187 | { % Format a name with last.part.name.format, 2188 | % as part of more complicated things. 2189 | % Call with 2190 | % field authornumber format.last.part.name 2191 | % e.g. 2192 | % author #1 format.last.part.name 2193 | % Instead of field, a string may also be used. 2194 | last.part.name.format format.name$ 2195 | } 2196 | 2197 | FUNCTION {format.von.last.junior.name} 2198 | { % Format a name with von.last.junior.name.format, 2199 | % for citing or as part of more complicated things. 2200 | % Call with 2201 | % field authornumber format.von.last.junior.name 2202 | % e.g. 2203 | % author #1 format.von.last.junior.name 2204 | % Instead of field, a string may also be used. 2205 | von.last.junior.name.format format.name$ 2206 | } 2207 | 2208 | FUNCTION {format.von.junior.name} 2209 | { % Format a name with von.last.junior.name.format, 2210 | % for citing or as part of more complicated things. 2211 | % Call with 2212 | % field authornumber format.von.junior.name 2213 | % e.g. 2214 | % author #1 format.von.junior.name 2215 | % Instead of field, a string may also be used. 2216 | von.junior.name.format format.name$ 2217 | } 2218 | 2219 | FUNCTION {format.cite.initials.name} 2220 | { % Format a name for citing with initials. 2221 | % Call with 2222 | % field authornumber format.cite.initials.name 2223 | % e.g. 2224 | % author #1 format.cite.initials.name 2225 | % Instead of field, a string may also be used. 2226 | % 2227 | % First, extract the complete name, format it in the canonical form, 2228 | % and push on the stack. 2229 | one.complete.name.format format.name$ 2230 | % 2231 | % Format the initials and push on the stack. 2232 | duplicate$ #1 format.initials.with.hyphen 2233 | % 2234 | % Format the von-last-junior part and push on the stack. 2235 | swap$ #1 format.von.last.junior.name 2236 | % 2237 | % Connect with "~" hyphen (if they're both non-empty). 2238 | "~" connect.check 2239 | } 2240 | 2241 | FUNCTION {format.author.name} 2242 | { % Format an author name for the reference list. 2243 | % Call with 2244 | % field authornumber format.author.name 2245 | % e.g. 2246 | % author #1 format.author.name 2247 | % Instead of field, a string may also be used. 2248 | % 2249 | % First, extract the complete name, format it in the canonical form, 2250 | % and push on the stack. 2251 | one.complete.name.format format.name$ 2252 | % 2253 | % Make two copies of the name, format the last name and push on the stack. 2254 | duplicate$ duplicate$ #1 format.last.part.name 2255 | % 2256 | % Format the initials and push on the stack. 2257 | swap$ #1 format.initials.with.hyphen 2258 | % 2259 | % Connect with last name. 2260 | connect.with.comma.check 2261 | % 2262 | % Format the von-junior part and connect with initials. 2263 | swap$ #1 format.von.junior.name "" connect.check 2264 | } 2265 | 2266 | FUNCTION {format.editor.name} 2267 | { % Format a name for the reference list as an editor. 2268 | % Call with 2269 | % field authornumber format.editor.name 2270 | % e.g. 2271 | % author #1 format.editor.name 2272 | % Instead of field, a string may also be used. 2273 | % 2274 | format.cite.initials.name 2275 | } 2276 | 2277 | FUNCTION {format.index.name} 2278 | { % Format an author name for the index. 2279 | % Call with 2280 | % field authornumber format.index.name 2281 | % e.g. 2282 | % author #1 format.index.name 2283 | % Instead of field, a string may also be used. 2284 | % 2285 | format.author.name 2286 | } 2287 | 2288 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2289 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2290 | FUNCTION {comma.between.two} { "\BCBT {}" } 2291 | 2292 | FUNCTION {comma.between.names} { ", " } 2293 | 2294 | FUNCTION {comma.before.last} { "\BCBL {}" } 2295 | 2296 | FUNCTION {dots.before.last} { "\BDBL {}" } 2297 | 2298 | FUNCTION {and.before.last} { "\ \BBA {} " } 2299 | 2300 | FUNCTION {et.al.string.cite} { "\ \protect \BOthers {.}" } 2301 | 2302 | FUNCTION {et.al.string} { "\ \BOthers {.}" } 2303 | 2304 | FUNCTION {et.al.string.period} { "\ \BOthersPeriod {.}" } 2305 | 2306 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2307 | 2308 | FUNCTION {add.name.index} 2309 | { % 2310 | % 2311 | make.index 2312 | { "%" * write$ newline$ 2313 | % Check for corporate author 2314 | field is.bibcorporate 2315 | { "\corporateAX{" } 2316 | { "\AX{" } 2317 | if$ 2318 | write$ 2319 | field nameptr sort.name.format format.name$ sortify write$ newline$ 2320 | "@" write$ 2321 | field nameptr format.index.name 2322 | "}%" * write$ newline$ 2323 | } 2324 | { "%" * write$ newline$ } 2325 | if$ 2326 | } 2327 | 2328 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2329 | 2330 | FUNCTION {make.name.cite.label} 2331 | { 'field := 2332 | 'format.num.names := 2333 | % 2334 | field num.names$ 'numnames := % numnames is the total number of names 2335 | % contained in field 2336 | % 2337 | % It is implicit in the APA manual that if "et al." would refer 2338 | % to exactly one author, then this author should be named 2339 | % instead of "et al." 2340 | % 2341 | format.num.names numnames #1 - = 2342 | { numnames 'format.num.names := } 2343 | 'skip$ 2344 | if$ 2345 | % 2346 | % Format first author: with or without initials 2347 | % 2348 | #1 'nameptr := 2349 | cite.initials #1 = 2350 | { field nameptr format.cite.initials.name } 2351 | { field nameptr cite.name.format format.name$ } 2352 | if$ 2353 | add.name.index % Add index entry when desired. 2354 | % 2355 | numnames #1 = 2356 | 'skip$ 2357 | { format.num.names #1 = 2358 | { % 2359 | % First author et al. 2360 | % 2361 | et.al.string.cite write$ 2362 | } 2363 | { numnames #2 = 2364 | { % 2365 | % Given that format.num.names > 1, it is 2. 2366 | % Format second author. 2367 | % 2368 | #2 'nameptr := 2369 | field nameptr cite.name.format format.name$ 's := 2370 | % 2371 | % Check if 2nd author is explicit "others". 2372 | % If so, insert "et al." string. 2373 | % 2374 | s "others" = 2375 | { et.al.string.cite write$ } % First et al. 2376 | { % 2377 | % First \& Second 2378 | % 2379 | and.before.last write$ 2380 | s 2381 | add.name.index % Add index entry when desired. 2382 | } 2383 | if$ 2384 | } 2385 | { % 2386 | % 3 or more names, 2 or more must be cited 2387 | % 2388 | % for nameptr := 2 to format.num.names - 1 do 2389 | % 2390 | #2 'nameptr := 2391 | { nameptr format.num.names < } 2392 | { % 2393 | % Put comma between consecutive authors 2394 | % 2395 | comma.between.names write$ 2396 | % 2397 | % Format and add next author 2398 | % 2399 | field nameptr cite.name.format format.name$ 2400 | add.name.index % Add index entry when desired. 2401 | % 2402 | % Move to next author 2403 | % 2404 | nameptr #1 + 'nameptr := 2405 | } 2406 | while$ 2407 | % 2408 | % nameptr = format.num.names 2409 | % Format this author. 2410 | % 2411 | field nameptr cite.name.format format.name$ 's := 2412 | % 2413 | format.num.names numnames = 2414 | { % 2415 | % This is also the last author. Add (optional) comma. 2416 | % 2417 | comma.before.last write$ 2418 | % 2419 | % Check if this author is explicit "others". 2420 | % If so, insert "et al." string. 2421 | % 2422 | s "others" = 2423 | { et.al.string.cite write$ } 2424 | { and.before.last write$ 2425 | s 2426 | add.name.index % Add index entry when desired. 2427 | } 2428 | if$ 2429 | } 2430 | { % 2431 | % This is not the last author. 2432 | % Add comma, author name, and "et al." 2433 | % 2434 | comma.between.names write$ 2435 | s 2436 | add.name.index % Add index entry when desired. 2437 | % 2438 | comma.before.last et.al.string.cite * write$ 2439 | } 2440 | if$ 2441 | } 2442 | if$ 2443 | } 2444 | if$ 2445 | } 2446 | if$ 2447 | } 2448 | 2449 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2450 | 2451 | FUNCTION {make.title.cite.label} 2452 | { % 2453 | % Formatting: check if formatted as article title or 2454 | % as book title, and insert this formatting. 2455 | % 2456 | is.atype 2457 | { "\APACciteatitle {" } 2458 | { "\APACcitebtitle {" } 2459 | if$ 2460 | % 2461 | title empty$ 2462 | { text empty$ 2463 | { type empty$ 2464 | { howpublished empty$ 2465 | { note empty$ 2466 | { url empty$ 2467 | { cite$ } 2468 | { url } 2469 | if$ 2470 | } 2471 | { note } 2472 | if$ 2473 | } 2474 | { howpublished } 2475 | if$ 2476 | } 2477 | { type } 2478 | if$ 2479 | } 2480 | { text } 2481 | if$ 2482 | } 2483 | { title } 2484 | if$ 2485 | % 2486 | % Connect with formatting. 2487 | % 2488 | * "}" * 2489 | % 2490 | % Write to output 2491 | % 2492 | write$ 2493 | } 2494 | 2495 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2496 | 2497 | FUNCTION {make.author.editor.cite.label} 2498 | { author empty$ 2499 | { editor empty$ 2500 | { % 2501 | % No author or editor: 2502 | % Use title or other description as citation label. 2503 | % 2504 | make.title.cite.label 2505 | "}{%" write$ newline$ 2506 | make.title.cite.label 2507 | } 2508 | { cite.num.names.full editor make.name.cite.label 2509 | "}{%" write$ newline$ 2510 | cite.num.names.short editor make.name.cite.label 2511 | } 2512 | if$ 2513 | } 2514 | { cite.num.names.full author make.name.cite.label 2515 | "}{%" write$ newline$ 2516 | cite.num.names.short author make.name.cite.label 2517 | } 2518 | if$ 2519 | } 2520 | 2521 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2522 | 2523 | FUNCTION {make.author.cite.label} 2524 | { author empty$ 2525 | { % 2526 | % No author: 2527 | % Use title or other description as citation label. 2528 | % 2529 | make.title.cite.label 2530 | "}{%" write$ newline$ 2531 | make.title.cite.label 2532 | } 2533 | { cite.num.names.full author make.name.cite.label 2534 | "}{%" write$ newline$ 2535 | cite.num.names.short author make.name.cite.label 2536 | } 2537 | if$ 2538 | } 2539 | 2540 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2541 | 2542 | FUNCTION {make.definitive.year.supplement} 2543 | { % 2544 | % Add "a", "b", etc. when necessary. 2545 | % 2546 | add.to.year #0 = 2547 | { "" } 2548 | { "{\protect " 2549 | year empty$ 2550 | { "\BCntND " * } 2551 | { year "\bibnodate" = 2552 | year "l" change.case$ "no date" = or 2553 | year "l" change.case$ "n.d." = or 2554 | { "\BCntND " * } 2555 | { year "\BIP" = 2556 | year "l" change.case$ "in press" = or 2557 | year "l" change.case$ "forthcoming" = or 2558 | { "\BCntIP " * } 2559 | { "\BCnt " * } 2560 | if$ 2561 | } 2562 | if$ 2563 | } 2564 | if$ 2565 | "{" * add.to.year int.to.str$ * "}}" * 2566 | } 2567 | if$ 2568 | } 2569 | 2570 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2571 | 2572 | FUNCTION {protect.year} 2573 | { year empty$ 2574 | { "{\protect \bibnodate {}}" } 2575 | { year "\bibnodate" = 2576 | year "l" change.case$ "no date" = or 2577 | year "l" change.case$ "n.d." = or 2578 | { "{\protect \bibnodate {}}" } 2579 | { year "\BIP" = 2580 | year "l" change.case$ "in press" = or 2581 | year "l" change.case$ "forthcoming" = or 2582 | { "{\protect \BIP {}}" } 2583 | { year } 2584 | if$ 2585 | } 2586 | if$ 2587 | } 2588 | if$ 2589 | } 2590 | 2591 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2592 | 2593 | FUNCTION {make.definitive.year.label} 2594 | { "{\protect \APACyear {" 2595 | originalyear empty$ 2596 | { protect.year } 2597 | { originalyear "\bibnodate" = % date of original publication unknown 2598 | originalyear "l" change.case$ "no date" = or 2599 | originalyear "l" change.case$ "n.d." = or 2600 | { translator empty$ 2601 | { protect.year } 2602 | { "{\protect \BTRANSL {}}~" protect.year * } 2603 | if$ 2604 | } 2605 | { year empty$ 2606 | { originalyear "/{\protect \bibnodate {}}" * } % 1923/n.d. 2607 | { originalyear year = 2608 | { protect.year } 2609 | { originalyear "/" * protect.year * } % 1923/1961 2610 | if$ 2611 | } 2612 | if$ 2613 | } 2614 | if$ 2615 | } 2616 | if$ 2617 | * "}}%" * write$ newline$ 2618 | % 2619 | % Add "a", "b", etc. when necessary. 2620 | % 2621 | "{\protect \APACexlab {" "}}" 2622 | make.definitive.year.supplement enclose.check 2623 | } 2624 | 2625 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2626 | 2627 | FUNCTION {make.cite.labels} 2628 | { newline$ 2629 | % 2630 | % Write a few lines for testing purposes. 2631 | % 2632 | test 2633 | { "\bibitem [] {} \fullciteA {" cite$ * "}" * write$ newline$ 2634 | "\bibitem [] {} \citeA {" cite$ * "}" * write$ newline$ 2635 | } 2636 | 'skip$ 2637 | if$ 2638 | % 2639 | "\bibitem [\protect \citeauthoryear {%" write$ newline$ 2640 | % 2641 | % When key or firstkey is available, this takes precedence. 2642 | % 2643 | firstkey empty$ not 2644 | { % 2645 | % Full cite: firstkey. 2646 | % 2647 | firstkey write$ 2648 | "}{%" write$ newline$ 2649 | % 2650 | % Short cite: if key is not empty and cite.initials is 0, 2651 | % then key, else firstkey. 2652 | % 2653 | cite.initials #0 = 2654 | key empty$ not 2655 | and 2656 | { key } 2657 | { firstkey } 2658 | if$ 2659 | write$ 2660 | } 2661 | { key empty$ not 2662 | { % 2663 | % No firstkey, but key available: 2664 | % Both full and short labels are key. 2665 | % 2666 | key write$ 2667 | "}{%" write$ newline$ 2668 | key write$ 2669 | } 2670 | { % No key or firstkey, so find out which field 2671 | % to use as author. 2672 | % 2673 | % Check reference type: 2674 | % if result is 1 then possibly editor acts as author 2675 | % 2 then editor does not act as author 2676 | % 3 then key should have been used 2677 | % 0 then unknown reference type 2678 | ref.type #2 = 2679 | { make.author.cite.label } 2680 | { make.author.editor.cite.label } 2681 | if$ 2682 | } 2683 | if$ 2684 | } 2685 | if$ 2686 | "}{%" write$ newline$ 2687 | % 2688 | % Make year label that's used for citations 2689 | % 2690 | make.definitive.year.label write$ 2691 | "}]{%" write$ newline$ 2692 | cite$ write$ 2693 | "} " write$ newline$ 2694 | % author.year.sort.label write$ newline$ % for testing purposes 2695 | % year.label write$ newline$ % for testing purposes 2696 | % 2697 | % If the item is used in a meta-analysis, indicate this with 2698 | % a star. 2699 | % 2700 | "\APACinsertmetastar {%" write$ newline$ 2701 | cite$ write$ 2702 | "}%" write$ newline$ 2703 | } 2704 | 2705 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2706 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2707 | 2708 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2709 | 2710 | FUNCTION {editor.postfix} 2711 | { editor num.names$ #1 > 2712 | { "(\BEDS)" } 2713 | { "(\BED)" } 2714 | if$ 2715 | } 2716 | 2717 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2718 | 2719 | FUNCTION {editor.trans.postfix} 2720 | { editor num.names$ #1 > 2721 | { "(\BEDS{} \BAnd{} \BTRANSS)" } 2722 | { "(\BED{} \BAnd{} \BTRANS)" } 2723 | if$ 2724 | } 2725 | 2726 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2727 | % 2728 | % "(Trans.)" postfix 2729 | % translator must not be empty 2730 | % 2731 | FUNCTION {trans.postfix} 2732 | { translator num.names$ #1 > 2733 | { "(\BTRANSS)" } 2734 | { "(\BTRANS)" } 2735 | if$ 2736 | } 2737 | 2738 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2739 | 2740 | FUNCTION {authors.editors.reflist.apa5} 2741 | { 'field := 2742 | 'dot := 2743 | % 2744 | field num.names$ 'numnames := % numnames is the total number of names 2745 | % contained in field 2746 | numnames 'format.num.names := % Format all authors 2747 | format.num.names name.max > % Unless this exceeds the maximum of 6. 2748 | { dot 2749 | { name.max 'format.num.names := } % Format 6 authors 2750 | { cite.num.names.full 'format.num.names := } % Format 1 editor 2751 | if$ 2752 | } 2753 | 'skip$ 2754 | if$ 2755 | % 2756 | % Enclose authors in APACrefauthors environment to allow crude style 2757 | % options in \LaTeX. 2758 | "\begin{APACrefauthors}%" 2759 | write$ newline$ 2760 | % 2761 | % It is kind of explicit in the APA manual that if "et al." would 2762 | % refer to exactly one author (the 7th), then this author should 2763 | % still be replaced by "et al.", unlike with citations. 2764 | % So format.num.names is not adapted. 2765 | % 2766 | % Format first author 2767 | % 2768 | #1 'nameptr := 2769 | field nameptr format.author.name 2770 | % 2771 | % Add period if required and if this is the only author. 2772 | % 2773 | numnames #1 = 2774 | dot 2775 | and 2776 | { add.period$ } 2777 | 'skip$ 2778 | if$ 2779 | add.name.index % Add index entry when desired. 2780 | % 2781 | numnames #1 = 2782 | 'skip$ 2783 | { format.num.names #1 = 2784 | { % 2785 | % First author et al. 2786 | % 2787 | comma.between.two 2788 | % 2789 | % Add period if required. 2790 | % 2791 | dot 2792 | { et.al.string.period * } 2793 | { et.al.string * } 2794 | if$ 2795 | write$ 2796 | } 2797 | { numnames #2 = 2798 | { % 2799 | % Given that format.num.names > 1, it is 2. 2800 | % 2801 | comma.between.two write$ 2802 | % 2803 | % Format second author. 2804 | % 2805 | #2 'nameptr := 2806 | field nameptr format.author.name 's := 2807 | % 2808 | % Check if 2nd author is explicit "others". 2809 | % If so, insert "et al." string. 2810 | % 2811 | s "others" = 2812 | { % 2813 | % First et al. 2814 | % Add period if required. 2815 | % 2816 | dot 2817 | { et.al.string.period } 2818 | { et.al.string } 2819 | if$ 2820 | write$ 2821 | } 2822 | { % 2823 | % First \& Second 2824 | % 2825 | and.before.last write$ 2826 | % 2827 | % Add period if required. 2828 | % 2829 | dot 2830 | { s add.period$ } 2831 | { s } 2832 | if$ 2833 | add.name.index % Add index entry when desired. 2834 | } 2835 | if$ 2836 | } 2837 | { % 2838 | % 3 or more names, 2 or more must be cited 2839 | % 2840 | % for nameptr := 2 to format.num.names - 1 do 2841 | % 2842 | #2 'nameptr := 2843 | { nameptr format.num.names < } 2844 | { % 2845 | % Put comma between consecutive authors 2846 | % 2847 | comma.between.names write$ 2848 | % 2849 | % Format and add next author 2850 | % 2851 | field nameptr format.author.name 2852 | add.name.index % Add index entry when desired. 2853 | % 2854 | % Move to next author 2855 | % 2856 | nameptr #1 + 'nameptr := 2857 | } 2858 | while$ 2859 | % 2860 | % nameptr = format.num.names 2861 | % Format this author. 2862 | % 2863 | field nameptr format.author.name 's := 2864 | % 2865 | format.num.names numnames = 2866 | { % 2867 | % This is also the last author. Add (optional) comma. 2868 | % 2869 | comma.before.last write$ 2870 | % 2871 | % Check if this author is explicit "others". 2872 | % If so, insert "et al." string. 2873 | % 2874 | s "others" = 2875 | { % 2876 | % Add period if required. 2877 | % 2878 | dot 2879 | { et.al.string.period } 2880 | { et.al.string } 2881 | if$ 2882 | write$ 2883 | } 2884 | { and.before.last write$ 2885 | % 2886 | % Add period if required. 2887 | % 2888 | dot 2889 | { s add.period$ } 2890 | { s } 2891 | if$ 2892 | add.name.index % Add index entry when desired. 2893 | } 2894 | if$ 2895 | } 2896 | { % 2897 | % This is not the last author. 2898 | % Add comma, author name, and "et al." 2899 | % 2900 | comma.between.names write$ 2901 | s 2902 | add.name.index % Add index entry when desired. 2903 | % 2904 | comma.before.last 2905 | % 2906 | % Add period if required. 2907 | % 2908 | dot 2909 | { et.al.string.period * } 2910 | { et.al.string * } 2911 | if$ 2912 | write$ 2913 | } 2914 | if$ 2915 | } 2916 | if$ 2917 | } 2918 | if$ 2919 | } 2920 | if$ 2921 | % 2922 | % End APACrefauthors environment. 2923 | "\end{APACrefauthors}%" 2924 | write$ newline$ 2925 | } 2926 | 2927 | FUNCTION {authors.reflist.apa6} 2928 | { 'field := 2929 | 'dot := 2930 | field num.names$ 'numnames := 2931 | numnames #7 > 2932 | { #7 'format.num.names := } 2933 | { numnames 'format.num.names := } 2934 | if$ 2935 | "\begin{APACrefauthors}%" 2936 | write$ newline$ 2937 | #1 'nameptr := 2938 | field nameptr format.author.name 2939 | numnames #1 = 2940 | { dot 2941 | { add.period$ } 2942 | 'skip$ 2943 | if$ 2944 | add.name.index 2945 | } 2946 | { add.name.index 2947 | numnames #2 = 2948 | { comma.between.two write$ 2949 | #2 'nameptr := 2950 | field nameptr format.author.name 's := 2951 | s "others" = 2952 | { "`others' not consistent with 6th ed. of the APA Manual" 2953 | warning$ 2954 | dot 2955 | { et.al.string.period } 2956 | { et.al.string } 2957 | if$ 2958 | write$ newline$ 2959 | } 2960 | { and.before.last write$ 2961 | dot 2962 | { s add.period$ } 2963 | { s } 2964 | if$ 2965 | add.name.index 2966 | } 2967 | if$ 2968 | } 2969 | { %% for nameptr := 2 to format.num.names - 1 do 2970 | #2 'nameptr := 2971 | { nameptr format.num.names < } 2972 | { comma.between.names write$ 2973 | field nameptr format.author.name 2974 | add.name.index 2975 | nameptr #1 + 'nameptr := 2976 | } 2977 | while$ 2978 | field numnames format.author.name 's := 2979 | format.num.names numnames = 2980 | { comma.before.last write$ 2981 | s "others" = 2982 | { "`others' not consistent with 6th ed. of the APA " 2983 | "Manual" * 2984 | warning$ 2985 | dot 2986 | { et.al.string.period } 2987 | { et.al.string } 2988 | if$ 2989 | write$ 2990 | } 2991 | { and.before.last write$ 2992 | dot 2993 | { s add.period$ } 2994 | { s } 2995 | if$ 2996 | add.name.index 2997 | } 2998 | if$ 2999 | } 3000 | { dots.before.last write$ 3001 | s 3002 | add.name.index 3003 | } 3004 | if$ 3005 | } 3006 | if$ 3007 | } 3008 | if$ 3009 | "\end{APACrefauthors}%" 3010 | write$ newline$ 3011 | } 3012 | 3013 | FUNCTION {format.author.names} 3014 | { 'field := 3015 | 'dot := 3016 | dot 3017 | { dot field authors.reflist.apa6 } 3018 | { dot field authors.editors.reflist.apa5 } 3019 | if$ 3020 | } 3021 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3022 | 3023 | FUNCTION {format.authors} 3024 | { #1 author format.author.names } 3025 | 3026 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3027 | 3028 | FUNCTION {format.editors.as.authors} 3029 | { #0 editor format.author.names 3030 | "\ " editor.postfix * add.period$ write$ newline$ 3031 | } 3032 | 3033 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3034 | 3035 | FUNCTION {format.ed.trans.as.authors} 3036 | { #0 editor format.author.names 3037 | "\ " editor.trans.postfix * add.period$ write$ newline$ 3038 | } 3039 | 3040 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3041 | 3042 | FUNCTION {format.editor.names} 3043 | { 'field := 3044 | % 3045 | field num.names$ 'numnames := % numnames is the total number of names 3046 | % contained in field 3047 | numnames 'format.num.names := % Format all authors 3048 | format.num.names name.max > % Unless this exceeds the maximum of 6. 3049 | { #1 'format.num.names := } % Then it becomes 1 (First et al.) 3050 | 'skip$ 3051 | if$ 3052 | % 3053 | % Format first editor 3054 | % 3055 | field #1 format.editor.name 3056 | % 3057 | numnames #1 = 3058 | 'skip$ 3059 | { format.num.names #1 = 3060 | { et.al.string * } % First editor et al., no comma. 3061 | { numnames #2 = 3062 | { % 3063 | % Given that format.num.names > 1, it is 2. 3064 | % No comma. Format second editor. 3065 | % 3066 | field #2 format.editor.name 's := 3067 | % 3068 | % Check if 2nd editor is explicit "others". 3069 | % If so, insert "et al." string. 3070 | % 3071 | s "others" = 3072 | { et.al.string * } % First et al. 3073 | { and.before.last * s * } % First \& Second 3074 | if$ 3075 | } 3076 | { % 3077 | % 3 or more names, 2 or more must be cited 3078 | % 3079 | % for nameptr := 2 to format.num.names - 1 do 3080 | % 3081 | #2 'nameptr := 3082 | { nameptr format.num.names < } 3083 | { % 3084 | % Put comma between consecutive editors 3085 | % 3086 | comma.between.names * 3087 | % 3088 | % Format and add next editor 3089 | % 3090 | field nameptr format.editor.name * 3091 | % 3092 | % Move to next editor 3093 | % 3094 | nameptr #1 + 'nameptr := 3095 | } 3096 | while$ 3097 | % 3098 | % nameptr = format.num.names 3099 | % Format this editor. 3100 | % 3101 | field nameptr format.editor.name 's := 3102 | % 3103 | format.num.names numnames = 3104 | { % 3105 | % This is also the last editor. Add (optional) comma. 3106 | % 3107 | comma.before.last * 3108 | % 3109 | % Check if this editor is explicit "others". 3110 | % If so, insert "et al." string. 3111 | % 3112 | s "others" = 3113 | { et.al.string * } 3114 | { and.before.last * s * } 3115 | if$ 3116 | } 3117 | { % 3118 | % This is not the last editor. 3119 | % Add comma, editor name, and "et al." 3120 | % 3121 | comma.between.names * s * 3122 | comma.before.last * et.al.string * 3123 | } 3124 | if$ 3125 | } 3126 | if$ 3127 | } 3128 | if$ 3129 | } 3130 | if$ 3131 | } 3132 | 3133 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3134 | % 3135 | % format editors in case editors do not act as authors 3136 | % (such as reference to chapter in edited book) 3137 | % 3138 | % L. W. Poon (Ed.) (1 editor) 3139 | % or 3140 | % A. S. Gurman \& D. P. Kniskern (Eds.) (2 editors) 3141 | % or 3142 | % L. Poon, A. Jones, \& D. P. Smith (Eds.) (>2 editors) 3143 | % 3144 | % editor must not be empty 3145 | % 3146 | FUNCTION {format.editors.in.line} 3147 | { editor format.editor.names 3148 | editor.postfix connect.with.space.check 3149 | } 3150 | 3151 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3152 | % 3153 | % format editors in case editors are also translators 3154 | % and do not act as authors 3155 | % (such as reference to chapter in edited book 3156 | % of translated articles) 3157 | % 3158 | % L. W. Poon (Ed. and Trans.) (1 editor) 3159 | % or 3160 | % A. S. Gurman \& D. P. Kniskern (Eds. and Trans.) (2 editors) 3161 | % or 3162 | % L. Poon, A. Jones, \& D. P. Smith (Eds. and Trans.) (>2 editors) 3163 | % 3164 | % editor must not be empty 3165 | % 3166 | FUNCTION {format.editors.trans.in.line} 3167 | { editor format.editor.names 3168 | editor.trans.postfix connect.with.space.check 3169 | } 3170 | 3171 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3172 | % 3173 | % format translators in case translators act as editors 3174 | % (such as reference to chapter in translated book) 3175 | % 3176 | % L. W. Poon (Trans.) (1 translator) 3177 | % or 3178 | % A. S. Gurman \& D. P. Kniskern (Trans.) (2 translators) 3179 | % or 3180 | % L. Poon, A. Jones, \& D. P. Smith (Trans.) (>2 translators) 3181 | % 3182 | % translator must not be empty 3183 | % 3184 | FUNCTION {format.translators.in.line} 3185 | { translator format.editor.names 3186 | trans.postfix connect.with.space.check 3187 | } 3188 | 3189 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3190 | % 3191 | % format translators in case translator does not act as editor 3192 | % (such as reference to translated book) 3193 | % 3194 | % L. Solotaroff, Trans. 3195 | % 3196 | FUNCTION {format.translators.in.paren.check} 3197 | { translator empty$ 3198 | { "" } 3199 | { translator format.editor.names 3200 | translator num.names$ #1 > 3201 | { ", \BTRANSS{}" * } 3202 | { ", \BTRANS{}" * } 3203 | if$ 3204 | } 3205 | if$ 3206 | } 3207 | 3208 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3209 | % 3210 | % format editors and translators in case neither act as editor 3211 | % (such as reference to edited or translated book with a 3212 | % a single author) 3213 | % 3214 | % L. Solotaroff, Ed. 3215 | % L. Solotaroff, Ed. \& Trans. 3216 | % L. Solotaroff, Trans. 3217 | % L. Solotaroff, Ed. \& S. Prokofieff, Trans. 3218 | % 3219 | FUNCTION {format.editors.translators.in.paren.check} 3220 | { editor empty$ 3221 | { translator empty$ 3222 | { "" } 3223 | { translator format.editor.names 3224 | translator num.names$ #1 > 3225 | { ", \BTRANSS{}" * } 3226 | { ", \BTRANS{}" * } 3227 | if$ 3228 | } 3229 | if$ 3230 | } 3231 | { editor format.editor.names 3232 | editor num.names$ #1 > 3233 | { ", \BEDS{}" * } 3234 | { ", \BED{}" * } 3235 | if$ 3236 | translator empty$ 3237 | 'skip$ 3238 | { editor translator = 3239 | { editor num.names$ #1 > 3240 | { " \BAnd{} \BTRANSS" * } 3241 | { " \BAnd{} \BTRANS" * } 3242 | if$ 3243 | } 3244 | { " \BAnd{} " * 3245 | translator format.editor.names * 3246 | translator num.names$ #1 > 3247 | { ", \BTRANSS{}" * } 3248 | { ", \BTRANS{}" * } 3249 | if$ 3250 | } 3251 | if$ 3252 | } 3253 | if$ 3254 | } 3255 | if$ 3256 | } 3257 | 3258 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3259 | % 3260 | % translator of article 3261 | % 3262 | FUNCTION {format.atrans.check} 3263 | { format.translators.in.paren.check parenthesize.check } 3264 | 3265 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3266 | % 3267 | % format "In editor (Ed.), " 3268 | % 3269 | FUNCTION {format.in.editors} 3270 | { "\BIn{} " 3271 | editor empty$ 3272 | 'skip$ 3273 | { format.editors.in.line * ", " * } 3274 | if$ 3275 | } 3276 | 3277 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3278 | % 3279 | % format "In translator (Trans.)," 3280 | % 3281 | FUNCTION {format.in.trans} 3282 | { "\BIn{} " 3283 | translator empty$ 3284 | 'skip$ 3285 | { format.translators.in.line * ", " * } 3286 | if$ 3287 | } 3288 | 3289 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3290 | % 3291 | % format "In editor (Ed. and Trans.)" 3292 | % or "In editor (Ed.)" if editor not equal to translator 3293 | % 3294 | FUNCTION {format.in.editors.trans} 3295 | { "\BIn{} " 3296 | editor empty$ 3297 | { translator empty$ 3298 | 'skip$ 3299 | { format.translators.in.line * ", " * } 3300 | if$ 3301 | } 3302 | { translator empty$ 3303 | { format.editors.in.line * } 3304 | { editor translator = 3305 | { format.editors.trans.in.line * } 3306 | { format.editors.in.line * } 3307 | if$ 3308 | } 3309 | if$ 3310 | ", " * 3311 | } 3312 | if$ 3313 | } 3314 | 3315 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3316 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3317 | 3318 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3319 | 3320 | FUNCTION {format.year.check} 3321 | { "\APACrefYear{" 3322 | protect.year * 3323 | % 3324 | % Add "a", "b", etc. when necessary. 3325 | % 3326 | make.definitive.year.supplement * 3327 | "}" * 3328 | } 3329 | 3330 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3331 | 3332 | FUNCTION {format.year.month.day.check} 3333 | { "\APACrefYearMonthDay{" 3334 | protect.year * 3335 | % 3336 | % Add "a", "b", etc. when necessary. 3337 | % 3338 | make.definitive.year.supplement * 3339 | "}{" * 3340 | % 3341 | % Add month and day when present. 3342 | % 3343 | month empty$ 3344 | 'skip$ 3345 | { month * } 3346 | if$ 3347 | "}{" * 3348 | day empty$ 3349 | 'skip$ 3350 | { day * } 3351 | if$ 3352 | "}" * 3353 | } 3354 | 3355 | FUNCTION {format.atitle.no.dot} 3356 | { "{\BBOQ}" swap$ 3357 | "{\BBCQ}" swap$ 3358 | duplicate$ empty$ 3359 | 'skip$ 3360 | { duplicate$ 3361 | % Two arguments: Title twice: (1) don't change case; (2) change case 3362 | "\APACrefatitle {" swap$ * "} {" * swap$ 3363 | "t" change.case$ 3364 | * "}" * 3365 | } 3366 | if$ 3367 | enclose.check 3368 | } 3369 | 3370 | FUNCTION {format.atitle.dot} 3371 | { "{\BBOQ}" swap$ 3372 | "{\BBCQ}" swap$ 3373 | duplicate$ empty$ 3374 | 'skip$ 3375 | { duplicate$ 3376 | % Two arguments: Title twice: (1) don't change case; (2) change case 3377 | "\APACrefatitle {" swap$ * "} {" * swap$ 3378 | "t" change.case$ 3379 | * "}" * add.period$ 3380 | } 3381 | if$ 3382 | enclose.check 3383 | } 3384 | 3385 | FUNCTION {format.atitle.connect} 3386 | { swap$ 3387 | duplicate$ empty$ 3388 | { pop$ 3389 | format.atitle.dot 3390 | } 3391 | { swap$ 3392 | format.atitle.no.dot 3393 | swap$ connect.with.space.check 3394 | add.period$ 3395 | } 3396 | if$ 3397 | } 3398 | 3399 | FUNCTION {format.btitle.no.dot} 3400 | { duplicate$ empty$ 3401 | { pop$ 3402 | "" 3403 | } 3404 | { duplicate$ 3405 | % Two arguments: Title twice: (1) don't change case; (2) change case 3406 | "\APACrefbtitle {" swap$ * "} {" * swap$ 3407 | "t" change.case$ 3408 | * "}" * 3409 | } 3410 | if$ 3411 | } 3412 | 3413 | FUNCTION {format.btitle.dot} 3414 | { duplicate$ empty$ 3415 | { pop$ 3416 | "" 3417 | } 3418 | { add.period$ format.btitle.no.dot } 3419 | if$ 3420 | } 3421 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3422 | % 3423 | % title of book and similar 3424 | % field must be on top of stack 3425 | % second element on stack must be connected: 3426 | % if that is empty, then btitle.dot 3427 | % else btitle.no.dot, connect, and add period 3428 | % 3429 | FUNCTION {format.btitle.connect} 3430 | { swap$ 3431 | duplicate$ empty$ 3432 | { pop$ 3433 | format.btitle.dot 3434 | } 3435 | { swap$ 3436 | format.btitle.no.dot 3437 | swap$ connect.with.space.check 3438 | add.period$ 3439 | } 3440 | if$ 3441 | } 3442 | 3443 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3444 | % 3445 | % title of book and similar 3446 | % field must be on top of stack 3447 | % second element on stack must be connected 3448 | % 3449 | FUNCTION {format.btitle.connect.no.dot} 3450 | { swap$ 3451 | duplicate$ empty$ 3452 | { pop$ 3453 | format.btitle.no.dot 3454 | } 3455 | { swap$ 3456 | format.btitle.no.dot 3457 | swap$ connect.with.space.check 3458 | } 3459 | if$ 3460 | } 3461 | 3462 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3463 | % 3464 | % format englishtitle (of nonenglish article, etc.) 3465 | % 3466 | FUNCTION {format.aetitle.check} 3467 | { englishtitle empty$ 3468 | { "" } 3469 | { % Two arguments: Title twice: (1) don't change case; (2) change case 3470 | "\APACrefaetitle {" englishtitle * "} {" * 3471 | englishtitle "t" change.case$ * "}" * 3472 | } 3473 | if$ 3474 | } 3475 | 3476 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3477 | % 3478 | % format englishtitle (of nonenglish book, etc.) 3479 | % 3480 | FUNCTION {format.betitle.check} 3481 | { englishtitle empty$ 3482 | { "" } 3483 | { % Two arguments: Title twice: (1) don't change case; (2) change case 3484 | "\APACrefbetitle {" englishtitle * "} {" * 3485 | englishtitle "t" change.case$ * "}" * 3486 | } 3487 | if$ 3488 | } 3489 | 3490 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3491 | % 3492 | % format type (of article, etc.) 3493 | % 3494 | FUNCTION {format.atype.check} 3495 | { type bracket.check } 3496 | 3497 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3498 | % 3499 | % format title and englishtitle (of article, etc.) 3500 | % 3501 | FUNCTION {format.atitle.check} 3502 | { format.aetitle.check 3503 | title format.atitle.connect 3504 | } 3505 | 3506 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3507 | % 3508 | % format title, englishtitle, and type 3509 | % (of article, etc.) 3510 | % 3511 | FUNCTION {format.atitle.type.check} 3512 | { format.aetitle.check 3513 | format.atype.check connect.with.space.check 3514 | title format.atitle.connect 3515 | } 3516 | 3517 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3518 | % 3519 | % format title, englishtitle, 3520 | % and translator (of article, etc.) 3521 | % 3522 | FUNCTION {format.atitle.trans.check} 3523 | { format.aetitle.check 3524 | format.atrans.check connect.with.space.check 3525 | title format.atitle.connect 3526 | } 3527 | 3528 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3529 | % 3530 | % format title, englishtitle, type, 3531 | % and translator (of article, etc.) 3532 | % 3533 | FUNCTION {format.atitle.type.trans.check} 3534 | { format.aetitle.check 3535 | format.atype.check connect.with.space.check 3536 | format.atrans.check connect.with.space.check 3537 | title format.atitle.connect 3538 | } 3539 | 3540 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3541 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3542 | 3543 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3544 | % 3545 | % format journal, volume, number and pages 3546 | % call with 3547 | % formatted.pages format.journal.vol.num.pages.check 3548 | % 3549 | FUNCTION { format.journal.vol.num.pages.check } 3550 | { "journal" journal warning.if.empty 3551 | duplicate$ empty$ 3552 | journal empty$ and 3553 | volume empty$ and 3554 | number empty$ and 3555 | { pop$ "" } 3556 | { "\APACjournalVolNumPages{" journal "" connect.check 3557 | "}{" * volume "" connect.check 3558 | "}{" * number "" connect.check 3559 | "}{" * swap$ "" connect.check 3560 | "}" * 3561 | } 3562 | if$ 3563 | } 3564 | 3565 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3566 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3567 | 3568 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3569 | % 3570 | % volume of book, checks whether 3571 | % "Volume" or "Volumes" 3572 | % 3573 | % call with 3574 | % field format.bvolume.check 3575 | % 3576 | FUNCTION {format.bvolume.check} 3577 | { duplicate$ empty$ 3578 | 'skip$ 3579 | { duplicate$ multi.result.check 3580 | { "\BVOLS" swap$ tie.or.space.connect } 3581 | { "\BVOL" swap$ tie.or.space.connect } 3582 | if$ 3583 | } 3584 | if$ 3585 | } 3586 | 3587 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3588 | % 3589 | % edition of book, must not be empty 3590 | % call with 3591 | % field format.edition.check 3592 | % 3593 | FUNCTION {format.edition.check} 3594 | { duplicate$ empty$ 3595 | 'skip$ 3596 | { "\PrintOrdinal{" swap$ * "}" * 3597 | "\BEd" connect.with.space.check 3598 | } 3599 | if$ 3600 | } 3601 | 3602 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3603 | % 3604 | % volume and edition of book 3605 | % 3606 | FUNCTION {format.bvol.edition.check} 3607 | { edition format.edition.check 3608 | volume format.bvolume.check 3609 | connect.with.comma.check 3610 | } 3611 | 3612 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3613 | % 3614 | % volume and edition of book 3615 | % 3616 | FUNCTION {format.bvol.edition} 3617 | { format.bvol.edition.check 3618 | parenthesize.check 3619 | } 3620 | 3621 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3622 | % 3623 | % volume and edition and translator of translated book 3624 | % 3625 | FUNCTION {format.bvol.edition.trans} 3626 | { format.bvol.edition.check 3627 | format.translators.in.paren.check connect.with.semicolon.check 3628 | parenthesize.check 3629 | } 3630 | 3631 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3632 | % 3633 | % volume, edition, editor, and translator of (translated) book 3634 | % 3635 | FUNCTION {format.bvol.edition.editor.trans} 3636 | { format.bvol.edition.check 3637 | format.editors.translators.in.paren.check connect.with.semicolon.check 3638 | parenthesize.check 3639 | } 3640 | 3641 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3642 | % 3643 | % formats pages by first checking if 1 or more pages 3644 | % and prefixing pages with "p." or "pp." (these strings 3645 | % are given in the commands \BPG and \BPGS, respectively), 3646 | % whichever is applicable, and do a tie or space connect 3647 | % 3648 | % call with 3649 | % field format.bpages.check 3650 | % 3651 | FUNCTION {format.bpages.check} 3652 | { duplicate$ empty$ 3653 | 'skip$ 3654 | { duplicate$ multi.result.check 3655 | { "\BPGS" swap$ tie.or.space.connect } 3656 | { "\BPG~" swap$ * } 3657 | if$ 3658 | } 3659 | if$ 3660 | } 3661 | 3662 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3663 | % 3664 | % formats chapters by first checking if 1 or more chapters 3665 | % and prefixing pages with "chap." (this string 3666 | % is given in the commands \BCHAP and \BCHAPS, respectively), 3667 | % whichever is applicable, and do a tie or space connect 3668 | % 3669 | % call with 3670 | % field format.bchapter.check 3671 | % 3672 | FUNCTION {format.bchapter.check} 3673 | { duplicate$ empty$ 3674 | 'skip$ 3675 | { duplicate$ multi.result.check 3676 | { "\BCHAPS" swap$ tie.or.space.connect } 3677 | { "\BCHAP" swap$ tie.or.space.connect } 3678 | if$ 3679 | } 3680 | if$ 3681 | } 3682 | 3683 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3684 | % 3685 | % volume, edition, and pages or chapter of article in book etc. 3686 | % 3687 | FUNCTION {format.bvol.edition.pages} 3688 | { format.bvol.edition.check 3689 | pages empty$ 3690 | { chapter format.bchapter.check connect.with.comma.check } 3691 | { pages format.bpages.check connect.with.comma.check } 3692 | if$ 3693 | parenthesize.check 3694 | } 3695 | 3696 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3697 | % 3698 | % title, volume, edition of book 3699 | % 3700 | FUNCTION {format.btitle.vol.edition} 3701 | { format.betitle.check 3702 | format.bvol.edition connect.with.space.check 3703 | title format.btitle.connect.no.dot 3704 | } 3705 | 3706 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3707 | % 3708 | % title, volume, edition, and translator of book 3709 | % 3710 | FUNCTION {format.btitle.vol.edition.trans} 3711 | { format.betitle.check 3712 | format.bvol.edition.trans connect.with.space.check 3713 | title format.btitle.connect.no.dot 3714 | } 3715 | 3716 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3717 | % 3718 | % title, volume, edition, editor, and translator of book 3719 | % 3720 | FUNCTION {format.btitle.vol.edition.editor.trans} 3721 | { format.betitle.check 3722 | format.bvol.edition.editor.trans connect.with.space.check 3723 | title format.btitle.connect.no.dot 3724 | } 3725 | 3726 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3727 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3728 | 3729 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3730 | % 3731 | % format address and publisher of book etc. 3732 | % 3733 | % New York: Wiley 3734 | % or 3735 | % Wiley (if address empty) 3736 | % or 3737 | % New York (if publisher empty) 3738 | % 3739 | FUNCTION {format.address.publisher} 3740 | { % 3741 | % If publisher = author or publisher = "author" or publisher = "Author" 3742 | % then hand over the final choice how to format this to \LaTeX. 3743 | % (I could imagine similar code for editors, but the APA manual does 3744 | % not mention it and then we'd have to check whether the editor is in 3745 | % the author position, so let's keep it simple until someone complains.) 3746 | % 3747 | author empty$ 3748 | publisher empty$ or 3749 | { publisher "\APACaddressPublisher{" } 3750 | { author publisher = 3751 | "author" publisher = or 3752 | "Author" publisher = or 3753 | { author "\APACaddressPublisherEqAuth{" } 3754 | { publisher "\APACaddressPublisher{" } 3755 | if$ 3756 | } 3757 | if$ 3758 | address "" connect.check "}{" * 3759 | % Recover publisher that was pushed onto the stack previously. 3760 | swap$ "" connect.check "}" * 3761 | } 3762 | 3763 | FUNCTION {format.address.publisher.check} 3764 | { publisher empty$ 3765 | address empty$ 3766 | and 3767 | 'skip$ 3768 | { 3769 | duplicate$ empty$ 3770 | 'skip$ 3771 | { output.new.block } 3772 | if$ 3773 | format.address.publisher 3774 | } 3775 | if$ 3776 | } 3777 | 3778 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3779 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3780 | 3781 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3782 | % 3783 | % format number as in reports: No. 2017 3784 | % call with 3785 | % field format.rnumber.check 3786 | % 3787 | FUNCTION {format.rnumber.check} 3788 | { duplicate$ empty$ 3789 | 'skip$ 3790 | { duplicate$ multi.result.check 3791 | { "\BNUMS" swap$ tie.or.space.connect } 3792 | { "\BNUM" swap$ tie.or.space.connect } 3793 | if$ 3794 | } 3795 | if$ 3796 | } 3797 | 3798 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3799 | % 3800 | % format type and number of a standalone item 3801 | % call with 3802 | % format.type.number 3803 | % 3804 | FUNCTION { format.type.number } 3805 | { type empty$ 3806 | { type.2 } 3807 | { type } 3808 | if$ 3809 | number empty$ 3810 | { bracket.check } 3811 | { number format.rnumber.check connect.with.space.check 3812 | parenthesize.check 3813 | } 3814 | if$ 3815 | } 3816 | 3817 | FUNCTION {format.howpublished} 3818 | { howpublished empty$ 3819 | 'skip$ 3820 | { % clear the stack 3821 | duplicate$ empty$ 3822 | 'pop$ 3823 | { output.dot.new.block } 3824 | if$ 3825 | "\APAChowpublished {" howpublished * "}" * 3826 | } 3827 | if$ 3828 | } 3829 | FUNCTION {output.howpublished} 3830 | { howpublished empty$ 3831 | 'skip$ 3832 | { "\APAChowpublished {" howpublished * "}" * 3833 | output.dot.new.block 3834 | } 3835 | if$ 3836 | } 3837 | FUNCTION {howpublished.block} 3838 | { howpublished empty$ 3839 | 'skip$ 3840 | { start.new.block 3841 | "\APAChowpublished {" howpublished * "}" * 3842 | output.dot.end.block 3843 | } 3844 | if$ 3845 | } 3846 | FUNCTION {begin.end.url.env} 3847 | { "\begin{APACrefURL} " 3848 | lastchecked empty$ 3849 | { urldate empty$ 3850 | 'skip$ 3851 | { "[{" * urldate * "}]" * } 3852 | if$ 3853 | } 3854 | { "[{" * lastchecked * "}]" * } 3855 | if$ 3856 | " \end{APACrefURL} " 3857 | } 3858 | 3859 | FUNCTION {begin.end.doi.env} 3860 | { "\begin{APACrefDOI} " 3861 | " \end{APACrefDOI} " 3862 | } 3863 | 3864 | FUNCTION {begin.end.msg.env} 3865 | { "\begin{APACrefURLmsg} " 3866 | " \end{APACrefURLmsg} " 3867 | } 3868 | FUNCTION {format.url} 3869 | { type.2 empty$ 3870 | { begin.end.url.env } 3871 | { type.2 "\bibmessage" = 3872 | { begin.end.msg.env } 3873 | { begin.end.url.env } 3874 | if$ 3875 | } 3876 | if$ 3877 | "\url{" url * "}" * 3878 | enclose.check 3879 | } 3880 | FUNCTION {url.block} 3881 | { doi empty$ 3882 | { url empty$ 3883 | 'skip$ 3884 | { start.new.block 3885 | format.url 3886 | output.end.block 3887 | } 3888 | if$ 3889 | } 3890 | 'skip$ 3891 | if$ 3892 | } 3893 | FUNCTION {format.doi} 3894 | { begin.end.doi.env 3895 | "\doi{" doi * "}" * 3896 | enclose.check 3897 | } 3898 | FUNCTION {doi.block} 3899 | { doi empty$ 3900 | 'skip$ 3901 | { start.new.block 3902 | format.doi 3903 | output.end.block 3904 | } 3905 | if$ 3906 | } 3907 | FUNCTION {format.note} 3908 | { "\APACrefnote{" "}" note enclose.check } 3909 | FUNCTION {note.block} 3910 | { note empty$ 3911 | 'skip$ 3912 | { start.new.block 3913 | format.note 3914 | output.end.block 3915 | } 3916 | if$ 3917 | } 3918 | 3919 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3920 | % 3921 | % format original year of publication and note 3922 | % (reprint or translation) 3923 | % 3924 | FUNCTION {format.orig.year.note} 3925 | { originalyear empty$ 3926 | { format.note } 3927 | { "\APACorigyearnote{" 3928 | originalyear "" connect.check "}{" * 3929 | note "" connect.check "}" * 3930 | } 3931 | if$ 3932 | } 3933 | 3934 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3935 | % 3936 | % format original journal of publication and note 3937 | % (reprint or translation) 3938 | % 3939 | FUNCTION {format.orig.journal.note} 3940 | { "\APACorigjournalnote{" 3941 | originalyear "" connect.check "}{" * 3942 | originaljournal "" connect.check "}{" * 3943 | originalvolume "" connect.check "}{" * 3944 | originalnumber "" connect.check "}{" * 3945 | originalpages "" connect.check "}{" * 3946 | note "" connect.check "}" * 3947 | } 3948 | 3949 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3950 | % 3951 | % format original book of publication and note 3952 | % (reprint or translation) 3953 | % 3954 | FUNCTION {format.orig.book.note} 3955 | { "\APACorigbooknote{" originalyear "" connect.check "}{" * 3956 | % 3957 | originaleditor empty$ 3958 | 'skip$ 3959 | { originaleditor num.names$ #1 > 3960 | { "\APACorigEDS {" * originaleditor format.editor.names * "}" * } 3961 | { "\APACorigED {" * originaleditor format.editor.names * "}" * } 3962 | if$ 3963 | } 3964 | if$ 3965 | % 3966 | "}{" * 3967 | originalbooktitle format.btitle.no.dot "" connect.check "} {" * 3968 | originaledition format.edition.check "" connect.check "} {" * 3969 | originalvolume format.bvolume.check "" connect.check "} {" * 3970 | originalpages format.bpages.check "" connect.check "} {" * 3971 | originaladdress "" connect.check "} {" * 3972 | originalpublisher "" connect.check "} {" * 3973 | note "" connect.check "}" * 3974 | } 3975 | 3976 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3977 | % 3978 | % format information about original publication of reprint 3979 | % and format optional note 3980 | % 3981 | FUNCTION {format.orig.note} 3982 | { originaljournal empty$ 3983 | { originalbooktitle empty$ 3984 | { note empty$ 3985 | { originalyear empty$ 3986 | 'skip$ 3987 | { originalyear "\bibnodate" = 3988 | originalyear "l" change.case$ "no date" = or 3989 | originalyear "l" change.case$ "n.d." = or 3990 | 'skip$ 3991 | { output.new.block 3992 | format.orig.year.note 3993 | } 3994 | if$ 3995 | } 3996 | if$ 3997 | } 3998 | { output.new.block 3999 | format.orig.year.note 4000 | } 4001 | if$ 4002 | } 4003 | { output.new.block 4004 | format.orig.book.note 4005 | } 4006 | if$ 4007 | } 4008 | { output.new.block 4009 | format.orig.journal.note 4010 | } 4011 | if$ 4012 | } 4013 | FUNCTION {fin.entry} 4014 | { doi empty$ 4015 | 'skip$ 4016 | { output.new.block 4017 | format.doi 4018 | } 4019 | if$ 4020 | output.end.block 4021 | "\PrintBackRefs{\CurrentBib}" write$ newline$ 4022 | test 4023 | { "\vspace{\baselineskip}" write$ newline$ } 4024 | 'skip$ 4025 | if$ 4026 | % 4027 | % According to TLC2, pp. 810-811, both annote and annotate fields are 4028 | % known, so support them both, but do not print them both, in case 4029 | % someone wants to make a file that is compatible with both the annotate 4030 | % and annotation styles and thus duplicates the information. Instead, we 4031 | % give annote priority. 4032 | % 4033 | annote empty$ 4034 | {% Try annotate 4035 | annotate empty$ 4036 | 'skip$ 4037 | { % add annotation 4038 | "\begin{APACrefannotation}" write$ newline$ 4039 | annotate write$ newline$ 4040 | "\end{APACrefannotation}" write$ newline$ 4041 | } 4042 | if$ 4043 | } 4044 | { % add annotation 4045 | "\begin{APACrefannotation}" write$ newline$ 4046 | annote write$ newline$ 4047 | "\end{APACrefannotation}" write$ newline$ 4048 | } 4049 | if$ 4050 | } 4051 | FUNCTION {fin.entry.2} 4052 | { doi.block 4053 | "\PrintBackRefs{\CurrentBib}" write$ newline$ 4054 | test 4055 | { "\vspace{\baselineskip}" write$ newline$ } 4056 | 'skip$ 4057 | if$ 4058 | annote empty$ 4059 | {% Try annotate 4060 | annotate empty$ 4061 | 'skip$ 4062 | { % add annotation 4063 | "\begin{APACrefannotation}" write$ newline$ 4064 | annotate write$ newline$ 4065 | "\end{APACrefannotation}" write$ newline$ 4066 | } 4067 | if$ 4068 | } 4069 | { % add annotation 4070 | "\begin{APACrefannotation}" write$ newline$ 4071 | annote write$ newline$ 4072 | "\end{APACrefannotation}" write$ newline$ 4073 | } 4074 | if$ 4075 | } 4076 | FUNCTION {periodical} 4077 | { 4078 | author empty$ 4079 | % 4080 | % no author: possibly special issue with editors as authors 4081 | % (APA manual, ex. 11, p. 121) 4082 | % 4083 | { editor empty$ 4084 | % 4085 | % no author or editor: title serves as author. 4086 | % title formatted as article title (APA manual not consistent in this, 4087 | % compare statement on p. 119: ``treat as book title'' and 4088 | % example 8, p. 121: no underlining => article title) 4089 | % 4090 | { format.atitle.type.trans.check output.new.block 4091 | % 4092 | % now formatted date on top of stack 4093 | % 4094 | output.dot.new.block 4095 | } 4096 | % 4097 | % format editor and year, and check if year is present 4098 | % format article title and check if title or type present 4099 | % 4100 | { format.editors.as.authors start.new.block 4101 | % 4102 | % now formatted date on top of stack 4103 | % 4104 | output.dot.new.block 4105 | format.atitle.type.trans.check output.new.block 4106 | } 4107 | if$ 4108 | } 4109 | % 4110 | % format author and year, and check if year is present 4111 | % format article title and check if title or type present 4112 | % 4113 | { format.authors start.new.block 4114 | % 4115 | % now formatted date on top of stack 4116 | % 4117 | output.dot.new.block 4118 | format.atitle.type.trans.check output.new.block 4119 | } 4120 | if$ 4121 | % 4122 | % format journal name, volume and issue number, and pages 4123 | % and check if journal not empty 4124 | % 4125 | format.journal.vol.num.pages.check 4126 | % 4127 | % if not empty, insert howpublished. 4128 | % (used if article is retrieved from the internet) 4129 | % 4130 | format.howpublished add.period$ 4131 | % 4132 | % format url 4133 | % 4134 | url empty$ 4135 | 'skip$ 4136 | { % Clear the stack 4137 | duplicate$ empty$ 4138 | 'skip$ 4139 | { output.new.block } 4140 | if$ 4141 | format.url 4142 | } 4143 | if$ 4144 | % 4145 | % possible reprint and optional note 4146 | % 4147 | format.orig.note 4148 | fin.entry 4149 | } 4150 | 4151 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4152 | % 4153 | % journal article 4154 | % 4155 | FUNCTION {article} 4156 | { pages format.year.month.day.check periodical } 4157 | 4158 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4159 | % 4160 | % magazine article 4161 | % 4162 | FUNCTION {magazine} 4163 | { pages format.year.month.day.check periodical } 4164 | 4165 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4166 | % 4167 | % newspaper article 4168 | % 4169 | FUNCTION {newspaper} 4170 | { pages format.bpages.check format.year.month.day.check periodical } 4171 | 4172 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4173 | % 4174 | % (translation of) entire book 4175 | % 4176 | FUNCTION {book} 4177 | { % 4178 | % author or editor, 4179 | % year, title, englishtitle, translator 4180 | % 4181 | author empty$ 4182 | % 4183 | % no author: possibly edited book with editors as authors 4184 | % 4185 | { editor empty$ 4186 | % 4187 | % no author or editor: title serves as author. 4188 | % title formatted as book title 4189 | % 4190 | { format.btitle.vol.edition.trans 4191 | format.type.number connect.with.space.check 4192 | output.dot.new.block 4193 | format.year.check add.period$ 4194 | } 4195 | % 4196 | % format editor and year, and check if year is present 4197 | % format booktitle, volume, and edition and check if title present 4198 | % 4199 | { translator empty$ 4200 | { format.editors.as.authors start.new.block 4201 | format.year.check output.dot.new.block 4202 | format.btitle.vol.edition 4203 | } 4204 | % 4205 | % format translator correctly 4206 | % 4207 | { translator editor = 4208 | not 4209 | { format.editors.as.authors start.new.block 4210 | format.year.check output.dot.new.block 4211 | format.btitle.vol.edition.trans 4212 | } 4213 | { format.ed.trans.as.authors start.new.block 4214 | format.year.check output.dot.new.block 4215 | format.btitle.vol.edition 4216 | } 4217 | if$ 4218 | } 4219 | if$ 4220 | format.type.number connect.with.space.check 4221 | add.period$ 4222 | } 4223 | if$ 4224 | } 4225 | % 4226 | % format author and year, and check if year is present 4227 | % format booktitle, volume, and edition and check if title present 4228 | % 4229 | { format.authors start.new.block 4230 | format.year.check output.dot.new.block 4231 | format.btitle.vol.edition.editor.trans 4232 | format.type.number connect.with.space.check 4233 | add.period$ 4234 | } 4235 | if$ 4236 | % 4237 | % format address and publisher 4238 | % 4239 | format.address.publisher.check 4240 | % 4241 | % if not empty, insert howpublished. 4242 | % (used if book is retrieved from the internet) 4243 | % 4244 | format.howpublished add.period$ 4245 | % 4246 | % format url 4247 | % 4248 | url empty$ 4249 | 'skip$ 4250 | { % Clear the stack 4251 | duplicate$ empty$ 4252 | 'skip$ 4253 | { output.new.block } 4254 | if$ 4255 | format.url 4256 | } 4257 | if$ 4258 | % 4259 | % format original publication (of reprint/translation) 4260 | % and optional note 4261 | % 4262 | format.orig.note 4263 | fin.entry 4264 | } 4265 | FUNCTION {incollection} 4266 | { author empty$ 4267 | { editor.ne.trans 4268 | { format.atitle.type.trans.check } 4269 | { format.atitle.type.check } 4270 | if$ 4271 | output.new.block 4272 | format.year.month.day.check add.period$ 4273 | } 4274 | { format.authors start.new.block 4275 | format.year.month.day.check output.dot.new.block 4276 | editor.ne.trans 4277 | { format.atitle.type.trans.check } 4278 | { format.atitle.type.check } 4279 | if$ 4280 | } 4281 | if$ 4282 | editor empty$ 4283 | translator empty$ and 4284 | edition empty$ and 4285 | volume empty$ and 4286 | pages empty$ and 4287 | chapter empty$ and 4288 | booktitle empty$ and 4289 | 'skip$ 4290 | { 4291 | output.new.block 4292 | format.in.editors.trans 4293 | format.bvol.edition.pages 4294 | booktitle format.btitle.connect * add.period$ 4295 | } 4296 | if$ 4297 | format.address.publisher.check 4298 | format.howpublished add.period$ 4299 | url empty$ 4300 | 'skip$ 4301 | { 4302 | duplicate$ empty$ 4303 | 'skip$ 4304 | { output.new.block } 4305 | if$ 4306 | format.url 4307 | } 4308 | if$ 4309 | format.orig.note 4310 | fin.entry 4311 | } 4312 | 4313 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4314 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4315 | 4316 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4317 | % 4318 | % technical report number 4319 | % 4320 | FUNCTION {format.tr.number} 4321 | { type empty$ 4322 | { "\BTR{}" } 4323 | { type "\bibnotype" = 4324 | { "" } 4325 | { type } 4326 | if$ 4327 | } 4328 | if$ 4329 | number format.rnumber.check connect.with.space.check 4330 | } 4331 | 4332 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4333 | % 4334 | % title, volume, edition, report number 4335 | % 4336 | FUNCTION {format.tr.title.number} 4337 | { format.betitle.check 4338 | % Single out the situation in which there is no number 4339 | % and type = {\bibnotype}, i.e., no type as well. 4340 | % (Why not use book then?) 4341 | type empty$ 4342 | { % Now, we're in the regular situation with at least a 4343 | % number, a type, a volume, or an edition. 4344 | "\APACbVolEdTR{" format.bvol.edition.check * "}{" * 4345 | format.tr.number * "}" * 4346 | } 4347 | { type "\bibnotype" = 4348 | number empty$ 4349 | volume empty$ 4350 | edition empty$ 4351 | and 4352 | and 4353 | and 4354 | { "" } 4355 | { % Now, we're in the regular situation with at least a 4356 | % number, a type, a volume, or an edition. 4357 | "\APACbVolEdTR {" format.bvol.edition.check * "}{" * 4358 | format.tr.number * "}" * 4359 | } 4360 | if$ 4361 | } 4362 | if$ 4363 | connect.with.space.check 4364 | title format.btitle.connect 4365 | } 4366 | 4367 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4368 | % 4369 | % format address and institution of reports etc. 4370 | % 4371 | % Washington, DC: National Institute of Education 4372 | % or 4373 | % National Institute of Education (if address empty) 4374 | % 4375 | % warning if no institution 4376 | % 4377 | FUNCTION {format.address.institution.check} 4378 | { url empty$ 4379 | doi empty$ and 4380 | { "institution" institution warning.if.empty 4381 | "address" address warning.if.empty 4382 | } 4383 | 'skip$ 4384 | if$ 4385 | institution empty$ 4386 | address empty$ 4387 | and 4388 | 'skip$ 4389 | { % Clear the stack 4390 | duplicate$ empty$ 4391 | 'skip$ 4392 | { output.new.block } 4393 | if$ 4394 | % 4395 | % If institution = author or institution = "author" 4396 | % or institution = "Author" then hand over the final choice how to 4397 | % format this to \LaTeX. See also format.address.publisher 4398 | % 4399 | author empty$ 4400 | institution empty$ or 4401 | { institution "\APACaddressInstitution{" } 4402 | { author institution = 4403 | "author" institution = or 4404 | "Author" institution = or 4405 | { author "\APACaddressInstitutionEqAuth{" } 4406 | { institution "\APACaddressInstitution{" } 4407 | if$ 4408 | } 4409 | if$ 4410 | address "" connect.check "}{" * 4411 | % Recover institution that was pushed onto the stack previously. 4412 | swap$ "" connect.check "}" * 4413 | } 4414 | if$ 4415 | } 4416 | 4417 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4418 | % 4419 | % reports 4420 | % 4421 | FUNCTION {techreport} 4422 | { author empty$ 4423 | % 4424 | % no author: possibly edited report with editors as authors 4425 | % 4426 | { editor empty$ 4427 | % 4428 | % no author or editor: title serves as author. 4429 | % title formatted as book title 4430 | % 4431 | { format.tr.title.number output.dot.new.block 4432 | format.year.month.day.check add.period$ 4433 | } 4434 | % 4435 | % format editor and year, and check if year is present 4436 | % format report title and check if title present 4437 | % format volume, edition, type, and number 4438 | % 4439 | { format.editors.as.authors start.new.block 4440 | format.year.month.day.check output.dot.new.block 4441 | format.tr.title.number add.period$ 4442 | } 4443 | if$ 4444 | } 4445 | % 4446 | % format author and year, and check if year is present 4447 | % format report title and check if title present 4448 | % format volume, edition, type, and number 4449 | % 4450 | { format.authors start.new.block 4451 | format.year.month.day.check output.dot.new.block 4452 | format.tr.title.number add.period$ 4453 | } 4454 | if$ 4455 | % 4456 | % format address and institution, check if institution present 4457 | % 4458 | format.address.institution.check 4459 | % 4460 | % if not empty, insert howpublished. 4461 | % (used if report is retrieved from the internet) 4462 | % 4463 | format.howpublished add.period$ 4464 | % 4465 | % format url 4466 | % 4467 | url empty$ 4468 | 'skip$ 4469 | { % Clear the stack 4470 | duplicate$ empty$ 4471 | 'skip$ 4472 | { output.new.block } 4473 | if$ 4474 | format.url 4475 | } 4476 | if$ 4477 | % 4478 | % format optional note 4479 | % 4480 | note empty$ 4481 | 'skip$ 4482 | { % Clear the stack 4483 | duplicate$ empty$ 4484 | 'skip$ 4485 | { output.new.block } 4486 | if$ 4487 | format.note 4488 | } 4489 | if$ 4490 | fin.entry 4491 | } 4492 | 4493 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4494 | % 4495 | % (translated) article or chapter in report 4496 | % 4497 | FUNCTION {intechreport} 4498 | { author empty$ 4499 | % 4500 | % no author: title serves as author. 4501 | % title formatted as article title (APA manual not consistent in this, 4502 | % compare statement on p. 119: ``treat as book title'' and 4503 | % example 8, p. 121: no underlining => article title) 4504 | % 4505 | { editor.ne.trans 4506 | { format.atitle.trans.check } 4507 | { format.atitle.check } 4508 | if$ 4509 | output.new.block 4510 | format.year.month.day.check output.dot.new.block 4511 | } 4512 | % 4513 | % format author and year, and check if year is present 4514 | % format article title and check if title or type present 4515 | % 4516 | { format.authors start.new.block 4517 | format.year.month.day.check output.dot.new.block 4518 | editor.ne.trans 4519 | { format.atitle.trans.check } 4520 | { format.atitle.check } 4521 | if$ 4522 | output.new.block 4523 | } 4524 | if$ 4525 | % 4526 | % format "In " editor " (Ed. \& Trans.), " 4527 | % booktitle, volume, edition, pages 4528 | % 4529 | format.in.editors.trans 4530 | % 4531 | % volume, edition, report type and number, pages 4532 | % 4533 | "\APACbVolEdTRpgs {" format.bvol.edition.check * "} {" * 4534 | format.tr.number * 4535 | "} {" * pages format.bpages.check * 4536 | "}" * 4537 | % 4538 | booktitle format.btitle.connect * 4539 | add.period$ 4540 | % 4541 | % format address and publisher 4542 | % 4543 | format.address.institution.check 4544 | % 4545 | % if not empty, insert howpublished. 4546 | % (used if report is retrieved from the internet) 4547 | % 4548 | format.howpublished add.period$ 4549 | % 4550 | % format url 4551 | % 4552 | url empty$ 4553 | 'skip$ 4554 | { % Clear the stack 4555 | duplicate$ empty$ 4556 | 'skip$ 4557 | { output.new.block } 4558 | if$ 4559 | format.url 4560 | } 4561 | if$ 4562 | % 4563 | % format original publication (of reprint/translation) 4564 | % and optional note 4565 | % 4566 | format.orig.note 4567 | fin.entry 4568 | } 4569 | 4570 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4571 | % 4572 | % papers presented at conferences etc. 4573 | % 4574 | FUNCTION {lecture} 4575 | { author empty$ 4576 | { "author" author warning.if.empty } 4577 | { format.authors start.new.block } 4578 | if$ 4579 | % 4580 | % format year, month, and day, and check if year present 4581 | % format title and check if title present 4582 | % format howpublished and check if howpublished present 4583 | % 4584 | format.year.month.day.check output.dot.new.block 4585 | symposium empty$ 4586 | { format.betitle.check 4587 | title format.btitle.connect output.new.block 4588 | howpublished empty$ 4589 | { "symposium and howpublished missing in " cite$ * warning$ 4590 | "" 4591 | } 4592 | { "\APAChowpublished {" howpublished * "}" * } 4593 | if$ 4594 | address connect.with.comma.check 4595 | } 4596 | { format.atitle.type.check output.new.block 4597 | "\BIn{} " 4598 | chair empty$ 4599 | 'skip$ 4600 | { chair format.editor.names 4601 | chair num.names$ #1 > 4602 | { "(\BCHAIRS)" } 4603 | { "(\BCHAIR)" } 4604 | if$ 4605 | connect.with.space.check * ", " * 4606 | } 4607 | if$ 4608 | symposium format.btitle.no.dot * 4609 | format.howpublished 4610 | address connect.with.comma.check 4611 | } 4612 | if$ 4613 | add.period$ 4614 | % 4615 | % format url 4616 | % 4617 | url empty$ 4618 | 'skip$ 4619 | { % Clear the stack 4620 | duplicate$ empty$ 4621 | 'skip$ 4622 | { output.new.block } 4623 | if$ 4624 | format.url 4625 | } 4626 | if$ 4627 | % 4628 | % format optional note 4629 | % 4630 | note empty$ 4631 | 'skip$ 4632 | { % Clear the stack 4633 | duplicate$ empty$ 4634 | 'skip$ 4635 | { output.new.block } 4636 | if$ 4637 | format.note 4638 | } 4639 | if$ 4640 | fin.entry 4641 | } 4642 | 4643 | FUNCTION {format.ttitle.type.school} 4644 | { doi empty$ not 4645 | url empty$ not or 4646 | howpublished empty$ not or 4647 | { pop$ } 4648 | { swap$ pop$ } 4649 | if$ 4650 | type empty$ 4651 | 'skip$ 4652 | { type "\bibnotype" = 4653 | { pop$ 4654 | "" 4655 | } 4656 | { pop$ 4657 | type 4658 | } 4659 | if$ 4660 | } 4661 | if$ 4662 | duplicate$ empty$ 4663 | doi empty$ 4664 | url empty$ and 4665 | howpublished empty$ and 4666 | address empty$ 4667 | school empty$ and or and 4668 | { 'pop$ 4669 | title empty$ not 4670 | englishtitle empty$ not or 4671 | { start.new.block } 4672 | 'skip$ 4673 | if$ 4674 | "" 4675 | } 4676 | { start.new.block 4677 | "\APACtypeAddressSchool {" swap$ * "}{" * 4678 | doi empty$ 4679 | url empty$ and 4680 | howpublished empty$ and 4681 | { "}{}" * } 4682 | { address "" connect.check "}{" * 4683 | school "" connect.check "}" * 4684 | } 4685 | if$ 4686 | } 4687 | if$ 4688 | format.betitle.check swap$ 4689 | connect.with.space.check 4690 | "title" title warning.if.empty 4691 | title format.btitle.connect 4692 | } 4693 | FUNCTION {unpub.address.school.block} 4694 | { doi empty$ 4695 | url empty$ and 4696 | howpublished empty$ and 4697 | { "school" school warning.if.empty 4698 | school empty$ 4699 | address empty$ and 4700 | 'skip$ 4701 | { start.new.block 4702 | "\APACaddressSchool {" address "" connect.check "}{" * 4703 | school "" connect.check "}" * 4704 | output.dot.end.block 4705 | } 4706 | if$ 4707 | } 4708 | 'skip$ 4709 | if$ 4710 | } 4711 | FUNCTION {thesis} 4712 | { journal empty$ not 4713 | { pop$ pop$ 4714 | article 4715 | } 4716 | { author empty$ 4717 | { "author" author warning.if.empty } 4718 | { format.authors start.new.block } 4719 | if$ 4720 | format.year.check output.dot.end.block 4721 | format.ttitle.type.school output.dot.end.block 4722 | unpub.address.school.block 4723 | howpublished.block 4724 | url.block 4725 | note.block 4726 | fin.entry.2 4727 | } 4728 | if$ 4729 | } 4730 | FUNCTION {phdthesis} 4731 | { "\BPhD" "\BUPhD" thesis } 4732 | FUNCTION {mastersthesis} 4733 | { "\BMTh" "\BUMTh" thesis } 4734 | 4735 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4736 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4737 | 4738 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4739 | % 4740 | % title of something (used in unpublished and misc) 4741 | % english translation of title 4742 | % type and number of something 4743 | % 4744 | FUNCTION {format.btitle.type.num} 4745 | { format.betitle.check 4746 | format.bvol.edition connect.with.space.check 4747 | format.type.number 4748 | connect.with.space.check 4749 | title empty$ 4750 | { add.period$ } 4751 | { title format.btitle.connect } 4752 | if$ 4753 | } 4754 | 4755 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4756 | % 4757 | % title of message or software-related thing (used in misc) 4758 | % english translation of title 4759 | % type and number of something 4760 | % 4761 | FUNCTION {format.mtitle.type.num} 4762 | { format.aetitle.check 4763 | format.bvol.edition connect.with.space.check 4764 | type.2 "\bibmessage" = 4765 | { number empty$ 4766 | 'skip$ 4767 | { type.2 number tie.or.space.connect 4768 | bracket.check 4769 | connect.with.space.check 4770 | } 4771 | if$ 4772 | } 4773 | { format.type.number 4774 | connect.with.space.check 4775 | } 4776 | if$ 4777 | title empty$ 4778 | { add.period$ } 4779 | { title format.atitle.connect } 4780 | if$ 4781 | } 4782 | 4783 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4784 | % 4785 | % title, english translation of title, 4786 | % type and number of something (used in misc) 4787 | % 4788 | FUNCTION {output.misctitle.type.num} 4789 | { type.2 empty$ 4790 | { format.btitle.type.num } 4791 | { type.2 "\bibmessage" = 4792 | type.2 "\bibcomputerprogram" = or 4793 | type.2 "\bibcomputerprogrammanual" = or 4794 | type.2 "\bibcomputerprogramandmanual" = or 4795 | type.2 "\bibcomputersoftware" = or 4796 | type.2 "\bibcomputersoftwaremanual" = or 4797 | type.2 "\bibcomputersoftwareandmanual" = or 4798 | type.2 "\bibprogramminglanguage" = or 4799 | { format.mtitle.type.num } 4800 | { format.btitle.type.num } 4801 | if$ 4802 | } 4803 | if$ 4804 | } 4805 | 4806 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4807 | % 4808 | % unpublished manuscripts, etc. 4809 | % 4810 | FUNCTION {unpublished} 4811 | { check.relevant.fields 4812 | author empty$ 4813 | % 4814 | % no author: possibly edited book with editors as authors 4815 | % 4816 | { editor empty$ 4817 | % 4818 | % no author or editor: title serves as author. 4819 | % title formatted as book title 4820 | % 4821 | { format.btitle.type.num output.new.block 4822 | format.year.month.day.check add.period$ 4823 | } 4824 | % 4825 | % format editor and year, and check if year is present 4826 | % format book title, volume, and edition and check if title present 4827 | % 4828 | { format.editors.as.authors start.new.block 4829 | format.year.month.day.check output.dot.new.block 4830 | format.btitle.type.num 4831 | } 4832 | if$ 4833 | } 4834 | % 4835 | % format author and year, and check if year is present 4836 | % format book title, volume, and edition 4837 | % and check if title or type present 4838 | % 4839 | { format.authors start.new.block 4840 | format.year.month.day.check output.dot.new.block 4841 | format.btitle.type.num 4842 | } 4843 | if$ 4844 | howpublished empty$ 4845 | organization empty$ and 4846 | address empty$ and 4847 | 'skip$ 4848 | { output.new.block 4849 | "\APAChowpublished{" "}" howpublished enclose.check 4850 | organization connect.with.comma.check 4851 | address connect.with.comma.check 4852 | add.period$ 4853 | } 4854 | if$ 4855 | % 4856 | % format url 4857 | % 4858 | url empty$ 4859 | 'skip$ 4860 | { % Clear the stack 4861 | duplicate$ empty$ 4862 | 'skip$ 4863 | { output.new.block } 4864 | if$ 4865 | format.url 4866 | } 4867 | if$ 4868 | % 4869 | % format optional note 4870 | % 4871 | note empty$ 4872 | 'skip$ 4873 | { % Clear the stack 4874 | duplicate$ empty$ 4875 | 'skip$ 4876 | { output.new.block } 4877 | if$ 4878 | format.note 4879 | } 4880 | if$ 4881 | fin.entry 4882 | } 4883 | 4884 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4885 | % 4886 | % nonprint media and other things that don't fit 4887 | % 4888 | FUNCTION {misc} 4889 | { % 4890 | % To handle @manual: use type.2 instead of type. 4891 | type.2 empty$ 4892 | type empty$ not and 4893 | { type 'type.2 := } 4894 | 'skip$ 4895 | if$ 4896 | % 4897 | author empty$ 4898 | % 4899 | % no author: possibly edited item with editors as authors 4900 | % 4901 | { editor empty$ 4902 | % 4903 | % no author or editor: title/type serves as author. 4904 | % title formatted as book title 4905 | % 4906 | % if no title and no type, howpublished is title 4907 | % 4908 | { title empty$ 4909 | type.2 empty$ and 4910 | { howpublished empty$ 4911 | { "No author, editor, title, type, and howpublished in " 4912 | cite$ * warning$ 4913 | "" 4914 | } 4915 | { "\APAChowpublished{" howpublished * "}" * add.period$ } 4916 | if$ 4917 | format.year.month.day.check add.period$ 4918 | } 4919 | { output.misctitle.type.num output.new.block 4920 | format.year.month.day.check add.period$ 4921 | format.howpublished add.period$ 4922 | } 4923 | if$ 4924 | } 4925 | % 4926 | % format editor and year, and check if year is present 4927 | % format book title, volume, and edition and check if title present 4928 | % 4929 | { format.editors.as.authors start.new.block 4930 | format.year.month.day.check output.dot.new.block 4931 | output.misctitle.type.num 4932 | format.howpublished add.period$ 4933 | } 4934 | if$ 4935 | } 4936 | % 4937 | % format author and year, and check if year is present 4938 | % format book title, volume, and edition 4939 | % and check if title or type present 4940 | % 4941 | { format.authors start.new.block 4942 | format.year.month.day.check output.dot.new.block 4943 | output.misctitle.type.num 4944 | format.howpublished add.period$ 4945 | } 4946 | if$ 4947 | % 4948 | address empty$ 4949 | publisher empty$ and 4950 | 'skip$ 4951 | { % Clear the stack 4952 | duplicate$ empty$ 4953 | 'skip$ 4954 | { output.new.block } 4955 | if$ 4956 | format.address.publisher add.period$ 4957 | } 4958 | if$ 4959 | % 4960 | % format url 4961 | % 4962 | url empty$ 4963 | 'skip$ 4964 | { % Clear the stack 4965 | duplicate$ empty$ 4966 | 'skip$ 4967 | { output.new.block } 4968 | if$ 4969 | format.url 4970 | } 4971 | if$ 4972 | % 4973 | % format optional note 4974 | % 4975 | note empty$ 4976 | 'skip$ 4977 | { % Clear the stack 4978 | duplicate$ empty$ 4979 | 'skip$ 4980 | { output.new.block } 4981 | if$ 4982 | format.note 4983 | } 4984 | if$ 4985 | fin.entry 4986 | } 4987 | 4988 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4989 | % 4990 | % for legal cases and other cases that need to be 4991 | % done by hand 4992 | % 4993 | FUNCTION {literal} 4994 | { "key" key warning.if.empty 4995 | "text" text warning.if.empty 4996 | text empty$ 4997 | { "" } 4998 | { text } 4999 | if$ 5000 | fin.entry 5001 | } 5002 | 5003 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5004 | % 5005 | % technical documentation 5006 | % 5007 | FUNCTION {manual} 5008 | { % 5009 | % If type is empty, assume that it is a computer software manual. 5010 | % 5011 | type empty$ 5012 | { "\bibcomputersoftwaremanual" 'type.2 := } 5013 | 'skip$ 5014 | if$ 5015 | misc 5016 | } 5017 | 5018 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5019 | % 5020 | % booklet 5021 | % 5022 | FUNCTION {booklet} 5023 | { misc } 5024 | 5025 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5026 | % 5027 | % part of a book 5028 | % 5029 | FUNCTION {inbook} 5030 | { incollection } 5031 | 5032 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5033 | % 5034 | % article in proceedings 5035 | % 5036 | FUNCTION {inproceedings} 5037 | { incollection } 5038 | 5039 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5040 | % 5041 | % article in proceedings (Kopka & Daly, 2004, p. 230) 5042 | % 5043 | FUNCTION {conference} 5044 | { inproceedings } 5045 | 5046 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5047 | % 5048 | % proceedings 5049 | % 5050 | FUNCTION {proceedings} 5051 | { misc } 5052 | 5053 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5054 | % 5055 | % unknown types 5056 | % 5057 | FUNCTION {default.type} 5058 | { misc } 5059 | 5060 | FUNCTION {initialize} 5061 | { 5062 | #6 'name.max := 5063 | %% #250 'entry.max$ := 5064 | %% #5000 'global.max$ := 5065 | } 5066 | FUNCTION {init.old.number} 5067 | { #0 'old.number := } 5068 | FUNCTION {init.old.label} 5069 | { "zzzzzz" 'old.label := } 5070 | FUNCTION {init.cite.initials.add.to.year} 5071 | { #0 'cite.initials := 5072 | #0 'add.to.year := 5073 | } 5074 | FUNCTION {move.forward} 5075 | { #1 'forward := } 5076 | FUNCTION {move.backward} 5077 | { #0 'forward := } 5078 | FUNCTION {begin.bib} 5079 | { preamble$ empty$ 5080 | 'skip$ 5081 | { preamble$ write$ newline$ } 5082 | if$ 5083 | "\begin{thebibliography}{}" write$ newline$ 5084 | } 5085 | FUNCTION {end.bib} 5086 | { newline$ 5087 | "\end{thebibliography}" write$ newline$ 5088 | } 5089 | FUNCTION {write.bbl.entry} 5090 | { 5091 | make.cite.labels 5092 | call.type$ 5093 | } 5094 | READ 5095 | EXECUTE { identify.apacite.version } 5096 | EXECUTE { initialize } 5097 | EXECUTE { init.old.number } 5098 | ITERATE { make.citeorder.number } 5099 | ITERATE { make.sort.title } 5100 | SORT 5101 | EXECUTE { init.old.number } 5102 | EXECUTE { init.old.label } 5103 | ITERATE { make.title.number } 5104 | ITERATE { make.tentative.sort.label } 5105 | SORT 5106 | ITERATE { init.cite.initials.add.to.year } 5107 | EXECUTE { init.initials } 5108 | ITERATE { check.add.initials } 5109 | EXECUTE { init.initials } 5110 | REVERSE { check.add.initials } 5111 | ITERATE { tentative.cite.num.names } 5112 | EXECUTE { init.cite.num.names } 5113 | EXECUTE { move.forward } 5114 | ITERATE { definitive.cite.num.names } 5115 | EXECUTE { init.cite.num.names } 5116 | EXECUTE { move.backward } 5117 | REVERSE { definitive.cite.num.names } 5118 | ITERATE { make.final.sort.key } 5119 | SORT 5120 | EXECUTE { begin.bib } 5121 | ITERATE { write.bbl.entry } 5122 | EXECUTE { end.bib } 5123 | 5124 | %% 5125 | %% End of file `apacannx.bst'. 5126 | --------------------------------------------------------------------------------