From 3a43c9a819d5d675e2a90f90b1ba1e36076a1af0 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Wed, 22 Oct 2014 17:15:03 +0200 Subject: 2014-10-22 16:25:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4382 -> 4384 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/publ-imp-apa.lua | 36 +- tex/context/base/publ-imp-apa.mkvi | 1692 +++++++++++++++++++++------------ tex/context/base/publ-imp-author.mkvi | 33 +- tex/context/base/publ-ini.mkiv | 45 +- tex/context/base/status-files.pdf | Bin 24727 -> 24740 bytes tex/context/base/status-lua.pdf | Bin 333413 -> 333413 bytes 9 files changed, 1168 insertions(+), 642 deletions(-) (limited to 'tex/context/base') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 4e38c9757..765db89ef 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.10.22 16:03} +\newcontextversion{2014.10.22 16:23} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 497b1fcb8..931034d50 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index c751ce462..2b5595c11 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.10.22 16:03} +\edef\contextversion{2014.10.22 16:23} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua index 0329208a7..5f6a1d35d 100644 --- a/tex/context/base/publ-imp-apa.lua +++ b/tex/context/base/publ-imp-apa.lua @@ -8,12 +8,20 @@ return { copyright = "ConTeXt development team", categories = { article = { - required = { "author", "title", "journal", "year" }, - optional = { "volume", "number", "pages", "month", "note" }, + required = { {"author", "editor"}, "title", "journal", "year" }, + optional = { "volume", "number", "pages", "note", "type", "url", "doi" }, + }, + magazine = { + required = { {"author", "editor",}, "title", "journal", "year" }, + optional = { "volume", "number", "pages", "month", "day", "note", "url", "doi" }, + }, + newspaper = { + required = { {"author", "editor",}, "title", "journal", "year" }, + optional = { "volume", "number", "pages", "month", "day", "note", "url", "doi" }, }, book = { required = { { "author", "editor" }, "title", "publisher", "year" }, - optional = { { "volume", "number" }, "series", "address", "edition", "month","note" }, + optional = { { "volume", "number" }, "series", "address", "edition", "month", "note", "pages", "ISBN" }, }, booklet = { required = { "title" }, @@ -21,16 +29,18 @@ return { }, inbook = { required = { { "author", "editor" }, "title", { "chapter", "pages" }, "publisher","year" }, - optional = { { "volume", "number" }, "series", "type", "address", "edition", "month", "note" }, + optional = { { "volume", "number" }, "series", "type", "address", "edition", "month", "note", "ISBN" }, }, incollection = { required = { "author", "title", "booktitle", "publisher", "year" }, - optional = { "editor", { "volume", "number" }, "series", "type", "chapter", "pages", "address", "edition", "month", "note" }, + optional = { "editor", { "volume", "number" }, "series", "type", "chapter", "pages", "address", "edition", "month", "note", "ISBN" }, }, inproceedings = { required = { "author", "title", "booktitle", "year" }, - optional = { "editor", { "volume", "number" }, "series", "pages", "address", "month","organization", "publisher", "note" }, + optional = { "editor", { "volume", "number" }, "series", "pages", "address", "month", "organization", "publisher", "note", "ISBN" }, }, + -- does this work: + conference = inproceedings, manual = { required = { "title" }, optional = { "author", "organization", "address", "edition", "month", "year", "note" }, @@ -40,16 +50,22 @@ return { optional = { "type", "address", "month", "note" }, }, misc = { - required = { "author", "title", "howpublished", "month", "year", "note" }, + required = { }, optional = { "author", "title", "howpublished", "month", "year", "note" }, }, + -- Not sure yet how "periodical" is used... but "jabref" includes it as standard. + -- strangely, "jabref" does not include "author" as required nor optional.. + periodical = { + required = { "title", "year" }, + optional = { "author", "editor", "month", "note", "number", "organization", "series", "volume" }, + }, phdthesis = { required = { "author", "title", "school", "year" }, optional = { "type", "address", "month", "note" }, }, proceedings = { required = { "title", "year" }, - optional = { "editor", { "volume", "number" }, "series", "address", "month", "organization", "publisher", "note" }, + optional = { "editor", { "volume", "number" }, "series", "address", "month", "organization", "publisher", "note", "pages", "ISBN" }, }, techreport = { required = { "author", "title", "institution", "year" }, @@ -63,6 +79,10 @@ return { required = { "author", "title", "note" }, optional = { "month", "year" }, }, + literal = { + required = { "key", "text", }, + optional = { }, + }, }, } diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 047e7c49b..e83306bcd 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -36,24 +36,20 @@ % First of all, the APA style defines authoryear bibliography lists. -\setupbtxrendering [standard] [numbering=no,sorttype=authoryear] +% Question: is the field "key=" (->sortkey, not the \cite [key]) used if present? + +% does not work here: \setupbtxrendering [standard] [numbering=no,sorttype=authoryear] % does not work here: \setupbtxcitevariant [alternative=authoryear,sorttype=authoryear] -\setupbtxlistvariant [lastnamesep={ \& },finalnamesep={ \& }] +\setupbtxlistvariant + [lastnamesep={\nobreakspace\textampersand\space}, + finalnamesep={\nobreakspace\textampersand\space}] -\definebtxlistvariant +\setupbtxlistvariant [author] [author=invertedshort] -\definebtxlistvariant - [editor] - [author] - -\definebtxlistvariant - [artauthor] - [author] - % Should the following be loaded by default? %D In order to be able to get journals expanded (or normalized or abbreviated) you need @@ -66,6 +62,9 @@ %D Because we want to mix rendering (in the manual) we need a namespace in label %D texts: +% TODO: The APA guide calls for abbreviations, but this should be a tunable option. +% We need then to define both and create a mechanism to select. + \setupbtxlabeltext [en] [apa:mastersthesis={Master's thesis}, @@ -74,10 +73,10 @@ apa:supplement={Suppl.}, % Supplement apa:patent=patent, apa:Translator={Trans.}, % Translator(s) - apa:editor={Ed.}, % editor - apa:editors={Eds.}, % editors + apa:Editor={Ed.}, % Editor + apa:Editors={Eds.}, % Editors apa:edition={ed.}, % edition - apa:volume=volume, + apa:volume=volume, % used? apa:Volume={Vol.}, % Volume apa:Volumes={Vols.}, % Volumes apa:number=number, @@ -87,8 +86,8 @@ apa:of=of, apa:In=In, apa:Part={Pt.}, % Part - apa:p=p, - apa:pp=pp, + apa:p={p.}, + apa:pp={pp.}, apa:pages=pages, apa:and=and, apa:period={. }, @@ -102,19 +101,24 @@ [apa:mastersthesis={Thèse de master (DEA, DESS, master)}, apa:phdthesis={Thèse de doctorat}, apa:technicalreport={Rapport technique}, + apa:supplement=Supplément, apa:patent=brevet, - apa:editor={Éd.}, % éditeur, - apa:editors={Éds.}, % éditeurs, + apa:Translator=Traducteur, + apa:Editor=Éditeur, + apa:Editors=Éditeurs, apa:edition=édition, apa:volume=volume, apa:Volume=Volume, + apa:Volumes=Volumes, apa:number=numéro, apa:Number=Numéro, + apa:nd={s.d.} % sans date apa:in=dans, apa:of=de, apa:In=Dans, - apa:p=p, - apa:pp=pp, + apa:Part=Partie, + apa:p={p.}, + apa:pp={pp.}, apa:pages=pages, apa:and=et, apa:period={. }, @@ -128,24 +132,24 @@ [apa:mastersthesis={Masterarbeit}, apa:phdthesis={Dissertation}, apa:technicalreport={Technischer Bericht}, - apa:supplement={Beilage}, % Supplement + apa:supplement={Beilage}, % Supplement apa:patent=Patent, - apa:Translator={Übersetzer}, % Übers. - apa:editor=Herausgeber, % Hrsg./Hg. - apa:editors=Herausgeber, + apa:Translator={Übersetzer}, % Übers. + apa:Editor=Herausgeber, % Hrsg./Hg. + apa:Editors=Herausgeber, apa:edition=Auf\/lage, - apa:volume=Band, % Bd. + apa:volume=Band, % Bd. apa:Volume=Band, apa:Volumes={Bände}, apa:number=Nummer, apa:Number={Nr.}, - apa:nd={o.D.}, % ohne Datum (mostly: o.J. / ohne Jahr) + apa:nd={o.D.}, % ohne Datum (mostly: o.J. / ohne Jahr) apa:in=in, apa:of=von, apa:In=In, - apa:Part={Teil}, - apa:p=S, - apa:pp=S, + apa:Part=Teil, + apa:p={S.}, + apa:pp={S.}, apa:pages=Seiten, apa:and=und, apa:period={. }, @@ -158,36 +162,35 @@ \setupbtxlabeltext [it] - [apa:mastersthesis={Tesi di laurea}, % should be abbr. = T.? - apa:phdthesis={Tesi di dottorato}, % should be abbr. = T.? + [apa:mastersthesis={Tesi di laurea}, + apa:phdthesis={Tesi di dottorato}, apa:technicalreport={Relazione tecnica}, - apa:supplement={Suppl.}, % Supplement - apa:patent=patent, + apa:supplement={Supplemento}, + apa:patent=brevetto, apa:Translator={Trad.}, % Translator(s) - apa:editor={A c. di}, - apa:editors={A c. di}, + apa:Editor={A cura di}, + apa:Editors={A cura di}, apa:edition={ed.}, apa:volume=volume, apa:Volume={Vol.}, apa:Volumes={Vol.}, - apa:number=number, - apa:Number={N.}, + apa:number=numero, + apa:Number=Numero, apa:nd={s.d.}, apa:in=in, - apa:of=of, + apa:of=di, apa:In=In, - apa:Part={Pt.}, - apa:p=p, - apa:pp=pp, + apa:Part=Parte, + apa:p={p.}, + apa:pp={pp.}, apa:pages=pagine, apa:and=e, apa:period={. }, - apa:Author=Author, %TODO, should be typeset in italic... - apa:Advanced={Pubblicazione online}, % ? - apa:Retrieved={Retrieved from}, % ? website? + apa:Author=Autore, + apa:Advanced={Pre-pubblicazione on line}, + apa:Retrieved={Accessible online}, 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. @@ -213,50 +216,126 @@ right=\btxperiod, otherwise=\btxperiod] -\starttexdefinition btx:apa:author-editor-other #field - \doifelse {#field} {publisher} - {\doifelse {\btxflush{#field}} {\btxflush{author}} - {\btxlabeltext{apa:Author}} - {\btxflush{#field}} +% First some helpers: + +% If month (and day) are present, they will (optionally) be used. + +\starttexdefinition btx:apa:suffixedyear #date + \btxleftparenthesis + \btxdoifelse {year} { + \btxflush{year} + \btxdoif {suffix} { + \btxflush{suffix} + } + \doif {#date} {date} { + \btxdoif {month} { + \btxcomma + % language issue here? + \btxflush{month} + \btxspace + \btxdoif {day} { + \btxspace + \btxflush{day} + } + } } - {\btxflush{#field}} + } { + \btxlabeltext{apa:nd} + } + \btxrightparenthesisperiod \stoptexdefinition -\starttexdefinition btx:apa:wherefrom #field - \btxdoifelse {address} { - \btxspace - \btxflush{address} - \btxdoif {country} { - \btxcomma - \btxflush{country} - } - \btxdoif {#field} { +\starttexdefinition btx:apa:title-subtitle #before #type + \btxdoif {title} { + #before + \btxflush{Word -> title} + \btxdoif {subtitle} { \btxcolon - \texdefinition{btx:apa:author-editor-other}{#field} + \btxflush{Word -> subtitle} } - \btxperiod - } { - \btxdoifelse {country} { - \btxspace - \btxflush{country} - \btxdoif {#field} { - \btxcolon - \texdefinition{btx:apa:author-editor-other}{#field} + \doifelse {#type} {type} { + \btxdoifelse{type} { + \btxleftbracket + \btxflush{Word -> type} + \btxrightbracketperiod + } { + \btxperiod } + } { \btxperiod + } + } +\stoptexdefinition + +\starttexdefinition btx:apa:author-or-title #type + \btxdoifelse {author} { + \btxflushauthor[invertedshort]{author} + } { + \setmode{btx:apa:title-placed} + \texdefinition{btx:apa:title-subtitle}{}{#type} + } +\stoptexdefinition + +\starttexdefinition btx:apa:editor-or-editors + \btxleftparenthesis + \btxsingularplural {editor} { + \btxlabeltext{apa:Editor} + } { + \btxlabeltext{apa:Editors} + } + \btxrightparenthesisperiod +\stoptexdefinition + +\starttexdefinition btx:apa:author-or-editor-or-publisher #title + \btxdoifelse {author} { + \btxflushauthor[invertedshort]{author} + } { + \btxdoifelse {editor} { + \btxflushauthor[invertedshort]{editor} + \texdefinition{btx:apa:editor-or-editors} } { - \btxdoifelse {#field} { - \getvariable{btx:apa:#field}{left} - \texdefinition{btx:apa:author-editor-other}{#field} - \getvariable{btx:apa:#field}{right} + \btxdoifelse {publisher} { + \btxflush{publisher} } { - % check that this is needed! - \getvariable{btx:apa:#field}{otherwise} + \doif {#title} {title} { + \setmode{btx:apa:title-placed} + \texdefinition{btx:apa:title-subtitle}{}{type} + } + } + } + } +\stoptexdefinition + +\starttexdefinition btx:apa:editor-or-organization #title + \btxdoifelse {editor} { + \btxflushauthor[invertedshort]{editor} + \texdefinition{btx:apa:editor-or-editors} + } { + \btxdoifelse {organization} { + \btxflush{organization} + } { + \doif {#title} {title} { + \setmode{btx:apa:title-placed} + \texdefinition{btx:apa:title-subtitle}{}{type} } } } \stoptexdefinition +\starttexdefinition btx:apa:title-if-not-placed #it + \doifnotmode {btx:apa:title-placed} { + \doifelse {#it} {it} { + \begingroup + \it + \texdefinition{btx:apa:title-subtitle}{\btxspace}{type} + \italiccorrection + \endgroup + } { + \texdefinition{btx:apa:title-subtitle}{\btxspace}{type} + } + } +\stoptexdefinition + \starttexdefinition btx:apa:italic #field \begingroup \it @@ -265,193 +344,186 @@ \endgroup \stoptexdefinition -\starttexdefinition btx:apa:title-and-series - \btxdoif {title} { +\starttexdefinition btx:apa:editor #title + \btxdoifelse {editor} { + \btxlabeltext{apa:In} \btxspace - \btxflush{Word -> title} - \btxdoif {series} { - \btxlparenthesis - \btxflush{series} - \btxrparenthesis + } { + \btxdoif {#title} { + \btxlabeltext{apa:In} + \btxspace } - \btxperiod } -\stoptexdefinition - -% can these two be elegantly collapsed somehow using #it, for example? - -\starttexdefinition btx:apa:title-it-and-series - \btxdoif {title} { + \btxdoif {editor} { + \btxflushauthor[normalshort]{editor} \btxspace - \texdefinition{btx:apa:italic}{Word -> title} - \btxdoif {series} { - \btxlparenthesis - \btxflush{series} - \btxrparenthesis - } - \btxperiod + \texdefinition{btx:apa:editor-or-editors} + } + \btxdoif {#title} { + \texdefinition{btx:apa:italic}{Word -> #title} } \stoptexdefinition -\disablemode[btx:apa:edited-book] % hm, ugly - -\starttexdefinition btx:apa:suffixedyear - \btxdoif {year} { - \btxlparenthesis - \btxflush{year} - \btxdoif {suffix} { - \btxflush{suffix} +\starttexdefinition btx:apa:doif-edition-or-volume-or-number-or-pages #if + \btxdoifelse {edition} { + #if + }{ + \btxdoifelse {volume} { + #if + } { + \btxdoifelse {number} { + #if + } { + \btxdoif {pages} { + #if + } + } } - \btxrparenthesis } \stoptexdefinition -\starttexdefinition btx:apa:author-and-year - \btxdoif {author} { - \btxflushauthor{author} +\starttexdefinition btx:apa:edition-volume-number-pages + \texdefinition{btx:apa:doif-edition-or-volume-or-number-or-pages}{\btxleftparenthesis} + \btxdoif {edition} { + \btxflush{edition} + \btxspace + \btxlabeltext{apa:edition} } - \texdefinition{btx:apa:suffixedyear} - \btxperiod -\stoptexdefinition - -\starttexdefinition btx:apa:author-or-key-and-year - \btxdoifelse {author} { - \btxflushauthor{author} - } { - \btxdoif {key} { - \btxlbracket - \btxsetup{btx:format:key} - \btxrbracket + \btxdoif {volume} { + \btxdoif {edition} { + \btxcomma + } + \btxoneorrange {volume} { + \btxlabeltext{apa:Volume} + } { + \btxlabeltext{apa:Volumes} } + \btxspace + \btxflush{volume} } - \texdefinition{btx:apa:suffixedyear} - \btxperiod -\stoptexdefinition - -\starttexdefinition btx:apa:author-editors-crossref-year - % TODO: if there is no author or editor, then use publisher... - \btxdoifelse {author} { - \btxflushauthor{author} - } { - \btxdoifelse {editor} { - \setmode{btx:apa:edited-book} - \btxflushauthor{editor} + \btxdoif {number} { + \btxdoifelse {volume} { \btxcomma - \btxsingularplural {editor} { - \btxlabeltext{apa:editor} - } { - \btxlabeltext{apa:editors} - } } { - % weird period - \btxdoif {crossref} { - \btxlbracket - \btxsetup{btx:format:crossref} - \btxrbracket - \btxperiod + \btxdoif {edition} { + \btxcomma } } + \btxspace + \btxlabeltext{apa:Number} + \btxspace + \btxflush{number} } - \texdefinition{btx:apa:suffixedyear} - \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} + \btxdoif {pages} { + \btxdoifelse {volume} { + \btxcomma } { - \btxlabeltext{apa:editors} + \btxdoifelse {edition} { + \btxcomma + } { + \btxdoif {number} { + \btxcomma + } + } } - } { - \btxdoif {key} { - \btxlbracket - \btxsetup{btx:format:key} - \btxrbracket + \btxoneorrange {pages} { + \btxlabeltext{apa:p} + } { + \btxlabeltext{apa:pp} } - } - \texdefinition{btx:apa:suffixedyear} - \btxperiod -\stoptexdefinition - -\starttexdefinition btx:apa:title - \btxdoif {title} { \btxspace - \btxflush{Word -> title} - \btxperiod + \btxflush{pages} } + \texdefinition{btx:apa:doif-edition-or-volume-or-number-or-pages}{\btxrightparenthesisperiod} \stoptexdefinition -% No longer used (not conforming to APA style) -\starttexdefinition btx:apa:title-it - \btxdoif {title} { +\starttexdefinition btx:apa:journal-volume-number-pages #pp + \btxdoif {journal} { \btxspace - \texdefinition{btx:apa:italic}{Word -> title} - \btxflush{Word -> title} - \btxperiod - } -\stoptexdefinition - -\starttexdefinition btx:apa:journal-volume-issue - \btxdoifelse {journal} { % expandedjournal abbreviatedjournal \texdefinition{btx:apa:italic}{expandedjournal -> journal} - } { - \btxdoif {crossref} { - \btxlabeltext{apa:In} - \btxspace - \btxflush{crossref} + % A newspaper may not have a volume but may have a number! + \btxdoif {volume} { + \btxcomma + \texdefinition{btx:apa:italic}{volume} + \btxdoifnot {number} { + \btxdoifelse {pages} + {\btxcomma} + {\btxperiod} + } } - } - \btxdoifelse {volume} { - \btxspace - \texdefinition{btx:apa:italic}{volume} - \btxdoif {issue} { - \btxlparenthesis - \btxflush{issue} - \btxrparenthesis + \btxdoif {number} { + \btxdoifelse {volume} { + \removeunwantedspaces( + } { + \btxcomma + \btxleftparenthesis + } + \btxflush{number} + \btxdoifelse {pages} + {\btxrightparenthesiscomma} + {\btxrightparenthesisperiod} } - \btxcomma - } { - \btxdoifelse {doi} { - \btxspace - \btxlabeltext{apa:Advanced} - \btxperiod - } { - \btxdoif {url} { + \btxdoif {pages} { + \btxdoifnot {volume} { + \btxdoifnot {number} { + \btxcomma + } + } + % APA rule for newspaper, ... + \doif {#pp} {pp} { + \btxoneorrange {pages} { + \btxlabeltext{apa:p} + } { + \btxlabeltext{apa:pp} + } \btxspace - \btxlabeltext{apa:Advanced} - \btxperiod + } + \btxflush{pages} + \btxperiod + } + \doifnot {#pp} {pp} { + % not a newspaper... + \btxdoifnot {volume} { + \btxdoifnot {number} { + \btxdoifnot {pages} { + \btxdoifelse {doi} { + \btxspace + \btxlabeltext{apa:Advanced} + \btxperiod + } { + \btxdoif {url} { + \btxspace + \btxlabeltext{apa:Advanced} + \btxperiod + } + } + } + } } } } \stoptexdefinition -\starttexdefinition btx:apa:note - \btxdoif {note} { - % Note: no punctuation +\starttexdefinition btx:apa:url + \btxdoif {url} { \btxspace - \btxflush{note} - \btxperiod - } -\stoptexdefinition - -\starttexdefinition btx:apa:comment - \btxdoif {comment} { - % Note: no punctuation + \btxlabeltext{apa:Retrieved} \btxspace - \btxflush{comment} - \btxperiod + \ifconditional\btxinteractive + \goto { + \hyphenatedurl{\btxflush{url}} + } [ + url(\btxflush{url}) + ] + \else + \hyphenatedurl{\btxflush{url}} + \fi } \stoptexdefinition -% We should create a lua function that prepends "doi:" if not already there... - -\starttexdefinition btx:apa:doi-or-url - \btxdoifelse {doi} { +\starttexdefinition btx:apa:doi + \btxdoif {doi} { \btxspace \ifconditional\btxinteractive \goto { @@ -462,455 +534,856 @@ \else \hyphenatedurl{doi:\btxflush{doi}} \fi - } { - \btxdoif {url} { - \btxspace - \btxlabeltext{apa:Retrieved} - \btxspace - \ifconditional\btxinteractive - \goto { - \hyphenatedurl{\btxflush{url}} - } [ - url(\btxflush{url}) - ] - \else - \hyphenatedurl{\btxflush{url}} - \fi - } } \stoptexdefinition -\starttexdefinition btx:apa:pages - \btxdoif {pages} { - \btxspace - \btxflush{pages} - \btxperiod +\starttexdefinition btx:apa:note + % grouping could indeed be useful... + \btxdoif {note} { + \btxleftparenthesis + {\btxflush{note}} + \btxrightparenthesis\removeunwantedspaces + % nospace if last item... } \stoptexdefinition -\starttexdefinition btx:apa:pages:p - \btxdoif {pages} { - \btxspace - \btxoneorrange {pages} { - \btxlabeltext{apa:p} +\starttexdefinition btx:apa:url-note-doi + \texdefinition{btx:apa:url} + \texdefinition{btx:apa:note} + \texdefinition{btx:apa:doi} +\stoptexdefinition + +\starttexdefinition btx:apa:author-editor-other #field + \btxdoif {#field} { + \doifelse {#field} {publisher} { + \doifelse {\btxflush{#field}} {\btxflush{author}} { + \btxlabeltext{apa:Author} + } { + \btxflush{#field} + } } { - \btxlabeltext{apa:pp} + \btxflush{#field} } - \btxperiod - \btxnbsp - \btxflush{pages} - \btxperiod } \stoptexdefinition -\starttexdefinition btx:apa:pages:pp - \btxdoif {pages} { - \btxspace - \btxflush{pages} - \btxnbsp - \btxlabeltext{apa:pp} - \btxperiod - } -\stoptexdefinition - -% this does not seem to comply with APA style - need to verify! - -\starttexdefinition btx:apa:pages:pages - \btxdoif {pages} { - \btxcomma - \btxlabeltext{apa:pages} - \btxnbsp - \btxflush{pages} - \btxperiod +\starttexdefinition btx:apa:doifelse-publisher-or-author-or-editor #author #if #else + \btxdoifelse {publisher} { + \btxdoifelse {#author} { + #if + } { + \btxdoifelse {editor} { + #if + } { + #else + } + } + } { + \btxdoifelse {#author} { + #if + } { + \doifelse {editor} { + #if + } { + #else + } + } } \stoptexdefinition -\starttexdefinition btx:apa:edition:sentence - \btxdoif {edition} { - \btxspace - \btxflush{edition} +\starttexdefinition btx:apa:wherefrom-publisher #author + \btxdoifelse {country} { \btxspace - \btxlabeltext{apa:edition} - \btxperiod + \btxdoif {address} { + \btxflush{address} + \btxcomma + } + \btxflush{country} + \texdefinition{btx:apa:doifelse-publisher-or-author-or-editor}{#author} + {\btxcolon} {\btxperiod} + } { + \btxdoifelse {address} { + \btxspace + \btxflush{address} + \texdefinition{btx:apa:doifelse-publisher-or-author-or-editor}{#author} + {\btxcolon} {\btxperiod} + } { + \texdefinition{btx:apa:doifelse-publisher-or-author-or-editor}{#author} + {\btxspace} {} + } + } + \btxdoifelse {publisher} { + \btxdoifelse {#author} { + \btxflush{publisher} + \btxperiod + } { + \btxdoif {editor} { + \btxflush{publisher} + \btxperiod + } + } + } { + \btxdoifelse {#author} { + \btxlabeltext{apa:Author} + \btxperiod + } { + \btxdoif {editor} { + \btxlabeltext{apa:Author} + \btxperiod + } + } } \stoptexdefinition -% check when the next is used (no period) - -% \starttexdefinition btx:apa:edition -% \btxdoif {edition} { -% \btxspace -% \btxflush{edition} -% \btxspace -% \btxlabeltext{apa:edition} -% } -% \stoptexdefinition +% Then by category -% specific +% An article from a journal +% Required fields: author or title, journal, (year). +% Optional fields: volume, number, pages, type, doi, url, note. \startsetups btx:apa:article - \texdefinition{btx:apa:author-or-key-and-year} - \texdefinition{btx:apa:title} - \texdefinition{btx:apa:journal-volume-issue} - \texdefinition{btx:apa:pages} - \texdefinition{btx:apa:doi-or-url} - \texdefinition{btx:apa:note} - \texdefinition{btx:apa:comment} + \texdefinition{btx:apa:author-or-title}{type} + \texdefinition{btx:apa:suffixedyear}{} + \texdefinition{btx:apa:title-if-not-placed}{} + \texdefinition{btx:apa:journal-volume-number-pages}{} + \texdefinition{btx:apa:url-note-doi} +\stopsetups + +% An article from a magazine. +% Required fields: author or title, journal, (year). +% Optional fields: volume, number, pages, type, month, day, doi, url, note. + +\startsetups btx:apa:magazine + \texdefinition{btx:apa:author-or-title}{type} + \texdefinition{btx:apa:suffixedyear}{date} + \texdefinition{btx:apa:title-if-not-placed}{} + \texdefinition{btx:apa:journal-volume-number-pages}{} + \texdefinition{btx:apa:url-note-doi} +\stopsetups + +% An article from a newspaper. +% Required fields: author or title, journal, (year). +% Optional fields: volume, number, pages, type, month, day, doi, url, note. + +\startsetups btx:apa:newspaper + \texdefinition{btx:apa:author-or-title}{type} + \texdefinition{btx:apa:suffixedyear}{date} + \texdefinition{btx:apa:title-if-not-placed}{} + \texdefinition{btx:apa:journal-volume-number-pages}{pp} + \texdefinition{btx:apa:url-note-doi} \stopsetups +% A book with an explicit publisher. +% Required fields: author or editor or publisher, title, (year). +% Optional fields: volume or number, series, address, edition, month, day, note. +% APA ignores: month, day + +% todo: series? + \startsetups btx:apa:book - \texdefinition{btx:apa:author-editors-crossref-year} - \btxdoif {title} { - %texdefinition{btx:apa:italic}{converters.Word -> title} - \texdefinition{btx:apa:italic}{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:pp}% twice? - \texdefinition{btx:apa:doi-or-url} - \texdefinition{btx:apa:note} + \texdefinition{btx:apa:author-or-editor-or-publisher}{title} + \texdefinition{btx:apa:suffixedyear}{} + \texdefinition{btx:apa:title-if-not-placed}{it} + \texdefinition{btx:apa:edition-volume-number-pages} + \texdefinition{btx:apa:wherefrom-publisher}{author} + \texdefinition{btx:apa:url-note-doi} \stopsetups +% A part of a book, which may be a chapter (or section or whatever) and/or a range of pages. +% Required fields: author or editor, title, chapter and/or pages, publisher, year. +% Optional fields: volume or number, series, type, address, edition, month, note. +% APA ignores: month + +% todo: series? + \startsetups btx:apa:inbook - \texdefinition{btx:apa:author-editors-crossref-year} - \btxdoifelse {title} { - %texdefinition{btx:apa:italic}{converters.Word -> title} - \texdefinition{btx:apa:italic}{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 - } - } + \texdefinition{btx:apa:author-or-editor-or-publisher}{} + \texdefinition{btx:apa:suffixedyear}{} + \btxdoif {chapter} { + \btxflush{Word -> chapter} + \btxspace + } + \texdefinition{btx:apa:editor}{title} + \texdefinition{btx:apa:edition-volume-number-pages} + \texdefinition{btx:apa:wherefrom-publisher}{author} + \texdefinition{btx:apa:url-note-doi} +\stopsetups + +% A part of a book having its own title. +% Required fields: author, title, booktitle, publisher, year. +% Optional fields: editor, volume or number, series, type, chapter, pages, address, edition, month, note. +% APA ignores: month + +% todo: series? + +\startsetups btx:apa:incollection + \texdefinition{btx:apa:author-or-editor-or-publisher}{title} + \texdefinition{btx:apa:suffixedyear}{} + \texdefinition{btx:apa:title-if-not-placed}{} + \texdefinition{btx:apa:editor}{booktitle} + \texdefinition{btx:apa:edition-volume-number-pages} + \texdefinition{btx:apa:wherefrom-publisher}{author} + \texdefinition{btx:apa:url-note-doi} +\stopsetups + +% The proceedings of a conference. +% Required fields: title, year. +% Optional fields: editor, volume or number, series, address, month, organization, publisher, note. +% todo: series? + +\startsetups btx:apa:proceedings + \texdefinition{btx:apa:editor-or-organization}{title} + \texdefinition{btx:apa:suffixedyear}{date} + \texdefinition{btx:apa:title-if-not-placed}{} + \texdefinition{btx:apa:edition-volume-number-pages} + \btxdoifelse {editor} { + \btxdoif {organization} { + \btxspace + \btxflush{organization} + \btxcomma } + \texdefinition{btx:apa:wherefrom-publisher} {editor} + } { + \texdefinition{btx:apa:wherefrom-publisher} {organization} } - \btxspace - \texdefinition{btx:apa:edition:sentence} - \texdefinition{btx:apa:wherefrom}{publisher} - \texdefinition{btx:apa:note} + \texdefinition{btx:apa:url-note-doi} \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} +% An article in a conference proceedings. +% Required fields: author, title, booktitle, year. +% Optional fields: editor, volume or number, series, pages, address, month, organization, publisher, note. +% todo: series? + +\startsetups btx:apa:inproceedings + \texdefinition{btx:apa:author-or-editor-or-publisher}{title} + \texdefinition{btx:apa:suffixedyear}{date} + \texdefinition{btx:apa:title-if-not-placed}{} + \texdefinition{btx:apa:editor}{booktitle} + \texdefinition{btx:apa:edition-volume-number-pages} + \btxdoif {organization} { + \btxspace + \btxflush{organization} + \btxcomma + } + \texdefinition{btx:apa:wherefrom-publisher}{author} + \texdefinition{btx:apa:url-note-doi} \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} +\startsetups btx:apa:conference + \fastsetup{btx:apa:inproceedings} \stopsetups -\startsetups btx:apa:incollection - \texdefinition{btx:apa:author-and-year} - \btxdoifelse {arttitle} { - %btxflush{converters.Word -> arttitle} - \btxflush{Word -> arttitle} - \btxperiod +% A thesis. +% Required fields: author, title, school, year. +% Optional fields: type, address, month, note. + +\startsetups btx:apa:thesis + % unlikely not to have author! + \texdefinition{btx:apa:author-or-title}{} + \texdefinition{btx:apa:suffixedyear}{date} + \texdefinition{btx:apa:title-if-not-placed}{it} + \btxleftparenthesis + \btxdoifelse {type} { + \btxflush{type} } { - \btxdoif {title} { - %btxflush{converters.Word -> title} - \btxflush{Word -> title} + \btxlabeltext{apa:\currentbtxcategory} + } + \btxrightparenthesisperiod + \btxdoif {school} { + \btxflush{school} + \btxdoif {address} { + \btxcomma + } { \btxperiod } } - \btxlabeltext{apa:In} - \btxspace - \btxdoifelse {booktitle} { - \btxdoif {editor} { - \btxflushauthor{editor} + \btxdoif {address} { + \btxflush{address} + \btxdoif {country} { \btxcomma + \btxflush{country} } - %texdefinition{btx:apa:italic}{converters.Word -> booktitle} - \texdefinition{btx:apa:italic}{Word -> booktitle} + \btxperiod + } + \texdefinition{btx:apa:url-note-doi} +\stopsetups + +\startsetups btx:apa:phdthesis + \fastsetup{btx:apa:thesis} +\stopsetups + +\startsetups btx:apa:mastersthesis + \fastsetup{btx:apa:thesis} +\stopsetups + +% Alan's current revision stops here.. + +%\starttexdefinition btx:apa:wherefrom #field +% \btxdoifelse {address} { +% \btxspace +% \btxflush{address} +% \btxdoif {country} { +% \btxcomma +% \btxflush{country} +% } +% \btxdoif {#field} { +% \btxcolon +% \texdefinition{btx:apa:author-editor-other}{#field} +% } +% \btxperiod +% } { +% \btxdoifelse {country} { +% \btxspace +% \btxflush{country} +% \btxdoif {#field} { +% \btxcolon +% \texdefinition{btx:apa:author-editor-other}{#field} +% } +% \btxperiod +% } { +% \btxdoifelse {#field} { +% \getvariable{btx:apa:#field}{left} +% \texdefinition{btx:apa:author-editor-other}{#field} +% \getvariable{btx:apa:#field}{right} +% } { +% % check that this is needed! +% \getvariable{btx:apa:#field}{otherwise} +% } +% } +% } +%\stoptexdefinition + +\starttexdefinition btx:apa:title-and-series + \btxdoif {title} { + \btxspace + \btxflush{Word -> title} \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} + \btxleftparenthesis + \btxflush{series} + \btxrightparenthesis } + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:title-and-series-it + \btxdoif {title} { \btxspace - \texdefinition{btx:apa:pages:pages} - \btxdoif {edition} { - \btxspace - \btxflush{edition} - \btxspace - \btxlabeltext{apa:edition} - \btxspace + \texdefinition{btx:apa:italic}{Word -> title} + \btxdoif {series} { + \btxleftparenthesis + \btxflush{series} + \btxrightparenthesis } - \texdefinition{btx:apa:wherefrom}{publisher} + \btxperiod + } +\stoptexdefinition + +\disablemode[btx:apa:edited-book] % hm, ugly + +\starttexdefinition btx:apa:author-and-year + \btxdoif {author} { + \btxflushauthor{author} + } + \texdefinition{btx:apa:suffixedyear}{} + \btxperiod +\stoptexdefinition + +\starttexdefinition btx:apa:author-or-key-and-year + \btxdoifelse {author} { + \btxflushauthor{author} } { - \btxdoif {crossref} { - \btxlbracket - \btxsetup{btx:format:crossref} - \btxrbracket - } - \btxdoif {chapter} { - \btxcomma - \btxflush{chapter} + \btxdoif {key} { + \btxleftbracket + \btxsetup{btx:format:key} + \btxrightbracket } - \btxspace - \texdefinition{btx:apa:pages:pages} } - \texdefinition{btx:apa:note} -\stopsetups + \texdefinition{btx:apa:suffixedyear}{} + \btxperiod +\stoptexdefinition -\startsetups btx:apa:inproceedings - \texdefinition{btx:apa:author-and-year} - \btxdoif {arttitle} { - %btxflush{converters.Word -> arttitle} - \btxflush{Word -> arttitle} - \btxperiod - } - \btxlabeltext{apa:In} - \btxspace - \btxdoifelse {title} { - \btxdoif {editor} { - \btxflush{btx:apa:format:editors} +\starttexdefinition btx:apa:author-editors-crossref-year + % TODO: if there is no author or editor, then use publisher... + \btxdoifelse {author} { + \btxflushauthor{author} + } { + \btxdoifelse {editor} { + \setmode{btx:apa:edited-book} + \btxflushauthor{editor} \btxcomma \btxsingularplural {editor} { - \btxlabeltext{apa:editor} + \btxlabeltext{apa:Editor} } { - \btxlabeltext{apa:editors} + \btxlabeltext{apa:Editors} } - \btxcomma - } - %texdefinition{btx:apa:italic}{converters.Word -> title} - \texdefinition{btx:apa:italic}{Word -> title} - \btxdoif {series} { - \btxdoif {volume} { - \btxcomma - \btxlabeltext{apa:number} - \btxspace - \btxflush{crossref} - \btxflush{volume} - \btxspace - \btxlabeltext{apa:in} + } { + % weird period + \btxdoif {crossref} { + \btxleftbracket + \btxsetup{btx:format:crossref} + \btxrightbracket + \btxperiod } - \btxspace - \btxflush{series} } - \btxdoif {chapter} { - \btxcomma - \btxflush{chapter} - \btxspace + } + \texdefinition{btx:apa:suffixedyear}{} + \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} } - \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 + \btxdoif {key} { + \btxleftbracket + \btxsetup{btx:format:key} + \btxrightbracket } - \texdefinition{btx:apa:pages:pages} + } + \texdefinition{btx:apa:suffixedyear}{} + \btxperiod +\stoptexdefinition + +\starttexdefinition btx:apa:pages + \btxdoif {pages} { + \btxspace + \btxflush{pages} \btxperiod } - \texdefinition{btx:apa:note} -\stopsetups +\stoptexdefinition -\startsetups btx:apa:proceedings - \texdefinition{btx:apa:editor-or-key-and-year} - \btxdoif {title} { - %texdefinition{btx:apa:italic}{converters.Word -> title} - \texdefinition{btx:apa:italic}{Word -> title} - \btxdoif {volume} { - \btxcomma - \btxlabeltext{apa:number} - \btxspace - \btxflush{volume} - \btxspace - \btxlabeltext{apa:in} - \btxspace - } - \btxdoif {chapter} { - \btxcomma - \btxflush{chapter} - \btxspace +\starttexdefinition btx:apa:pages:p + \btxdoif {pages} { + \btxspace + \btxoneorrange {pages} { + \btxlabeltext{apa:p} + } { + \btxlabeltext{apa:pp} } - \texdefinition{btx:apa:pages:pages} \btxperiod - \texdefinition{btx:apa:wherefrom}{organization} + \btxnbsp + \btxflush{pages} + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:pages:pp + \btxdoif {pages} { + \btxspace + \btxflush{pages} + \btxnbsp + \btxlabeltext{apa:pp} + \btxperiod + } +\stoptexdefinition + +% this does not seem to comply with APA style - need to verify! + +\starttexdefinition btx:apa:pages:pages + \btxdoif {pages} { + \btxcomma + \btxlabeltext{apa:pages} + \btxnbsp + \btxflush{pages} + \btxperiod + } +\stoptexdefinition + +\starttexdefinition btx:apa:edition:sentence + \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:book +% \texdefinition{btx:apa:author-editors-crossref-year} +% \btxdoif {title} { +% %texdefinition{btx:apa:italic}{converters.Word -> title} +% \texdefinition{btx:apa:italic}{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} +% \btxleftbracket +% \btxsetup{btx:format:crossref} +% \btxrightbracket +% } { +% \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:pp}% twice? +% \texdefinition{btx:apa:url-note-doi} +%\stopsetups + +%\startsetups btx:apa:inbook +% \texdefinition{btx:apa:author-editors-crossref-year} +% \btxdoifelse {title} { +% %texdefinition{btx:apa:italic}{converters.Word -> title} +% \texdefinition{btx:apa:italic}{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} +% \btxleftbracket +% \btxsetup{btx:format:crossref} +% \btxrightbracket +% } { +% \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} { +% \btxleftbracket +% \btxsetup{btx:format:crossref} +% \btxrightbracket +% } +% } { +% \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 + +% A work that is printed and bound, but without a named publisher or sponsoring institution. +% Required field: title. +% Optional fields: author, howpublished, address, month, year, note. + +\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 -\starttexdefinition btx:apa:thesis - \texdefinition{btx:apa:author-and-year} +% Technical documentation. +% Required field: title. +% Optional fields: author, organization, address, edition, month, year, note. + +\startsetups btx:apa:manual + \texdefinition{btx:apa:author-or-key-and-year} \texdefinition{btx:apa:title-it-and-series} - \btxdoifelse {type} { - \btxflush{type} - } { - \btxlabeltext{apa:\currentbtxcategory} - } - \texdefinition{btx:apa:wherefrom}{school} + \texdefinition{btx:apa:edition:sentence} + \texdefinition{btx:apa:wherefrom}{organization} \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:incollection +% \texdefinition{btx:apa:author-and-year} +% \btxdoifelse {arttitle} { +% %btxflush{converters.Word -> arttitle} +% \btxflush{Word -> arttitle} +% \btxperiod +% } { +% \btxdoif {title} { +% %btxflush{converters.Word -> title} +% \btxflush{Word -> title} +% \btxperiod +% } +% } +% \btxlabeltext{apa:In} +% \btxspace +% \btxdoifelse {booktitle} { +% \btxdoif {editor} { +% \btxflushauthor{editor} +% \btxcomma +% } +% %texdefinition{btx:apa:italic}{converters.Word -> booktitle} +% \texdefinition{btx:apa:italic}{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} { +% \btxleftbracket +% \btxsetup{btx:format:crossref} +% \btxrightbracket +% } +% \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} +% \btxflush{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} +% \texdefinition{btx:apa:italic}{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} { +% \btxleftbracket +% \btxsetup{btx:format:crossref} +% \btxrightbracket +% } +% \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} +% \texdefinition{btx:apa:italic}{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 + +% A report published by a school or other institution, usually numbered within a series. +% Required fields: author, title, institution, year. +% Optional fields: type, number, address, month, note. \startsetups btx:apa:techreport \texdefinition{btx:apa:author-and-year} @@ -928,8 +1401,7 @@ \btxcomma \texdefinition{btx:apa:wherefrom}{institution} \texdefinition{btx:apa:pages:p} - \texdefinition{btx:apa:doi-or-url} - \texdefinition{btx:apa:note} + \texdefinition{btx:apa:url-note-doi} \stopsetups \startsetups btx:apa:patent @@ -953,6 +1425,10 @@ \texdefinition{btx:apa:note} \stopsetups +% Use this type when nothing else fits. +% Required fields: none. +% Optional fields: author, title, howpublished, month, year, note. + \startsetups btx:apa:misc \texdefinition{btx:apa:author-and-year} \texdefinition{btx:apa:title-and-series} @@ -961,27 +1437,37 @@ \texdefinition{btx:apa:note} \stopsetups +% A document having an author and title, but not formally published. +% Required fields: author, title, note. +% Optional fields: month, year. + \startsetups btx:apa:unpublished \texdefinition{btx:apa:author-and-year} \texdefinition{btx:apa:title-and-series} \texdefinition{btx:apa:pages:p} \btxdoif {type} { - \btxlparenthesis + \btxleftparenthesis \btxflush{type} - \btxrparenthesis + \btxrightparenthesis } \texdefinition{btx:apa:note} \stopsetups +% If all else fails to match: + +\startsetups btx:apa:literal + \btxdoif {text} { + \btxflush{text} + } +\stopsetups + %D Experiment: \startsetups btx:apa:lefttext \currentbtxlefttext - \enspace \stopsetups \startsetups btx:apa:righttext - \enspace \currentbtxrighttext \stopsetups diff --git a/tex/context/base/publ-imp-author.mkvi b/tex/context/base/publ-imp-author.mkvi index 3f344e86b..dfae44af0 100644 --- a/tex/context/base/publ-imp-author.mkvi +++ b/tex/context/base/publ-imp-author.mkvi @@ -33,18 +33,23 @@ % \currentbtxjuniors : \btxauthorfield{juniors} \startsetups \s!btx:\s!cite:\s!author:concat - \ifcase\currentbtxconcat \or \or + \ifcase\currentbtxoverflow + \ifcase\currentbtxconcat \or \or + \btxcitevariantparameter\c!namesep + \or + \btxcitevariantparameter\c!lastnamesep + \or + \btxcitevariantparameter\c!finalnamesep + \fi + \else \btxcitevariantparameter\c!namesep - \or - \btxcitevariantparameter\c!lastnamesep - \or - \btxcitevariantparameter\c!finalnamesep \fi \stopsetups \startsetups \s!btx:\s!cite:\s!author:others \ifcase\currentbtxoverflow \else - \btxcitevariantparameter\c!others + \btxspace + \btxcitevariantparameter\c!otherstext \fi \stopsetups @@ -146,19 +151,23 @@ \currentbtxsurnames \fastsetup{\s!btx:\s!cite:\s!author:others} \else - \fastsetup{\s!btx:\s!list:\s!author:normal} + \fastsetup{\s!btx:\s!list:\s!author:normal} \fi \stopsetups % list (mostly the same) \startsetups \s!btx:\s!list:\s!author:concat - \ifcase\currentbtxconcat \or \or + \ifcase\currentbtxoverflow + \ifcase\currentbtxconcat \or \or + \btxlistvariantparameter\c!namesep + \or + \btxlistvariantparameter\c!lastnamesep + \or + \btxlistvariantparameter\c!finalnamesep + \fi + \else \btxlistvariantparameter\c!namesep - \or - \btxlistvariantparameter\c!lastnamesep - \or - \btxlistvariantparameter\c!finalnamesep \fi \stopsetups diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 01b0b9653..65231a09a 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -331,7 +331,7 @@ % \let\btxsetdataset\setbtxdataset % \let\btxsetentry \setbtxentry -% todo: no need for the currents as we can keep them at the lua end so we will haqve +% todo: no need for the currents as we can keep them at the lua end so we will have % % \btxfield : current % \btxspecificfield : dataset,tag,key @@ -352,19 +352,23 @@ %D Rendering. -\unexpanded\def\btxspace {\removeunwantedspaces\space} -\unexpanded\def\btxnobreakspace{\removeunwantedspaces\nobreakspace} % these two are the -\unexpanded\def\btxnbsp {\removeunwantedspaces\nbsp} % same anyway -\unexpanded\def\btxperiod {\removeunwantedspaces.\space} -\unexpanded\def\btxcomma {\removeunwantedspaces,\space} -\unexpanded\def\btxcolon {\removeunwantedspaces:\space} -\unexpanded\def\btxsemicolon {\removeunwantedspaces;\space} -\unexpanded\def\btxlparent {\removeunwantedspaces\space(} % obsolete -\unexpanded\def\btxrparent {\removeunwantedspaces)\space} % obsolete -\unexpanded\def\btxlparenthesis{\removeunwantedspaces\space(} -\unexpanded\def\btxrparenthesis{\removeunwantedspaces)\space} -\unexpanded\def\btxlbracket {\removeunwantedspaces\space[} -\unexpanded\def\btxrbracket {\removeunwantedspaces]\space} +\unexpanded\def\btxspace {\removeunwantedspaces\space} +\unexpanded\def\btxnobreakspace {\removeunwantedspaces\nobreakspace} % these two are +\unexpanded\def\btxnbsp {\removeunwantedspaces\nbsp} % the same anyway +\unexpanded\def\btxperiod {\removeunwantedspaces.\space} +\unexpanded\def\btxcomma {\removeunwantedspaces,\space} +\unexpanded\def\btxcolon {\removeunwantedspaces:\space} +\unexpanded\def\btxsemicolon {\removeunwantedspaces;\space} +\unexpanded\def\btxlparent {\removeunwantedspaces\space(} % obsolete +\unexpanded\def\btxrparent {\removeunwantedspaces)\space} % obsolete +\unexpanded\def\btxleftparenthesis {\removeunwantedspaces\space(} +\unexpanded\def\btxrightparenthesis {\removeunwantedspaces)\space} +\unexpanded\def\btxrightparenthesisperiod{\removeunwantedspaces).\space} +\unexpanded\def\btxrightparenthesiscomma {\removeunwantedspaces),\space} +\unexpanded\def\btxleftbracket {\removeunwantedspaces\space[} +\unexpanded\def\btxrightbracket {\removeunwantedspaces]\space} +\unexpanded\def\btxrightbracketperiod {\removeunwantedspaces].\space} +\unexpanded\def\btxrightbracketcomma {\removeunwantedspaces],\space} %D Variables: @@ -1281,7 +1285,7 @@ % \c!setups=btx:cite:initialize, \c!alternative=num, \c!authorconversion=\v!normal, - \c!andtext={ \btxlabeltext{\currentbtxalternative:and} }, + % \c!andtext={ \btxlabeltext{\currentbtxalternative:and} }, \c!otherstext={ \btxlabeltext{\currentbtxalternative:others}}, \c!pubsep={, }, \c!lastpubsep={ \btxlabeltext{\currentbtxalternative:and} }, @@ -1347,6 +1351,10 @@ \c!middle={, }, % is middle used? \c!right={)}] +\definebtxcitevariant + [title] + [\c!middle={, }] + \definebtxcitevariant [tag] [\c!left={[}, @@ -1369,6 +1377,10 @@ \c!middle={, }, \c!right={]}] +\definebtxcitevariant + [pages] + [page] + \definebtxcitevariant [short] [\c!left={[}, @@ -1415,7 +1427,7 @@ \c!lastnamesep={ \btxlabeltext{\currentbtxalternative:and} }, \c!finalnamesep={ \btxlabeltext{\currentbtxalternative:and} }, \c!firstnamesep={ }, - \c!andtext={ \btxlabeltext{\currentbtxalternative:and} }, + % \c!andtext={ \btxlabeltext{\currentbtxalternative:and} }, \c!otherstext={ \btxlabeltext{\currentbtxalternative:others}}, \c!juniorsep={ }, \c!vonsep={ }, @@ -1431,7 +1443,6 @@ \definebtxlistvariant [author] - [author=invertedshort] % we could also do this in the apa style itself \definebtxlistvariant [editor] diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index b0a25a492..6025bdecb 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 4670bcc59..5005381c5 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ -- cgit v1.2.3