%D \module %D [ file=publ-imp-apa, %D version=2013.12.12, % based on bibl-apa.tex and later xml variant %D title=APA bibliography style, %D subtitle=Publications, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted %D by \PRAGMA. See mreadme.pdf for details. % \loadbtxdefinitionfile[def] %D Instead of texdefinitions without arguments, we could have used setups but in my %D editor the commands stand out better and it also saves an additional component %D in the name (e.g. common:) because commands and setups have a different namespace. %D %D Sometimes we have verbose injections in an entry and these can be language %D dependent, so we use labels. \startbtxrenderingdefinitions[apa] %D Because we want to mix rendering (in the manual) we need a namespace in label %D texts: \setupbtxlabeltext [en] [apa:mastersthesis={Master's thesis}, apa:phdthesis={PhD thesis}, apa:technicalreport={Technical report}, apa:patent=patent, apa:editor=editor, apa:editors=editors, apa:edition=edition, apa:volume=volume, apa:Volume=Volume, apa:number=number, apa:Number=Number, apa:in=in, apa:of=of, apa:In=In, apa:p=p, apa:pp=pp, apa:pages=pages, apa:and=and, apa:others={et al.}] \setupbtxlabeltext [fr] [apa:mastersthesis={Thèse de master (DEA, DESS, master)}, apa:phdthesis={Thèse de doctorat}, apa:technicalreport={Rapport technique}, apa:patent=brevet, apa:editor=éditeur, apa:editors=éditeurs, apa:edition=édition, apa:volume=volume, apa:Volume=Volume, apa:number=numéro, apa:Number=Numéro, apa:in=dans, apa:of=de, apa:In=Dans, apa:p=p, apa:pp=pp, apa:pages=pages, apa:and=et, apa:others={et al.}] \setupbtxlabeltext [de] [apa:mastersthesis={Masterarbeit}, apa:phdthesis={Dissertation}, apa:technicalreport={Technischer Bericht}, apa:patent=Patent, apa:editor=Herausgeber, apa:editors=Herausgeber, apa:edition=Auflage, apa:volume=Band, apa:Volume=Band, apa:number=Numer, apa:Number=Numer, apa:in=in, apa:of=von, apa:In=In, apa:p=S, apa:pp=S, apa:pages=Seiten, apa:and=und, apa:others={et al.}] %D The variables control the shared code for which we use a tex definition with %D one argument, specifying the field name. \setvariables [btx:apa:publisher] [left=\btxspace, right=\btxperiod] \setvariables [btx:apa:organization] [left=\btxspace, right=\btxperiod] \setvariables [btx:apa:school] [left=\btxcomma, right=\btxperiod, otherwise=\btxperiod] \setvariables [btx:apa:institution] [left=\btxcomma, right=\btxperiod, otherwise=\btxperiod] \starttexdefinition btx:apa:wherefrom #field \btxdoifelse {address} { \getvariable{btx:apa:\currentbtxcategory}{left} \btxdoifelse {country} { \btxflush{address} \btxcomma \btxflush{country} \btxdoif {#field} { \btxcolon \btxflush{field} } } { \btxflush{address} \btxdoif {#field} { \btxcomma \btxflush{#field} } } \getvariable{btx:apa:\currentbtxcategory}{right} } { \btxdoifelse {country} { \getvariable{btx:apa:\currentbtxcategory}{left} \btxflush{country} \btxdoif {#field} { \btxcolon \btxflush{#field} } \getvariable{btx:apa:\currentbtxcategory}{right} } { \btxdoifelse {#field} { \getvariable{btx:apa:#field}{left} \btxflush{#field} \getvariable{btx:apa:#field}{right} } { \getvariable{btx:apa:#field}{otherwise} } } } \stoptexdefinition \starttexdefinition btx:apa:italic #field \begingroup \it \btxflush{#field} \italiccorrection \endgroup \stoptexdefinition \starttexdefinition btx:apa:title-and-series \btxdoif {title} { \btxflush{converters.Word -> title} \btxdoif {series} { \btxlparent \btxflush{series} \btxrparent } \btxperiod } \stoptexdefinition \starttexdefinition btx:apa:title-it-and-series \btxdoif {title} { \texdefinition{btx:apa:italic}{converters.Word -> title} \btxdoif {series} { \btxlparent \btxflush{series} \btxrparent } \btxperiod } \stoptexdefinition \disablemode[btx:apa:edited-book] % hm, ugly \starttexdefinition btx:apa:author-and-year \btxdoif {author} { \btxflushauthor{author} } \btxdoif {year} { \btxlparent \btxflush{year} \btxrparent } \btxperiod \stoptexdefinition \starttexdefinition btx:apa:author-or-key-and-year \btxdoifelse {author} { \btxflushauthor{author} } { \btxdoif {key} { \btxlbracket \btxsetup{btx:format:key} \btxrbracket } } \btxdoif {year} { \btxlparent \btxflush{year} \btxrparent } \btxperiod \stoptexdefinition \starttexdefinition btx:apa:author-editors-crossref-year \btxdoif {author} { \btxflushauthor{author} } { \btxdoifelse {editor} { \setmode{btx:apa:edited-book} \btxflushauthor{editor} \btxcomma \btxsingularplural {editor} { \btxlabeltext{apa:editor} } { \btxlabeltext{apa:editors} } } { % weird period \btxdoif {crossref} { \btxlbracket \btxsetup{btx:format:crossref} \btxrbracket \btxperiod } } } \btxdoif {year} { \btxlparent \btxflush{year} \btxrparent } \btxperiod \stoptexdefinition \starttexdefinition btx:apa:editor-or-key-and-year \btxdoifelse {editor} { \setmode{btx:apa:edited-book} \btxflushauthor{editor} \btxcomma \btxsingularplural {editor} { \btxlabeltext{apa:editor} } { \btxlabeltext{apa:editors} } } { \btxdoif {key} { \btxlbracket \btxsetup{btx:format:key} \btxrbracket } } \btxspace \btxdoif {year} { \btxlparent \btxflush{year} \btxrparent } \btxperiod \stoptexdefinition \starttexdefinition btx:apa:note \btxdoif {note} { \btxspace \btxflush{note} \btxperiod } \stoptexdefinition \starttexdefinition btx:apa:comment \btxdoif {comment} { \btxspace \btxflush{comment} \btxperiod } \stoptexdefinition \starttexdefinition btx:apa:pages:p \btxdoif {pages} { \btxspace \btxflush{pages} \btxspace \btxlabeltext{apa:p} \btxperiod } \stoptexdefinition \starttexdefinition btx:apa:pages:pp \btxdoif {pages} { \btxspace \btxflush{pages} \btxspace \btxlabeltext{apa:pp} \btxperiod } \stoptexdefinition \starttexdefinition btx:apa:pages:pages \btxdoif {pages} { \btxcomma \btxlabeltext{apa:pages} \btxnbsp \btxflush{pages} } \stoptexdefinition \starttexdefinition btx:apa:edition:sentense \btxdoif {edition} { \btxspace \btxflush{edition} \btxspace \btxlabeltext{apa:edition} \btxperiod } \stoptexdefinition % check when the next is used (no period) % \starttexdefinition btx:apa:edition % \btxdoif {edition} { % \btxspace % \btxflush{edition} % \btxspace % \btxlabeltext{apa:edition} % } % \stoptexdefinition % specific \startsetups btx:apa:article \texdefinition{btx:apa:author-or-key-and-year} \btxdoif {title} { \btxflush{converters.Word -> title} \btxperiod } \btxdoifelse {journal} { \texdefinition{btx:apa:italic}{journal} } { \btxdoif {crossref} { \btxlabeltext{apa:In} \btxspace \btxflush{crossref} } } \btxdoifelse {volume} { \btxspace \texdefinition{btx:apa:italic}{volume} \btxdoif {issue} { \btxlparent \btxflush{issue} \btxrparent } \btxdoif {pages} { \btxcomma \btxflush{pages} } \btxperiod } { \texdefinition{btx:apa:pages:pp} } \texdefinition{btx:apa:note} \texdefinition{btx:apa:comment} \stopsetups \startsetups btx:apa:book \texdefinition{btx:apa:author-editors-crossref-year} \btxdoif {title} { \texdefinition{btx:apa:italic}{converters.Word -> title} \doifmodeelse {btx:apa:edited-book} { \btxdoifelse {volume} { \btxspace \btxlabeltext{apa:Number} \btxnbsp \btxflush{volume} \btxdoifelse {series} { \btxspace \btxlabeltext{apa:in} \btxnbsp \btxflush{series} \btxperiod } { \btxdoifelse {crossref} { \btxspace \btxlabeltext{apa:in} \btxlbracket \btxsetup{btx:format:crossref} \btxrbracket } { \btxperiod } } } { \btxdoif {series} { \btxspace \btxflush{series} } \btxperiod } } { \btxdoifelse {crossref} { \btxdoif {chapter} { \btxcomma \btxflush{chapter} } \texdefinition{btx:apa:pages:pages} \btxperiod \btxdoif {volume} { \btxlabeltext{apa:Volume} \btxnbsp \btxflush{volume} \btxspace \btxlabeltext{apa:of} \btxnbsp } } { \btxdoif {volume} { \btxcomma \btxlabeltext{apa:volume} \btxnbsp \btxflush{volume} \btxdoif {series} { \btxspace \btxlabeltext{apa:of} \btxnbsp \texdefinition{btx:apa:italic}{series} } \btxdoif {chapter} { \btxcomma \btxflush{chapter} } \texdefinition{btx:apa:pages:pages} } \btxperiod } } } \texdefinition{btx:apa:edition:sentence} \texdefinition{btx:apa:wherefrom}{publisher} \texdefinition{btx:apa:pages:p}% twice? \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:inbook \texdefinition{btx:apa:author-editors-crossref-year} \btxdoifelse {title} { \texdefinition{btx:apa:italic}{converters.Word -> title} } { \doifmodeelse {btx:apa:edited-book} { \btxdoifelse {volume} { \btxspace \btxlabeltext{apa:number} \btxnbsp \btxflush{volume} \btxdoifelse {series} { \btxspace \btxlabeltext{apa:in} \btxnbsp \btxflush{series} \btxperiod } { \btxdoifelse {crossref} { \btxspace \btxlabeltext{apa:in} \btxlbracket \btxsetup{btx:format:crossref} \btxrbracket } { \btxperiod } } } { \btxdoif {series} { \btxspace \btxflush{series} \btxperiod } } } { \btxdoifelse {crossref} { \btxdoif {chapter} { \btxcomma \btxflush{chapter} } \texdefinition{btx:apa:pages:pages} \btxdoif {volume} { \btxlabeltext{apa:Volume} \btxnbsp \btxflush{volume} \btxspace \btxlabeltext{apa:of} \btxnbsp } \btxdoif {crossref} { \btxlbracket \btxsetup{btx:format:crossref} \btxrbracket } } { \btxdoif {volume} { \btxcomma \btxlabeltext{apa:volume} \btxnbsp \btxflush{volume} \btxdoif {series} { \btxspace \btxlabeltext{apa:of} \btxnbsp \texdefinition{btx:apa:italic}{series} } \btxdoif {chapter} { \btxcomma \btxflush{chapter} } \texdefinition{btx:apa:pages:pages} \btxperiod } } } } \btxspace \texdefinition{btx:apa:edition:sentence} \texdefinition{btx:apa:wherefrom}{publisher} \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:booklet \texdefinition{btx:apa:author-or-key-and-year} \texdefinition{btx:apa:title-it-and-series} \texdefinition{btx:apa:edition:sentence} \texdefinition{btx:apa:publication:sentence} \texdefinition{btx:apa:pages:p} \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:manual \texdefinition{btx:apa:author-or-key-and-year} \texdefinition{btx:apa:title-it-and-series} \texdefinition{btx:apa:edition:sentence} \texdefinition{btx:apa:wherefrom}{organization} \texdefinition{btx:apa:pages:p} \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:incollection \texdefinition{btx:apa:author-and-year} \btxdoifelse {arttitle} { \btxflush{converters.Word -> arttitle} \btxperiod } { \btxdoif {title} { \btxflush{converters.Word -> title} \btxperiod } } \btxlabeltext{apa:In} \btxspace \btxdoifelse {booktitle} { \btxdoif {editor} { \btxflushauthor{editor} \btxcomma } \texdefinition{btx:apa:italic}{converters.Word -> booktitle} \btxdoif {series} { \btxdoif {volume} { \btxspace \btxlabeltext{apa:number} \btxspace \btxflush{volume} \btxspace \btxlabeltext{apa:in} } \btxspace \btxspace\btxflush{series} \btxcomma } \btxdoif {chapter} { \btxspace \btxflush{chapter} } \btxspace \texdefinition{btx:apa:pages:pages} \btxdoif {edition} { \btxspace \btxflush{edition} \btxspace \btxlabeltext{apa:edition} \btxspace } \texdefinition{btx:apa:wherefrom}{publisher} } { \btxdoif {crossref} { \btxlbracket \btxsetup{btx:format:crossref} \btxrbracket } \btxdoif {chapter} { \btxcomma \btxflush{chapter} } \btxspace \texdefinition{btx:apa:pages:pages} } \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:inproceedings \texdefinition{btx:apa:author-and-year} \btxdoif {arttitle} { \btxflush{converters.Word -> arttitle} \btxperiod } \btxlabeltext{apa:In} \btxspace \btxdoifelse {title} { \btxdoif {editor} { \btxflush{btx:apa:format:editors} \btxcomma \btxsingularplural {editor} { \btxlabeltext{apa:editor} } { \btxlabeltext{apa:editors} } \btxcomma } \texdefinition{btx:apa:italic}{converters.Word -> title} \btxdoif {series} { \btxdoif {volume} { \btxcomma \btxlabeltext{apa:number} \btxspace \btxflush{crossref} \btxflush{volume} \btxspace \btxlabeltext{apa:in} } \btxspace \btxflush{series} } \btxdoif {chapter} { \btxcomma \btxflush{chapter} \btxspace } \texdefinition{btx:apa:pages:pages} \btxperiod \texdefinition{btx:apa:wherefrom}{organization} } { \btxdoif {crossref} { \btxlbracket \btxsetup{btx:format:crossref} \btxrbracket } \btxdoif {chapter} { \btxcomma \btxflush{chapter} \btxspace } \texdefinition{btx:apa:pages:pages} \btxperiod } \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:proceedings \texdefinition{btx:apa:editor-or-key-and-year} \btxdoif {title} { \texdefinition{btx:apa:italic}{converters.Word -> title} \btxdoif {volume} { \btxcomma \btxlabeltext{apa:number} \btxspace \btxflush{volume} \btxspace \btxlabeltext{apa:in} \btxspace } \btxdoif {chapter} { \btxcomma \btxflush{chapter} \btxspace } \texdefinition{btx:apa:pages:pages} \btxperiod \texdefinition{btx:apa:wherefrom}{organization} } \texdefinition{btx:apa:note} \stopsetups \starttexdefinition btx:apa:thesis \texdefinition{btx:apa:author-and-year} \texdefinition{btx:apa:title-it-and-series} \btxdoifelse {type} { \btxflush{type} } { \btxlabeltext{apa:\currentbtxcategory} } \texdefinition{btx:apa:wherefrom}{school} \texdefinition{btx:apa:pages:p} \texdefinition{btx:apa:note} \stoptexdefinition \startsetups btx:apa:mastersthesis \texdefinition{btx:apa:thesis} \stopsetups \startsetups btx:apa:phdthesis \texdefinition{btx:apa:thesis} \stopsetups \startsetups btx:apa:techreport \texdefinition{btx:apa:author-and-year} \texdefinition{btx:apa:title-and-series} \btxdoifelse {type} { \btxflush{type} \btxdoif {volume} { \btxspace \btxflush{volume} } } { \btxspace \btxlabeltext{apa:technicalreport} } \btxcomma \texdefinition{btx:apa:wherefrom}{institution} \texdefinition{btx:apa:pages:p} \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:patent \texdefinition{btx:apa:author-and-year} \btxdoif {title} { \btxspace \texdefinition{btx:apa:italic}{converters.Word -> title} } \btxdoif {nationality} { \btxspace \btxflush{nationality} } \btxspace \btxlabeltext{apa:patent} \btxdoif {number} { \btxspace \btxflush{number} } \texdefinition{btx:apa:wherefrom}{publisher} \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:misc \texdefinition{btx:apa:author-and-year} \texdefinition{btx:apa:title-and-series} \texdefinition{btx:apa:wherefrom}{publisher} \texdefinition{btx:apa:pages:p} \texdefinition{btx:apa:note} \stopsetups \startsetups btx:apa:unpublished \texdefinition{btx:apa:author-and-year} \texdefinition{btx:apa:title-and-series} \texdefinition{btx:apa:pages:p} \btxdoif {type} { \btxlparent \btxflush{type} \btxrparent } \texdefinition{btx:apa:note} \stopsetups \stopbtxrenderingdefinitions