summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-06-24 03:01:47 +0000
committerNorbert Preining <norbert@preining.info>2022-06-24 03:01:47 +0000
commit1ef4c041ba74d4619dd62209ae48a2b24563954c (patch)
treeb45a2e8da583a0f219e75f9536d9696f9af2aca7 /macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
parent00e67dfd87c53faeafcf0c9e66c8c2c7a410fcb8 (diff)
CTAN sync 202206240301
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx')
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx251
1 files changed, 153 insertions, 98 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
index 5523f83e17..ee19f6dd0a 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-apa/apa.bbx
@@ -12,7 +12,7 @@
%%
%% The Current Maintainer of this work is Philip Kime.
-\ProvidesFile{apa.bbx}[2021/12/24\space v9.15\space APA biblatex references style]
+\ProvidesFile{apa.bbx}[2022/06/22\space v9.16\space APA biblatex references style]
\RequireBiber[3]
\RequireBibliographyStyle{standard}
\urlstyle{same} % APA examples all have URLs in same font as text
@@ -157,37 +157,41 @@
or test {\ifentrytype{legal}}
or ( test {\ifentrytype{legadminmaterial}} and
test {\ifkeyword{proposed}} ) }
- {\printtext{%
- \mkbibdateapalongmdy{#1year}{#1month}{#1day}%
+ {\printtext[#1date]{%
+ \mkbibdateapalongmdy{#1year}{#1yeardivision}{#1month}{#1day}%
\iffieldundef{#1endyear}%
{}%
{\iffieldequalstr{#1endyear}{}% open-ended range?
{\bibdatedash\bibstring{present}}
- {\bibdatedash%
- \iffieldsequal{#1year}{#1endyear}%
- {\iffieldsequal{#1month}{#1endmonth}%
- {\iffieldsequal{#1day}{#1endday}%
- {}%
- {\mkbibdateapalongmdy{}{}{#1endday}}}%
- {\mkbibdateapalongmdy{}{#1endmonth}{#1endday}}}%
- {\mkbibdateapalongmdy{#1endyear}{#1endmonth}{#1endday}}}}%
+ {\iffieldundef{#1endyeardivision}
+ {\bibdatedash%
+ \iffieldsequal{#1year}{#1endyear}%
+ {\iffieldsequal{#1month}{#1endmonth}%
+ {\iffieldsequal{#1day}{#1endday}%
+ {}%
+ {\mkbibdateapalongmdy{}{}{}{#1endday}}}%
+ {\mkbibdateapalongmdy{}{}{#1endmonth}{#1endday}}}%
+ {\mkbibdateapalongmdy{#1endyear}{#1endyeardivision}{#1endmonth}{#1endday}}}}
+ {\addslash\mkbibdateapalongmdy{}{#1endyeardivision}{}{}}}%
\dateuncertainprint}}
{\printtext{%
- \mkbibdateapalong{#1year}{#1month}{#1day}%
+ \mkbibdateapalong{#1year}{#1yeardivision}{#1month}{#1day}%
\dateeraprint{#1year}%
\iffieldundef{#1endyear}%
{}%
{\iffieldequalstr{#1endyear}{}% open-ended range?
{\bibdatedash\bibstring{present}}
- {\bibdatedash%
- \iffieldsequal{#1year}{#1endyear}%
- {\iffieldsequal{#1month}{#1endmonth}%
- {\iffieldsequal{#1day}{#1endday}%
- {}%
- {\mkbibdateapalong{}{}{#1endday}}}%
- {\mkbibdateapalong{}{#1endmonth}{#1endday}}}%
- {\mkbibdateapalong{#1endyear}{#1endmonth}{#1endday}%
- \dateeraprint{#1endyear}}}%
+ {\iffieldundef{#1endyeardivision}
+ {\bibdatedash%
+ \iffieldsequal{#1year}{#1endyear}%
+ {\iffieldsequal{#1month}{#1endmonth}%
+ {\iffieldsequal{#1day}{#1endday}%
+ {}%
+ {\mkbibdateapalong{}{}{}{#1endday}}}%
+ {\mkbibdateapalong{}{}{#1endmonth}{#1endday}}}%
+ {\mkbibdateapalong{#1endyear}{#1endyeardivision}{#1endmonth}{#1endday}%
+ \dateeraprint{#1endyear}}}
+ {\addslash\mkbibdateapalongmdy{}{#1endyeardivision}{}{}}}%
\enddateuncertainprint}}}}%
\endgroup}
@@ -196,24 +200,26 @@
\begingroup
\blx@metadateinfo{#1}%
\iffieldundef{#1year}{}
- {\printtext{%
+ {\printtext[#1date]{%
\datecircaprint
- \mkbibdateapalongextra{#1year}{#1month}{#1day}%
+ \mkbibdateapalongextra{#1year}{#1yeardivision}{#1month}{#1day}%
\dateeraprint{#1year}%
\dateuncertainprint
\iffieldundef{#1endyear}%
{}%
{\iffieldequalstr{#1endyear}{}% open-ended range?
{\bibdatedash\bibstring{present}}
- {\bibdatedash%
- \iffieldsequal{#1year}{#1endyear}%
- {\iffieldsequal{#1month}{#1endmonth}%
- {\iffieldsequal{#1day}{#1endday}%
- {}%
- {\mkbibdateapalongextra{}{}{#1endday}}}
- {\mkbibdateapalongextra{}{#1endmonth}{#1endday}}}
- {\mkbibdateapalongextra{#1endyear}{#1endmonth}{#1endday}%
- \dateeraprint{#1endyear}}}%
+ {\iffieldundef{#1endyeardivision}
+ {\bibdatedash%
+ \iffieldsequal{#1year}{#1endyear}%
+ {\iffieldsequal{#1month}{#1endmonth}%
+ {\iffieldsequal{#1day}{#1endday}%
+ {}%
+ {\mkbibdateapalongextra{}{}{}{#1endday}}}
+ {\mkbibdateapalongextra{}{}{#1endmonth}{#1endday}}}
+ {\mkbibdateapalongextra{#1endyear}{#1endyeardivision}{#1endmonth}{#1endday}%
+ \dateeraprint{#1endyear}}}
+ {\addslash\mkbibdateapalongmdy{}{#1endyeardivision}{}{}}}%
\enddateuncertainprint}}}%
\endgroup}
@@ -226,8 +232,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (APA 8.12) sort citations
-% (APA 8.17) More than two authors is truncated to one but overriden for list ambiguity to
-% point of no ambiguity
+% (APA 8.17,8.18) More than two authors is truncated to one but overriden for list ambiguity to
+% point of no ambiguity but only when same year.
% (APA 8.20) Use initials to disambiguate shared surnames
% (APA 8.19) Use year postfix to disambiguate multiple items in same year
% (APA 9.44, 9.46, 9.47) Sorting is nyt but we need to account for PUBSTATE which comes
@@ -236,6 +242,25 @@
% (APA Figure 9.2) Sorting ignores punctuation in names
% (APA 9.47) Ignore "The", "An" and "A" when sorting titles
+% Used for sorting citations with biblatex option "sortcites" as this needs to use
+% the silly APA standards for name list visibility (8.17, 8.18) in cites which differs from the reference list.
+\DeclareSortingNamekeyTemplate[apasortcite]{
+ \visibility{cite}
+ \keypart{
+ \namepart[use=true]{prefix}
+ \namepart{family}
+ }
+ \keypart{
+ \namepart{given}
+ }
+ \keypart{
+ \namepart{suffix}
+ }
+ \keypart{
+ \namepart[use=false]{prefix}
+ }
+}
+
\DeclareNosort{
\nosort{setnames}{\regexp{\p{General_Category=Punctuation}}}
\nosort{settitles}{\regexp{\A(?:The|An|A)\s+}}
@@ -322,6 +347,7 @@
maxitems=999,%
origdate=apalong,%
pagetracker=true,%
+ pluralothers=true,%
sortcites=true,%
sorting=apa,%
uniquelist=minyear,%
@@ -332,7 +358,35 @@
usetranslator=true,%
usenarrator=true}
+
+% It's not completely obvious but it's implied that names identical apart from a suffix
+% are to be treated as different name lists for extradate calculation so we add suffix
+% to the default definition
+\DeclareUniquenameTemplate{
+ \namepart[use=true, base=true]{prefix}
+ \namepart[base=true]{family}
+ \namepart{given}
+ \namepart{suffix}
+}
+
+% Force, in every refsection, the generation of refcontext data with a
+% sorting name key template which works for citation sorting with sortcites. This
+% would not be generated in the .bcf otherwise and therefore no sorted list
+% with this sorting name key tenplate would generated in teh .bbl by biber because no
+% \printbibliography would be executed in this context since it is only
+% used for sorting of citations truncated to one name as per 8.17/8.18.
%
+% Two things needs to happen in general:
+% 1. Generate the refcontext sorted data list in the .bbl (biber) which requires a datalist
+% section in the .bcf. This latter is done by \printbibliography/\printbiblist or \GenRefcontextData
+% when no \printbibliography/\printbiblist is done in the refcontext
+% 2. Switch to the relevant refcontext at the right time in order to pull the date from the
+% correct data list (\newrefcontext/\begin{refcontext})
+\AtBeginRefsection{\GenRefcontextData{sortingnamekeytemplatename=apasortcite}}
+% Switch to the reference context using citation visibility setting for sorting of citations
+\AtEveryCite{\localrefcontext[sortingnamekeytemplatename=apasortcite]}
+
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Enforce ignoring of PUBSTATE if there is a YEAR or DATE field
@@ -367,6 +421,7 @@
\map{
\pertype{inproceedings}
\step[notfield=editor, final]
+ \step[notfield=crossref, final]% A bit suspect but assuming that any crossref contains EDITOR
\step[fieldsource=booktitle, fieldtarget=journaltitle]
\step[typesource=inproceedings, typetarget=article]
}
@@ -427,7 +482,7 @@
\DeclareFieldFormat{maintitleaddon}{\mkbibbrackets{\bbx@colon@search\MakeSentenceCase*{#1}}}
% NOTE
-\DeclareFieldFormat[legmaterial,legadminmaterial]{note}{\mkbibparens{#1}}
+\DeclareFieldFormat[legmaterial,legadminmaterial,report]{note}{\mkbibparens{#1}}
% BOOKTITLEADDON
\DeclareFieldFormat{booktitleaddon}{\mkbibbrackets{\bbx@colon@search\MakeSentenceCase*{#1}}}
@@ -451,7 +506,6 @@
\DeclareFieldFormat{volumes}{\bibcpstring{volumes}~#1}
% CHAPTER
-
\DeclareFieldFormat{chapter}{\bibcpstring{chapter}~\apanum{#1}}
% NUMBER
@@ -467,7 +521,8 @@
\ifthenelse{%
\iffieldequalstr{type}{report}\OR%
\iffieldequalstr{type}{execorder}}{\bibcpstring{number}~\apanum{#1}}{\apanum{#1}}}
-
+\DeclareFieldFormat[thesis]{number}{%
+ \bibcpstring{publication}\setunit{\addspace}\bibcpstring{number}~\apanum{#1}}
% PAGES
\DeclareFieldFormat{pageswithprefix}{\mkpageprefix[bookpagination]{#1}}
@@ -496,10 +551,6 @@
\DeclareFieldFormat[dataset,software]{version}{\bibcpstring{version}~#1}
\DeclareFieldFormat[online]{version}{\mkbibparens{#1}}
-% URL
-\DeclareFieldFormat{url}{\url{#1}}
-\DeclareFieldFormat{urldate}{#1}
-
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -522,16 +573,6 @@
% to do \printnames[format][-\value{listtotal}]{field} to ensure we get
% all of the names in the list to work on
-% It's not completely obvious but it's implied that names identical apart from a suffix
-% are to be treated as different name lists for extradate calculation so we add suffix
-% to the default definition
-\DeclareUniquenameTemplate{
- \namepart[use=true, base=true]{prefix}
- \namepart[base=true]{family}
- \namepart{given}
- \namepart{suffix}
-}
-
\DeclareNameAlias{default}{apaauthor}
\DeclareNameFormat{apaauthor}{%
@@ -575,7 +616,7 @@
{}}
\DeclareDelimFormat[bib,biblist]{nameyeardelim}{\newunitpunct}
-\DeclareDelimAlias*[bib,biblist]{nonameyeardelim}{nameyeardelim}
+\DeclareDelimAlias[bib,biblist]{nonameyeardelim}{nameyeardelim}
\renewbibmacro*{author/editor}{%
\ifnameundef{author}
@@ -730,7 +771,8 @@
\setunit{\subtitlepunct}%
\printfield[apacase]{subtitle}}}%
\setunit{\addspace}%
- \ifentrytype{inbook}{}{\usebibmacro{addinfo1}}% additional info in parens
+ \ifthenelse{\ifentrytype{inbook}\OR\ifentrytype{thesis}}{}{\usebibmacro{addinfo1}}% additional info in parens
+ \ifentrytype{thesis}{\usebibmacro{addinfo3}}{}%
\setunit{\addspace}%
\printfield{titleaddon}%
\setunit{\addspace}%
@@ -743,7 +785,6 @@
\printfield{edition}%
\setunit*{\addcomma\addspace}%
\ifthenelse{\ifentrytype{report}\OR%
- \ifentrytype{thesis}\OR%
\ifentrytype{unpublished}\OR%
\ifentrytype{dataset}\OR%
\ifentrytype{software}\OR%
@@ -753,9 +794,9 @@
\setunit*{\addcomma\addspace}%
\ifentrytype{inbook}{\printfield{pages}}{}%
\setunit*{\addcomma\addspace}%
- \ifentrytype{book}{\printfield{volumes}}{}%
+ \ifthenelse{\ifentrytype{book}\OR\ifentrytype{inbook}}{\printfield{volumes}}{}%
\setunit*{\addcomma\addspace}%
- \ifentrytype{book}{\printfield{volume}}{}}}
+ \ifthenelse{\ifentrytype{book}\OR\ifentrytype{inbook}}{\printfield{volume}}{}}}
% Additional post title information in brackets unless it's the meta subtype "nonacademic"
% which is used to conditionalise date formats in the .lbx files
@@ -767,22 +808,33 @@
{\bibcplstring{\thefield{entrysubtype}}}
{\printfield{entrysubtype}}}%
\setunit*{\addsemicolon\addspace}%
- \printfield{note}}}
+ \ifentrytype{report}{}{\printfield{note}}}}
% number/issue information
\newbibmacro*{addinfo3}{%
- \iffieldundef{type}
- {\iffieldundef{issue}
- {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}
- {\printfield{issue}\setunit{\addspace}%
- \iffieldundef{number}
+ \ifentrytype{thesis}
+ {\iffieldundef{number}
+ {}
+ {\printtext[parens]{\printfield{number}}}%
+ \setunit{\addspace}%
+ \iffieldundef{type}
+ {}
+ {% Inconsistent - standard thesis types have institution inside the brackts, manual types outside ...
+ \ifthenelse{\iffieldequalstr{type}{phdthesis}\OR\iffieldequalstr{type}{mathesis}}
+ {\printtext[brackets]{\printfield{type}\setunit*{\addcomma\addspace}\printlist{institution}}}
+ {\printtext[brackets]{\printfield{type}}\setunit*{\adddot\addspace}\printlist{institution}}}}
+ {\iffieldundef{type}
+ {\iffieldundef{issue}
+ {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}
+ {\printfield{issue}\setunit{\addspace}%
+ \iffieldundef{number}
{}
{\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}}}
- {\printfield{type}\setunit{\addspace}%
- \iffieldundef{number}
- {}
- {\iffieldnums{number}{\bibcpstring{number}~}{}\printfield{number}}}%
- \ifthenelse{\ifentrytype{dataset}\OR\ifentrytype{software}}
+ {\printfield{type}\setunit{\addspace}%
+ \iffieldundef{number}
+ {}
+ {\bibcpstring{number}~\printfield{number}}}}% Inconsistent - numbers after type aren't necessarily numbers ...
+ \ifthenelse{\ifentrytype{dataset}\OR\ifentrytype{software}}
{\setunit*{\addsemicolon\addspace}%
\printfield{version}}
{}}
@@ -1284,7 +1336,9 @@
{\usebibmacro{in}%
\printnames[apanames][-\value{listtotal}]{execproducer}%
\setunit{\addspace}%
- \bibcplstring[\mkbibparens]{execproducers}%
+ \ifthenelse{\the\c@execproducer=1}%
+ {\bibcplstring[\mkbibparens]{execproducer}}
+ {\bibcplstring[\mkbibparens]{execproducers}}%
\setunit{\addcomma\addspace}%
\printfield{maintitle}}}
@@ -1383,24 +1437,22 @@
\settoggle{bbx:annotation}{#1}}
\ExecuteBibliographyOptions{annotation=true}
+\long\def\blxapa@appunit#1{%
+ \iftoggle{blx@keepunit}
+ {}
+ {\gappto\blx@unitpunct{#1}%
+ \global\toggletrue{blx@unit}}}
+
\renewbibmacro*{annotation}{%
- \ifboolexpr{test {\iffieldundef{annotation}}
- or not togl {bbx:annotation}}
- {\IfFileExists{\bibannotationprefix\thefield{entrykey}.tex}
- {\begingroup
- \togglefalse{blx@bibliography}%
- \newline
- \setunit{}%
- \printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}%
- \endgroup}
- {}}
+ \iftoggle{bbx:annotation}
{\begingroup
\togglefalse{blx@bibliography}%
- \newline
- \setunit{}%
- \printfield{annotation}%
- \endgroup}}
-
+ \blxapa@appunit{\newline}%
+ \iffieldundef{annotation}
+ {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}
+ {\printfield{annotation}}%
+ \endgroup}
+ {}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1904,6 +1956,8 @@
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\setunit{\addspace}\newblock
+ \printfield{note}%
+ \setunit{\addspace}\newblock
\usebibmacro{apa:related}%
\newunit\newblock
\printlist{institution}%
@@ -1951,8 +2005,6 @@
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit\newblock
- \printlist{institution}%
- \newunit\newblock
\usebibmacro{location+publisher}%
\newunit\newblock
\usebibmacro{doi+url}%
@@ -2066,9 +2118,22 @@
-%(APA 9.35) No periods after URLS
+%(APA 9.35) No periods after URLS and DOIs
% we'll override a global url option for for @online entries
\ExecuteBibliographyOptions[online]{url=true}
+
+\DeclareFieldFormat{doi}{%
+ \ifhyperref
+ {\href{https://doi.org/#1}{\nolinkurl{https://doi.org/#1}}}
+ {\nolinkurl{https://doi.org/#1}}%
+ \nopunct}
+
+\DeclareFieldFormat{url}{\url{#1}\nopunct}
+
+\DeclareFieldFormat{urldate}{%
+ \bibstring{retrieved}\space#1%
+ \urldatecomma\bibstring{from}}
+
\newbibmacro*{doi+url}{%
\ifboolexpr{ test {\iffieldundef{doi}}
or not togl {bbx:doi}}
@@ -2078,7 +2143,6 @@
{\usebibmacro{url+urldate}%
\setunit{\addspace}}}
{\printfield{doi}%
- \renewcommand*{\finentrypunct}{\relax}%
\setunit{\addspace}}}
\renewbibmacro*{url+urldate}{%
@@ -2086,18 +2150,9 @@
{}
{\iffieldundef{urlyear}
{}
- {\bibstring{retrieved}%
- \setunit{\addspace}%
- \printurldate
- \setunit{\urldatecomma}%
- \bibstring{from}%
+ {\printurldate
\setunit{\addspace}}%
- \iffieldundef{url}{}{\printfield{url}\renewcommand*{\finentrypunct}{\relax}}}}
-
-\DeclareFieldFormat{doi}{%
- \ifhyperref
- {\href{https://doi.org/#1}{\nolinkurl{https://doi.org/#1}}}
- {\nolinkurl{https://doi.org/#1}}}
+ \printfield{url}}}
\newbibmacro*{location+publisher}{%
\printlist{location}%