summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex/latex/biblatex.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/biblatex/latex/biblatex.sty')
-rw-r--r--macros/latex/contrib/biblatex/latex/biblatex.sty2800
1 files changed, 1524 insertions, 1276 deletions
diff --git a/macros/latex/contrib/biblatex/latex/biblatex.sty b/macros/latex/contrib/biblatex/latex/biblatex.sty
index 775d3ecfb3..e48b124277 100644
--- a/macros/latex/contrib/biblatex/latex/biblatex.sty
+++ b/macros/latex/contrib/biblatex/latex/biblatex.sty
@@ -12,8 +12,8 @@
% particular purpose.
% Set up the version strings here
-\def\abx@date{2019/12/01}
-\def\abx@version{3.14}
+\def\abx@date{2020/08/19}
+\def\abx@version{3.15}
\def\abx@bbxid{\abx@date\space v\abx@version\space biblatex bibliography style (PK/MW)}
\def\abx@cbxid{\abx@date\space v\abx@version\space biblatex citation style (PK/MW)}
\def\abx@lbxid{\abx@date\space v\abx@version\space biblatex localization (PK/MW)}
@@ -53,6 +53,39 @@
\endinput}
+% generalised keyval interface
+% define a new key (possibly with a default value)
+% {<family>}{<key>}[<default>]{<code>}
+\providerobustcmd*{\blx@kv@defkey}{\define@key}
+
+% globally define new key (should only be the last resort)
+% {<family>}{<key>}[<default>]{<code>}
+\providerobustcmd*{\blx@kv@gdefkey}[2]{%
+ \@ifnextchar[%
+ {\blx@kv@gdefkey@default{#1}{#2}}
+ {\blx@kv@gdefkey@nodefault{#1}{#2}}}
+
+\ifundef\blx@kv@gdefkey@nodefault
+ {\protected\def\blx@kv@gdefkey@nodefault#1#2{\csgdef{KV@#1@#2}##1}}
+ {}
+\ifundef\blx@kv@gdefkey@default
+ {\protected\def\blx@kv@gdefkey@default#1#2[#3]{%
+ \csgdef{KV@#1@#2@default}{\csuse{KV@#1@#2}{#3}}%
+ \csgdef{KV@#1@#2}##1}}
+ {}
+
+% test if key is undefined
+% {<family>}{<key>}{<true>}{<false>}
+\providecommand*{\blx@kv@ifkeyundef}[2]{%
+ \ifcsundef{KV@#1@#2}}
+
+% undefine key
+% {<family>}{<key>}
+\providerobustcmd*{\blx@kv@undef}[2]{\csundef{KV@#1@#2}}
+
+% {<family>}{<key-vals>}
+\providerobustcmd*{\blx@kv@setkeys}{\setkeys}
+
%% Category codes
\def\blx@docatcodes{%
@@ -180,12 +213,12 @@
{'polyglossia' loaded after biblatex}
{'polyglossia' must be loaded before biblatex}}
{}%
- \@ifpackagelater{polyglossia}{2019/10/27}
+ \@ifpackagelater{polyglossia}{2020/04/08}
{}
{\blx@warning@noline
- {biblatex works best with 'polyglossia' 1.45\MessageBreak
+ {biblatex works best with 'polyglossia' 1.49\MessageBreak
or above.\MessageBreak
- Please update 'polyglossia' to v1.45 (2019/10/27)\MessageBreak
+ Please update 'polyglossia' to v1.49 (2020/04/08)\MessageBreak
or later.\MessageBreak
Variant detection will not work properly with\MessageBreak
older versions}}}
@@ -361,11 +394,19 @@
{}}
{}}
{}%
- \apptocmd\@floatboxreset
- {\boolfalse{citetracker}%
- \boolfalse{pagetracker}}
+ \iftoggle{blx@trackfloats}
{}
- {\blx@err@patch{floats}}%
+ {\apptocmd\@floatboxreset
+ {\boolfalse{citetracker}%
+ \boolfalse{pagetracker}}
+ {}
+ {\blx@err@patch{floats}}}%
+ \iftoggle{blx@backreffloats}
+ {}
+ {\apptocmd\@floatboxreset
+ {\boolfalse{backtracker}}
+ {}
+ {\blx@err@patch{floats}}}%
\ifdef\TX@endtabularx % tabularx/memoir
{\pretocmd\TX@endtabularx
{\addtocounter{tabx@nest}{1}}% track nested tabularx environments
@@ -501,8 +542,13 @@
\iftoggle{blx@autolangcite}
{\let\blx@beglangcite\blx@beglang}
{}%
+ % babel/polyglossia has loaded the (main document) language already,
+ % so we need to explicitly enable our captions (abx@strings@)
+ % and extras (abx@extras@) now
+ \toggletrue{blx@lang@captions@\blx@languagename}%
\csuse{abx@extras@\blx@languagename}%
\csuse{abx@strings@\blx@languagename}%
+ % avoid accidental re-initialization
\undef\blx@mkautolangbabel
\undef\blx@mkautolangpoly
\undef\blx@mknoautolang
@@ -515,26 +561,35 @@
{}%
}
+% our copy of \addtocontents with \immediate (not @protected,
+% so a bit different, but we are only going to use it for very
+% specific input, so that doesn't matter)
+\def\blx@immediate@addtocontents#1#2{%
+ \blx@auxwrite\@auxout
+ {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
+ {\string\@writefile{#1}{#2}}}
-\begingroup
-\@makeother\#
-% \relax: gobble newline -> titletoc.sty
-\AtEndPreamble{%
- \addtocontents{toc}{%
+\AtBeginDocument{%
+ \blx@immediate@addtocontents{toc}{%
\boolfalse{citerequest}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\boolfalse{backtracker}\relax}%
- \addtocontents{lof}{%
+ \blx@immediate@addtocontents{lof}{%
\boolfalse{citerequest}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\boolfalse{backtracker}\relax}%
- \addtocontents{lot}{%
+ \blx@immediate@addtocontents{lot}{%
\boolfalse{citerequest}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
- \boolfalse{backtracker}\relax}%
+ \boolfalse{backtracker}\relax}}
+
+\begingroup
+\@makeother\#
+% \relax: gobble newline -> titletoc.sty
+\AtEndPreamble{%
\patchcmd\addtocontents
{\string\@writefile}
{\string\@writefile{#1}{\defcounter{refsection}{\the\c@refsection}\relax}%
@@ -543,6 +598,7 @@
{\blx@err@patch{\string\addtocontents}}}
\endgroup
+
% trick hyperref into believing we're natbib
\let\NAT@parse\@empty
% trick showkeys into believing we're havard
@@ -576,10 +632,52 @@
\ifundef\pdf@mdfivesum
{\let\blx@mdfivesum\@firstofone
\blx@warning@noline{Command '\string\pdf@mdfivesum' undefined.\MessageBreak
- 'labelprefix' may not be able to accept all input}}
+ 'labelprefix' may not be able to accept all input.\MessageBreak
+ The command is available (via 'pdftexcmds')\MessageBreak
+ in recent versions of pdfTeX, LuaTeX and XeTeX}}
{\let\blx@mdfivesum\pdf@mdfivesum}
+\ifundef\pdf@filemdfivesum
+ {\blx@warning@noline{Command '\string\pdf@filemdfivesum' undefined.\MessageBreak
+ Biber rerun detection may not work as expected.\MessageBreak
+ The command is available (via 'pdftexcmds')\MessageBreak
+ in recent versions of pdfTeX, LuaTeX and XeTeX}%
+ \let\blx@generate@bbl@mdfivesum@found\relax
+ \let\blx@generate@bbl@mdfivesum@notfound\relax
+ \let\blx@aux@read@bbl@mdfivesum\@gobble
+ \let\blx@aux@write@bbl@mdfivesum\relax
+ \let\blx@check@bbl@rerun@mdfivesum\relax}
+ {\let\blx@filemdfivesum\pdf@filemdfivesum
+
+ \def\blx@generate@bbl@mdfivesum@found{%
+ \xdef\blx@bbl@mdfivesum@new{\blx@filemdfivesum{\jobname.bbl}}}
+
+ \def\blx@generate@bbl@mdfivesum@notfound{%
+ \gdef\blx@bbl@mdfivesum@new{nobblfile}}
+
+ \def\blx@aux@read@bbl@mdfivesum{%
+ \gdef\blx@bbl@mdfivesum@old}
+
+ % If we need Biber to rerun, save the hash of the current .bbl.
+ % That way we can detect if the Biber rerun really happened when
+ % we run LaTeX the next time.
+ \def\blx@aux@write@bbl@mdfivesum{%
+ \iftoggle{blx@runbiber}
+ {\blx@auxwrite\@mainaux{}{%
+ \string\blx@aux@read@bbl@mdfivesum{\blx@bbl@mdfivesum@new}}}
+ {}}
+
+ % There was a Biber rerun request last time (\blx@bbl@mdfivesum@old),
+ % yet the bbl files are the same (as far as md5 hashes are concerned),
+ % that means *no* Biber rerun happened.
+ % So we need to re-request a rerun.
+ \def\blx@check@bbl@rerun@mdfivesum{%
+ \ifdefstrequal\blx@bbl@mdfivesum@old\blx@bbl@mdfivesum@new
+ {\blx@logreq@active{}}
+ {}}}
+
+
% xstring replacements
% reverse a given string
@@ -712,6 +810,7 @@
\newcount\blx@parenlevel@foot
\expandafter\newcount\csname blx@sectionciteorder@0\endcsname
\newcount\blx@entrysetcounter
+\newcount\blx@biblioinstance
\def\blx@uniquename{false}
\def\blx@uniquelist{false}
@@ -1087,10 +1186,15 @@
{\blx@info@noline{Trying to load #2..}%
\IfFileExists{#1}
{\blx@info@noline{... file '#1' found}%
- #3\@@input\@filef@und#4#5%
+ \csuse{blx@filehook@preload@#1}%
+ #3\@@input\@filef@und#4%
+ \csuse{blx@filehook@postload@#1}%
+ #5%
\listxadd\blx@list@req@stat{#1}%
\@addtofilelist{#1}}
- {\blx@info@noline{... file '#1' not found}#6}%
+ {\blx@info@noline{... file '#1' not found}%
+ \csuse{blx@filehook@failure@#1}%
+ #6}%
\global\cslet{blx@file@#1}\@empty}
{#5}}
@@ -1151,21 +1255,23 @@
\detokenize{" xmlns:bcf="https://sourceforge.net/projects/biblatex">}}
% {<true>}{<false>}
-\newrobustcmd*{\lbx@ifutfinput}{\ifboolexpr{%
- test {\ifdefstring\inputencodingname{utf8}}
- or
- test {\ifdefstring\inputencodingname{utf8x}}
- or
- test {\ifdefstring\inputencodingname{lutf8}}
- or
- ( test {\ifundef\inputencodingname}
- and
- ( not test {\ifundef\XeTeXrevision}
- or
- not test {\ifundef\luatexversion}
+\newrobustcmd*{\lbx@ifutfinput}{%
+ \ifboolexpr{%
+ test {\ifdefstring\inputencodingname{utf8}}
+ or
+ test {\ifdefstring\inputencodingname{utf8x}}
+ or
+ test {\ifdefstring\inputencodingname{lutf8}}
+ or
+ ( test {\ifundef\inputencodingname}
+ and
+ ( not test {\ifundef\XeTeXrevision}
+ or
+ not test {\ifundef\luatexversion}
+ )
)
- )
-}}
+ }%
+}
%% More user feedback
\protected\def\blx@warning@entry#1{%
@@ -1320,7 +1426,7 @@
\protected\def\blx@warn@nostring#1{%
\blx@warning@entry{Bibliography string '#1'
- \ifcsundef{KV@blx@lbx@#1}{undefined}{untranslated}}%
+ \blx@kv@ifkeyundef{blx@lbx}{#1}{undefined}{untranslated}}%
\abx@missing{#1}}
\def\blx@warn@conflopt#1{%
@@ -1459,6 +1565,7 @@
\global\toggletrue{blx@runbiber}%
\global\let\blx@rerun@biber\relax}
+
\let\blx@checksum@old\@empty
\let\blx@checksum@new\@empty
\let\blx@pagesum@old\@empty
@@ -1511,14 +1618,10 @@
\endgroup}
\def\blx@warn@auxlist{%
- \begingroup
- \edef\blx@tempa{%
- Please (re)run Biber on the file:\MessageBreak
- \jobname}%
\blx@warning@noline{%
- \blx@tempa\MessageBreak
- and rerun LaTeX afterwards}%
- \endgroup}
+ Please (re)run Biber on the file:\MessageBreak
+ \jobname\MessageBreak
+ and rerun LaTeX afterwards}}
\AfterEndDocument{%
\blx@check@rerun
@@ -1603,6 +1706,12 @@
\sfcode`\?=3002
}
+\def\abx@dosingleaccents{%
+ \do\"\do\'\do\`\do\^\do\~\do\=\do\.%
+ \do\H\do\b\do\c\do\d\do\r\do\u\do\v}
+\def\abx@dodoubleaccents{%
+ \do\t}
+
% Defining characters that count as prefices in names like d'Argent
% Code from moewe
\let\blx@prefchars\@empty
@@ -1909,7 +2018,7 @@
\newrobustcmd*{\autocap}[1]{#1}
\protected\def\blx@imc@autocap{%
- \blx@imc@ifcapital\MakeUppercase\@firstofone}
+ \blx@imc@ifcapital\MakeCapital\@firstofone}
\protected\def\blx@imc@nopunct{%
\leavevmode\spacefactor\blx@sf@nopunct}
@@ -2055,8 +2164,15 @@
\providerobustcmd*{\nohyphenation}{%
\language\blx@langwohyphens}
-\providerobustcmd*{\textnohyphenation}[1]{%
- \bgroup\nohyphenation#1\egroup}
+% work around odd XeTeX/babel-french behaviour
+% https://github.com/plk/biblatex/issues/979
+% fix by Ulrike Fischer
+% https://tex.stackexchange.com/a/544914/
+\ifundef\XeTeXrevision
+ {\providerobustcmd*{\textnohyphenation}[1]{%
+ \bgroup\nohyphenation#1\egroup}}
+ {\providerobustcmd*{\textnohyphenation}[1]{%
+ \bgroup\nohyphenation#1\egroup^^^^200b}}
\blx@regimcs{%
\setpunctfont \resetpunctfont \ifcapital \autocap \ifpunctmark
@@ -2447,17 +2563,26 @@
{\@secondoftwo}
{\ifcsundef{abx@name@#2}
{\@secondoftwo}
- {\blx@ifnamesequal{#1}{#2}}}}
+ {\blx@ifnamesequalcscs{abx@name@#1}{abx@name@#2}}}}
+
+\def\blx@ifnamesequalcscs#1#2{%
+ \expandafter\expandafter\expandafter\blx@ifnamesequaldefdef
+ \expandafter\expandafter\expandafter{%
+ \expandafter\csname\expandafter #1\expandafter\endcsname
+ \expandafter}%
+ \expandafter{\csname #2\endcsname}}
-\def\blx@ifnamesequal#1#2{%
+\def\blx@ifnamesequalcsdef#1#2{%
+ \expandafter\blx@ifnamesequaldefdef\expandafter{%
+ \csname #1\endcsname}{#2}}
+
+\def\blx@ifnamesequaldefdef#1#2{%
\begingroup
\let\blx@tempa\@empty
- \expandafter\expandafter
- \expandafter\blx@ifnamesequal@i\csname abx@name@#2\endcsname
+ \expandafter\blx@ifnamesequal@i#2%
\let\blx@tempb\blx@tempa
\let\blx@tempa\@empty
- \expandafter\expandafter
- \expandafter\blx@ifnamesequal@i\csname abx@name@#1\endcsname
+ \expandafter\blx@ifnamesequal@i#1%
\expandafter\endgroup
\ifx\blx@tempa\blx@tempb
\expandafter\@firstoftwo
@@ -2477,47 +2602,39 @@
% These explicit nameparts are alright as they are for bibtex only
% biber names will always have a hash generated from all nameparts in datamodel
\def\blx@ifnamesequal@iii#1#2{%
- \setkeys{blx@opt@name}{#1}%
- \setkeys{blx@opt@namepart}{#2}%
+ \blx@kv@setkeys{blx@opt@name}{#1}%
+ \blx@kv@setkeys{blx@opt@namepart}{#2}%
\ifdef\abx@field@hash
{\eappto\blx@tempa{{\abx@field@hash}}}
{\eappto\blx@tempa{{{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}}}}
-% {<field>}{<macro>}{<true>}{<false>}
-\def\blx@imc@iffieldequals#1#2{%
- \blx@imc@iffieldundef{#1}
+% {<csname>}{<def>}{<true>}{<false>}
+\newcommand*{\blx@ifcsdefequal}[2]{%
+ \ifcsundef{#1}
{\@secondoftwo}
{\ifundef#2%
{\@secondoftwo}
- {\expandafter\ifx\csname abx@field@#1\endcsname#2%
+ {\expandafter\ifx\csname#1\endcsname#2%
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi}}}
+% {<field>}{<macro>}{<true>}{<false>}
+\def\blx@imc@iffieldequals#1#2{%
+ \blx@ifcsdefequal{abx@field@#1}{#2}}
+
% {<plainlist>}{<macro>}{<true>}{<false>}
\def\blx@imc@iflistequals#1#2{%
- \blx@imc@iflistundef{#1}
- {\@secondoftwo}
- {\ifundef#2%
- {\@secondoftwo}
- {\expandafter\ifx\csname abx@list@#1\endcsname#2%
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi}}}
+ \blx@ifcsdefequal{abx@list@#1}{#2}}
% {<namelist>}{<macro>}{<true>}{<false>}
-\def\blx@imc@ifnameequals#1#2{% FIXME
+\def\blx@imc@ifnameequals#1#2{%
\blx@imc@ifnameundef{#1}
{\@secondoftwo}
{\ifundef#2%
{\@secondoftwo}
- {\expandafter\ifx\csname abx@name@#1\endcsname#2%
- \expandafter\@firstoftwo
- \else
- \expandafter\@secondoftwo
- \fi}}}
+ {\blx@ifnamesequalcsdef{abx@name@#1}{#2}}}}
% {<field>}{<csname>}{<true>}{<false>}
\def\blx@imc@iffieldequalcs#1{%
@@ -2528,8 +2645,12 @@
\ifcsequal{abx@list@#1}}
% {<namelist>}{<csname>}{<true>}{<false>}
-\def\blx@imc@ifnameequalcs#1{% FIXME
- \ifcsequal{abx@name@#1}}
+\def\blx@imc@ifnameequalcs#1#2{%
+ \blx@imc@ifnameundef{#1}
+ {\@secondoftwo}
+ {\ifcsundef{#2}
+ {\@secondoftwo}
+ {\blx@ifnamesequalcscs{abx@name@#1}{#2}}}}
% {<field>}{<string>}{<true>}{<false>}
\protected\long\def\blx@imc@iffieldequalstr#1#2{%
@@ -2671,17 +2792,25 @@
\expandafter\@secondoftwo
\fi}}}
+
% {<true>}{<false>}
+%\def\blx@imc@iffirstcitekey{%
+% \ifboolexpr{ ( test {\ifnumequal\c@multicitetotal\z@}
+% and test {\ifnumequal\c@citecount\@ne} )
+% or ( test {\ifnumgreater\c@multicitetotal\z@}
+% and test {\ifnumequal\c@multicitecount\@ne}
+% and test {\ifnumequal\c@citecount\@ne} ) }}
\def\blx@imc@iffirstcitekey{%
- \ifboolexpr{ ( test {\ifnumequal\c@multicitetotal\z@}
- and test {\ifnumequal\c@citecount\@ne} )
- or ( test {\ifnumgreater\c@multicitetotal\z@}
- and test {\ifnumequal\c@multicitecount\@ne}
- and test {\ifnumequal\c@citecount\@ne} ) }}
+ \ifnumequal\c@citecount\@ne
+ {\ifnumequal\c@multicitetotal\z@
+ {\@firstoftwo}
+ {\ifnumequal\c@multicitecount\@ne}}
+ {\@secondoftwo}}
\def\blx@imc@iflastcitekey{%
- \ifboolexpr{ test {\ifnumequal\c@citecount\c@citetotal}
- and test {\ifnumequal\c@multicitecount\c@multicitetotal} }}
+ \ifnumequal\c@citecount\c@citetotal
+ {\ifnumequal\c@multicitecount\c@multicitetotal}
+ {\@secondoftwo}}
% {<category>}{<true>}{<false>}
\protected\def\blx@imc@ifcategory{%
@@ -2970,7 +3099,7 @@
\begingroup
\def\do##1{\uccode`##1=`\%}%
\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9%
- \makeatletter
+ \catcode`\@=11
\catcode`\%=9
\endlinechar\m@ne
\uppercase{\scantokens{\def\blx@tempa{#1}}}%
@@ -3007,7 +3136,7 @@
\ifx\blx@tempa\@empty
\aftergroup\@secondoftwo
\else
- \makeatletter
+ \catcode`\@=11
\catcode`\%=9
\endlinechar\m@ne
\everyeof{\noexpand}#1%
@@ -3157,6 +3286,12 @@
\newrobustcmd*{\NumCheckSetup}{\appto\blx@hook@ifnum}
\newcommand*{\NumcheckSetup}{\NumCheckSetup}
+\newrobustcmd*{\NumsCheckSetup}{\appto\blx@hook@ifnums}
+
+\newrobustcmd*{\PagesCheckSetup}{\appto\blx@hook@ifpages}
+
+\PagesCheckSetup{\let\pnfmt\@firstofone}
+
% [<pagination>][<postpro>]{<string>}
\newrobustcmd*{\blx@imc@mkpageprefix}[1][pagination]{%
\begingroup
@@ -3180,7 +3315,7 @@
{\bibstring{#1s}\ppspace}
{\def\pno{\bibstring{#1}}%
\def\ppno{\bibstring{#1s}}}}%
- \blx@mkpageprefix@i[#2]{#3}}
+ \blx@mkpageprefix@i[{#2}]{#3}}
\long\def\blx@mkpageprefix@i[#1]#2{#1{#2}\endgroup}
@@ -3243,7 +3378,7 @@
\@ifnextchar[{\blx@range@aux@i#1}{#1[\@firstofone][\@firstofone]}}
\def\blx@range@aux@i#1[#2]{%
- \@ifnextchar[{#1[#2]}{#1[#2][\@firstofone]}}
+ \@ifnextchar[{#1[{#2}]}{#1[{#2}][\@firstofone]}}
\def\blx@normrange@i[#1][#2]#3{%
\let\blx@tempa\@empty
@@ -3301,9 +3436,9 @@
% Unicode en-dashes are supported in blx-unicode.def
\def\blx@genrange@split#1{%
- \edef\blx@normrange@abort{%
+ \protected@edef\blx@normrange@abort{%
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\unexpanded{#1}}}}%
+ \blx@range@out@item@process{\unexpanded{#1}}}}%
\blx@imc@ifpages{#1}
{\blx@normrange@range#1\bibrangedash\bibrangedash&}
{\blx@normrange@abort}}
@@ -3313,17 +3448,17 @@
{\blx@normrange@hyphen#1--&}
{\ifblank{#2}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\unexpanded{#1}}%
+ \blx@range@out@item@process{\unexpanded{#1}}%
\noexpand\bibrangedash}}%
\blx@tempc}
{\ifblank{#1}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{%
+ \blx@range@out@item@process{%
\unexpanded{#2}}}}%
\blx@tempc}
{\blx@range@process{#1}{#2}}}}}
@@ -3338,10 +3473,10 @@
\blx@normrange@hyphen@i#3&}
{\ifblank{#1}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{%
+ \blx@range@out@item@process{%
\unexpanded{#2}}}}%
\blx@tempc}
{\blx@range@process{#1}{#2}}}}}
@@ -3349,18 +3484,18 @@
\def\blx@normrange@hyphen@i#1-#2&{%
\ifblank{#1#2}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\expandonce\blx@tempb}%
+ \blx@range@out@item@process{\expandonce\blx@tempb}%
\noexpand\bibrangedash}}%
\blx@tempc}
{\notblank{#1}
{\ifdefempty\blx@tempb
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{%
+ \blx@range@out@item@process{%
\unexpanded{#1}}}}%
\blx@tempc}
{\expandafter\blx@range@process
@@ -3369,11 +3504,11 @@
\def\blx@normrange@process#1#2{%
\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\unexpanded{#1}}%
+ \blx@range@out@item@process{\unexpanded{#1}}%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{\unexpanded{#2}}}}%
+ \blx@range@out@item@process{\unexpanded{#2}}}}%
\blx@tempc}
% <*>[<postpro>]{<string>}
@@ -3414,11 +3549,11 @@
{\@secondoftwo}
{\blx@comprange@comp{#1}{#2}}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\unexpanded{#1}}%
+ \blx@range@out@item@process{\unexpanded{#1}}%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{\unexpanded{#2}}}}%
+ \blx@range@out@item@process{\unexpanded{#2}}}}%
\blx@tempc}}
\def\blx@comprange@comp#1#2{%
@@ -3450,11 +3585,11 @@
\numdef\blx@tempc\blx@tempd
\fi
\begingroup
- \edef\blx@tempb{\endgroup
+ \protected@edef\blx@tempb{\endgroup
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\blx@tempb}%
+ \blx@range@out@item@process{\blx@tempb}%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{\blx@tempc}}}%
+ \blx@range@out@item@process{\blx@tempc}}}%
\blx@tempb}
\def\blx@comprange@comp@div{%
@@ -3508,9 +3643,9 @@
% Unicode en-dashes are supported in blx-unicode.def
\def\blx@firstpage@split#1{%
- \edef\blx@firstpage@abort{%
+ \protected@edef\blx@firstpage@abort{%
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\unexpanded{#1}}}}%
+ \blx@range@out@item@process{\unexpanded{#1}}}}%
\blx@firstpage@range#1\bibrangedash\bibrangedash&}
\def\blx@firstpage@range#1\bibrangedash#2\bibrangedash#3&{%
@@ -3518,15 +3653,15 @@
{\blx@firstpage@hyphen#1--&}
{\ifblank{#1}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{\unexpanded{#2}}}}%
+ \blx@range@out@item@process{\unexpanded{#2}}}}%
\blx@tempc}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\unexpanded{#1}}}}%
+ \blx@range@out@item@process{\unexpanded{#1}}}}%
\blx@tempc}}}
\def\blx@firstpage@hyphen#1-#2-#3&{%
@@ -3536,16 +3671,16 @@
{\ifblank{#2}
{\blx@firstpage@hyphen@i#3&}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{%
+ \blx@range@out@item@process{%
\unexpanded{#2}}}}%
\blx@tempc}}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
- \expandonce\blx@range@out@item@process{\unexpanded{#1}}}}%
+ \blx@range@out@item@process{\unexpanded{#1}}}}%
\blx@tempc}}}
\def\blx@firstpage@hyphen@i#1-#2&{%
@@ -3554,10 +3689,10 @@
{\blx@firstpage@abort}
{\blx@firstpage@hyphen@i#2&}}
{\begingroup
- \edef\blx@tempc{\endgroup
+ \protected@edef\blx@tempc{\endgroup
\blx@range@out@value{%
\noexpand\bibrangedash
- \expandonce\blx@range@out@item@process{%
+ \blx@range@out@item@process{%
\unexpanded{#1}}}}%
\blx@tempc}}
@@ -3597,7 +3732,7 @@
\blx@cleardelim{#2}%
\ifblank{#1}
{\blx@declaredelim{#2}{#3}}
- {\blx@declaredelim[#1]{#2}{#3}}}
+ {\blx@declaredelim[{#1}]{#2}{#3}}}
\newrobustcmd*{\blx@declaredelim}[3][]{%
\ifblank{#1}
@@ -3615,13 +3750,71 @@
\csdef{#1##1}{#4}}%
\forcsvlist{\do@i}{#3}}
-% *[<alias context, ...>]{<alias>}[<delim context>]{<delim>}
+% [<alias context, ...>]{<alias>}[<delim context>]{<delim>}
+% deprecated: *[<alias context, ...>]{<alias>}[<delim context>]{<delim>}
+% the starred version is only implemented for backwards compatibility
+% the only difference is that a missing first argument
+% implies the global/empty context
\newrobustcmd*{\DeclareDelimAlias}{%
\@ifstar
- {\blx@declaredelimalias@expl}
- {\blx@declaredelimalias@auto}}
+ {\blx@declaredelimalias@s}
+ {\blx@declaredelimalias@a}}
-\newrobustcmd*{\blx@declaredelimalias@auto}[2]{%
+\def\blx@declaredelimalias@s{%
+ \blx@warning{%
+ The starred command '\string\DeclareDelimAlias*' is\MessageBreak
+ deprecated.%
+ \MessageBreak
+ Use the unstarred version '\string\DeclareDelimAlias'\MessageBreak
+ instead}%
+ \@ifnextchar[%]
+ {\blx@declaredelimalias@om}
+ {\blx@declaredelimalias@om[]}}
+
+\def\blx@declaredelimalias@a{%
+ \@ifnextchar[%]
+ {\blx@declaredelimalias@om}
+ {\blx@declaredelimalias@m}}
+
+\def\blx@declaredelimalias@m#1{%
+ \@ifnextchar[%]
+ {\blx@declaredelimalias@mom{#1}}
+ {\blx@declaredelimalias@mm{#1}}}
+
+\def\blx@declaredelimalias@mm{%
+ \blx@declaredelimalias@auto}
+
+\def\blx@declaredelimalias@mom{%
+ \blx@declaredelimalias@omom[]}
+
+\def\blx@declaredelimalias@om[#1]#2{%
+ \@ifnextchar[%]
+ {\blx@declaredelimalias@omom[{#1}]{#2}}
+ {\blx@declaredelimalias@omm[{#1}]{#2}}}
+
+% hrmpf ... remember that \docsvlist doesn't do anthing for empty
+% lists/list items
+\def\blx@declaredelimalias@omom[#1]#2[#3]#4{%
+ \ifstrequal{#1}{*}
+ {\ifstrequal{#3}{*}
+ {\blx@declaredelimalias@auto{#2}{#4}}
+ {\blx@cleardelim{#1}%
+ \blx@declaredelimalias@manual{}{#2}{#3}{#4}}}
+ {\def\do##1{\blx@declaredelimalias@manual{##1}{#2}{#3}{#4}}%
+ \ifblank{#1}
+ {\do{}}
+ {\docsvlist{#1}}}}
+
+\def\blx@declaredelimalias@omm[#1]#2#3{%
+ \ifstrequal{#1}{*}
+ {\blx@declaredelimalias@auto{#2}{#3}}
+ {\def\do##1{\blx@declaredelimalias@manual{##1}{#2}{##1}{#3}}%
+ \ifblank{#1}
+ {\do{}}
+ {\docsvlist{#1}}}}
+
+% {<alias>}{<source>}
+\def\blx@declaredelimalias@auto#1#2{%
\blx@cleardelim{#1}%
\blx@declaredelimalias@def{}{#1}{}{#2}%
\ifcsvoid{blx@declaredelimcontexts@#2}
@@ -3631,37 +3824,15 @@
{blx@printdelim@##1@}{#1}{blx@printdelim@##1@}{#2}}%
\dolistcsloop{blx@declaredelimcontexts@#2}}}
-\def\blx@declaredelimalias@expl{%
- \@ifnextchar[%]
- {\blx@declaredelimalias@expl@i}
- {\blx@declaredelimalias@expl@i[]}}
-
-\def\blx@declaredelimalias@expl@i[#1]#2{%
- \@ifnextchar[%]
- {\blx@declaredelimalias@expl@iii{#1}{#2}}
- {\blx@declaredelimalias@expl@ii{#1}{#2}}}
-
-\def\blx@declaredelimalias@expl@ii#1#2#3{%
- \ifblank{#1}
- {\blx@declaredelimalias@def{}{#2}{}{#3}}
- {\def\do##1{%
- \blx@declaredelimalias@def
- {blx@printdelim@##1@}{#2}{blx@printdelim@##1@}{#3}}%
- \docsvlist{#1}}}
-
-\def\blx@declaredelimalias@expl@iii#1#2[#3]#4{%
+% {<alias context>}{<alias>}{<source context>}{<source>}
+\def\blx@declaredelimalias@manual#1#2#3#4{%
\ifblank{#1}
{\ifblank{#3}
{\blx@declaredelimalias@def{}{#2}{}{#4}}
{\blx@declaredelimalias@def{}{#2}{blx@printdelim@#3@}{#4}}}
{\ifblank{#3}
- {\def\do##1{%
- \blx@declaredelimalias@def
- {blx@printdelim@##1@}{#2}{}{#4}}}
- {\def\do##1{%
- \blx@declaredelimalias@def
- {blx@printdelim@##1@}{#2}{blx@printdelim@#3@}{#4}}}%
- \docsvlist{#1}}}
+ {\blx@declaredelimalias@def{blx@printdelim@#1@}{#2}{}{#4}}}
+ {\blx@declaredelimalias@def{blx@printdelim@#1@}{#2}{blx@printdelim@#3@}{#4}}}
\def\blx@declaredelimalias@def#1#2#3#4{%
\ifcsdef{#1#2}
@@ -3707,6 +3878,7 @@
\blx@regimcs{\UseUsedriverHook}
\AtUsedriver{%
+ \delimcontext{bib}%
\let\finentry\blx@finentry@usedrv
\let\newblock\relax
\let\abx@macro@bibindex\@empty
@@ -3715,7 +3887,6 @@
% {<init>}{<entrytype>}
\protected\def\blx@imc@usedriver#1#2{%
\begingroup
- \delimcontext{bib}%
\csuse{blx@hook@usedriver}%
\csuse{blx@hook@bbxinit}#1%
\blx@beglangbib
@@ -3830,37 +4001,75 @@
\def\ifentrycategory{\blx@imc@ifentrycategory}
\def\ifentrykeyword{\blx@imc@ifentrykeyword}
+
\def\blx@imc@iflabeldateisdate{%
- \ifboolexpr{%
- togl {blx@labeldateparts}
- and not test {\iffieldundef{labeldatesource}}
- and
- (test {\iffieldequalstr{labeldatesource}{}}
- or test {\iffieldequalstr{labeldatesource}{year}})}}
+ \iftoggle{blx@labeldateparts}
+ {\iffieldundef{labeldatesource}
+ {\@secondoftwo}
+ {\iffieldequalstr{labeldatesource}{}
+ {\@firstoftwo}
+ {\iffieldequalstr{labeldatesource}{year}}}}
+ {\@secondoftwo}}
+
\def\blx@imc@ifdatehasyearonlyprecision#1{%
- \ifboolexpr{not test {\iffieldundef{#1year}}
- and (test {\ifcsstring{blx@dateformat@#1date}{year}}
- or (test {\iffieldundef{#1month}}
- and test {\iffieldundef{#1season}}))}}
+ \iffieldundef{#1year}
+ {\@secondoftwo}
+ {\ifcsstring{blx@dateformat@#1date}{year}
+ {\@firstoftwo}
+ {\iffieldundef{#1month}
+ {\iffieldundef{#1season}}
+ {\@secondoftwo}}}}
\def\blx@imc@ifdatehastime#1{%
- \ifboolexpr{togl {blx@#1dateusetime}
- and not test {\iffieldundef{#1hour}}}}
+ \iftoggle{blx@#1dateusetime}
+ {\iffieldundef{#1hour}
+ {\@secondoftwo}
+ {\@firstoftwo}}
+ {\@secondoftwo}}
\def\blx@imc@ifdateshavedifferentprecision#1#2{%
- \ifboolexpr{ (test {\ifdatehasyearonlyprecision{#1}}
+ \ifboolexpr{ ( test {\ifdatehasyearonlyprecision{#1}}
and not test {\ifdatehasyearonlyprecision{#2}})
- or (not test {\ifdatehasyearonlyprecision{#1}}
- and test {\ifdatehasyearonlyprecision{#2}})
- or (test {\ifdatehastime{#1}}
+ or ( not test {\ifdatehasyearonlyprecision{#1}}
+ and test {\ifdatehasyearonlyprecision{#2}})
+ or ( test {\ifdatehastime{#1}}
and not test {\ifdatehastime{#2}})
- or (not test {\ifdatehastime{#1}}
- and test {\ifdatehastime{#2}})}}
+ or ( not test {\ifdatehastime{#1}}
+ and test {\ifdatehastime{#2}})}}
\def\blx@imc@ifdateyearsequal#1#2{%
- \ifboolexpr{ test {\iffieldsequal{#1year}{#2year}}
- and test {\iffieldsequal{#1dateera}{#2dateera}}}}
+ \iffieldsequal{#1year}{#2year}
+ {\iffieldundef{#1dateera}
+ {\iffieldundef{#2dateera}}
+ {\iffieldsequal{#1dateera}{#2dateera}}}
+ {\@secondoftwo}}
+
+\def\blx@reconstruct@comparabledate#1{%
+ \thefield{#1year}-\thefield{#1month}(\thefield{#1season})-%
+ \thefield{#1day}T%
+ \thefield{#1hour}:\thefield{#1minute}:\thefield{#1second}Z%
+ \thefield{#1timezone}//%
+ e\thefield{#1dateera}E%
+ c\csuse{if#1datecirca}{T}{F}%
+ j\csuse{if#1datejulian}{T}{F}%
+ r\csuse{if#1dateuncertain}{T}{F}%
+ k\csuse{if#1dateunknown}{T}{F}%
+}
+
+\def\blx@imc@ifdatesequal#1#2{%
+ \begingroup
+ \edef\blx@tempa{\blx@reconstruct@comparabledate{#1}}%
+ \edef\blx@tempb{\blx@reconstruct@comparabledate{#2}}%
+ \edef\blx@tempc{\endgroup
+ \ifstrequal{\blx@tempa}{\blx@tempb}}%
+ \blx@tempc
+}
+
+\def\blx@imc@ifdaterangesequal#1#2{%
+ \blx@imc@ifdatesequal{#1}{#2}
+ {\blx@imc@ifdatesequal{#1end}{#2end}}
+ {\@secondoftwo}}
\blx@regimcs{%
\ifdriver \thefield \strfield \csfield \usefield \thelist \strlist
@@ -3881,7 +4090,7 @@
\iffieldint \iffieldnum \iffieldnums \iffieldpages
\iflabeldateisdate \ifdatehasyearonlyprecision \ifdatehastime
\ifdateshavedifferentprecision
- \ifdateyearsequal
+ \ifdateyearsequal \ifdatesequal \ifdaterangesequal
\mkpageprefix \mkpagetotal
\newblock \newunit \setunit \printunit \finentry}
@@ -3927,279 +4136,6 @@
%% Global formatting hooks
-% capitalization
-
-% {<text>}
-\newrobustcmd{\MakeCapital}[1]{%
- \begingroup
- \blx@mkcp@init
- \protected@edef\blx@tempa{#1}%
- \expandafter\blx@mkcp@parse\blx@tempa\@empty\blx@mkcp@end}
-
-\def\blx@mkcp@init{%
- \def\blx@mkcp@iec{\noexpand\blx@mkcp@iec\noexpand}%
- \def\blx@mkcp@bbl{\noexpand\blx@mkcp@bbl\noexpand}%
- \def\blx@mkcp@sgl{\noexpand\blx@mkcp@sgl\noexpand}%
- \def\blx@mkcp@dbl{\noexpand\blx@mkcp@dbl\noexpand}%
- \def\do##1{\def##1{\blx@mkcp@sgl##1}}\abx@dosingleaccents
- \def\do##1{\def##1{\blx@mkcp@dbl##1}}\abx@dodoubleaccents
- \def\IeC##1{\blx@mkcp@iec\IeC{##1}}%
- \def\@tabacckludge##1{%
- \expandafter\blx@mkcp@sgl\csname\string##1\endcsname}}
-
-\begingroup
-\catcode`\"=\active
-\gappto\blx@mkcp@init{%
- \ifnum\catcode`\"=\active
- \def"#1{\blx@mkcp@bbl"\noexpand#1}%
- \fi}
-\endgroup
-
-\def\blx@mkcp@parse{%
- \futurelet\@let@token\blx@mkcp@eval}
-
-\long\def\blx@mkcp@eval{%
- \ifx\@let@token\blx@mkcp@iec
- \expandafter\blx@mkcp@getiec
- \fi
- \ifx\@let@token\blx@mkcp@bbl
- \expandafter\blx@mkcp@gettwo
- \fi
- \ifx\@let@token\blx@mkcp@sgl
- \expandafter\blx@mkcp@gettwo
- \fi
- \ifx\@let@token\blx@mkcp@dbl
- \expandafter\blx@mkcp@getthree
- \fi
- \blx@mkcp@case}
-
-\def\blx@mkcp@getiec#1\blx@mkcp@case#2#3#4{%
- \blx@mkcp@case{#2#3{#4}}}
-
-\def\blx@mkcp@gettwo#1\blx@mkcp@case#2#3#4{%
- \blx@mkcp@case{#2#3#4}}
-
-\def\blx@mkcp@getthree#1\blx@mkcp@case#2#3#4#5{%
- \blx@mkcp@case{#2#3#4#5}}
-
-\long\def\blx@mkcp@case#1{%
- \begingroup
- \def\i{I}\def\j{J}%
- \def\do##1##2{\let##1##2\do}%
- \expandafter\do\@uclclist\relax{\relax\@gobble}%
- \uppercase{\protected@edef\blx@tempa{\endgroup\blx@mkcp@end#1}}%
- \blx@tempa}
-
-\protected\long\def\blx@mkcp@end#1\blx@mkcp@end{%
- \let\blx@mkcp@iec\noexpand
- \let\blx@mkcp@bbl\noexpand
- \let\blx@mkcp@sgl\noexpand
- \let\blx@mkcp@dbl\noexpand
- \protected@edef\blx@tempa{\endgroup#1}%
- \blx@tempa}
-
-\def\abx@dosingleaccents{%
- \do\"\do\'\do\`\do\^\do\~\do\=\do\.%
- \do\H\do\b\do\c\do\d\do\r\do\u\do\v}
-\def\abx@dodoubleaccents{%
- \do\t}
-
-% {<text>}
-\newrobustcmd*{\MakeSentenceCase}{%
- \@ifstar\blx@mksc@i\blx@mksc@ii}
-
-% Check, in order:
-% * explicit option language=<lang>, which overrides everything
-% * langid field of entry
-% * babel/polyglossia lang
-% * main document lang
-\def\blx@mksc@i{%
- \ifdef\blx@forcelanguagename
- {\xifinlist\blx@forcelanguagename\blx@cmksc@lang
- {\blx@mksc@ii}
- {\@firstofone}}
- {\ifdef\abx@field@langid
- {\xifinlist\abx@field@langid\blx@cmksc@lang
- {\blx@mksc@ii}
- {\@firstofone}}
- {\ifdef\blx@main@language
- {\xifinlist\blx@main@language\blx@cmksc@lang
- {\blx@mksc@ii}
- {\@firstofone}}
- {\xifinlist\blx@languagename\blx@cmksc@lang
- {\blx@mksc@ii}
- {\@firstofone}}}}}
-
-\long\def\blx@mksc@ii#1{%
- \begingroup
- \let\blx@tempa\@empty
- \let\blx@tempb\@empty
- \blx@mksc@init
- \protected@edef\@tempa{#1}%
- \expandafter\blx@mksc@parse\@tempa\blx@mksc@end}
-
-\def\blx@mksc@init{%
- \blx@mkcp@init
- \def\blx@mkcp@nil{\noexpand\blx@mkcp@nil\noexpand}%
- \def\i{\blx@mkcp@nil\i}\def\j{\blx@mkcp@nil\j}%
- \def\do##1{%
- \ifx##1\relax
- \else
- \def##1{\blx@mkcp@nil##1}%
- \expandafter\do
- \fi}%
- \expandafter\do\@uclclist\relax}
-
-\def\blx@mksc@parse{%
- \futurelet\@let@token\blx@mksc@eval}
-
-\def\blx@mksc@eval{%
- \ifx\@let@token\blx@mksc@end
- \expandafter\blx@mksc@end
- \fi
- \ifx\@let@token\bgroup
- \expandafter\blx@mksc@group
- \fi
- \ifx\@let@token\@sptoken
- \expandafter\blx@mksc@space
- \fi
- \ifx\@let@token\blx@mkcp@nil
- \expandafter\blx@mksc@getone
- \fi
- \ifx\@let@token\blx@mkcp@iec
- \expandafter\blx@mksc@getiec
- \fi
- \ifx\@let@token\blx@mkcp@bbl
- \expandafter\blx@mksc@gettwo
- \fi
- \ifx\@let@token\blx@mkcp@sgl
- \expandafter\blx@mksc@gettwo
- \fi
- \ifx\@let@token\blx@mkcp@dbl
- \expandafter\blx@mksc@getthree
- \fi
- \if\noexpand\@let@token\relax
- \expandafter\blx@mksc@cs
- \fi
- \blx@mksc@other}
-
-\def\blx@mksc@end#1\blx@mksc@end{%
- \blx@mksc@eject
- \let\blx@mkcp@nil\noexpand
- \let\blx@mkcp@iec\noexpand
- \let\blx@mkcp@bbl\noexpand
- \let\blx@mkcp@sgl\noexpand
- \let\blx@mkcp@dbl\noexpand
- \let\MakeUppercase\relax
- \let\MakeLowercase\relax
- \protected@edef\blx@tempa{\endgroup\blx@tempa}%
- \blx@tempa}
-
-\long\def\blx@mksc@group#1\blx@mksc@other#2{%
- \futurelet\@let@token\blx@mksc@ingroup#2&{#2}%
- \blx@mksc@endhead
- \blx@mksc@parse}
-
-\long\def\blx@mksc@ingroup#1&#2{%
- \if\noexpand\@let@token\relax
- \ifx\@let@token\blx@mkcp@sgl
- \blx@mksc@nocase{{#2}}%
- \else
- \ifx\@let@token\blx@mkcp@dbl
- \blx@mksc@nocase{{#2}}%
- \else
- \blx@mksc@locase{{#2}}%
- \fi
- \fi
- \else
- \blx@mksc@nocase{{#2}}%
- \fi}
-
-\def\blx@mksc@space{\def\blx@mksc@space##1\blx@mksc@other}
-\csuse{blx@mksc@space} {%
- \blx@mksc@anycase{ }%
- \blx@mksc@endhead
- \blx@mksc@parse}
-
-\long\def\blx@mksc@cs#1\blx@mksc@other#2{%
- \ifcat\noexpand~\noexpand#2%
- \blx@mksc@locase{#2}%
- \else
- \blx@mksc@nocase{#2}%
- \fi
- \blx@mksc@endhead
- \blx@mksc@parse}
-
-\def\blx@mksc@getiec#1\blx@mksc@other#2#3#4{%
- \blx@mksc@other{#2#3{#4}}}
-
-\def\blx@mksc@getone#1\blx@mksc@other#2#3{%
- \blx@mksc@other{#2#3}}
-
-\def\blx@mksc@gettwo#1\blx@mksc@other#2#3#4{%
- \blx@mksc@other{#2#3#4}}
-
-\def\blx@mksc@getthree#1\blx@mksc@other#2#3#4#5{%
- \blx@mksc@other{#2#3#4#5}}
-
-\long\def\blx@mksc@other#1{%
- \blx@mksc@locase{#1}%
- \blx@mksc@endhead
- \blx@mksc@parse}
-
-\def\blx@mksc@locase{%
- \appto\blx@tempb}
-
-\def\blx@mksc@nocase{%
- \blx@mksc@eject
- \appto\blx@tempa}
-
-\def\blx@mksc@anycase{%
- \ifx\blx@tempb\@empty
- \expandafter\appto
- \expandafter\blx@tempa
- \else
- \expandafter\appto
- \expandafter\blx@tempb
- \fi}
-
-\def\blx@mksc@eject{%
- \ifx\blx@tempb\@empty
- \else
- \eappto\blx@tempa{\noexpand\MakeLowercase{\expandonce\blx@tempb}}%
- \let\blx@tempb\@empty
- \fi}
-
-\def\blx@mksc@endhead{%
- \ifx\blx@tempb\@empty
- \else
- \eappto\blx@tempa{\noexpand\MakeCapital{\expandonce\blx@tempb}}%
- \let\blx@tempb\@empty
- \fi
- \let\blx@mksc@endhead\relax}
-
-% {<language,language,...>}
-\newrobustcmd*{\DeclareCaseLangs}{%
- \@ifstar
- {\blx@defcaselangs}
- {\global\let\blx@cmksc@lang\@empty
- \blx@defcaselangs}}
-
-\def\blx@defcaselangs#1{%
- \ifblank{#1}
- {}
- {\forcsvlist{\listgadd\blx@cmksc@lang}{#1}}}
-
-\DeclareCaseLangs{%
- american,british,canadian,
- english,USenglish,UKenglish,
- australian,newzealand}
-
-\newrobustcmd*{\ifcaselang}[1][]{%
- \ifblank{#1}
- {\xifinlist\blx@languagename\blx@cmksc@lang}
- {\xifinlist{#1}\blx@cmksc@lang}}
-
%% Main formatting commands
% They work by creating a \let alias:
% \abx@<class>@<entrytype>@<formatname> -> \blx@defformat@d
@@ -4240,19 +4176,11 @@
\@ifstar
{\blx@defformat\blx@defnameformat{nwd}*}
{\blx@defformat\blx@defnameformat{nwd}{}}}
-\newrobustcmd*{\DeclareIndexNameWrapperFormat}{%
- \@ifstar
- {\blx@defformat\blx@defnameformat{nxd}*}
- {\blx@defformat\blx@defnameformat{nxd}{}}}
\newrobustcmd*{\DeclareListWrapperFormat}{%
\@ifstar
{\blx@defformat\blx@defplainformat{lwd}*}
{\blx@defformat\blx@defplainformat{lwd}{}}}
-\newrobustcmd*{\DeclareIndexListWrapperFormat}{%
- \@ifstar
- {\blx@defformat\blx@defplainformat{lxd}*}
- {\blx@defformat\blx@defplainformat{lxd}{}}}
% {<macro>}{<class>}{<*>}
\def\blx@defformat#1#2#3{%
@@ -4260,8 +4188,8 @@
{\blx@defformat@i{#1}{#2}{#3}}
{\blx@defformat@i{#1}{#2}{#3}[*]}}
-% {<macro>}{<class>}{<*>}[<entrytype>]{<name>}
-\def\blx@defformat@i#1#2#3[#4]#5{%
+% {<macro>}{<class>}{<*>}[<entrytype>]{<name>}{<code>}
+\def\blx@defformat@i#1#2#3[#4]#5#6{%
\notblank{#3}
{\blx@resetformat{#2}{#5}}
{}%
@@ -4269,7 +4197,7 @@
\def\blx@defformat@b{#4}%
\blx@xsanitizeafter{\def\blx@defformat@c}{#5}%
\afterassignment\blx@defformat@ii
- #1}
+ #1{#6}}
\def\blx@defformat@ii{%
\expandafter\forcsvlist
@@ -4366,10 +4294,8 @@
\newrobustcmd*{\DeclareIndexFieldAlias}{\blx@defalias{fid}}
\newrobustcmd*{\DeclareNameWrapperAlias}{\blx@defalias{nwd}}
-\newrobustcmd*{\DeclareIndexNameWrapperAlias}{\blx@defalias{nxd}}
\newrobustcmd*{\DeclareListWrapperAlias}{\blx@defalias{lwd}}
-\newrobustcmd*{\DeclareIndexListWrapperAlias}{\blx@defalias{lxd}}
% #1: internal type signature, #2: type text for warning
% #3 #4 #5 #6
@@ -4413,13 +4339,9 @@
\newrobustcmd*{\DeprecateNameWrapperFormatWithReplacement}{%
\blx@deprecateformat{nwd}{Name wrapper format}}
-\newrobustcmd*{\DeprecateIndexNameWrapperFormatWithReplacement}{%
- \blx@deprecateformat{nxd}{Index name wrapper format}}
\newrobustcmd*{\DeprecateListWrapperFormatWithReplacement}{%
\blx@deprecateformat{lwd}{List wrapper format}}
-\newrobustcmd*{\DeprecateIndexListWrapperFormatWithReplacement}{%
- \blx@deprecateformat{lxd}{Index list wrapper format}}
% [<format>]{<text>}
\newrobustcmd{\blx@imc@printtext}[2][]{%
@@ -4467,7 +4389,7 @@
\iftoggle{blx@loadfiles}
{\IfFileExists{#2}
{\listxadd\blx@list@req@edit{#2}%
- \blx@imc@printtext[#1]{\input{#2}\unspace}}
+ \blx@imc@printtext[{#1}]{\input{#2}\unspace}}
{\blx@nounit}}
{\blx@nounit}}
@@ -4547,17 +4469,17 @@
\c@uniquelist\z@
\ifblank{#1}
{}
- {\setkeys{blx@opt@namelist}{#1}}%
+ {\blx@kv@setkeys{blx@opt@namelist}{#1}}%
\def\blx@thedata{#2}}
% Biber-calculated info passed back to biblatex as an option in the .bbl
% unlike stuff defined with \DeclareBiblatexOption and
% \blx@DeclareBackendOption these are not 'real' options
-\define@key{blx@opt@namelist}{ul}{\c@uniquelist#1\relax}
+\blx@kv@defkey{blx@opt@namelist}{ul}{\c@uniquelist#1\relax}
-\define@key{blx@opt@name}{un}{\c@uniquename#1\relax}
-\define@key{blx@opt@name}{uniquepart}{\def\abx@field@uniquepart{#1}}
-\define@key{blx@opt@name}{hash}{\edef\abx@field@hash{\detokenize{#1}}}
+\blx@kv@defkey{blx@opt@name}{un}{\c@uniquename#1\relax}
+\blx@kv@defkey{blx@opt@name}{uniquepart}{\def\abx@field@uniquepart{#1}}
+\blx@kv@defkey{blx@opt@name}{hash}{\edef\abx@field@hash{\detokenize{#1}}}
\newrobustcmd*{\bibinitperiod}{\adddot}
@@ -4577,17 +4499,15 @@
\def\blx@indexnames#1#2#3#4{%
\blx@imc@ifnameundef{#4}
{}
- {\blx@getformat\blx@thewrapperformat{nxd}{#1}{#4}%
- \ifdefvoid\blx@thewrapperformat
+ {\blx@getformat\blx@theformat{nid}{#1}{#4}%
+ \ifdefvoid\blx@theformat
{}
- {\blx@getformat\blx@theformat{nid}{#1}{#4}%
- \ifdefvoid\blx@theformat
- {}
- {\begingroup
- \blx@namesetup{#2}{#3}{#4}%
- \blx@indexnamesetup
- \expandafter\blx@nameparser\blx@thedata{}&%
- \endgroup}}}}
+ {\begingroup
+ \blx@namesetup{#2}{#3}{#4}%
+ \blx@indexnamesetup
+ \expandafter\blx@nameparser\blx@thedata{}&%
+ \endgroup}}}
+
\def\blx@indexnamesetup{%
\let\bibinitperiod\bibindexinitperiod
@@ -4618,13 +4538,13 @@
\begingroup
\ifblank{#1}
{}
- {\setkeys{blx@opt@name}{#1}}%
+ {\blx@kv@setkeys{blx@opt@name}{#1}}%
% reset all the nameparts to empty between names
\def\do##1{%
\cslet{namepart##1}\@empty
\cslet{namepart##1i}\@empty}%
\expandafter\docsvlist\expandafter{\blx@datamodel@constant@nameparts}%
- \setkeys{blx@opt@namepart}{#2}% Extract nameparts information
+ \blx@kv@setkeys{blx@opt@namepart}{#2}% Extract nameparts information
% Still pass the nameparts forward for backwards compat
% When \nameparts is finally removed, remove the "{2}" and remove the
% arg to \blx@defformat@d in def of \blx@defnameformat
@@ -4687,16 +4607,13 @@
\def\blx@indexlist#1#2#3#4{%
\blx@imc@iflistundef{#4}
{}
- {\blx@getformat\blx@thewrapperformat{lxd}{#1}{#4}%
- \ifdefvoid\blx@thewrapperformat
+ {\blx@getformat\blx@theformat{lid}{#1}{#4}%
+ \ifdefvoid\blx@theformat
{}
- {\blx@getformat\blx@theformat{lid}{#1}{#4}%
- \ifdefvoid\blx@theformat
- {}
- {\begingroup
- \blx@listsetup{#2}{#3}{#4}%
- \expandafter\blx@listparser\blx@thedata{}&%
- \endgroup}}}}
+ {\begingroup
+ \blx@listsetup{#2}{#3}{#4}%
+ \expandafter\blx@listparser\blx@thedata{}&%
+ \endgroup}}}
% {<item1>}{<item2>}{...}
\long\def\blx@listparser#1{%
@@ -4797,6 +4714,20 @@
%% Localization
+% {<wrapper>}{<long/short>}{<string>}{<print code>}
+% <print code> is executed when the bibstring is defined
+% it differs between the \bib...string versions
+% in <print code> \blx@tempa should be used as <string>
+\protected\def\blx@met@bibstring#1#2#3#4{%
+ \blx@begunit
+ \blx@hyphenreset
+ \blx@bibstringsimple
+ \lowercase{\edef\blx@tempa{#3}}%
+ \ifcsundef{#2@\blx@tempa}
+ {\blx@warn@nostring\blx@tempa
+ \blx@endnounit}
+ {#4}}
+
% [<wrapper>]{<string>}
\newrobustcmd*{\blx@imc@bibstring}[2][\@firstofone]{%
\blx@bibstring{#1}{\abx@str}{#2}}
@@ -4818,19 +4749,28 @@
\let\bibsstring\blx@imc@bibsstring}
\protected\def\blx@bibstring#1#2#3{%
- \blx@begunit
- \blx@hyphenreset
- \blx@bibstringsimple
- \lowercase{\edef\blx@tempa{#3}}%
- \ifcsundef{#2@\blx@tempa}
- {\blx@warn@nostring\blx@tempa
- \blx@endnounit}
+ \blx@met@bibstring{#1}{#2}{#3}
{\blx@imc@ifcapital
{#1{\MakeCapital{\csuse{#2@\blx@tempa}}}}
{#1{\csuse{#2@\blx@tempa}}}%
\blx@endunit}}
% [<wrapper>]{<string>}
+\newrobustcmd*{\blx@imc@bibncpstring}[2][\@firstofone]{%
+ \blx@bibncpstring{#1}{\abx@str}{#2}}
+
+\newrobustcmd*{\blx@imc@bibncplstring}[2][\@firstofone]{%
+ \blx@bibncpstring{#1}{abx@lstr}{#2}}
+
+\newrobustcmd*{\blx@imc@bibncpsstring}[2][\@firstofone]{%
+ \blx@bibncpstring{#1}{abx@sstr}{#2}}
+
+\protected\def\blx@bibncpstring#1#2#3{%
+ \blx@met@bibstring{#1}{#2}{#3}
+ {#1{\csuse{#2@\blx@tempa}}%
+ \blx@endunit}}
+
+% [<wrapper>]{<string>}
\newrobustcmd*{\blx@imc@bibcpstring}[2][\@firstofone]{%
\blx@bibcpstring{#1}{\abx@str}{#2}}
@@ -4841,13 +4781,7 @@
\blx@bibcpstring{#1}{abx@sstr}{#2}}
\protected\def\blx@bibcpstring#1#2#3{%
- \blx@begunit
- \blx@hyphenreset
- \blx@bibstringsimple
- \lowercase{\edef\blx@tempa{#3}}%
- \ifcsundef{#2@\blx@tempa}
- {\blx@warn@nostring\blx@tempa
- \blx@endnounit}
+ \blx@met@bibstring{#1}{#2}{#3}
{#1{\MakeCapital{\csuse{#2@\blx@tempa}}}%
\blx@endunit}}
@@ -4862,14 +4796,8 @@
\blx@biblcstring{#1}{abx@sstr}{#2}}
\protected\def\blx@biblcstring#1#2#3{%
- \blx@begunit
- \blx@hyphenreset
- \blx@bibstringsimple
- \lowercase{\edef\blx@tempa{#3}}%
- \ifcsundef{#2@\blx@tempa}
- {\blx@warn@nostring\blx@tempa
- \blx@endnounit}
- {#1{\MakeLowercase{\csuse{#2@\blx@tempa}}}%
+ \blx@met@bibstring{#1}{#2}{#3}
+ {#1{\blx@maketext@lowercase{\csuse{#2@\blx@tempa}}}%
\blx@endunit}}
% [<wrapper>]{<string>}
@@ -4883,14 +4811,8 @@
\blx@bibucstring{#1}{abx@sstr}{#2}}
\protected\def\blx@bibucstring#1#2#3{%
- \blx@begunit
- \blx@hyphenreset
- \blx@bibstringsimple
- \lowercase{\edef\blx@tempa{#3}}%
- \ifcsundef{#2@\blx@tempa}
- {\blx@warn@nostring\blx@tempa
- \blx@endnounit}
- {#1{\MakeUppercase{\csuse{#2@\blx@tempa}}}%
+ \blx@met@bibstring{#1}{#2}{#3}
+ {#1{\blx@maketext@uppercase{\csuse{#2@\blx@tempa}}}%
\blx@endunit}}
% {<string>}
@@ -4942,6 +4864,7 @@
\blx@regimcs{%
\bibstring \biblstring \bibsstring
\bibxstring \bibxlstring \bibxsstring
+ \bibncpstring \bibncplstring \bibncpsstring
\bibcpstring \bibcplstring \bibcpsstring
\biblcstring \biblclstring \biblcsstring
\bibucstring \bibuclstring \bibucsstring
@@ -5296,14 +5219,17 @@
\do{langjapanese}%
\do{langlatin}%
\do{langlatvian}%
+ \do{langlithuanian}%
\do{langnorwegian}%
\do{langpolish}%
\do{langportuguese}%
+ \do{langserbian}%
\do{langrussian}%
\do{langslovak}%
\do{langslovene}%
\do{langspanish}%
\do{langswedish}%
+ \do{langturkish}%
\do{langukrainian}%
\do{fromamerican}%
\do{frombrazilian}%
@@ -5324,15 +5250,18 @@
\do{fromitalian}%
\do{fromjapanese}%
\do{fromlatin}%
+ \do{fromlithuanian}%
\do{fromlatvian}%
\do{fromnorwegian}%
\do{frompolish}%
\do{fromportuguese}%
\do{fromrussian}%
+ \do{fromserbian}%
\do{fromslovak}%
\do{fromslovene}%
\do{fromspanish}%
\do{fromswedish}%
+ \do{fromturkish}%
\do{fromukrainian}%
\do{countryde}%
\do{countryep}%
@@ -5369,19 +5298,19 @@
\forcsvlist\blx@newstring{#1}}
\def\blx@newstring#1{%
- \ifcsundef{KV@blx@lbx@#1}
+ \blx@kv@ifkeyundef{blx@lbx}{#1}
{\gappto\abx@dostrings{\do{#1}}%
- \csgdef{KV@blx@lbx@#1}##1{\blx@defstring{#1}{##1}}}
+ \blx@kv@gdefkey{blx@lbx}{#1}{\blx@defstring{#1}{##1}}}
{}}
% in *.cbx/bbx/tex: <key> = {<string>},
% in *.lbx: <key> = {{<longstring>}{<abbrevstring>}},
-\def\do#1{\define@key{blx@lbx}{#1}{\blx@defstring{#1}{##1}}}
+\def\do#1{\blx@kv@defkey{blx@lbx}{#1}{\blx@defstring{#1}{##1}}}
\abx@dostrings
% in *.cbx/bbx/tex: (implicit)
% in *.lbx: inherit = {<language>},
-\define@key{blx@lbx}{inherit}{%
+\blx@kv@defkey{blx@lbx}{inherit}{%
\blx@lbxinput@strings{#1}{}{\blx@err@nolang{#1}}%
\csuse{abx@strings@#1}}
@@ -5443,7 +5372,7 @@
\def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}%
\abx@dostrings
\csuse{abx@strings@#1}%
- \setkeys{blx@lbx}{#2}%
+ \blx@kv@setkeys{blx@lbx}{#2}%
\let\do\blx@defbibstrings@i
\csxdef{abx@strings@#1}{\abx@dostrings}%
\csgappto{abx@strings@#1}{%
@@ -5457,6 +5386,10 @@
{\letcs\biblistname{\abx@str @shorthands}}
{\let\biblistname\@empty}}}
+% this one is special, it's basically ours and probably not defined
+% by anyone else, so we had better make sure it exists
+\providecommand*{\biblistname}{\blx@warn@nostring{shorthands}}
+
\def\blx@defbibstrings@i#1{%
\ifcsdef{abx@lstr@#1}
{\def\expandafter\noexpand\csname abx@lstr@#1\endcsname{%
@@ -5562,13 +5495,18 @@
\blx@info@noline{Trying to load #2..}%
\IfFileExists{#1}
{\blx@info@noline{... file '#1' found}%
- #3\@@input\@filef@und#4#5%
+ \csuse{blx@lbxfilehook@simple@preload@#1}%
+ #3\@@input\@filef@und#4%
+ \csuse{blx@lbxfilehook@simple@postload@#1}%
+ #5%
\ifcsundef{blx@file@lbx@simple@#1}
{\listxadd\blx@list@req@stat{#1}%
\@addtofilelist{#1}%
\global\cslet{blx@file@lbx@simple@#1}\@empty}
{}}
- {\blx@info@noline{... file '#1' not found}#6}}
+ {\blx@info@noline{... file '#1' not found}%
+ \csuse{blx@lbxfilehook@simple@failure@#1}%
+ #6}}
% {<file>}{<message>}{<preload>}{<postload>}{<success>}{<failure>}
\protected\long\def\blx@lbx@input@handler@once#1#2#3#4#5#6{%
@@ -5576,12 +5514,17 @@
{\blx@info@noline{Trying to load #2..}%
\IfFileExists{#1}
{\blx@info@noline{... file '#1' found}%
- #3\@@input\@filef@und#4#5%
+ \csuse{blx@lbxfilehook@once@preload@#1}%
+ #3\@@input\@filef@und#4%
+ \csuse{blx@lbxfilehook@once@postload@#1}%
+ #5%
\ifcsundef{blx@file@lbx@simple@#1}
{\listxadd\blx@list@req@stat{#1}%
\@addtofilelist{#1}}
{}}
- {\blx@info@noline{... file '#1' not found}#6}%
+ {\blx@info@noline{... file '#1' not found}%
+ \csuse{blx@lbxfilehook@once@failure@#1}%
+ #6}%
\global\cslet{blx@file@lbx@once@#1}\@empty
\global\cslet{blx@file@lbx@simple@#1}\@empty}
{#5}}
@@ -5647,10 +5590,7 @@
{\edef\blx@languagename{#1}}
{\blx@warning
{Language '#1' not supported.\MessageBreak
- Using fallback language '\blx@languagename'}%
- \blx@lbxinput{\blx@languagename}
- {\blx@maplang{#1}{\blx@languagename}}
- {\blx@err@nolang{\blx@languagename}}}}
+ Using dummy definitions}}}
% auxiliary macros
@@ -5710,13 +5650,13 @@
{\iffieldsequal{#1minute}{#1endminute}
% 14:13:xx 14:13:xx
{\toggletrue{blx@seconds}%
- \printtext[#1time]{%
+ \printtext[{#1time}]{%
\csuse{mkbibtime24h}{#1hour}{#1minute}{#1second}{}%
\bibtimerangesep
\csuse{mkbibtime24h}{}{}{#1endsecond}{}}}
% 14:13:xx 14:14:xx
{\toggletrue{blx@seconds}%
- \printtext[#1time]{\csuse{mkbibtime24h}{#1hour}{#1minute}{}{}%
+ \printtext[{#1time}]{\csuse{mkbibtime24h}{#1hour}{#1minute}{}{}%
\bibtimerangesep
\csuse{mkbibtime24h}{}{#1endminute}{}{}}}}
% 14:xx:xx 15:xx:xx
@@ -5724,17 +5664,20 @@
% {<24h|24hcomp|12h>}{<datetype>}
\newrobustcmd*{\mktimerange}[2]{%
- \iffieldundef{#2hour}
- {\blx@nounit}
- {\blx@timepre{#2}{}%
- \printtext[#2time]{\csuse{mkbibtime#1}{#2hour}{#2minute}{#2second}{#2timezone}%
- \iffieldundef{#2endhour}
- {}
- {\blx@timepre{#2}{end}%
- \iffieldequalstr{#2endhour}{}
- {\mbox{\bibtimerangesep}}
- {\bibtimerangesep
- \csuse{mkbibtime#1}{#2endhour}{#2endminute}{#2endsecond}{#2endtimezone}}}}}}
+ \begingroup
+ \iffieldundef{#2hour}
+ {\blx@nounit}
+ {\blx@timepre{#2}{}%
+ \printtext[{#2time}]{%
+ \csuse{mkbibtime#1}{#2hour}{#2minute}{#2second}{#2timezone}%
+ \iffieldundef{#2endhour}
+ {}
+ {\blx@timepre{#2}{end}%
+ \iffieldequalstr{#2endhour}{}
+ {\mbox{\bibtimerangesep}}
+ {\bibtimerangesep
+ \csuse{mkbibtime#1}{#2endhour}{#2endminute}{#2endsecond}{#2endtimezone}}}}}%
+ \endgroup}
% {<datetype>}{''|end}
\newrobustcmd*{\blx@timepre}[2]{%
@@ -5744,24 +5687,27 @@
{\blx@imc@clearfield{#1#2second}}}
\newcommand*{\blx@if@printtime}[2]{%
- \ifboolexpr{%
- togl {blx@#1dateusetime}
- and
- not test {\iffieldundef{#1#2hour}}}}
+ \iftoggle{blx@#1dateusetime}
+ {\iffieldundef{#1#2hour}
+ {\@secondoftwo}
+ {\@firstoftwo}}
+ {\@secondoftwo}}
\newcommand*{\blx@if@printanytimes}[1]{%
- \ifboolexpr{
- togl {blx@#1dateusetime}
- and
- ( not test {\iffieldundef{#1hour}}
- or not test {\iffieldundef{#1endhour}})}}
+ \iftoggle{blx@#1dateusetime}
+ {\iffieldundef{#1hour}
+ {\iffieldundef{#1endhour}
+ {\@secondoftwo}
+ {\@firstoftwo}}
+ {\@firstoftwo}}
+ {\@secondoftwo}}
% {<datetype>}{'' | end}
\newrobustcmd*{\blx@printtime}[2]{%
\blx@if@printtime{#1}{#2}
{\blx@timepre{#1}{#2}%
- \printtext{\bibdatetimesep}%
- \printtext[#1time]{%
+ \bibdatetimesep%
+ \printtext[{#1time}]{%
\csuse{mkbibtime\csuse{blx@timeformat@#1time}}
{#1#2hour}{#1#2minute}{#1#2second}{#1#2timezone}}}
{}}
@@ -5772,7 +5718,7 @@
\blx@metadateinfo{#2}%
\iffieldundef{#2year}
{\blx@nounit}
- {\printtext[#2date]{%
+ {\printtext[{#2date}]{%
\datecircaprint
% Such a season component can only come from an ISO8601 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
@@ -5803,7 +5749,7 @@
\blx@metadateinfo{#2}%
\iffieldundef{#2year}
{\blx@nounit}
- {\printtext[#2date]{%
+ {\printtext[{#2date}]{%
\datecircaprint
% Such a season component can only come from an ISO8601 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
@@ -5818,18 +5764,17 @@
{\printfield{extradate}}
{\iffieldequalstr{#2endyear}{}
{\printfield{extradate}%
- \printtext{\mbox{\bibdaterangesep}}}
- {\printtext{%
- \bibdaterangesep
- \enddatecircaprint
- \iffieldundef{#2endseason}
- {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
- % Optionally print the time after the date
- \blx@printtime{#2}{end}}
- {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}}%
- \printfield{extradate}%
- \enddateuncertainprint
- \dateeraprint{#2endyear}}}}}%
+ \mbox{\bibdaterangesep}}
+ {\bibdaterangesep
+ \enddatecircaprint
+ \iffieldundef{#2endseason}
+ {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
+ % Optionally print the time after the date
+ \blx@printtime{#2}{end}}
+ {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}}%
+ \printfield{extradate}%
+ \enddateuncertainprint
+ \dateeraprint{#2endyear}}}}%
\endgroup}
\newrobustcmd*{\mkdaterangetrunc}[2]{%
@@ -5842,7 +5787,7 @@
\blx@metadateinfo{#2}%
\iffieldundef{#2year}
{\blx@nounit}
- {\printtext[#2date]{%
+ {\printtext[{#2date}]{%
\datecircaprint
% Such a season component can only come from an ISO8601 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
@@ -5883,7 +5828,7 @@
\blx@metadateinfo{#2}%
\iffieldundef{#2year}
{\blx@nounit}
- {\printtext[#2date]{%
+ {\printtext[{#2date}]{%
\datecircaprint
% Such a season component can only come from an ISO8601 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
@@ -5905,37 +5850,38 @@
{\printfield{extradate}}
{\iffieldequalstr{#2endyear}{}
{\printfield{extradate}%
- \printtext{\mbox{\bibdaterangesep}}}
- {\printtext{%
- \bibdaterangesep
- \enddatecircaprint
- \iffieldundef{#2endseason}
- {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}
- {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}}%
- \printfield{extradate}%
- \enddateuncertainprint
- \dateeraprint{#2endyear}}}}}%
+ \mbox{\bibdaterangesep}}
+ {\bibdaterangesep
+ \enddatecircaprint
+ \iffieldundef{#2endseason}
+ {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}
+ {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}}%
+ \printfield{extradate}%
+ \enddateuncertainprint
+ \dateeraprint{#2endyear}}}}%
\endgroup}
\newrobustcmd*{\mkdaterangeyear}[1]{%
- \blx@imc@clearfield{#1season}%
- \blx@imc@clearfield{#1month}%
- \blx@imc@clearfield{#1day}%
- \blx@imc@clearfield{#1hour}%
- \blx@imc@clearfield{#1minute}%
- \blx@imc@clearfield{#1second}%
- \blx@imc@clearfield{#1timezone}%
- \blx@imc@clearfield{#1endseason}%
- \blx@imc@clearfield{#1endmonth}%
- \blx@imc@clearfield{#1endday}%
- \blx@imc@clearfield{#1endhour}%
- \blx@imc@clearfield{#1endminute}%
- \blx@imc@clearfield{#1endsecond}%
- \blx@imc@clearfield{#1endtimezone}%
- \ifdateyearsequal{#1}{#1end}
- {\blx@imc@clearfield{#1endyear}}
- {}%
- \mkdaterangefull{short}{#1}}
+ \begingroup
+ \blx@imc@clearfield{#1season}%
+ \blx@imc@clearfield{#1month}%
+ \blx@imc@clearfield{#1day}%
+ \blx@imc@clearfield{#1hour}%
+ \blx@imc@clearfield{#1minute}%
+ \blx@imc@clearfield{#1second}%
+ \blx@imc@clearfield{#1timezone}%
+ \blx@imc@clearfield{#1endseason}%
+ \blx@imc@clearfield{#1endmonth}%
+ \blx@imc@clearfield{#1endday}%
+ \blx@imc@clearfield{#1endhour}%
+ \blx@imc@clearfield{#1endminute}%
+ \blx@imc@clearfield{#1endsecond}%
+ \blx@imc@clearfield{#1endtimezone}%
+ \ifdateyearsequal{#1}{#1end}
+ {\blx@imc@clearfield{#1endyear}}
+ {}%
+ \mkdaterangefull{short}{#1}%
+ \endgroup}
% {<datetype>}
\newrobustcmd*{\mkdaterangeymd}[1]{%
@@ -5943,7 +5889,7 @@
\blx@metadateinfo{#1}%
\iffieldundef{#1year}
{\blx@nounit}
- {\printtext[#1date]{%
+ {\printtext[{#1date}]{%
\datecircaprint
% Such a season component can only come from an ISO8601 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
@@ -5975,7 +5921,7 @@
\blx@metadateinfo{#1}%
\iffieldundef{#1year}
{\blx@nounit}
- {\printtext[#1date]{%
+ {\printtext[{#1date}]{%
\datecircaprint
% Such a season component can only come from an ISO8601 season which replaces
% a normal month so if it exists, we know that a normal date print is ruled out
@@ -5990,16 +5936,15 @@
{}
{\iffieldequalstr{#1endyear}{}
{\mbox{\bibdaterangesep}}
- {\printtext{%
- \bibdaterangesep
- \enddatecircaprint
- \iffieldundef{#1season}
- {\blx@ymddate{#1}{end}%
- % Optionally print the time after the date
- \blx@printtime{#1}{end}}
- {\csuse{mkbibseasondateshort}{#1endyear}{#1endseason}}}%
+ {\bibdaterangesep
+ \enddatecircaprint
+ \iffieldundef{#1season}
+ {\blx@ymddate{#1}{end}%
+ % Optionally print the time after the date
+ \blx@printtime{#1}{end}}
+ {\csuse{mkbibseasondateshort}{#1endyear}{#1endseason}}}%
\enddateuncertainprint
- \dateeraprint{#1endyear}}}}}%
+ \dateeraprint{#1endyear}}}}%
\endgroup}
% [extradate]{<datetype>}{''|end}
@@ -6010,24 +5955,26 @@
\iffieldundef{#2#3day}{}{\bibdatesep\mkdayzeros{\thefield{#2#3day}}}}
\newrobustcmd*{\mkdaterangeyearextra}[1]{%
- \blx@imc@clearfield{#1season}%
- \blx@imc@clearfield{#1month}%
- \blx@imc@clearfield{#1day}%
- \blx@imc@clearfield{#1hour}%
- \blx@imc@clearfield{#1minute}%
- \blx@imc@clearfield{#1second}%
- \blx@imc@clearfield{#1timezone}%
- \blx@imc@clearfield{#1endseason}%
- \blx@imc@clearfield{#1endmonth}%
- \blx@imc@clearfield{#1endday}%
- \blx@imc@clearfield{#1endhour}%
- \blx@imc@clearfield{#1endminute}%
- \blx@imc@clearfield{#1endsecond}%
- \blx@imc@clearfield{#1endtimezone}%
- \ifdateyearsequal{#1}{#1end}
- {\blx@imc@clearfield{#1endyear}}
- {}%
- \mkdaterangefullextra{short}{#1}}
+ \begingroup
+ \blx@imc@clearfield{#1season}%
+ \blx@imc@clearfield{#1month}%
+ \blx@imc@clearfield{#1day}%
+ \blx@imc@clearfield{#1hour}%
+ \blx@imc@clearfield{#1minute}%
+ \blx@imc@clearfield{#1second}%
+ \blx@imc@clearfield{#1timezone}%
+ \blx@imc@clearfield{#1endseason}%
+ \blx@imc@clearfield{#1endmonth}%
+ \blx@imc@clearfield{#1endday}%
+ \blx@imc@clearfield{#1endhour}%
+ \blx@imc@clearfield{#1endminute}%
+ \blx@imc@clearfield{#1endsecond}%
+ \blx@imc@clearfield{#1endtimezone}%
+ \ifdateyearsequal{#1}{#1end}
+ {\blx@imc@clearfield{#1endyear}}
+ {}%
+ \mkdaterangefullextra{short}{#1}%
+ \endgroup}
\newrobustcmd*{\mkdaterangeiso}[1]{%
\begingroup
@@ -6035,13 +5982,13 @@
\def\bibdatetimesep{T}%
\iffieldundef{#1year}
{\blx@nounit}
- {\printtext[#1date]{%
+ {\printtext[{#1date}]{%
\blx@isodate{#1}{}%
\ifboolexpr{%
togl {blx@#1dateusetime}
and
not test {\iffieldundef{#1hour}}}
- {\printtext{\bibdatetimesep}%
+ {\bibdatetimesep%
\blx@isotime{#1}{}}
{}%
\dateuncertainprint
@@ -6054,7 +6001,7 @@
togl {blx@#1dateusetime}
and
not test {\iffieldundef{#1endhour}}}
- {\printtext{\bibdatetimesep}%
+ {\bibdatetimesep%
\blx@isotime{#1}{end}}
{}%
\enddateuncertainprint
@@ -6067,13 +6014,13 @@
\def\bibdatetimesep{T}%
\iffieldundef{#1year}
{\blx@nounit}
- {\printtext[#1date]{%
+ {\printtext[{#1date}]{%
\blx@isodate[extradate]{#1}{}%
\ifboolexpr{%
togl {blx@#1dateusetime}
and
not test {\iffieldundef{#1hour}}}
- {\printtext{\bibdatetimesep}%
+ {\bibdatetimesep%
\blx@isotime{#1}{}}
{}%
\dateuncertainprint
@@ -6086,7 +6033,7 @@
togl {blx@#1dateusetime}
and
not test {\iffieldundef{#1endhour}}}
- {\printtext{\bibdatetimesep}%
+ {\bibdatetimesep%
\blx@isotime{#1}{end}}
{}%
\enddateuncertainprint
@@ -6194,13 +6141,17 @@
loaded, is faulty or does not contain a definition\MessageBreak
for \expandafter\string\csname mkbibtime24h\endcsname
}%
- \iffieldundef{#1}{}
- {\printtext{\mktimezeros{\thefield{#1}}}\setunit{\bibtimesep}}%
- \iffieldundef{#2}{}
- {\printtext{\mktimezeros{\thefield{#2}}}\setunit{\bibtimesep}}%
- \iffieldundef{#3}{}
- {\printtext{\mktimezeros{\thefield{#3}}}}%
- \setunit{}%
+ \iffieldundef{#1}
+ {}
+ {\mktimezeros{\thefield{#1}}%
+ \iffieldundef{#2}{}{\bibtimesep}}%
+ \iffieldundef{#2}
+ {}
+ {\mktimezeros{\thefield{#2}}%
+ \iffieldundef{#3}{}{\bibtimesep}}%
+ \iffieldundef{#3}
+ {}
+ {\mktimezeros{\thefield{#3}}}%
\iffieldundef{#4}{}
{\bibtimezonesep
\mkbibtimezone{\thefield{#4}}}}
@@ -6226,7 +6177,7 @@
{\bibstring{pm}}%
\iffieldundef{#4}{}
{\space\bibtimezonesep
- \parentext{\mkbibtimezone{\thefield{#4}}}}}
+ \mkbibparens{\mkbibtimezone{\thefield{#4}}}}}
\newrobustcmd*{\mkbibseasondateshort}[2]{%
\blx@warning@noline{%
@@ -6353,28 +6304,65 @@
% User macro for retrieving currrent language
\def\currentlang{\blx@languagename}
+% We need to be able to prefix \providetoggle with \global,
+% plus we don't need the testing from \providetoggle anway.
+% This uses internal implementation details of etoolbox's
+% toggles, so is a bit meh, but it's better than rolling our own
+% version of toggles just for that.
+\newcommand*{\blx@etb@inittoggle}[1]{\cslet{etb@tgl@#1}\@secondoftwo}
+
+% There is no \nocaptions..., so if we send everything to \captions...
+% we need to find a way to call our noextras only in situations where
+% \noextras... is called to clean up \extras... AND \captions...
+% and not just \extras...
+% We detect this by setting a toggle in the \captions...
+
% {<language>}{<strings>}
\def\blx@maplang@babel#1#2{%
- \csgappto{extras#1}{%
- \blx@resetpunct
- \csuse{abx@extras@#2}%
- \csuse{abx@strings@#2}}%
- \csgappto{noextras#1}{%
- \blx@resetpunct
- \csuse{abx@noextras@#2}}}
+ \global\blx@etb@inittoggle{blx@lang@captions@#2}%
+ \ifdefstring{\blx@langhook}{captions}
+ {\csgappto{captions#1}{%
+ \toggletrue{blx@lang@captions@#2}%
+ \blx@resetpunct
+ \csuse{abx@extras@#2}%
+ \csuse{abx@strings@#2}}%
+ \csgappto{noextras#1}{%
+ \iftoggle{blx@lang@captions@#2}
+ {\blx@resetpunct
+ \csuse{abx@noextras@#2}}
+ {}}}
+ {\csgappto{extras#1}{%
+ \blx@resetpunct
+ \csuse{abx@extras@#2}%
+ \csuse{abx@strings@#2}}%
+ \csgappto{noextras#1}{%
+ \blx@resetpunct
+ \csuse{abx@noextras@#2}}}}
\def\blx@maplang@polyglossia#1#2{%
- \csgappto{blockextras@bbl@#1}{%
- \blx@resetpunct
- \csuse{abx@extras@#2}%
- \csuse{abx@strings@#2}}%
- \csgappto{inlinextras@bbl@#1}{%
- \blx@resetpunct
- \csuse{abx@extras@#2}%
- \csuse{abx@strings@#2}}%
- \csgappto{noextras@bbl@#1}{%
- \blx@resetpunct
- \csuse{abx@noextras@#2}}}
+ \global\blx@etb@inittoggle{blx@lang@captions@#2}%
+ \ifdefstring{\blx@langhook}{captions}
+ {\csgappto{captions@bbl@#1}{%
+ \toggletrue{blx@lang@captions@#2}%
+ \blx@resetpunct
+ \csuse{abx@extras@#2}%
+ \csuse{abx@strings@#2}}%
+ \csgappto{noextras@bbl@#1}{%
+ \iftoggle{blx@lang@captions@#2}
+ {\blx@resetpunct
+ \csuse{abx@noextras@#2}}
+ {}}}
+ {\csgappto{blockextras@bbl@#1}{%
+ \blx@resetpunct
+ \csuse{abx@extras@#2}%
+ \csuse{abx@strings@#2}}%
+ \csgappto{inlineextras@bbl@#1}{%
+ \blx@resetpunct
+ \csuse{abx@extras@#2}%
+ \csuse{abx@strings@#2}}%
+ \csgappto{noextras@bbl@#1}{%
+ \blx@resetpunct
+ \csuse{abx@noextras@#2}}}}
%% babel/polyglossia interface
\def\blx@beglang{\blx@clearlang\begingroup}
@@ -6398,53 +6386,61 @@
\lefthyphenmin#1\relax
\righthyphenmin#2\relax}
-\begingroup
-\@makeother\#
-\gdef\blx@mkautolangbabel{%
+
+
+\def\blx@mkautolangbabel{%
\ifundef\bbl@main@language
{\blx@error
{No default 'babel' language defined}
{You must define a default language for 'babel'}}
{\let\blx@main@language\bbl@main@language}%
- \pretocmd\select@language{\blx@langsetup{#1}}
- {\ifdef\blx@thelangenv
- {\def\blx@beglang{%
- \blx@clearlang
- \begingroup
- % Need to override all entries, regardless of if there is a langid
- % if language=<language> option is given
+ % use afterreset to get in a bit earlier
+ % we want to be there before \captions... is issued
+ % beforeextras is before extras, but captions come before extras
+ % afterreset was added in 3.9i (~2014-03-16)
+ % way before 3.9r (2016-04-23), which we require
+ \AddBabelHook{biblatex@langsetup}{afterreset}{%
+ \expandafter\blx@langsetup\expandafter{\languagename}}%
+ \ifdef\blx@thelangenv
+ {\def\blx@beglang{%
+ \blx@clearlang
+ \begingroup
+ % Need to override all entries, regardless of if there is a
+ % langid if language=<language> option is given
\ifboolexpr { test {\ifdef\abx@field@langid }
or
test {\ifdef\blx@forcelanguagename} }
- % override local langid if we forced it with
- % language=<language> option
- {\ifdef\blx@forcelanguagename
- {\let\abx@field@langid\blx@forcelanguagename}
- {}%
- \let\blx@languagename\abx@field@langid% track global language
- \blx@ifhyphenationundef{\abx@field@langid}
- {\blx@warn@nohyph{\abx@field@langid}}
- {\blx@hook@initlang
- \def\blx@endlang{%
- \blx@hook@endlang
- \csname end\blx@thelangenv\endcsname
- \endgroup}%
- \iftoggle{blx@autolangbib}
- {\let\blx@endlangbib\blx@endlang}
- {}%
- \iftoggle{blx@autolangcite}
- {\let\blx@endlangcite\blx@endlang}
- {}%
- \csname\blx@thelangenv\expandafter\endcsname
- \expandafter{\abx@field@langid}}}
- {}}}
- {}%
- \def\blx@imc@mainlang{\select@language{\blx@main@language}}%
- \blx@langsetup\blx@main@language}
- {\blx@err@patch{'babel' package}%
- \blx@mknoautolang}}
+ % override local langid if we forced it with
+ % language=<language> option
+ {\ifdef\blx@forcelanguagename
+ {\let\abx@field@langid\blx@forcelanguagename}
+ {}%
+ \let\blx@languagename\abx@field@langid% track global language
+ \blx@ifhyphenationundef{\abx@field@langid}
+ {\blx@warn@nohyph{\abx@field@langid}}
+ {\blx@hook@initlang
+ \def\blx@endlang{%
+ \blx@hook@endlang
+ \csname end\blx@thelangenv\endcsname
+ \endgroup}%
+ \iftoggle{blx@autolangbib}
+ {\let\blx@endlangbib\blx@endlang}
+ {}%
+ \iftoggle{blx@autolangcite}
+ {\let\blx@endlangcite\blx@endlang}
+ {}%
+ \csname\blx@thelangenv\expandafter\endcsname
+ \expandafter{\abx@field@langid}}}
+ {}}}
+ {}%
+ \def\blx@imc@mainlang{%
+ \expandafter\selectlanguage\expandafter{\blx@main@language}}%
+ \expandafter\blx@langsetup\expandafter{\blx@main@language}%
+}
-\gdef\blx@mkautolangpoly{%
+\def\blx@beglang@spacefactors{\frenchspacing}
+
+\def\blx@mkautolangpoly{%
\ifundef\mainbabelname
{\ifundef\bbl@main@language
{\blx@error
@@ -6452,59 +6448,57 @@
{You must define a default language for 'polyglossia'}}
{\let\blx@main@language\bbl@main@language}}
{\let\blx@main@language\mainbabelname}%
- \edef\blx@saved@underscore@catcode{\the\catcode`\_}%
- \catcode`\_=11% polyglossia uses "_" as a letter
- \pretocmd\select@language{\blx@langsetup{\babelname}}
- {\ifdef\blx@thelangenv
- {\def\blx@beglang{%
- \blx@clearlang
- \begingroup
- % Need to override all entries, regardless of if there is a
- % langid if language=<language> option is given
- \ifboolexpr { test {\ifdef\abx@field@langid }
- or
- test {\ifdef\blx@forcelanguagename} }
- % override local langid if we forced it with
- % language=<language> option
- {\ifdef\blx@forcelanguagename
- {\let\abx@field@langid\blx@forcelanguagename}
- {}%
- \let\blx@languagename\abx@field@langid% track global language
- \blx@ifhyphenationundef{\abx@field@langid}
- {\blx@warn@nohyph{\abx@field@langid}}
- {\blx@hook@initlang
- \def\blx@endlang{%
- \blx@hook@endlang
- % Polyglossia language envs are \<lang>[]
- \ifcsstring{blx@thelangenv}{langname}
- {\csname end\abx@field@langid\endcsname}
- {\csname end\blx@thelangenv\endcsname}%
- \endgroup}%
- \iftoggle{blx@autolangbib}
- {\let\blx@endlangbib\blx@endlang}
- {}%
- \iftoggle{blx@autolangcite}
- {\let\blx@endlangcite\blx@endlang}
- {}%
+ \ifundef\polyglossia@language@switched
+ {\apptocmd\select@language
+ {\expandafter\blx@langsetup\expandafter{\babelname}}
+ {}
+ {\blx@err@patch{'polyglossia' package}%
+ \blx@mknoautolang}}
+ {\appto\polyglossia@language@switched{%
+ \expandafter\blx@langsetup\expandafter{\babelname}}}%
+ \ifdef\blx@thelangenv
+ {\def\blx@beglang{%
+ \blx@clearlang
+ \begingroup
+ % Need to override all entries, regardless of if there is a
+ % langid if language=<language> option is given
+ \ifboolexpr { test {\ifdef\abx@field@langid }
+ or
+ test {\ifdef\blx@forcelanguagename} }
+ % override local langid if we forced it with
+ % language=<language> option
+ {\ifdef\blx@forcelanguagename
+ {\let\abx@field@langid\blx@forcelanguagename}
+ {}%
+ \let\blx@languagename\abx@field@langid% track global language
+ \blx@ifhyphenationundef{\abx@field@langid}
+ {\blx@warn@nohyph{\abx@field@langid}}
+ {\blx@hook@initlang
+ \def\blx@endlang{%
+ \blx@hook@endlang
+ % Polyglossia language envs are \<lang>[]
\ifcsstring{blx@thelangenv}{langname}
- {\ifdef\abx@field@langidopts
- {\csname\abx@field@langid\expandafter\endcsname\expandafter[\abx@field@langidopts]}
- {\csname\abx@field@langid\endcsname}}
- {\csname\blx@thelangenv\expandafter\endcsname\expandafter{\abx@field@langid}}%
- % These lines are equal to \blx@maplang
- \ifcsstring{blx@thelangenv}{hyphenrules}
- {}
- {\blx@resetpunct
- \csuse{abx@extras@\abx@field@langid}%
- \csuse{abx@strings@\abx@field@langid}}}}
- {}}}
+ {\csname end\abx@field@langid\endcsname}
+ {\csname end\blx@thelangenv\endcsname}%
+ \endgroup}%
+ \iftoggle{blx@autolangbib}
+ {\let\blx@endlangbib\blx@endlang}
+ {}%
+ \iftoggle{blx@autolangcite}
+ {\let\blx@endlangcite\blx@endlang}
+ {}%
+ \ifcsstring{blx@thelangenv}{langname}
+ {\ifdef\abx@field@langidopts
+ {\csname\abx@field@langid\expandafter\endcsname
+ \expandafter[\abx@field@langidopts]}
+ {\csname\abx@field@langid\endcsname}}
+ {\csname\blx@thelangenv\expandafter\endcsname
+ \expandafter{\abx@field@langid}}%
+ \blx@beglang@spacefactors}}
+ {}}}
{}%
- \def\blx@imc@mainlang{\select@language{\blx@main@language}}%
- \blx@langsetup\blx@main@language}
- {\blx@err@patch{'polyglossia' package}%
- \blx@mknoautolang}%
- \catcode`\_=\blx@saved@underscore@catcode\relax}
-\endgroup
+ \def\blx@imc@mainlang{\select@language{\blx@main@language}}%
+ \expandafter\blx@langsetup\expandafter{\blx@main@language}}
\def\blx@mknoautolang{%
\blx@lbxinput{\blx@languagename}
@@ -6553,6 +6547,10 @@
% fields which can be used as labels - we auto-create some macros for these
\def\abx@dolabelfields{\dolistloop\blx@datamodel@labelfields}
+\def\abx@dolabelwidths{%
+ \do{labelnumber}%
+ \do{labelalpha}%
+ \abx@dolabelfields}
\def\abx@donames{\dolistloop\blx@datamodel@names}
\def\abx@donameparts{\expandafter\docsvlist\expandafter{\blx@datamodel@constant@nameparts}}
@@ -6682,19 +6680,19 @@
{\csuse{blx@defblxopt@#1opt}{#3}[]}}
\long\def\blx@defblxopt@globalopt#1[#2]#3{%
- \ifcsundef{KV@blx@opt@ldt@#1}
- {\ifcsundef{KV@blx@opt@pre@#1}
+ \blx@kv@ifkeyundef{blx@opt@ldt}{#1}
+ {\blx@kv@ifkeyundef{blx@opt@pre}{#1}
{\ifblank{#2}
- {\define@key{blx@opt@pre}{#1}{#3}}
- {\define@key{blx@opt@pre}{#1}[#2]{#3}}}
+ {\blx@kv@defkey{blx@opt@pre}{#1}{#3}}
+ {\blx@kv@defkey{blx@opt@pre}{#1}[{#2}]{#3}}}
{\blx@err@optdef{#1}{pre/global}}}
{\blx@err@optdef{#1}{ldt/global}}}
\long\def\blx@defblxopt@typeentryopt#1#2[#3]#4{%
- \ifcsundef{KV@blx@opt@#1@#2}
+ \blx@kv@ifkeyundef{blx@opt@#1}{#2}
{\ifblank{#3}
- {\define@key{blx@opt@#1}{#2}{#4}}
- {\define@key{blx@opt@#1}{#2}[#3]{#4}}}
+ {\blx@kv@defkey{blx@opt@#1}{#2}{#4}}
+ {\blx@kv@defkey{blx@opt@#1}{#2}[{#3}]{#4}}}
{\blx@err@optdef{#2}{#1}}}
\def\blx@defblxopt@typeopt{\blx@defblxopt@typeentryopt{typ}}
@@ -6715,10 +6713,10 @@
\forcsvlist{\listadd\blx@optscopes}{global,type,entry}
\long\def\blx@defblxopt@loopscopes@i#1[#2]#3#4{%
- \csuse{blx@defblxopt@#4opt}{#1}[#2]{#3}}
+ \csuse{blx@defblxopt@#4opt}{#1}[{#2}]{#3}}
\long\def\blx@defblxopt@loopscopes#1[#2]#3{%
- \forlistloop{\blx@defblxopt@loopscopes@i{#1}[#2]{#3}}{\blx@optscopes}}
+ \forlistloop{\blx@defblxopt@loopscopes@i{#1}[{#2}]{#3}}{\blx@optscopes}}
% {<option scopes>}[<datatype>]{<key>}[<default value>]{<code>}
\newrobustcmd*{\DeclareBiblatexOption}[1]{%
@@ -6792,6 +6790,8 @@
\gdef\blx@bcf@backendin@name@nametemplates{sortingnamekeytemplatename,%
uniquenametemplatename,labelalphanametemplatename}%
+
+
% Misc globalopts
\blx@DeclareBackendOption{global}[xml]{datamodel}
\blx@collectopts{string}{blx@globalopts}{controlversion}
@@ -7004,7 +7004,7 @@
{\blx@stripfromendinto{#1}{year}\blx@datetype}%
\csuse{if\blx@datetype\blx@tempa dateera}{bce}
{\ifnumless{0-\thefield{#1}}{0}
- {\printtext{\csuse{bibdateera\blx@tempa prefix}}}
+ {\csuse{bibdateera\blx@tempa prefix}}
{}}
{}%
\endgroup}
@@ -7020,10 +7020,10 @@
\csuse{if\blx@datetype\blx@tempa dateera}{bce}
{\ifnum\numexpr0-\thefield{#1}\relax<\blx@dateeraauto
% \midsentence is to suppress automatic capitalisation
- \printtext{\printdelim{dateeradelim}\midsentence\bibstring{\blx@dateera@bce}}\relax
+ \printdelim{dateeradelim}\midsentence\bibstring{\blx@dateera@bce}\relax
\fi}
{\ifnumless{\thefield{#1}}\blx@dateeraauto
- {\printtext{\printdelim{dateeradelim}\midsentence\bibstring{\blx@dateera@ce}}}
+ {\printdelim{dateeradelim}\midsentence\bibstring{\blx@dateera@ce}}
{}}%
\endgroup}
{}}}%
@@ -7160,10 +7160,8 @@
\def\do#1{\expandafter\newlength\expandafter{\csname #1width\endcsname}}
\abx@dolabelfields
-\newlength{\locallabelnumberwidth}
-\newlength{\locallabelalphawidth}
\def\do#1{\expandafter\newlength\expandafter{\csname local#1width\endcsname}}
-\abx@dolabelfields
+\abx@dolabelwidths
\protected\def\blx@resetdata{%
\let\blx@saved@do\do
@@ -7304,13 +7302,12 @@
\begingroup
\def\item{\MessageBreak-\space}%
\def\break{\MessageBreak\space\space}%
- \edef\blx@tempa{%
+ \blx@warning@noline{%
Biber reported the following issues%
\ifdef\abx@field@entrykey
{\MessageBreak with '\abx@field@entrykey'}
{}%
:#1}%
- \blx@warning@noline{\blx@tempa}%
\endgroup}
% {<field>}{<code>}
@@ -7860,6 +7857,7 @@
% {<entrykey>}
\protected\def\blx@bbl@xref#1{}% No-op to avoid an error with BibTeX .bbl
+\protected\def\blx@bbl@fakeset#1{}% No-op to avoid an error with BibTeX .bbl
% {<keyword>,...}
\protected\def\blx@bbl@keyw#1{%
@@ -7869,23 +7867,46 @@
\def\blx@addkeyword#1#2{%
\listcsxadd{blx@keyw@\the\c@refsection @\detokenize{#2}}{#1}}
+\newcommand*{\blx@ifcatcode@other}[1]{%
+ \ifnumequal{\catcode\number`#1}{12}}
+
% {<options>}
\protected\long\def\blx@bbl@options#1{%
- \begingroup
+ \ifblank{#1}
+ {}
+ {\begingroup
+ \blx@ifcatcode@other{,}
+ {\blx@ifcatcode@other{=}}
+ {\@secondoftwo}
+ {\blx@bbl@options@check{#1}}
+ {\ifundef\blx@bbl@options@warncatcode
+ {\blx@warning@noline{%
+ Irregular catcode regime detected.\MessageBreak
+ Attempting to work around this with \string\scantokens}%
+ \global\let\blx@bbl@options@warncatcode\@empty}
+ {}%
+ \makeatletter
+ \@makeother\=
+ \@makeother\'
+ \endlinechar\m@ne
+ \scantokens\expandafter{\blx@bbl@options@check{#1}}}}}
+
+\long\def\blx@bbl@options@check#1{%
\let\blx@tempa\@empty
- \forcsvlist\blx@bbl@options@i{#1}%
+ \forcsvlist\blx@bbl@options@checkopt{#1}%
\edef\blx@tempa{%
- \endgroup
+ \endgroup % this group was opened in \blx@bbl@options
\ifx\blx@tempa\@empty
\else
\def\noexpand\abx@field@options{\expandonce\blx@tempa}%
\fi}%
\blx@tempa}
-\long\def\blx@bbl@options@i#1{\blx@bbl@options@ii#1==&}
-\long\def\blx@bbl@options@ii#1=#2=#3&{%
- \ifcsundef{KV@blx@opt@ent@#1}
+\long\def\blx@bbl@options@checkopt#1{\blx@bbl@options@checkopt@i#1==&}
+
+\long\def\blx@bbl@options@checkopt@i#1=#2=#3&{%
+ \blx@kv@ifkeyundef{blx@opt@ent}{#1}
{\blx@warning@noline{%
Ignoring undefined option '#1'\MessageBreak
at entry '\abx@field@entrykey'}}
@@ -7971,107 +7992,43 @@
% in which case we only set labelyear.
{\ifcsundef{abx@field@\abx@field@labeldatesource}
% \DeclareLabeldate resolved to a literal/localisation string
- {\edef\abx@field@labelyear{\abx@field@labeldatesource}}
+ {\let\abx@field@labelyear\abx@field@labeldatesource}
% \DeclareLabeldate resolved to a non-date field. Not safe to \edef because
- % such contents could contain arbitrary macros, unlike ETDF sourced labeldatesource values
+ % such contents could contain arbitrary macros, unlike EDTF sourced labeldatesource values
{\letcs\abx@field@labelyear{abx@field@\abx@field@labeldatesource}}}
% \DeclareLabeldate resolved to a date field name prefix like '', 'event', 'url'
% or 'orig'
{% labeldateera/labelenddateera
- \ifcsdef{abx@field@\abx@field@labeldatesource dateera}
- {\edef\abx@field@labeldateera{\csuse{abx@field@\abx@field@labeldatesource dateera}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource enddateera}
- {\edef\abx@field@labelenddateera{\csuse{abx@field@\abx@field@labeldatesource enddateera}}}
- {}%
- % labelyear/labelendyear
- \ifcsdef{abx@field@\abx@field@labeldatesource year}
- {\edef\abx@field@labelyear{\csuse{abx@field@\abx@field@labeldatesource year}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endyear}
- {\edef\abx@field@labelendyear{\csuse{abx@field@\abx@field@labeldatesource endyear}}}
- {}%
- % labelmonth
- \ifcsdef{abx@field@\abx@field@labeldatesource month}
- {\edef\abx@field@labelmonth{\csuse{abx@field@\abx@field@labeldatesource month}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endmonth}
- {\edef\abx@field@labelendmonth{\csuse{abx@field@\abx@field@labeldatesource endmonth}}}
- {}%
- % labelday/labelendday
- \ifcsdef{abx@field@\abx@field@labeldatesource day}
- {\edef\abx@field@labelday{\csuse{abx@field@\abx@field@labeldatesource day}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endday}
- {\edef\abx@field@labelendday{\csuse{abx@field@\abx@field@labeldatesource endday}}}
- {}%
- % labelhour/labelendhour
- \ifcsdef{abx@field@\abx@field@labeldatesource hour}
- {\edef\abx@field@labelhour{\csuse{abx@field@\abx@field@labeldatesource hour}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endhour}
- {\edef\abx@field@labelendhour{\csuse{abx@field@\abx@field@labeldatesource endhour}}}
- {}%
- % labelminute/labelendminute
- \ifcsdef{abx@field@\abx@field@labeldatesource minute}
- {\edef\abx@field@labelminute{\csuse{abx@field@\abx@field@labeldatesource minute}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endminute}
- {\edef\abx@field@labelendminute{\csuse{abx@field@\abx@field@labeldatesource endminute}}}
- {}%
- % labelsecond/labelendsecond
- \ifcsdef{abx@field@\abx@field@labeldatesource second}
- {\edef\abx@field@labelsecond{\csuse{abx@field@\abx@field@labeldatesource second}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endsecond}
- {\edef\abx@field@labelendsecond{\csuse{abx@field@\abx@field@labeldatesource endsecond}}}
- {}%
- % labeltimezone/labelendtimezone
- \ifcsdef{abx@field@\abx@field@labeldatesource timezone}
- {\edef\abx@field@labeltimezone{\csuse{abx@field@\abx@field@labeldatesource timezone}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endtimezone}
- {\edef\abx@field@labelendtimezone{\csuse{abx@field@\abx@field@labeldatesource endtimezone}}}
- {}%
- % labelseason/labelendseason
- \ifcsdef{abx@field@\abx@field@labeldatesource season}
- {\edef\abx@field@labelseason{\csuse{abx@field@\abx@field@labeldatesource season}}}
- {}%
- \ifcsdef{abx@field@\abx@field@labeldatesource endseason}
- {\edef\abx@field@labelendseason{\csuse{abx@field@\abx@field@labeldatesource endseason}}}
- {}%
- % labeldateunspecified
- \ifcsdef{abx@field@\abx@field@labeldatesource dateunspecified}
- {\csletcs{abx@field@labeldateunspecified}{abx@field@\abx@field@labeldatesource dateunspecified}}
- {}%
- % labeldatecirca/labelenddatecirca
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource datecirca}
- {\csletcs{etb@tgl@abx@bool@labeldatecirca}{etb@tgl@abx@bool@\abx@field@labeldatesource datecirca}}
- {}%
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource enddatecirca}
- {\csletcs{etb@tgl@abx@bool@labelenddatecirca}{etb@tgl@abx@bool@\abx@field@labeldatesource enddatecirca}}
- {}%
- % labeldatejulian/labelenddatejulian
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource datejulian}
- {\csletcs{etb@tgl@abx@bool@labeldatejulian}{etb@tgl@abx@bool@\abx@field@labeldatesource datejulian}}
- {}%
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource enddatejulian}
- {\csletcs{etb@tgl@abx@bool@labelenddatejulian}{etb@tgl@abx@bool@\abx@field@labeldatesource enddatejulian}}
- {}%
- % labeldateuncertain/labelenddateuncertain
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource dateuncertain}
- {\csletcs{etb@tgl@abx@bool@labeldateuncertain}{etb@tgl@abx@bool@\abx@field@labeldatesource dateuncertain}}
- {}%
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource enddateuncertain}
- {\csletcs{etb@tgl@abx@bool@labelenddateuncertain}{etb@tgl@abx@bool@\abx@field@labeldatesource enddateuncertain}}
- {}%
- % labeldateunknown/labelenddateunknown
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource dateunknown}
- {\csletcs{etb@tgl@abx@bool@labeldateunknown}{etb@tgl@abx@bool@\abx@field@labeldatesource dateunknown}}
- {}%
- \ifcsdef{etb@tgl@abx@bool@\abx@field@labeldatesource enddateunknown}
- {\csletcs{etb@tgl@abx@bool@labelenddateunknown}{etb@tgl@abx@bool@\abx@field@labeldatesource enddateunknown}}
- {}}}}
+ \letcs\abx@field@labeldateera{abx@field@\abx@field@labeldatesource dateera}%
+ \letcs\abx@field@labelenddateera{abx@field@\abx@field@labeldatesource enddateera}%
+ \letcs\abx@field@labelyear{abx@field@\abx@field@labeldatesource year}%
+ \letcs\abx@field@labelendyear{abx@field@\abx@field@labeldatesource endyear}%
+ \letcs\abx@field@labelmonth{abx@field@\abx@field@labeldatesource month}%
+ \letcs\abx@field@labelendmonth{abx@field@\abx@field@labeldatesource endmonth}%
+ \letcs\abx@field@labelday{abx@field@\abx@field@labeldatesource day}%
+ \letcs\abx@field@labelendday{abx@field@\abx@field@labeldatesource endday}%
+ \letcs\abx@field@labelhour{abx@field@\abx@field@labeldatesource hour}%
+ \letcs\abx@field@labelendhour{abx@field@\abx@field@labeldatesource endhour}%
+ \letcs\abx@field@labelminute{abx@field@\abx@field@labeldatesource minute}%
+ \letcs\abx@field@labelendminute{abx@field@\abx@field@labeldatesource endminute}%
+ \letcs\abx@field@labelsecond{abx@field@\abx@field@labeldatesource second}%
+ \letcs\abx@field@labelendsecond{abx@field@\abx@field@labeldatesource endsecond}%
+ \letcs\abx@field@labeltimezone{abx@field@\abx@field@labeldatesource timezone}%
+ \letcs\abx@field@labelendtimezone{abx@field@\abx@field@labeldatesource endtimezone}%
+ \letcs\abx@field@labelseason{abx@field@\abx@field@labeldatesource season}%
+ \letcs\abx@field@labelendseason{abx@field@\abx@field@labeldatesource endseason}%
+ \letcs\abx@field@labeldateunspecified{abx@field@\abx@field@labeldatesource dateunspecified}%
+ \letcs\etb@tgl@abx@bool@labeldatecirca{etb@tgl@abx@bool@\abx@field@labeldatesource datecirca}%
+ \letcs\etb@tgl@abx@bool@labelenddatecirca{etb@tgl@abx@bool@\abx@field@labeldatesource enddatecirca}%
+ \letcs\etb@tgl@abx@bool@labeldatejulian{etb@tgl@abx@bool@\abx@field@labeldatesource datejulian}%
+ \letcs\etb@tgl@abx@bool@labelenddatejulian{etb@tgl@abx@bool@\abx@field@labeldatesource enddatejulian}%
+ \letcs\etb@tgl@abx@bool@labeldateuncertain{etb@tgl@abx@bool@\abx@field@labeldatesource dateuncertain}%
+ \letcs\etb@tgl@abx@bool@labelenddateuncertain{etb@tgl@abx@bool@\abx@field@labeldatesource enddateuncertain}%
+ \letcs\etb@tgl@abx@bool@labeldateunknown{etb@tgl@abx@bool@\abx@field@labeldatesource dateunknown}%
+ \letcs\etb@tgl@abx@bool@labelenddateunknown{etb@tgl@abx@bool@\abx@field@labeldatesource enddateunknown}%
+ }%
+ }%
+}
% This gets the entry data for a citation
\def\blx@getdata@cite#1{%
@@ -8080,26 +8037,35 @@
\ifcsdef{blx@setc@\the\c@refsection @#1}
{\blx@ifdata{#1}
{\def\abx@field@childentrykey{#1}%LEGACY(<3.8)
- \edef\abx@field@childentrytype{\abx@field@entrytype}%LEGACY(<3.8)
+ \let\abx@field@childentrytype\abx@field@entrytype %LEGACY(<3.8)
\begingroup
- \expandafter\expandafter\expandafter\blx@getdata\expandafter\expandafter\expandafter{%
- \csname blx@setc@\the\c@refsection @#1\endcsname}%
+ \expandafter\expandafter\expandafter\blx@getdata
+ \expandafter\expandafter\expandafter{%
+ \csname blx@setc@\the\c@refsection @#1\endcsname}%
\let\blx@tempa\@empty
% Inject labelnumber if it exists
\ifdef\abx@field@labelnumber
- {\appto\blx@tempa{\def\noexpand\abx@field@labelnumber{\abx@field@labelnumber}}}
+ {\appto\blx@tempa{%
+ \def\noexpand\abx@field@labelnumber{%
+ \expandonce\abx@field@labelnumber}}}
{}%
% Inject labelprefix if it exists
\ifdef\abx@field@labelprefix
- {\appto\blx@tempa{\def\noexpand\abx@field@labelprefix{\abx@field@labelprefix}}}
+ {\appto\blx@tempa{%
+ \def\noexpand\abx@field@labelprefix{%
+ \expandonce\abx@field@labelprefix}}}
{}%
% Inject labelalpha if it exists
\ifdef\abx@field@labelalpha
- {\appto\blx@tempa{\def\noexpand\abx@field@labelalpha{\abx@field@labelalpha}}}
+ {\appto\blx@tempa{%
+ \def\noexpand\abx@field@labelalpha{%
+ \expandonce\abx@field@labelalpha}}}
{}%
% Inject extraalpha if it exists
\ifdef\abx@field@extraalpha
- {\appto\blx@tempa{\def\noexpand\abx@field@extraalpha{\abx@field@extraalpha}}}
+ {\appto\blx@tempa{%
+ \def\noexpand\abx@field@extraalpha{%
+ \expandonce\abx@field@extraalpha}}}
{}%
% Perform the injection
\edef\blx@tempb{\endgroup\blx@tempa}%
@@ -8118,7 +8084,7 @@
{}
{\begingroup
\edef\blx@tempa{\endgroup
- \noexpand\setkeys{blx@opt@ent}{\abx@field@options}}%
+ \noexpand\blx@kv@setkeys{blx@opt@ent}{\abx@field@options}}%
\blx@tempa
\blx@checkoptions@entry}}
@@ -8126,7 +8092,7 @@
\ifcsdef{blx@opts@type@#1}
{\begingroup
\edef\blx@tempa{\endgroup
- \noexpand\setkeys{blx@opt@typ}{\csuse{blx@opts@type@#1}}}%
+ \noexpand\blx@kv@setkeys{blx@opt@typ}{\csuse{blx@opts@type@#1}}}%
\blx@tempa}
{}}
@@ -8172,7 +8138,7 @@
% for internal use but we always want the aliases themselves in the .bcf
% so that biber can correctly use and resolve them too.
\protected\def\blx@bbl@keyalias#1#2{%
- \csgdef{blx@keyalias@\the\c@refsection @#1}{\detokenize{#2}}%
+ \csxdef{blx@keyalias@\the\c@refsection @#1}{\detokenize{#2}}%
\listcsgadd{blx@keyaliases@\the\c@refsection}{#1}}
% blx@dlist@list@<section>@<refcontext> - a list of list items in a refcontext in a
@@ -8284,27 +8250,50 @@
\blx@getformat\abx@tmp@theformat{ffd}{#2}{#3}%
\csletcs{#1}{abx@tmp@theformat}}
+
+% {<instance (int)>}{<field>}{<length>}
+\def\abx@aux@locallabelwidth#1#2#3{%
+ \csgdef{blx@locallabelwidth@#1@#2}{#3}}
+
+\def\blx@locallabelwidth@write@length#1{%
+ \ifdimequal{\csname local#1width\endcsname}{0pt}
+ {}
+ {\blx@auxwrite\@mainaux{}
+ {\string\abx@aux@locallabelwidth
+ {\the\blx@biblioinstance}%
+ {#1}%
+ {\the\csname local#1width\endcsname}}}}
+
+\def\blx@locallabelwidth@write{%
+ \let\do\blx@locallabelwidth@write@length
+ \abx@dolabelwidths}
+
+\let\blx@locallabelwidth@finish\relax
+
\def\blx@labelwidth@resetlocal{%
- \locallabelnumberwidth\z@
- \locallabelalphawidth\z@
\def\do##1{%
\csname local##1width\endcsname\z@}%
- \abx@dolabelfields}
+ \abx@dolabelwidths}
+
+\def\blx@labelwidth@settolocal@length#1{%
+ \ifcsundef{blx@locallabelwidth@\the\blx@biblioinstance @#1}
+ {}
+ {\csname #1width\endcsname
+ \csname blx@locallabelwidth@\the\blx@biblioinstance @#1\endcsname
+ \space}}
\def\blx@labelwidth@settolocal{%
- \labelnumberwidth\locallabelnumberwidth
- \labelalphawidth\locallabelalphawidth
- \def\do##1{%
- \csname ##1width\endcsname\csname local##1width\endcsname}%
- \abx@dolabelfields}
+ \let\do\blx@labelwidth@settolocal@length
+ \abx@dolabelwidths}
-\def\blx@locallabelwidth#1{%
+\def\blx@locallabelwidth@setlengths{%
+ \global\advance\blx@biblioinstance\@ne
\blx@labelwidth@resetlocal
- \let\blx@do\blx@lengthitem
- \let\blx@done\relax
- \blx@listloop{#1}%
\blx@labelwidth@settolocal}
+\let\blx@locallabelwidth@init\relax
+
+
% {<prefix for labelwidth fields>}
\def\blx@bbl@labelnumberwidth@numeric#1{%
\abx@flfw@getfieldformat{abx@flfw@labelnumberwidth}{labelnumberwidth}{}%
@@ -8491,6 +8480,7 @@
\let\enddatalist\blx@bbl@enddlist
\let\set\blx@bbl@set
\let\inset\blx@bbl@inset
+ \let\fakeset\blx@bbl@fakeset % A No-op for Biber
\let\xref\blx@bbl@xref % A No-op for Biber
\let\keyw\blx@bbl@keyw
\let\name\blx@bbl@namedef
@@ -8565,15 +8555,22 @@
\begingroup
\def\do#1{\ifinlist{#1}\blx@cites{}{\blx@logreq@active{}}\relax}%
\dolistloop\blx@lastcites
- % Special case - if we are using sortingtemplate "none" anywhere, then changes
- % in citation order matter and we need to re-run biber. So a special test
- % to see if the cites from last run are identical in order. We have
- % already tested for more or less cites between runs by now, we are
+ % Special case - if we are using sortingtemplate with \citeorder anywhere,
+ % then changes in citation order matter and we need to re-run biber.
+ % So a special test to see if the cites from last run are identical in order.
+ % We have already tested for more or less cites between runs by now, we are
% testing here for exactly the same cites by treating the cite and
% lastcite lists as strings and comparing them. This doesn't apply
% to biblist sortingtemplates as nobody wants to sort biblists with
% "none", since it makes no sense
- \ifinlist{none}\blx@sortingtemplatenames
+ \togglefalse{blx@tempa}%
+ \def\do#1{%
+ \ifcsundef{blx@sortingtemplate@citeorder@relevant@#1}
+ {}
+ {\toggletrue{blx@tempa}%
+ \listbreak}}%
+ \dolistloop\blx@sortingtemplatenames
+ \iftoggle{blx@tempa}
{\ifdefstrequal{\blx@cites}{\blx@lastcites}
{}
{\blx@logreq@active{}}}
@@ -8603,6 +8600,11 @@
{\def\do#1{\blx@auxwrite\@mainaux{}{#1}}
\dolistloop\blx@localnumaux}}
{}%
+ % Wite md5 hash of .bbl to .aux if we need a Biber rerun.
+ % This needs to happen here and not in \blx@check@rerun together with
+ % the other rerun stuff, because \AfterEndBibliography would be too
+ % late for .aux file writing.
+ \blx@aux@write@bbl@mdfivesum
\endgroup}
% {<instcount>}{<entrykey>}{<refsection>}{<refcontext>}{<labelnumber>}
@@ -8682,8 +8684,8 @@
\appto\blx@tempa{{##1}}%
\advance\blx@tempcnta\@ne}%
\dolistcsloop{blx@pref@\the\c@refsection @#1}%
- \edef\blx@tempa{\endgroup\noexpand\blx@bbl@listdef
- {pageref}{\the\blx@tempcnta}{\expandonce{\blx@tempa}}}%
+ \edef\blx@tempa{\endgroup
+ \noexpand\blx@bbl@listdef{pageref}{\the\blx@tempcnta}{\expandonce{\blx@tempa}}}%
\blx@tempa}
%% Data input
@@ -8701,12 +8703,18 @@
\blx@ifsigned{\jobname}{bbl}
{\InputIfFileExists{\jobname.bbl}
{\blx@info@noline{... file '\jobname.bbl' found}%
- \global\toggletrue{blx@bbldone}}
+ \global\toggletrue{blx@bbldone}%
+ \blx@generate@bbl@mdfivesum@found}
{\blx@info@noline{... file '\jobname.bbl' not found}%
- \typeout{No file \jobname.bbl.}}}
- {}%
+ \typeout{No file \jobname.bbl.}%
+ % 'nobblfile' can never be equal to any mdfivehash
+ \blx@generate@bbl@mdfivesum@notfound}}
+ {\blx@generate@bbl@mdfivesum@notfound}%
\blx@bblend
\endgroup
+ % Check if Biber rerun was not carried out.
+ % If so, ask for it again.
+ \blx@check@bbl@rerun@mdfivesum
% global sorting as this is called at BeginDocument
\csnumgdef{blx@labelnumber@\the\c@refsection}{0}}
@@ -8749,7 +8757,7 @@
\def\blx@defbibheading#1[#2]{%
\csundef{#1}%
- \expandafter\newcommand\csname#1\endcsname[1][#2]}
+ \expandafter\newcommand\csname#1\endcsname[1][{#2}]}
% {<name>}{<text>}
\newrobustcmd*{\defbibnote}[1]{%
@@ -8823,76 +8831,76 @@
% We need a 2-pass structure for options in \printbibliography and
% \printbiblist because the section has to be set before any
% other options and this partly determines which list to use for later filtering
-\define@key{blx@bib1}{segment}{}
-\define@key{blx@bib1}{type}{}
-\define@key{blx@bib1}{nottype}{}
-\define@key{blx@bib1}{subtype}{}
-\define@key{blx@bib1}{notsubtype}{}
-\define@key{blx@bib1}{keyword}{}
-\define@key{blx@bib1}{notkeyword}{}
-\define@key{blx@bib1}{category}{}
-\define@key{blx@bib1}{notcategory}{}
-\define@key{blx@bib1}{filter}{}
-\define@key{blx@bib1}{check}{}
-\define@key{blx@bib1}{heading}{}
-\define@key{blx@bib1}{env}{}
-\define@key{blx@bib1}{title}{}
-\define@key{blx@bib1}{prenote}{}
-\define@key{blx@bib1}{postnote}{}
-\define@key{blx@bib1}{omitnumbers}[]{}
+\blx@kv@defkey{blx@bib1}{segment}{}
+\blx@kv@defkey{blx@bib1}{type}{}
+\blx@kv@defkey{blx@bib1}{nottype}{}
+\blx@kv@defkey{blx@bib1}{subtype}{}
+\blx@kv@defkey{blx@bib1}{notsubtype}{}
+\blx@kv@defkey{blx@bib1}{keyword}{}
+\blx@kv@defkey{blx@bib1}{notkeyword}{}
+\blx@kv@defkey{blx@bib1}{category}{}
+\blx@kv@defkey{blx@bib1}{notcategory}{}
+\blx@kv@defkey{blx@bib1}{filter}{}
+\blx@kv@defkey{blx@bib1}{check}{}
+\blx@kv@defkey{blx@bib1}{heading}{}
+\blx@kv@defkey{blx@bib1}{env}{}
+\blx@kv@defkey{blx@bib1}{title}{}
+\blx@kv@defkey{blx@bib1}{prenote}{}
+\blx@kv@defkey{blx@bib1}{postnote}{}
+\blx@kv@defkey{blx@bib1}{omitnumbers}[]{}
% Here we are using the first pass to see if there is an explicit setting for resetnumbers
% If there isn't we will use the default behaviour where if there is a labelprefix,
% resetnumbers will default to "true"
-\define@key{blx@bib1}{resetnumbers}[true]{%
+\blx@kv@defkey{blx@bib1}{resetnumbers}[true]{%
\toggletrue{blx@resetnumsexplicit}}
-\define@key{blx@bib2}{section}{}
-\define@key{blx@bib2}{sorting}{}
-
-\define@key{blx@biblist1}{segment}{}
-\define@key{blx@biblist1}{type}{}
-\define@key{blx@biblist1}{nottype}{}
-\define@key{blx@biblist1}{subtype}{}
-\define@key{blx@biblist1}{notsubtype}{}
-\define@key{blx@biblist1}{keyword}{}
-\define@key{blx@biblist1}{notkeyword}{}
-\define@key{blx@biblist1}{category}{}
-\define@key{blx@biblist1}{notcategory}{}
-\define@key{blx@biblist1}{filter}{}
-\define@key{blx@biblist1}{check}{}
-\define@key{blx@biblist1}{heading}{}
-\define@key{blx@biblist1}{env}{}
-\define@key{blx@biblist1}{title}{}
-\define@key{blx@biblist1}{prenote}{}
-\define@key{blx@biblist1}{postnote}{}
-
-\define@key{blx@biblist2}{section}{}
-\define@key{blx@biblist2}{sorting}{}
-
-\define@key{blx@bib1}{section}{%
+\blx@kv@defkey{blx@bib2}{section}{}
+\blx@kv@defkey{blx@bib2}{sorting}{}
+
+\blx@kv@defkey{blx@biblist1}{segment}{}
+\blx@kv@defkey{blx@biblist1}{type}{}
+\blx@kv@defkey{blx@biblist1}{nottype}{}
+\blx@kv@defkey{blx@biblist1}{subtype}{}
+\blx@kv@defkey{blx@biblist1}{notsubtype}{}
+\blx@kv@defkey{blx@biblist1}{keyword}{}
+\blx@kv@defkey{blx@biblist1}{notkeyword}{}
+\blx@kv@defkey{blx@biblist1}{category}{}
+\blx@kv@defkey{blx@biblist1}{notcategory}{}
+\blx@kv@defkey{blx@biblist1}{filter}{}
+\blx@kv@defkey{blx@biblist1}{check}{}
+\blx@kv@defkey{blx@biblist1}{heading}{}
+\blx@kv@defkey{blx@biblist1}{env}{}
+\blx@kv@defkey{blx@biblist1}{title}{}
+\blx@kv@defkey{blx@biblist1}{prenote}{}
+\blx@kv@defkey{blx@biblist1}{postnote}{}
+
+\blx@kv@defkey{blx@biblist2}{section}{}
+\blx@kv@defkey{blx@biblist2}{sorting}{}
+
+\blx@kv@defkey{blx@bib1}{section}{%
\ifcsundef{blx@sections@#1}
{\blx@err@nosec{#1}}
{\c@refsection#1\relax
\def\blx@tempe{#1}}}
-\define@key{blx@biblist1}{section}{%
+\blx@kv@defkey{blx@biblist1}{section}{%
\ifcsundef{blx@sections@#1}
{\blx@err@nosec{#1}}
{\c@refsection#1\relax
\def\blx@tempe{#1}}}
-\define@key{blx@bbg}{section}{%
+\blx@kv@defkey{blx@bbg}{section}{%
\ifcsundef{blx@sections@#1}
{\blx@err@nosec{#1}}
{\c@refsection#1\relax}}
-\define@key{blx@bbc}{section}{%
+\blx@kv@defkey{blx@bbc}{section}{%
\ifcsundef{blx@sections@#1}
{\blx@err@nosec{#1}}
{\c@refsection#1\relax}}
-\define@key{blx@bib2}{segment}{\blx@key@segment{#1}}
-\define@key{blx@biblist2}{segment}{\blx@key@segment{#1}}
+\blx@kv@defkey{blx@bib2}{segment}{\blx@key@segment{#1}}
+\blx@kv@defkey{blx@biblist2}{segment}{\blx@key@segment{#1}}
\def\blx@key@segment#1{%
\ifcsundef{blx@segm@\the\c@refsection @#1}
@@ -8901,8 +8909,8 @@
\blx@printbibchecks
\blx@filter\blx@tempa{blx@segm@\the\c@refsection @#1}}}
-\define@key{blx@bib2}{type}{\blx@key@type{#1}}
-\define@key{blx@biblist2}{type}{\blx@key@type{#1}}
+\blx@kv@defkey{blx@bib2}{type}{\blx@key@type{#1}}
+\blx@kv@defkey{blx@biblist2}{type}{\blx@key@type{#1}}
\def\blx@key@type#1{%
\ifcsundef{blx@type@\the\c@refsection @#1}
@@ -8920,8 +8928,8 @@
hence some options may not be used twice.\MessageBreak
Use 'filter' and '\string\defbibfilter' with OR conjunctions}}}}
-\define@key{blx@bib2}{nottype}{\blx@key@nottype{#1}}
-\define@key{blx@biblist2}{nottype}{\blx@key@nottype{#1}}
+\blx@kv@defkey{blx@bib2}{nottype}{\blx@key@nottype{#1}}
+\blx@kv@defkey{blx@biblist2}{nottype}{\blx@key@nottype{#1}}
\def\blx@key@nottype#1{%
\ifcsundef{blx@type@\the\c@refsection @#1}
@@ -8929,8 +8937,8 @@
{\blx@printbibchecks
\blx@notfilter\blx@tempa{blx@type@\the\c@refsection @#1}}}
-\define@key{blx@bib2}{subtype}{\blx@key@subtype{#1}}
-\define@key{blx@biblist2}{subtype}{\blx@key@subtype{#1}}
+\blx@kv@defkey{blx@bib2}{subtype}{\blx@key@subtype{#1}}
+\blx@kv@defkey{blx@biblist2}{subtype}{\blx@key@subtype{#1}}
\def\blx@key@subtype#1{%
\ifcsundef{blx@subt@\the\c@refsection @#1}
@@ -8948,8 +8956,8 @@
hence some options may not be used twice.\MessageBreak
Use 'filter' and '\string\defbibfilter' with OR conjunctions}}}}
-\define@key{blx@bib2}{notsubtype}{\blx@key@notsubtype{#1}}
-\define@key{blx@biblist2}{notsubtype}{\blx@key@notsubtype{#1}}
+\blx@kv@defkey{blx@bib2}{notsubtype}{\blx@key@notsubtype{#1}}
+\blx@kv@defkey{blx@biblist2}{notsubtype}{\blx@key@notsubtype{#1}}
\def\blx@key@notsubtype#1{%
\ifcsundef{blx@subt@\the\c@refsection @#1}
@@ -8957,8 +8965,8 @@
{\blx@printbibchecks
\blx@notfilter\blx@tempa{blx@subt@\the\c@refsection @#1}}}
-\define@key{blx@bib2}{keyword}{\blx@key@keyword{#1}}
-\define@key{blx@biblist2}{keyword}{\blx@key@keyword{#1}}
+\blx@kv@defkey{blx@bib2}{keyword}{\blx@key@keyword{#1}}
+\blx@kv@defkey{blx@biblist2}{keyword}{\blx@key@keyword{#1}}
\def\blx@key@keyword#1{%
\ifcsundef{blx@keyw@\the\c@refsection @\detokenize{#1}}
@@ -8967,8 +8975,8 @@
{\blx@printbibchecks
\blx@filter\blx@tempa{blx@keyw@\the\c@refsection @\detokenize{#1}}}}
-\define@key{blx@bib2}{notkeyword}{\blx@key@notkeyword{#1}}
-\define@key{blx@biblist2}{notkeyword}{\blx@key@notkeyword{#1}}
+\blx@kv@defkey{blx@bib2}{notkeyword}{\blx@key@notkeyword{#1}}
+\blx@kv@defkey{blx@biblist2}{notkeyword}{\blx@key@notkeyword{#1}}
\def\blx@key@notkeyword#1{%
\ifcsundef{blx@keyw@\the\c@refsection @\detokenize{#1}}
@@ -8976,8 +8984,8 @@
{\blx@printbibchecks
\blx@notfilter\blx@tempa{blx@keyw@\the\c@refsection @\detokenize{#1}}}}
-\define@key{blx@bib2}{category}{\blx@key@category{#1}}
-\define@key{blx@biblist2}{category}{\blx@key@category{#1}}
+\blx@kv@defkey{blx@bib2}{category}{\blx@key@category{#1}}
+\blx@kv@defkey{blx@biblist2}{category}{\blx@key@category{#1}}
\def\blx@key@category#1{%
\ifcsundef{blx@catg@\detokenize{#1}}
@@ -8986,8 +8994,8 @@
{\blx@printbibchecks
\blx@filter\blx@tempa{blx@catg@\detokenize{#1}}}}
-\define@key{blx@bib2}{notcategory}{\blx@key@notcategory{#1}}
-\define@key{blx@biblist2}{notcategory}{\blx@key@notcategory{#1}}
+\blx@kv@defkey{blx@bib2}{notcategory}{\blx@key@notcategory{#1}}
+\blx@kv@defkey{blx@biblist2}{notcategory}{\blx@key@notcategory{#1}}
\def\blx@key@notcategory#1{%
\ifcsundef{blx@catg@#1}
@@ -8995,8 +9003,8 @@
{\blx@printbibchecks
\blx@notfilter\blx@tempa{blx@catg@#1}}}
-\define@key{blx@bib2}{filter}{\blx@key@filter{#1}}
-\define@key{blx@biblist2}{filter}{\blx@key@filter{#1}}
+\blx@kv@defkey{blx@bib2}{filter}{\blx@key@filter{#1}}
+\blx@kv@defkey{blx@biblist2}{filter}{\blx@key@filter{#1}}
\def\blx@key@filter#1{%
\ifcsdef{blx@filter@#1}
@@ -9008,8 +9016,8 @@
{The filter '#1' could not be found.\MessageBreak
Use \string\defbibfilter\space to define it}}}
-\define@key{blx@bib2}{check}{\blx@key@bibcheck{#1}}
-\define@key{blx@biblist2}{check}{\blx@key@bibcheck{#1}}
+\blx@kv@defkey{blx@bib2}{check}{\blx@key@bibcheck{#1}}
+\blx@kv@defkey{blx@biblist2}{check}{\blx@key@bibcheck{#1}}
% empty bibcheck does nothing
\cslet{blx@bibcheck@}\relax
@@ -9023,17 +9031,17 @@
Use \string\defbibcheck\space to define it}}}
\def\blx@default@theheading{bibliography}
-\define@key{blx@bibdefaults}{heading}{%
+\blx@kv@defkey{blx@bibdefaults}{heading}{%
\blx@key@heading{\blx@default@theheading}{#1}}
-\define@key{blx@bhd}{heading}{%
+\blx@kv@defkey{blx@bhd}{heading}{%
\blx@key@heading{\blx@theheading}{#1}}
-\define@key{blx@bib2}{heading}{%
+\blx@kv@defkey{blx@bib2}{heading}{%
\blx@key@heading{\blx@theheading}{#1}}
-\define@key{blx@biblist2}{heading}{%
+\blx@kv@defkey{blx@biblist2}{heading}{%
\blx@key@heading{\blx@theheading}{#1}}
-\define@key{blx@bbs}{heading}{%
+\blx@kv@defkey{blx@bbs}{heading}{%
\blx@key@heading{\blx@theheading}{#1}}
-\define@key{blx@bbg}{heading}{%
+\blx@kv@defkey{blx@bbg}{heading}{%
\blx@key@heading{\blx@theheading}{#1}}
\def\blx@key@heading#1#2{%
@@ -9045,13 +9053,13 @@
{\def#1{#2}}}
\def\blx@default@theenv{bibliography}
-\define@key{blx@bibdefaults}{env}{%
+\blx@kv@defkey{blx@bibdefaults}{env}{%
\blx@key@env{\blx@default@theenv}{#1}}
-\define@key{blx@bib2}{env}{\blx@key@env{\blx@theenv}{#1}}
-\define@key{blx@biblist2}{env}{\blx@key@env{\blx@theenv}{#1}}
-\define@key{blx@bbs}{env}{\blx@key@env{\blx@theenv}{#1}}
-\define@key{blx@bbg}{env}{\blx@key@env{\blx@theenv}{#1}}
-\define@key{blx@bbc}{env}{\blx@key@env{\blx@theenv}{#1}}
+\blx@kv@defkey{blx@bib2}{env}{\blx@key@env{\blx@theenv}{#1}}
+\blx@kv@defkey{blx@biblist2}{env}{\blx@key@env{\blx@theenv}{#1}}
+\blx@kv@defkey{blx@bbs}{env}{\blx@key@env{\blx@theenv}{#1}}
+\blx@kv@defkey{blx@bbg}{env}{\blx@key@env{\blx@theenv}{#1}}
+\blx@kv@defkey{blx@bbc}{env}{\blx@key@env{\blx@theenv}{#1}}
\def\blx@key@env#1#2{%
\ifcsundef{blx@env@#2}
@@ -9062,11 +9070,11 @@
{\def#1{#2}}}
\let\blx@default@thetitle\@empty
-\define@key{blx@bibdefaults}{title}{%
+\blx@kv@defkey{blx@bibdefaults}{title}{%
\def\blx@default@thetitle{#1}}
-\define@key{blx@bhd}{title}{\def\blx@thetitle{#1}}
-\define@key{blx@bib2}{title}{\def\blx@thetitle{#1}}
-\define@key{blx@biblist2}{title}{\def\blx@thetitle{#1}}
+\blx@kv@defkey{blx@bhd}{title}{\def\blx@thetitle{#1}}
+\blx@kv@defkey{blx@bib2}{title}{\def\blx@thetitle{#1}}
+\blx@kv@defkey{blx@biblist2}{title}{\def\blx@thetitle{#1}}
\cslet{blx@note@}\@empty
\def\blx@key@bibnote#1#2{%
@@ -9078,49 +9086,51 @@
{\def#1{#2}}}
\let\blx@default@theprenote\@empty
-\define@key{blx@bibdefaults}{prenote}{%
+\blx@kv@defkey{blx@bibdefaults}{prenote}{%
\blx@key@bibnote{\blx@default@theprenote}{#1}}
-\define@key{blx@bib2}{prenote}{%
+\blx@kv@defkey{blx@bib2}{prenote}{%
\blx@key@bibnote{\blx@theprenote}{#1}}
-\define@key{blx@biblist2}{prenote}{%
+\blx@kv@defkey{blx@biblist2}{prenote}{%
\blx@key@bibnote{\blx@theprenote}{#1}}
-\define@key{blx@bbs}{prenote}{%
+\blx@kv@defkey{blx@bbs}{prenote}{%
\blx@key@bibnote{\blx@theprenote}{#1}}
-\define@key{blx@bbg}{prenote}{%
+\blx@kv@defkey{blx@bbg}{prenote}{%
\blx@key@bibnote{\blx@theprenote}{#1}}
-\define@key{blx@bbc}{prenote}{%
+\blx@kv@defkey{blx@bbc}{prenote}{%
\blx@key@bibnote{\blx@theprenote}{#1}}
\let\blx@default@thepostnote\@empty
-\define@key{blx@bibdefaults}{postnote}{%
+\blx@kv@defkey{blx@bibdefaults}{postnote}{%
\blx@key@bibnote{\blx@default@thepostnote}{#1}}
-\define@key{blx@bib2}{postnote}{%
+\blx@kv@defkey{blx@bib2}{postnote}{%
\blx@key@bibnote{\blx@thepostnote}{#1}}
-\define@key{blx@biblist2}{postnote}{%
+\blx@kv@defkey{blx@biblist2}{postnote}{%
\blx@key@bibnote{\blx@thepostnote}{#1}}
-\define@key{blx@bbs}{postnote}{%
+\blx@kv@defkey{blx@bbs}{postnote}{%
\blx@key@bibnote{\blx@thepostnote}{#1}}
-\define@key{blx@bbg}{postnote}{%
+\blx@kv@defkey{blx@bbg}{postnote}{%
\blx@key@bibnote{\blx@thepostnote}{#1}}
-\define@key{blx@bbc}{postnote}{%
+\blx@kv@defkey{blx@bbc}{postnote}{%
\blx@key@bibnote{\blx@thepostnote}{#1}}
-\let\abx@default@locallabelwidth\@gobble
-\define@key{blx@bibdefaults}{locallabelwidth}{%
- \blx@key@locallabelwidth{\abx@default@locallabelwidth}{#1}}
-\define@key{blx@bib1}{locallabelwidth}[]{}
-\define@key{blx@biblist1}{locallabelwidth}[]{}
-\define@key{blx@bib2}{locallabelwidth}[true]{%
- \blx@key@locallabelwidth{\abx@locallabelwidth}{#1}}
-\define@key{blx@biblist2}{locallabelwidth}[true]{%
- \blx@key@locallabelwidth{\abx@locallabelwidth}{#1}}
-
-\def\blx@key@locallabelwidth#1#2{%
- \ifstrequal{#2}{true}
- {\def#1{\blx@locallabelwidth}}
- {\let#1\@gobble}}
-
-\define@key{blx@bib2}{resetnumbers}[true]{%
+
+\blx@kv@defkey{blx@bibdefaults}{locallabelwidth}{%
+ \blx@key@locallabelwidth{#1}}
+\blx@kv@defkey{blx@bib1}{locallabelwidth}[]{}
+\blx@kv@defkey{blx@biblist1}{locallabelwidth}[]{}
+\blx@kv@defkey{blx@bib2}{locallabelwidth}[true]{%
+ \blx@key@locallabelwidth{#1}}
+\blx@kv@defkey{blx@biblist2}{locallabelwidth}[true]{%
+ \blx@key@locallabelwidth{#1}}
+
+\def\blx@key@locallabelwidth#1{%
+ \ifstrequal{#1}{true}
+ {\let\blx@locallabelwidth@init\blx@locallabelwidth@setlengths
+ \let\blx@locallabelwidth@finish\blx@locallabelwidth@write}
+ {\let\blx@locallabelwidth@init\relax
+ \let\blx@locallabelwidth@finish\relax}}
+
+\blx@kv@defkey{blx@bib2}{resetnumbers}[true]{%
\iftoggle{blx@defernumbers}
{\ifstrequal{#1}{true}
{\csnumdef{blx@labelnumber@\the\c@refsection}{0}}
@@ -9131,7 +9141,7 @@
Option 'resetnumbers' requires 'defernumbers=true'.\MessageBreak
Ignoring 'resetnumbers=true'}}}
-\define@key{blx@bib2}{omitnumbers}[true]{%
+\blx@kv@defkey{blx@bib2}{omitnumbers}[true]{%
\ifstrequal{#1}{true}
{\iftoggle{blx@defernumbers}
{\toggletrue{blx@omitnumbers}}
@@ -9142,7 +9152,7 @@
\newrobustcmd*{\DeclarePrintbibliographyDefaults}{%
- \setkeys{blx@bibdefaults}}
+ \blx@kv@setkeys{blx@bibdefaults}}
% [<options>]
\newrobustcmd*{\printbibheading}{%
@@ -9156,7 +9166,7 @@
\let\blx@theheading\blx@default@theheading
\let\blx@thetitle\blx@default@thetitle
\blx@safe@actives
- \setkeys{blx@bhd}{#1}%
+ \blx@kv@setkeys{blx@bhd}{#1}%
\blx@rest@actives
\blx@bibheading\blx@theheading\blx@thetitle
\endgroup}
@@ -9188,7 +9198,7 @@
\edef\blx@tempe{\the\c@refsection}% default refsection is current
\blx@safe@actives
\togglefalse{blx@resetnumsexplicit}%
- \setkeys{blx@bib1}{#1}% First pass options keys - section and resetnumbers
+ \blx@kv@setkeys{blx@bib1}{#1}% First pass options keys - section and resetnumbers
% Is there a user-specified option for resetnumbers? If so, this overrides the default
% "labelprefix implies resetnumbers" behaviour
\iftoggle{blx@resetnumsexplicit}
@@ -9197,7 +9207,7 @@
{\ifdefempty\blx@refcontext@labelprefix@real}
{\@secondoftwo}
{}
- {\setkeys{blx@bib2}{resetnumbers}}}%
+ {\blx@kv@setkeys{blx@bib2}{resetnumbers}}}%
\blx@rest@actives
\ifcsvoid{blx@dlist@entry@\blx@tempe @\blx@refcontext@context}
{}
@@ -9207,7 +9217,7 @@
% \printbibliography following one with this set will inherit any
% previous "true" value
\togglefalse{blx@omitnumbers}%
- \setkeys{blx@bib2}{#1}% ... now we have correct \blx@tempa, set rest of options
+ \blx@kv@setkeys{blx@bib2}{#1}% ... now we have correct \blx@tempa, set rest of options
\blx@rest@actives
% Add datalist to list of seen datalists to prevent duplicates
\xifinlist{\blx@refcontext@context @\blx@tempe @entry}\blx@dlistnames
@@ -9239,7 +9249,7 @@
\let\blx@thetitle\blx@default@thetitle
\c@refsection\z@
\blx@safe@actives
- \setkeys{blx@bbs}{#1}%
+ \blx@kv@setkeys{blx@bbs}{#1}%
\blx@rest@actives
\togglefalse{blx@tempa}%
\blx@refsections}
@@ -9278,7 +9288,7 @@
\let\blx@thetitle\blx@default@thetitle
\c@refsegment\@ne
\blx@safe@actives
- \setkeys{blx@bbg}{#1}%
+ \blx@kv@setkeys{blx@bbg}{#1}%
\blx@rest@actives
\togglefalse{blx@tempa}%
\blx@refsegments}
@@ -9322,7 +9332,7 @@
\let\blx@thetitle\blx@default@thetitle
\c@refsection\z@
\blx@safe@actives
- \setkeys{blx@bbc}{#1}%
+ \blx@kv@setkeys{blx@bbc}{#1}%
\blx@rest@actives
\togglefalse{blx@tempa}%
\forlistloop\blx@bibcategory\blx@categories
@@ -9346,7 +9356,7 @@
\endgroup}
% {<entrykey>,...}
-\def\blx@bibliography#1{%
+\def\blx@bibliography{%
\blx@bibheading\blx@theheading\blx@thetitle
\blx@bibnote\blx@theprenote
\begingroup
@@ -9359,17 +9369,18 @@
\ifnum\bibnamesep=\z@
\let\blx@namesep\relax
\fi
- \abx@locallabelwidth{#1}%
+ \blx@locallabelwidth@init
\csuse{blx@env@\blx@theenv}%
\csuse{blx@hook@bibinit}%
\csuse{blx@hook@bibinit@next}%
\let\blx@do\blx@bibitem
\let\blx@done\blx@endbibliography
- \blx@listloop{#1}}
+ \blx@listloop}
\def\blx@endbibliography{%
\csuse{blx@endenv@\blx@theenv}%
\blx@noitem
+ \blx@locallabelwidth@finish
\endgroup
\blx@bibnote\blx@thepostnote
\endgroup}
@@ -9385,7 +9396,7 @@
\let\newrefsegment\relax
\ifblank{#2}
{\csuse{blx@head@#1}}
- {\csuse{blx@head@#1}[#2]}%
+ {\csuse{blx@head@#1}[{#2}]}%
\let\newrefsection\blx@newrefsection
\let\newrefsegment\blx@newrefsegment}
@@ -9411,25 +9422,6 @@
\csuse{blx@bibsetup}}
% {<entrykey>}
-\def\blx@lengthitem#1{%
- \blx@ifdata{#1}
- {\begingroup
- \blx@getdata{#1}%
- \blx@bibcheck
- \iftoggle{blx@skipentry}{}{%
- \iftoggle{blx@labelnumber}
- {\blx@bbl@locallabelnumberwidth}
- {}%
- \iftoggle{blx@labelalpha}
- {\blx@bbl@locallabelalphawidth}
- {}%
- \nottoggle{blx@skipbiblist}
- {\blx@bbl@locallabelfields}
- {}}%
- \endgroup}
- {}}
-
-% {<entrykey>}
% output a bib item, this is why \blx@thelabelnumber is here so that
% labelnumber is deferred if defernumbers=true
\def\blx@bibitem#1{%
@@ -9444,6 +9436,15 @@
\blx@setoptions@entry
\blx@thelabelnumber
\addtocounter{instcount}\@ne
+ \iftoggle{blx@labelnumber}
+ {\blx@bbl@locallabelnumberwidth}
+ {}%
+ \iftoggle{blx@labelalpha}
+ {\blx@bbl@locallabelalphawidth}
+ {}%
+ \nottoggle{blx@skipbiblist}
+ {\blx@bbl@locallabelfields}
+ {}%
\csuse{blx@item@\blx@theenv}\relax
\blx@initsep
\blx@namesep
@@ -9605,14 +9606,14 @@
\appto\blx@mknohyperref{\let\blx@anchor\relax}
-\define@key{blx@biblist2}{driver}{\blx@key@driver{#1}}
-\define@key{blx@biblist1}{driver}{}
+\blx@kv@defkey{blx@biblist2}{driver}{\blx@key@driver{#1}}
+\blx@kv@defkey{blx@biblist1}{driver}{}
\def\blx@key@driver#1{%
\def\blx@thebiblistdriver{#1}}
% Custom bibliography list
-% [<otions>]{biblistname}
+% [<options>]{biblistname}
\newrobustcmd*{\printbiblist}[2][]{%
\begingroup
\delimcontext{biblist}%
@@ -9635,12 +9636,15 @@
\ifcsdef{blx@sortingtemplate@#2}
{#2}
{\blx@refcontext@sortingtemplatename}}%
- % locally define this since we want to fetch data from the datalist named
- % after the list we are printing rather than the data in refcontext list
- % Note that the name must be unique so we prepend "#2:" because the combination of
- % options might not generate a unique name since sortschemename has a fallback to the
- % refcontext scheme if there is no sortscheme named after the list
- \blx@edef@refcontext{#2:\blx@tempc/%
+ % locally define this since we want to fetch data from the datalist
+ % name after the list we are printing rather than the data in
+ % refcontext list.
+ % Note that the name must be unique so we prepend any filter name
+ % because the combination of options might not generate a unique name
+ % since sortschemename has a fallback to the refcontext scheme if there
+ % is no sortscheme named after the list
+ \blx@kv@setkeys{blx@biblist1}{#1}% Set section and biblistfilter only, if present ...
+ \blx@edef@refcontext{\blx@thebiblistfilter :\blx@tempc/%
\blx@refcontext@sortingnamekeytemplatename/%
\blx@refcontext@labelprefix/%
\blx@refcontext@uniquenametemplatename/%
@@ -9658,13 +9662,12 @@
{}
{\listxadd\blx@biblists\blx@tempc}%
\blx@auxwrite\@mainaux{}{\string\abx@aux@biblist{\blx@tempc}}%
- \setkeys{blx@biblist1}{#1}% Set section only, if present ...
\blx@rest@actives
\ifcsvoid{blx@dlist@list@\blx@tempe @\blx@refcontext@context}
{}
{\letcs\blx@tempa{blx@dlist@list@\blx@tempe @\blx@refcontext@context}}%
\blx@safe@actives
- \setkeys{blx@biblist2}{#1}% ... now we have correct \blx@tempa, set rest of options
+ \blx@kv@setkeys{blx@biblist2}{#1}% ... now we have correct \blx@tempa, set rest of options
\ifundef\blx@bibcheck
{\ifcsdef{blx@bibcheck@#2}
{\letcs\blx@bibcheck{blx@bibcheck@#2}}
@@ -9686,11 +9689,21 @@
\iftoggle{blx@defernumbers}
{\global\let\blx@printbibchecks\relax}
{\iftoggle{blx@labelnumber}
- {}
+ {\ifundef\blx@printbibchecks@suppresswarn
+ {\blx@warning@noline{%
+ Split bibliography detected.\MessageBreak
+ Many simple split bibliography setups with\MessageBreak
+ non-overlapping bibliographies benefit from%
+ \MessageBreak
+ setting 'defernumbers=true'.\MessageBreak
+ See the documentation for details.\MessageBreak
+ This warning can be suppressed with\MessageBreak
+ '\string\BiblatexSplitbibDefernumbersWarningOff'}}
+ {}}
{\global\let\blx@printbibchecks\relax}}}
% {<entrykey>,...}
-\def\blx@biblist#1{%
+\def\blx@biblist{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
@@ -9702,16 +9715,17 @@
\blx@bibinit
\let\@noitemerr\@empty
\def\blx@noitem{\blx@warn@biblistempty{\blx@thebiblist}}%
- \abx@locallabelwidth{#1}%
+ \blx@locallabelwidth@init
\csuse{blx@env@\blx@theenv}%
\csuse{blx@hook@biblistinit@\blx@thebiblist}%
\let\blx@do\blx@biblistitem
\let\blx@done\blx@endbiblist
- \blx@listloop{#1}}
+ \blx@listloop}
\def\blx@endbiblist{%
\csuse{blx@endenv@\blx@theenv}%
\blx@noitem
+ \blx@locallabelwidth@finish
\endgroup
\blx@bibnote\blx@thepostnote
\endgroup
@@ -9735,6 +9749,15 @@
\blx@setoptions@type\abx@field@entrytype
\blx@setoptions@entry
\addtocounter{instcount}\@ne
+ \iftoggle{blx@labelnumber}
+ {\blx@bbl@locallabelnumberwidth}
+ {}%
+ \iftoggle{blx@labelalpha}
+ {\blx@bbl@locallabelalphawidth}
+ {}%
+ \nottoggle{blx@skipbiblist}
+ {\blx@bbl@locallabelfields}
+ {}%
\csuse{blx@item@\blx@theenv}\relax
\csuse{blx@hook@biblistitem@\blx@thebiblist}%
\blx@execute
@@ -9772,8 +9795,8 @@
\def\refcontext@i[#1]{%
\@ifnextchar\bgroup
- {\refcontext@ii[#1]}
- {\refcontext@ii[#1]{}}}
+ {\refcontext@ii[{#1}]}
+ {\refcontext@ii[{#1}]{}}}
\newcommand*{\refcontext@ii}[2][]{%
\iftoggle{blx@refcontext}
@@ -9783,11 +9806,12 @@
% Set refcontext from named refcontext, if given
\ifblank{#2}
{}
- {\edef\z{%
- \noexpand\setkeys{blx@refcontext}{\csuse{blx@refcontext@name@#2}}}%
- \z}%
+ {\begingroup
+ \edef\blx@tempa{\endgroup%
+ \noexpand\blx@kv@setkeys{blx@refcontext}{\csuse{blx@refcontext@name@#2}}}%
+ \blx@tempa}%
% Override with explicit refcontext keyvals, if given
- \setkeys{blx@refcontext}{#1}%
+ \blx@kv@setkeys{blx@refcontext}{#1}%
% Add the sortingtemplate to the list of sortingtemplates so we can track
% special cases like sorting=none which need cite order change detection
\xifinlist\blx@refcontext@sortingtemplatename\blx@sortingtemplatenames
@@ -9834,15 +9858,15 @@
\blx@refcontext@labelalphanametemplatename}}
% Meta option to set all name template options
-\define@key{blx@refcontext}{nametemplates}{%
+\blx@kv@defkey{blx@refcontext}{nametemplates}{%
\gdef\blx@refcontext@sortingnamekeytemplatename{#1}%
\gdef\blx@refcontext@uniquenametemplatename{#1}%
\gdef\blx@refcontext@labelalphanametemplatename{#1}}
-\define@key{blx@refcontext}{sorting}{\gdef\blx@refcontext@sortingtemplatename{#1}}
-\define@key{blx@refcontext}{sortingnamekeytemplatename}{\gdef\blx@refcontext@sortingnamekeytemplatename{#1}}
-\define@key{blx@refcontext}{uniquenametemplatename}{\gdef\blx@refcontext@uniquenametemplatename{#1}}
-\define@key{blx@refcontext}{labelalphanametemplatename}{\gdef\blx@refcontext@labelalphanametemplatename{#1}}
+\blx@kv@defkey{blx@refcontext}{sorting}{\gdef\blx@refcontext@sortingtemplatename{#1}}
+\blx@kv@defkey{blx@refcontext}{sortingnamekeytemplatename}{\gdef\blx@refcontext@sortingnamekeytemplatename{#1}}
+\blx@kv@defkey{blx@refcontext}{uniquenametemplatename}{\gdef\blx@refcontext@uniquenametemplatename{#1}}
+\blx@kv@defkey{blx@refcontext}{labelalphanametemplatename}{\gdef\blx@refcontext@labelalphanametemplatename{#1}}
% labelprefix cannot be used as is because it is used to construct the internal
% refcontext name which is referenced/expanded a lot all over the place. So,
@@ -9850,7 +9874,7 @@
% But that is not enough since the MD5 hash function expands the argument all
% the way and so unexpandable content like \dag breaks.
% Unexpandable content should be protected with \detokenize.
-\define@key{blx@refcontext}{labelprefix}{%
+\blx@kv@defkey{blx@refcontext}{labelprefix}{%
\xdef\blx@refcontext@labelprefix{\blx@mdfivesum{#1}}%
\gdef\blx@refcontext@labelprefix@real{#1}%
\iftoggle{blx@defernumbers}
@@ -9873,7 +9897,7 @@
\let\blx@tempc\@empty%
\def\blx@tempd{global}%
\def\blx@tempe{global}%
- \setkeys{blx@assignrefcontext}{#2}%
+ \blx@kv@setkeys{blx@assignrefcontext}{#2}%
\def\do##1{%
\listxadd\blx@assignedrefcontextkeywlist{##1}%
\csxdef{blx@assignedrefcontextkeyws#1@\the\c@refsection @##1}%
@@ -9892,7 +9916,7 @@
\let\blx@tempc\@empty%
\def\blx@tempd{global}%
\def\blx@tempe{global}%
- \setkeys{blx@assignrefcontext}{#2}%
+ \blx@kv@setkeys{blx@assignrefcontext}{#2}%
\def\do##1{%
\listxadd\blx@assignedrefcontextcatlist{##1}%
\csxdef{blx@assignedrefcontextcats#1@\the\c@refsection @##1}%
@@ -9911,24 +9935,24 @@
\let\blx@tempc\@empty%
\def\blx@tempd{global}%
\def\blx@tempe{global}%
- \setkeys{blx@assignrefcontext}{#2}%
+ \blx@kv@setkeys{blx@assignrefcontext}{#2}%
\def\do##1{%
\csxdef{blx@assignedrefcontextkeys#1@\the\c@refsection @##1}%
{\blx@tempa/\blx@tempb/\blx@tempc/\blx@tempd/\blx@tempe}}%
\docsvlist{#3}}
% Meta option to set all name template options
-\define@key{blx@assignrefcontext}{nametemplates}{%
+\blx@kv@defkey{blx@assignrefcontext}{nametemplates}{%
\def\blx@tempb{#1}%
\def\blx@tempd{#1}%
\def\blx@tempe{#1}}
-\define@key{blx@assignrefcontext}{sorting}{\def\blx@tempa{#1}}
-\define@key{blx@assignrefcontext}{sortingnamekeytemplatename}{\def\blx@tempb{#1}}
-\define@key{blx@assignrefcontext}{labelprefix}{%
+\blx@kv@defkey{blx@assignrefcontext}{sorting}{\def\blx@tempa{#1}}
+\blx@kv@defkey{blx@assignrefcontext}{sortingnamekeytemplatename}{\def\blx@tempb{#1}}
+\blx@kv@defkey{blx@assignrefcontext}{labelprefix}{%
\edef\blx@tempc{\blx@mdfivesum{#1}}}
-\define@key{blx@assignrefcontext}{uniquenametemplatename}{\def\blx@tempd{#1}}
-\define@key{blx@assignrefcontext}{labelalphanametemplatename}{\def\blx@tempe{#1}}
+\blx@kv@defkey{blx@assignrefcontext}{uniquenametemplatename}{\def\blx@tempd{#1}}
+\blx@kv@defkey{blx@assignrefcontext}{labelalphanametemplatename}{\def\blx@tempe{#1}}
% Reference sections
\newrobustcmd*{\newrefsection}{%
@@ -10043,6 +10067,11 @@
\AtEndDocument{%
\endrefcontext
+ % close non-0 refsection if active
+ \ifnum\c@refsection>\z@
+ \blx@endrefsection
+ \fi
+ % close refsection 0
\blx@endrefsection
\def\abx@aux@refsection#1#2{\blx@addchecksum{#1}{#2}}}
@@ -10144,20 +10173,27 @@
%% that we can use for that purpose as well.
%% This is fairly new, so we need to have a fallback for older versions.
-%% The standard classes are tricky. They have no good hooks and just
-%% for sections at least \pretocmd-ing executes the code before
-%% counters are increased, so the labels attach to the wrong thing.
+%% The standard classes are tricky.
+%% We insert something in \@startsection to get the level number
+%% and then patch \@sect and \@ssect so the label attaches to the
+%% right thing.
%% Test for correct KOMA patch method
% KOMA 3.27 has \AddtoDoHook
\newcommand*{\blx@ifkoma@AddtoDoHook}{%
- \ifboolexpr{not test {\ifcsundef{KOMAClassName}}
- and not test {\ifcsundef{AddtoDoHook}}}}
+ \ifcsundef{KOMAClassName}
+ {\@secondoftwo}
+ {\ifcsundef{AddtoDoHook}
+ {\@secondoftwo}
+ {\@firstoftwo}}}
% KOMA 3.26 has \startsection@secnumdepth for some testing
\newcommand*{\blx@ifkoma@startsection}{%
- \ifboolexpr{not test {\ifcsundef{KOMAClassName}}
- and not test {\ifcsundef{startsection@secnumdepth}}}}
+ \ifcsundef{KOMAClassName}
+ {\@secondoftwo}
+ {\ifcsundef{startsection@secnumdepth}
+ {\@secondoftwo}
+ {\@firstoftwo}}}
\newcommand*{\blx@ifmemoir}{\@ifclassloaded{memoir}}
@@ -10202,7 +10238,12 @@
\apptocmd\memchapinfo{#1}
{}{\blx@err@patch{\string\memchapinfo}}%
\apptocmd\memchapstarinfo{#1}
- {}{\blx@err@patch{\string\memchapstarinfo}}}
+ {}{\blx@err@patch{\string\memchapstarinfo}}%
+ \apptocmd\memappchapinfo{#1}
+ {}{\blx@err@patch{\string\memappchapinfo}}%
+ \apptocmd\memappchapstarinfo{#1}
+ {}{\blx@err@patch{\string\memappchapstarinfo}}%
+}
\def\blx@refpatch@chapter@std#1{%
\pretocmd\@makechapterhead{#1}
@@ -10222,7 +10263,7 @@
{\blx@refpatch@chapter@std{#1}}}}}
% \section, \subsection
-% {<section csname>}{<precode>}{<section level number>}
+% {<section csname>}{<patch code>}{<section level number>}
\def\blx@refpatch@sect#1#2#3{%
\ifcsundef{#1}
{\blx@err@nodocdiv{#1}\@gobbletwo}
@@ -10241,6 +10282,8 @@
\def\blx@refpatch@sect@koma@startsection#1#2{%
\At@startsection{\ifnumequal{\startsection@secnumdepth}{#2}{#1}{}}}
+% The memoir classes have a nice hook we can use
+% {<section csname>}{<patch code>}
\edef\blx@refpatch@sect@memoir#1#2{%
\apptocmd\noexpand\memsecinfo
{\noexpand\blx@refpatch@sect@memoir@i{\string#1}{#1}{#2}}
@@ -10252,31 +10295,94 @@
\def\blx@refpatch@sect@memoir@i#1#2#3{%
\ifstrequal{#1}{#2}{#3}{}}
-\edef\blx@refpatch@sect@std#1#2{%
+% The standard classes have \@startsection, \@sect and \@ssect.
+% \@startsection is used by unstarred and starred sections alike
+% but it comes in too early if we set labels.
+% The counter is only stepped in \@sect, so we need to patch
+% that if we want \labels to attach to the right thing.
+% But then we also need to patch \@ssect for starred/un-numbered
+% sections. Unfortunately, \@ssect doesn't know the level number
+% so we patch \@startsection to remember the level number
+% in blx@refpatch@current@sectlevel
+% and then patch \@sect and \@ssect with the actual code
+% testing against blx@refpatch@current@sectlevel.
+
+% {<do initialization>}{<csv list to do>}{<error>}
+\def\blx@refpatch@docsvlist#1#2#3{%
+ \toggletrue{blx@tempa}%
+ #1%
+ \docsvlist{#2}%
+ \iftoggle{blx@tempa}
+ {#3}
+ {}%
+ \let\do\noexpand}
+
+\newtoggle{blx@refpatch@sect@std@pre@done}
+
+\def\blx@refpatch@sect@std@pre{%
+ \iftoggle{blx@refpatch@sect@std@pre@done}
+ {}
+ {\blx@refpatch@docsvlist
+ {\blx@refpatch@sect@std@pre@defdo}
+ {\scr@startsection,
+ \@startsection}
+ {\blx@err@patch{\string\@startsection}}
+ \global\toggletrue{blx@refpatch@sect@std@pre@done}}}
+
+\edef\blx@refpatch@sect@std@pre@defdo{%
\def\noexpand\do##1{%
- \pretocmd##1%
- {\noexpand\blx@refpatch@sect@std@i{#1}{#2}{\string#2}}
+ \pretocmd##1
+ {\csnumdef{blx@refpatch@current@sectlevel}{\string#2}}
{\togglefalse{blx@tempa}\noexpand\listbreak}
- {}}%
- \noexpand\blx@refpatch@sect@std@ii}
+ {}}}
-\def\blx@refpatch@sect@std@i#1#2#3{%
- \ifnumequal{#2}{#3}{#1}{}}
+\edef\blx@refpatch@sect@std@defdo@sect#1#2{%
+ \def\noexpand\do##1{%
+ \patchcmd##1%
+ {\noexpand\@tempskipa \string#5\noexpand\relax}
+ {\noexpand\blx@refpatch@sect@std@testandruncode{#1}{#2}%
+ \noexpand\@tempskipa \string#5\noexpand\relax}
+ {\togglefalse{blx@tempa}\noexpand\listbreak}
+ {}}}
-\def\blx@refpatch@sect@std@ii{%
- \toggletrue{blx@tempa}%
- \docsvlist{% order does matter:
- \H@old@sectm@m,% memoir+hyperref (what a mess...)
- \M@sect,% memoir
- \H@old@sect,% hyperref
- \NR@sect,% nameref
- \scr@sect,% koma-script 3.x
- \scr@startsection,% bad hack for koma 3.15 <= v <= 3.25
- \@startsection}% latex
- \iftoggle{blx@tempa}
+\edef\blx@refpatch@sect@std@defdo@ssect#1#2{%
+ \def\noexpand\do##1{%
+ \patchcmd##1%
+ {\noexpand\@tempskipa \string#3\noexpand\relax}
+ {\noexpand\blx@refpatch@sect@std@testandruncode{#1}{#2}%
+ \noexpand\@tempskipa \string#3\noexpand\relax}
+ {\togglefalse{blx@tempa}\noexpand\listbreak}
+ {}}}
+
+% {<patch code>}{<section level number>}
+\def\blx@refpatch@sect@std#1#2{%
+ \blx@refpatch@sect@std@pre
+ % \@sect for numbered (unstarred) sections
+ \blx@refpatch@docsvlist
+ {\blx@refpatch@sect@std@defdo@sect{#1}{#2}}
+ {\H@old@sectm@m,% memoir+hyperref (what a mess...)
+ \M@sect,% memoir
+ \H@old@sect,% hyperref
+ \NR@sect,% nameref
+ \scr@sect,% koma-script 3.x
+ \scr@startsection,% bad hack for koma 3.15 <= v <= 3.25
+ \@sect}
{\blx@err@patch{\string\@sect}}
- {}%
- \let\do\noexpand}
+ % \@ssect for un-numbered (starred) sections
+ \blx@refpatch@docsvlist
+ {\blx@refpatch@sect@std@defdo@ssect{#1}{#2}}
+ {\H@old@ssectm@m,% memoir+hyperref (what a mess...)
+ \M@ssect,% memoir
+ \H@old@ssect,% hyperref
+ \NR@ssect,% nameref
+ \scr@ssect,% koma-script 3.x
+ \@ssect}
+ {\blx@err@patch{\string\@ssect}}}
+
+\def\blx@refpatch@sect@std@testandruncode#1#2{%
+ \ifnumequal{#2}{0\csuse{blx@refpatch@current@sectlevel}}
+ {#1}
+ {}}
% Bibliography categories
@@ -10366,10 +10472,13 @@
{\blx@addbib@i{#1}}
{\blx@addbib@i{#1}[]}}
+% kill all spaces and %
+% see https://github.com/plk/biblatex/issues/1026
\def\blx@addbib@i#1[#2]{%
\begingroup
- \blx@hook@fileverb
- \blx@addbib@ii{#1}{#2}}
+ \@ifnextchar\bgroup
+ {\blx@hook@fileverb\blx@addbib@ii{#1}{#2}}%
+ {\blx@hook@fileverb\blx@addbib@ii{#1}{#2}}}
\def\blx@addbib@ii#1#2#3{%
\endgroup
@@ -10379,7 +10488,8 @@
\def\blx@tempc{local}%
\undef\blx@tempd
\let\blx@tempe\@empty
- \setkeys{blx@addbib}{#2}%
+ \def\blx@tempf{false}%
+ \blx@kv@setkeys{blx@addbib}{#2}%
\blx@xsanitizeafter{#1}{#3}%
\endgroup}
@@ -10390,22 +10500,27 @@
\catcode`\{=\@ne
\catcode`\}=\tw@}
-\define@key{blx@addbib}{type}{\def\blx@tempa{#1}}
-\define@key{blx@addbib}{datatype}{\def\blx@tempb{#1}}
-\define@key{blx@addbib}{location}{\def\blx@tempc{#1}}
-\define@key{blx@addbib}{label}{\edef\blx@tempd{\detokenize{#1}}}
-\define@key{blx@addbib}{bibencoding}{\def\blx@tempe{#1}}
+\blx@kv@defkey{blx@addbib}{type}{\def\blx@tempa{#1}}
+\blx@kv@defkey{blx@addbib}{datatype}{\def\blx@tempb{#1}}
+\blx@kv@defkey{blx@addbib}{location}{\def\blx@tempc{#1}}
+\blx@kv@defkey{blx@addbib}{label}{\edef\blx@tempd{\detokenize{#1}}}
+\blx@kv@defkey{blx@addbib}{bibencoding}{\def\blx@tempe{#1}}
+\blx@kv@defkey{blx@addbib}{glob}[true]{\def\blx@tempf{#1}}
% \blx@res@type@<resource> resource -> type
% \blx@res@data@<resource> resource -> datatype
% \blx@res@loca@<resource> resource -> datatype
% \blx@res@labl@<resource> label -> resource
+% \blx@res@glob@<resource> glob -> true|false
\def\blx@addbib@register#1{%
\csxdef{blx@res@type@#1}{\blx@tempa}%
\csxdef{blx@res@data@#1}{\blx@tempb}%
\csxdef{blx@res@loca@#1}{\blx@tempc}%
\csxdef{blx@res@bibencoding@#1}{\blx@tempe}%
+ \ifdef\blx@tempf
+ {\csxdef{blx@res@glob@#1}{\blx@tempf}}
+ {}%
\ifdef\blx@tempd
{\csxdef{blx@res@labl@\blx@tempd}{#1}}
{}}
@@ -10438,6 +10553,9 @@
{\ifcsvoid{blx@res@bibencoding@#2}
{}
{ encoding="\csuse{blx@res@bibencoding@#2}"}}
+ {\ifcsvoid{blx@res@glob@#2}
+ {}
+ { glob="\csuse{blx@res@glob@#2}"}}
{#3}}}
%% Citations
@@ -10452,6 +10570,12 @@
\newrobustcmd*{\AtEachCitekey}{%
\iftoggle{blx@citation}{\appto\blx@hook@citekey}{\@gobble}}
+\let\blx@hook@entrykey\@gobble
+\newrobustcmd*{\AtEveryEntrykey}{%
+ \apptocmd{\blx@hook@entrykey}}
+\@onlypreamble\AtEveryEntrykey
+
+
\def\blx@imc@UseEveryCiteHook{\csuse{blx@hook@cite}}
\def\blx@imc@UseEveryCitekeyHook{\csuse{blx@hook@citekey}}
\def\blx@imc@UseEveryMultiCiteHook{\csuse{blx@hook@mcite}}
@@ -10550,7 +10674,8 @@
{\ifinlistcs{#1}{blx@miss@\the\c@refsection}
{}
{\blx@logreq@active{#2{#1}}}}
- {\blx@logreq@active{#2{#1}}}}}
+ {\blx@logreq@active{#2{#1}}}}%
+ \blx@hook@entrykey{#1}}
\protected\def\abx@aux@segm#1#2#3{%
\xifinlistcs{\detokenize{#3}}{blx@segm@#1@#2}
@@ -10695,7 +10820,7 @@
% {<entrykey>}
\def\blx@citeadd#1{%
\ifcsdef{blx@keyalias@\the\c@refsection @#1}
- {\edef\blx@realkey{\csuse{blx@keyalias@\the\c@refsection @#1}}}
+ {\letcs\blx@realkey{blx@keyalias@\the\c@refsection @#1}}
{\def\blx@realkey{#1}}%
\expandafter\blx@getrefcontext\expandafter{\blx@realkey}% needed for \ifdata
\expandafter\blx@citation\expandafter{\blx@realkey}\blx@msg@cundefon
@@ -11397,7 +11522,7 @@
\long\def\blx@citexpunct@i#1#2#3#4{%
\@ifnextchar[%]
{\blx@citexpunct@ii{#1}{{#2}{#3}{#4}}}
- {\blx@citexpunct@ii{#1}{{#2}{#3}{#4}}[#1]}}
+ {\blx@citexpunct@ii{#1}{{#2}{#3}{#4}}[{#1}]}}
\long\def\blx@citexpunct@ii#1#2[#3]#4{%
\blx@thecheckpunct{\blxcitecmd{#1}#2{#3}{#4}}}
@@ -11825,7 +11950,7 @@
\ifnameundef{#5}
{\blx@warning@entry{'#5' undefined or not a name list}%
\abx@missing{#5}}
- {\printnames[#4]{#5}}}%
+ {\printnames[{#4}]{#5}}}%
\def\blx@dlimcode{\multicitedelim}%
\def\blx@postpunct@saved{#6}%
\ifblank{#2}
@@ -11853,7 +11978,7 @@
\iflistundef{#5}
{\blx@warning@entry{'#5' undefined or not a literal list}%
\abx@missing{#5}}
- {\printlist[#4]{#5}}}%
+ {\printlist[{#4}]{#5}}}%
\def\blx@dlimcode{\multicitedelim}%
\def\blx@postpunct@saved{#6}%
\ifblank{#2}
@@ -11882,7 +12007,7 @@
\iffieldundef{#5}
{\blx@warning@entry{'#5' undefined or not a field}%
\abx@missing{#5}}
- {\printfield[#4]{#5}}}%
+ {\printfield[{#4}]{#5}}}%
\def\blx@dlimcode{\multicitedelim}%
\def\blx@postpunct@saved{#6}%
\ifblank{#2}
@@ -11947,6 +12072,9 @@
\def\iffieldequals#1#2{\blx@TE{\blx@imc@iffieldequals{#1}{#2}}}%
\def\iffieldequalstr#1#2{\blx@TE{\blx@imc@iffieldequalstr{#1}{#2}}}%
\def\iffieldsequal#1#2{\blx@TE{\blx@imc@iffieldsequal{#1}{#2}}}%
+ \def\iflistequalcs#1#2{\blx@TE{\blx@imc@iflistequalcs{#1}{#2}}}%
+ \def\iflistequals#1#2{\blx@TE{\blx@imc@iflistequals{#1}{#2}}}%
+ \def\iflistsequal#1#2{\blx@TE{\blx@imc@iflistsequal{#1}{#2}}}%
\def\ifbibmacroundef#1{\blx@TE{\blx@imc@ifbibmacroundef{#1}}}%
\def\iffieldundef#1{\blx@TE{\blx@imc@iffieldundef{#1}}}%
\def\ifnameequalcs#1#2{\blx@TE{\blx@imc@ifnameequalcs{#1}{#2}}}%
@@ -12586,8 +12714,8 @@
~~<bcf:bibdata section="#1">\blx@nl
#2%
~~</bcf:bibdata>\blx@nl}
-\xdef\blx@xml@datasource#1#2#3#4{%
- ~~~~<bcf:datasource type="#1" datatype="#2"#3>#4</bcf:datasource>\blx@nl}
+\xdef\blx@xml@datasource#1#2#3#4#5{%
+ ~~~~<bcf:datasource type="#1" datatype="#2"#3#4>#5</bcf:datasource>\blx@nl}
\xdef\blx@xml@citekey#1#2#3{%
~~~~<bcf:citekey order="#3"#2>#1</bcf:citekey>}
\xdef\blx@xml@citeset#1#2{%
@@ -12713,8 +12841,8 @@
\blx@safe@actives
\let\protect\string
% options
- \edef\labelalphaothers{\labelalphaothers}%
- \edef\sortalphaothers{\sortalphaothers}%
+ \protected@edef\labelalphaothers{\labelalphaothers}%
+ \protected@edef\sortalphaothers{\sortalphaothers}%
\blx@xmlsanitizeafter{\def\labelalphaothers}{\labelalphaothers}%
\blx@xmlsanitizeafter{\def\sortalphaothers}{\sortalphaothers}%
% Expand the global use* name toggles
@@ -13026,7 +13154,7 @@
\let\blx@dm@datatype\@empty
\let\blx@member@field\@empty
\let\blx@tempb\@empty
- \setkeys{blx@datafieldsets@member}{#1}%
+ \blx@kv@setkeys{blx@datafieldsets@member}{#1}%
\eappto\blx@tempa{%
\blx@xml@datafieldsets@member{\blx@tempb}}%
\ifdefempty\blx@member@field
@@ -13051,13 +13179,13 @@
\listcsxadd{blx@datafieldset@\blx@setname}{##1}}
\dolistcsloop{blx@datamodelfields@datatypes@\blx@dm@datatype}}}}
-\define@key{blx@datafieldsets@member}{datatype}{% characters
+\blx@kv@defkey{blx@datafieldsets@member}{datatype}{% characters
\appto\blx@tempb{ datatype="#1"}%
\def\blx@dm@datatype{#1}}
-\define@key{blx@datafieldsets@member}{fieldtype}{% characters
+\blx@kv@defkey{blx@datafieldsets@member}{fieldtype}{% characters
\appto\blx@tempb{ fieldtype="#1"}%
\def\blx@dm@fieldtype{#1}}
-\define@key{blx@datafieldsets@member}{field}{% characters
+\blx@kv@defkey{blx@datafieldsets@member}{field}{% characters
\appto\blx@tempb{ field="#1"}%
\def\blx@member@field{#1}}
@@ -13093,8 +13221,8 @@
\let\map\blx@sourcemap@map
#2%
\ifblank{#1}
- {\setkeys{blx@sourcemap@maps}{datatype=bibtex, level=driver}}
- {\setkeys{blx@sourcemap@maps}{#1, level=driver}}%
+ {\blx@kv@setkeys{blx@sourcemap@maps}{datatype=bibtex, level=driver}}
+ {\blx@kv@setkeys{blx@sourcemap@maps}{#1, level=driver}}%
\eappto\blx@tempa{%
\blx@xml@sourcemap@maps{\blx@tempb}{\blx@tempc}}%
\csxdef{blx@sourcemap@defaults@\blx@tempd}{\blx@tempa}%
@@ -13106,8 +13234,8 @@
\let\blx@tempc\@empty
\let\map\blx@sourcemap@map
\ifblank{#1}
- {\setkeys{blx@sourcemap@maps}{datatype=bibtex, level=user}}
- {\setkeys{blx@sourcemap@maps}{#1, level=user}}%
+ {\blx@kv@setkeys{blx@sourcemap@maps}{datatype=bibtex, level=user}}
+ {\blx@kv@setkeys{blx@sourcemap@maps}{#1, level=user}}%
#2%
\eappto\blx@tempa{%
\blx@xml@sourcemap@maps{\blx@tempb}{\blx@tempc}}}
@@ -13117,20 +13245,20 @@
\let\blx@tempc\@empty
\let\map\blx@sourcemap@map
\ifblank{#1}
- {\setkeys{blx@sourcemap@maps}{datatype=bibtex, level=style}}
- {\setkeys{blx@sourcemap@maps}{#1, level=style}}%
+ {\blx@kv@setkeys{blx@sourcemap@maps}{datatype=bibtex, level=style}}
+ {\blx@kv@setkeys{blx@sourcemap@maps}{#1, level=style}}%
#2%
\eappto\blx@tempa{%
\blx@xml@sourcemap@maps{\blx@tempb}{\blx@tempc}}}
-\define@key{blx@sourcemap@maps}{datatype}{% characters
+\blx@kv@defkey{blx@sourcemap@maps}{datatype}{% characters
\eappto\blx@tempb{ datatype="#1"}%
\eappto\blx@tempd{#1}}
-\define@key{blx@sourcemap@maps}{overwrite}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@maps}{overwrite}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempb{ map\string_overwrite="1"}}
{}}
-\define@key{blx@sourcemap@maps}{level}{% user|style|driver
+\blx@kv@defkey{blx@sourcemap@maps}{level}{% user|style|driver
\appto\blx@tempb{ level="#1"}}
\newcommand*{\blx@sourcemap@map}[2][]{%
@@ -13142,18 +13270,18 @@
\let\step\blx@sourcemap@step
\ifblank{#1}
{}
- {\setkeys{blx@sourcemap@map}{#1}}%
+ {\blx@kv@setkeys{blx@sourcemap@map}{#1}}%
#2%
\eappto\blx@tempc{%
\blx@xml@sourcemap@map{\blx@tempm}{\blx@tempe}}}
-\define@key{blx@sourcemap@map}{overwrite}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@map}{overwrite}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempm{ map\string_overwrite="1"}}
{}}
-\define@key{blx@sourcemap@map}{foreach}{% characters
+\blx@kv@defkey{blx@sourcemap@map}{foreach}{% characters
\eappto\blx@tempm{ map\string_foreach="#1"}}
-\define@key{blx@sourcemap@map}{refsection}{% integer
+\blx@kv@defkey{blx@sourcemap@map}{refsection}{% integer
\eappto\blx@tempm{ refsection="#1"}}
\newcommand*{\blx@sourcemap@perdatasource}[1]{%
@@ -13170,96 +13298,100 @@
\newcommand*{\blx@sourcemap@step}[1][2]{%
\let\blx@tempf\@empty
- \setkeys{blx@sourcemap@step}{#1}%
+ \blx@kv@setkeys{blx@sourcemap@step}{#1}%
\eappto\blx@tempe{%
\blx@xml@sourcemap@step{\blx@tempf}}}
-\define@key{blx@sourcemap@step}{typesource}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{typesource}{% characters
\eappto\blx@tempf{ map\string_type\string_source="#1"}}
-\define@key{blx@sourcemap@step}{typetarget}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{typetarget}{% characters
\eappto\blx@tempf{ map\string_type\string_target="#1"}}
-\define@key{blx@sourcemap@step}{final}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{final}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_final="1"}}
{}}
-\define@key{blx@sourcemap@step}{cited}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{cited}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_entrykey\string_cited="1"}}
{}}
-\define@key{blx@sourcemap@step}{nocited}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{nocited}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_entrykey\string_nocited="1"}}
{}}
-\define@key{blx@sourcemap@step}{citedornocited}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{citedornocited}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_entrykey\string_citedornocited="1"}}
{}}
-\define@key{blx@sourcemap@step}{allnocited}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{allnocited}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_entrykey\string_allnocited="1"}}
{}}
-\define@key{blx@sourcemap@step}{fieldsource}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{starnocited}[true]{% true|false
+ \ifstrequal{#1}{true}
+ {\appto\blx@tempf{ map\string_entrykey\string_starnocited="1"}}
+ {}}
+\blx@kv@defkey{blx@sourcemap@step}{fieldsource}{% characters
\eappto\blx@tempf{ map\string_field\string_source="#1"}}
-\define@key{blx@sourcemap@step}{notfield}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{notfield}{% characters
\eappto\blx@tempf{ map\string_notfield="#1"}}
-\define@key{blx@sourcemap@step}{fieldtarget}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{fieldtarget}{% characters
\eappto\blx@tempf{ map\string_field\string_target="#1"}}
-\define@key{blx@sourcemap@step}{fieldset}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{fieldset}{% characters
\eappto\blx@tempf{ map\string_field\string_set="#1"}}
% We are sanitising the XML here as it's the value of an attribute which
% might contain quotes or ampersands (URLs, for example)
-\define@key{blx@sourcemap@step}{fieldvalue}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{fieldvalue}{% characters
\blx@xmlsanitizeafter{\def\blx@temps}{#1}%
\eappto\blx@tempf{ map\string_field\string_value="\blx@temps"}}
-\define@key{blx@sourcemap@step}{append}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{append}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_append="1"}}
{}}
-\define@key{blx@sourcemap@step}{appendstrict}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{appendstrict}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_appendstrict="1"}}
{}}
-\define@key{blx@sourcemap@step}{null}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{null}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_null="1"}}
{}}
-\define@key{blx@sourcemap@step}{entrynull}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{entrynull}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_entry\string_null="1"}}
{}}
-\define@key{blx@sourcemap@step}{entrynocite}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{entrynocite}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_entry\string_nocite="1"}}
{}}
-\define@key{blx@sourcemap@step}{entrynew}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{entrynew}{% characters
\appto\blx@tempf{ map\string_entry\string_new="#1"}}
-\define@key{blx@sourcemap@step}{entrynewtype}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{entrynewtype}{% characters
\appto\blx@tempf{ map\string_entry\string_newtype="#1"}}
-\define@key{blx@sourcemap@step}{entrytarget}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{entrytarget}{% characters
\appto\blx@tempf{ map\string_entrytarget="#1"}}
-\define@key{blx@sourcemap@step}{entryclone}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{entryclone}{% characters
\appto\blx@tempf{ map\string_entry\string_clone="#1"}}
-\define@key{blx@sourcemap@step}{origfield}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{origfield}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_origfield="1"}}
{}}
-\define@key{blx@sourcemap@step}{origfieldval}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{origfieldval}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_origfieldval="1"}}
{}}
-\define@key{blx@sourcemap@step}{origentrytype}[true]{% true|false
+\blx@kv@defkey{blx@sourcemap@step}{origentrytype}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempf{ map\string_origentrytype="1"}}
{}}
-\define@key{blx@sourcemap@step}{match}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{match}{% characters
\appto\blx@tempf{ map\string_match="#1"}}
-\define@key{blx@sourcemap@step}{matchi}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{matchi}{% characters
\appto\blx@tempf{ map\string_matchi="#1"}}
-\define@key{blx@sourcemap@step}{notmatch}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{notmatch}{% characters
\appto\blx@tempf{ map\string_notmatch="#1"}}
-\define@key{blx@sourcemap@step}{notmatchi}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{notmatchi}{% characters
\appto\blx@tempf{ map\string_notmatchi="#1"}}
-\define@key{blx@sourcemap@step}{replace}{% characters
+\blx@kv@defkey{blx@sourcemap@step}{replace}{% characters
\eappto\blx@tempf{ map\string_replace="#1"}}
% [<specname>]{<spec>}
@@ -13288,29 +13420,29 @@
\let\blx@tempc\@empty
\ifblank{#1}
{}
- {\setkeys{blx@lantem@namepart}{#1}}%
+ {\blx@kv@setkeys{blx@lantem@namepart}{#1}}%
\eappto\blx@tempa{%
\blx@xml@labelalphanametemplatenamepart{\blx@tempe}{\blx@tempc}{#2}}}
-\define@key{blx@lantem@namepart}{use}[true]{% use* option for namepart true|false
+\blx@kv@defkey{blx@lantem@namepart}{use}[true]{% use* option for namepart true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ use="1"}}
{}}
-\define@key{blx@lantem@namepart}{pre}[true]{% pre option for namepart true|false
+\blx@kv@defkey{blx@lantem@namepart}{pre}[true]{% pre option for namepart true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ pre="1"}}
{}}
-\define@key{blx@lantem@namepart}{compound}[true]{% base option for namepart true|false
+\blx@kv@defkey{blx@lantem@namepart}{compound}[true]{% base option for namepart true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ substring\string_compound="1"}}
{}}
-\define@key{blx@lantem@namepart}{strwidth}{% integer
+\blx@kv@defkey{blx@lantem@namepart}{strwidth}{% integer
\eappto\blx@tempc{ substring\string_width="#1"}}
-\define@key{blx@lantem@field}{strside}{% left|right
+\blx@kv@defkey{blx@lantem@field}{strside}{% left|right
\ifstrequal{#1}{right}
{\eappto\blx@tempc{ substring\string_side="right"}}
{\eappto\blx@tempc{ substring\string_side="left"}}}
@@ -13356,56 +13488,56 @@
\let\blx@tempc\@empty
\ifblank{#1}
{}
- {\setkeys{blx@latem@field}{#1}}%
+ {\blx@kv@setkeys{blx@latem@field}{#1}}%
\eappto\blx@tempb{%
\blx@xml@labelalpha@part{\blx@tempc}{#2}}}
-\define@key{blx@latem@field}{uppercase}[true]{% true|false
+\blx@kv@defkey{blx@latem@field}{uppercase}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ uppercase="1"}}
{}}
-\define@key{blx@latem@field}{lowercase}[true]{% true|false
+\blx@kv@defkey{blx@latem@field}{lowercase}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ lowercase="1"}}
{}}
-\define@key{blx@latem@field}{final}[true]{% true|false
+\blx@kv@defkey{blx@latem@field}{final}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ final="1"}}
{}}
-\define@key{blx@latem@field}{strwidth}{% integer
+\blx@kv@defkey{blx@latem@field}{strwidth}{% integer
\eappto\blx@tempc{ substring\string_width="#1"}}
-\define@key{blx@latem@field}{varwidth}[true]{% "v"
+\blx@kv@defkey{blx@latem@field}{varwidth}[true]{% "v"
\ifstrequal{#1}{true}
{\appto\blx@tempc{ substring\string_width="v"}}
{}}
-\define@key{blx@latem@field}{varwidthnorm}[true]{% "vf"
+\blx@kv@defkey{blx@latem@field}{varwidthnorm}[true]{% "vf"
\ifstrequal{#1}{true}
{\appto\blx@tempc{ substring\string_width="vf"}}
{}}
-\define@key{blx@latem@field}{varwidthlist}[true]{% "l"
+\blx@kv@defkey{blx@latem@field}{varwidthlist}[true]{% "l"
\ifstrequal{#1}{true}
{\appto\blx@tempc{ substring\string_width="l"}}
{}}
-\define@key{blx@latem@field}{strfixedcount}{%
+\blx@kv@defkey{blx@latem@field}{strfixedcount}{%
\eappto\blx@tempc{ substring\string_fixed\string_threshold="#1"}}
-\define@key{blx@latem@field}{strwidthmax}{%
+\blx@kv@defkey{blx@latem@field}{strwidthmax}{%
\eappto\blx@tempc{ substring\string_width\string_max="#1"}}
-\define@key{blx@latem@field}{strside}{% left|right
+\blx@kv@defkey{blx@latem@field}{strside}{% left|right
\ifstrequal{#1}{right}
{\eappto\blx@tempc{ substring\string_side="right"}}
{\eappto\blx@tempc{ substring\string_side="left"}}}
-\define@key{blx@latem@field}{namessep}{%
+\blx@kv@defkey{blx@latem@field}{namessep}{%
\eappto\blx@tempc{ namessep="#1"}}
-\define@key{blx@latem@field}{ifnames}{%
+\blx@kv@defkey{blx@latem@field}{ifnames}{%
\eappto\blx@tempc{ ifnames="#1"}}
-\define@key{blx@latem@field}{names}{%
+\blx@kv@defkey{blx@latem@field}{names}{%
\eappto\blx@tempc{ names="#1"}}
-\define@key{blx@latem@field}{noalphaothers}[true]{%
+\blx@kv@defkey{blx@latem@field}{noalphaothers}[true]{%
\eappto\blx@tempc{ noalphaothers="1"}}
-\define@key{blx@latem@field}{padchar}{%
+\blx@kv@defkey{blx@latem@field}{padchar}{%
\blx@xmlsanitizeafter{\def\blx@temps}{#1}%
\eappto\blx@tempc{ pad\string_char="\expandafter\regexp\expandafter{\blx@temps}"}}
-\define@key{blx@latem@field}{padside}{% left|right
+\blx@kv@defkey{blx@latem@field}{padside}{% left|right
\ifstrequal{#1}{left}
{\eappto\blx@tempc{ pad\string_side="left"}}
{\eappto\blx@tempc{ pad\string_side="right"}}}
@@ -13416,7 +13548,7 @@
\let\blx@tempf\@empty
\ifblank{#2}
{}
- {\setkeys{blx@inherit@default}{#2}}%
+ {\blx@kv@setkeys{blx@inherit@default}{#2}}%
\edef\blx@tempa{\space
inherit\string_all="\iftoggle{blx@inherit@all}{true}{false}"\space
override\string_target="\iftoggle{blx@inherit@override}{true}{false}"%
@@ -13432,11 +13564,11 @@
\newtoggle{blx@inherit@all}
\newtoggle{blx@inherit@override}
-\define@key{blx@inherit@default}{all}[true]{% true|false
+\blx@kv@defkey{blx@inherit@default}{all}[true]{% true|false
\settoggle{blx@inherit@all}{#1}}
-\define@key{blx@inherit@default}{override}[true]{% true|false
+\blx@kv@defkey{blx@inherit@default}{override}[true]{% true|false
\settoggle{blx@inherit@override}{#1}}
-\define@key{blx@inherit@default}{ignore}{% csv list
+\blx@kv@defkey{blx@inherit@default}{ignore}{% csv list
\edef\blx@tempf{ ignore="#1"}}
% {<source>}{<target>}{<options>}
@@ -13444,15 +13576,15 @@
\let\blx@tempc\@empty
\ifblank{#3}
{}
- {\setkeys{blx@inherit@except}{#3}}%
+ {\blx@kv@setkeys{blx@inherit@except}{#3}}%
\eappto\blx@tempb{%
\blx@xml@inherit@type{#1}{#2}{\blx@tempc}}}
-\define@key{blx@inherit@except}{all}[true]{% true|false
+\blx@kv@defkey{blx@inherit@except}{all}[true]{% true|false
\eappto\blx@tempc{ inherit\string_all="#1"}}
-\define@key{blx@inherit@except}{override}[true]{% true|false
+\blx@kv@defkey{blx@inherit@except}{override}[true]{% true|false
\eappto\blx@tempc{ override\string_target="#1"}}
-\define@key{blx@inherit@except}{ignore}{% csv list
+\blx@kv@defkey{blx@inherit@except}{ignore}{% csv list
\eappto\blx@tempc{ ignore="#1"}}
% {<type,type,...>}{<type,type,...>}{<spec>}
@@ -13462,7 +13594,7 @@
\let\blx@tempf\@empty
\ifblank{#1}
{}
- {\setkeys{blx@inherit}{#1}}%
+ {\blx@kv@setkeys{blx@inherit}{#1}}%
\forcsvlist{\blx@inherit@i{#3}}{#2}%
\let\blx@tempb\@empty
\let\inherit\blx@inherit@field
@@ -13488,17 +13620,17 @@
\let\blx@tempc\@empty
\ifblank{#1}
{}
- {\setkeys{blx@inherit@field}{#1}}%
+ {\blx@kv@setkeys{blx@inherit@field}{#1}}%
\eappto\blx@tempb{%
\blx@xml@inherit@field{#2}{#3}{\blx@tempc}}}
\newcommand*{\blx@inherit@block}[1]{%
\eappto\blx@tempb{\blx@xml@inherit@block{#1}}}
-\define@key{blx@inherit}{ignore}{% csv list
+\blx@kv@defkey{blx@inherit}{ignore}{% csv list
\edef\blx@tempf{ ignore="#1"}}
-\define@key{blx@inherit@field}{override}[true]{% true|false
+\blx@kv@defkey{blx@inherit@field}{override}[true]{% true|false
\ifstrequal{#1}{true}
{\edef\blx@tempc{ override\string_target="true"}}
{\edef\blx@tempc{ override\string_target="false"}}}
@@ -13526,21 +13658,21 @@
\newcommand*{\blx@biblistfilter}[1][2]{%
\let\blx@tempc\@empty
\let\blx@tempd\@empty
- \setkeys{blx@biblistfilter@filter}{#1}%
+ \blx@kv@setkeys{blx@biblistfilter@filter}{#1}%
\eappto\blx@tempa{%
\blx@xml@dlistfilter{\blx@tempc}{\blx@tempd}}}
-\define@key{blx@biblistfilter@filter}{type}{%
+\blx@kv@defkey{blx@biblistfilter@filter}{type}{%
\def\blx@tempc{#1}}
-\define@key{blx@biblistfilter@filter}{filter}{%
+\blx@kv@defkey{blx@biblistfilter@filter}{filter}{%
\def\blx@tempd{#1}}
% Predefine filters for label fields
\def\do#1{\DeclareBiblistFilter{#1}{\filter[type=field,filter=#1]}}
\abx@dolabelfields
-\define@key{blx@biblist2}{biblistfilter}{\blx@key@biblistfilter{#1}}
-\define@key{blx@biblist1}{biblistfilter}{}
+\blx@kv@defkey{blx@biblist1}{biblistfilter}{\blx@key@biblistfilter{#1}}
+\blx@kv@defkey{blx@biblist2}{biblistfilter}{}
\def\blx@key@biblistfilter#1{%
\ifcsundef{blx@biblistfilters@#1}
@@ -13599,21 +13731,21 @@
\let\blx@tempc\@empty
\ifblank{#1}
{}
- {\setkeys{blx@untemp@namepart}{#1}}%
+ {\blx@kv@setkeys{blx@untemp@namepart}{#1}}%
\eappto\blx@tempa{%
\blx@xml@uniquenametemplatenamepart{\blx@tempe}{\blx@tempc}{#2}}}
-\define@key{blx@untemp@namepart}{use}[true]{% use* option for namepart true|false
+\blx@kv@defkey{blx@untemp@namepart}{use}[true]{% use* option for namepart true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ use="1"}}
{}}
-\define@key{blx@untemp@namepart}{base}[true]{% base option for namepart true|false
+\blx@kv@defkey{blx@untemp@namepart}{base}[true]{% base option for namepart true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ base="1"}}
{}}
-\define@key{blx@untemp@namepart}{disambiguation}{% disambiguation option for namepart none|inits|full|fullonly
+\blx@kv@defkey{blx@untemp@namepart}{disambiguation}{% disambiguation option for namepart none|inits|full|fullonly
\appto\blx@tempc{ disambiguation="#1"}}
% [<templatename>]{<template>}
@@ -13668,16 +13800,16 @@
\let\blx@tempc\@empty
\ifblank{#1}
{}
- {\setkeys{blx@sortnk@namepart}{#1}}%
+ {\blx@kv@setkeys{blx@sortnk@namepart}{#1}}%
\eappto\blx@tempb{%
\blx@xml@sortingnamekeynamepart{\blx@tempe}{\blx@tempc}{#2}}}
-\define@key{blx@sortnk@namepart}{use}[true]{% use* option for namepart true|false
+\blx@kv@defkey{blx@sortnk@namepart}{use}[true]{% use* option for namepart true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ use="1"}}
{\appto\blx@tempc{ use="0"}}}
-\define@key{blx@sortnk@namepart}{inits}[true]{% initials only option for namepart true|false
+\blx@kv@defkey{blx@sortnk@namepart}{inits}[true]{% initials only option for namepart true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ inits="1"}}
{\appto\blx@tempc{ inits="0"}}}
@@ -13686,7 +13818,7 @@
\newrobustcmd*{\DeclareSortingTemplate}[3][]{%
\ifblank{#1}
{}
- {\setkeys{blx@sortdef@sorting}{#1}%
+ {\blx@kv@setkeys{blx@sortdef@sorting}{#1}%
\csxdef{blx@sortdef@locale@#2}{\blx@templ}}%
\begingroup
\def\name{%LEGACY(<2.0)
@@ -13700,7 +13832,10 @@
\let\sort\blx@sortdef@sort
\let\field\blx@sortdef@field
\let\literal\blx@sortdef@literal
- \def\citeorder{\blx@sortdef@field{citeorder}}%
+ \global\csundef{blx@sortingtemplate@citeorder@relevant@#2}%
+ \def\citeorder{%
+ \global\cslet{blx@sortingtemplate@citeorder@relevant@#2}\@empty
+ \blx@sortdef@field{citeorder}}%
\blx@tempcnta\z@
\let\blx@tempa\@empty
#3%
@@ -13709,7 +13844,7 @@
\@onlypreamble\DeclareSortingTemplate
\blx@DeclareBackendOption{global}[xml]{sortingtemplate}
-\define@key{blx@sortdef@sorting}{locale}{% locale name
+\blx@kv@defkey{blx@sortdef@sorting}{locale}{% locale name
\def\blx@templ{#1}}
\newcommand*{\blx@sortdef@sort}[2][]{%
@@ -13719,27 +13854,27 @@
\edef\blx@tempc{order="\the\blx@tempcnta"}%
\ifblank{#1}
{}
- {\setkeys{blx@sortdef@sort}{#1}}%
+ {\blx@kv@setkeys{blx@sortdef@sort}{#1}}%
\let\do\@firstofone
#2%
\eappto\blx@tempa{%
\blx@xml@sort{\blx@tempc}{\blx@tempb}}}
-\define@key{blx@sortdef@sort}{locale}{% locale name
+\blx@kv@defkey{blx@sortdef@sort}{locale}{% locale name
\eappto\blx@tempc{ locale="#1"}}
-\define@key{blx@sortdef@sort}{direction}{% ascending|descending
+\blx@kv@defkey{blx@sortdef@sort}{direction}{% ascending|descending
\ifstrequal{#1}{ascending}
{\eappto\blx@tempc{ sort\string_direction="ascending"}}
{\eappto\blx@tempc{ sort\string_direction="descending"}}}
-\define@key{blx@sortdef@sort}{final}[true]{% true|false
+\blx@kv@defkey{blx@sortdef@sort}{final}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ final="1"}}
{}}
-\define@key{blx@sortdef@sort}{sortcase}[true]{% true|false
+\blx@kv@defkey{blx@sortdef@sort}{sortcase}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ sortcase="1"}}
{\appto\blx@tempc{ sortcase="0"}}}
-\define@key{blx@sortdef@sort}{sortupper}[true]{% true|false
+\blx@kv@defkey{blx@sortdef@sort}{sortupper}[true]{% true|false
\ifstrequal{#1}{true}
{\appto\blx@tempc{ sortupper="1"}}
{\appto\blx@tempc{ sortupper="0"}}}
@@ -13749,24 +13884,24 @@
\edef\blx@tempd{order="\the\blx@tempcntb"}%
\ifblank{#1}
{}
- {\setkeys{blx@sortdef@field}{#1}}%
+ {\blx@kv@setkeys{blx@sortdef@field}{#1}}%
\eappto\blx@tempb{%
\blx@xml@sortitem{\blx@tempd}{#2}}}
-\define@key{blx@sortdef@field}{padside}{% left|right
+\blx@kv@defkey{blx@sortdef@field}{padside}{% left|right
\ifstrequal{#1}{right}
{\eappto\blx@tempd{ pad\string_side="right"}}
{\eappto\blx@tempd{ pad\string_side="left"}}}
-\define@key{blx@sortdef@field}{padwidth}{% integer
+\blx@kv@defkey{blx@sortdef@field}{padwidth}{% integer
\eappto\blx@tempd{ pad\string_width="#1"}}
-\define@key{blx@sortdef@field}{padchar}{% character
+\blx@kv@defkey{blx@sortdef@field}{padchar}{% character
\blx@xmlsanitizeafter{\def\blx@tempe}{#1}%
\eappto\blx@tempd{ pad\string_char="\blx@tempe"}}
-\define@key{blx@sortdef@field}{strside}{% left|right
+\blx@kv@defkey{blx@sortdef@field}{strside}{% left|right
\ifstrequal{#1}{right}
{\eappto\blx@tempd{ substring\string_side="right"}}
{\eappto\blx@tempd{ substring\string_side="left"}}}
-\define@key{blx@sortdef@field}{strwidth}{% integer
+\blx@kv@defkey{blx@sortdef@field}{strwidth}{% integer
\eappto\blx@tempd{ substring\string_width="#1"}}
\def\blx@sortdef@literal#1{%
@@ -13905,7 +14040,7 @@
\let\blx@tempc\@empty
\ifblank{#1}
{}
- {\setkeys{blx@ordered@field}{#1}}%
+ {\blx@kv@setkeys{blx@ordered@field}{#1}}%
\advance\blx@tempcnta\@ne
\ifdefempty{\blx@tempa}
{\csxappto{blx@bcf@\blx@tempb}{%
@@ -13920,7 +14055,7 @@
\let\blx@tempc\@empty
\ifblank{#1}
{}
- {\setkeys{blx@ordered@field}{#1}}%
+ {\blx@kv@setkeys{blx@ordered@field}{#1}}%
\advance\blx@tempcnta\@ne
\ifdefempty{\blx@tempa}
{\csxappto{blx@bcf@\blx@tempb}{%
@@ -13948,7 +14083,7 @@
\newrobustcmd*{\ExecuteBibliographyOptions}[2][]{%
\ifblank{#1}
- {\setkeys{blx@opt@pre}{#2}}
+ {\blx@kv@setkeys{blx@opt@pre}{#2}}
{\forcsvlist{\blx@typeoptions{#2}}{#1}}}
\@onlypreamble\ExecuteBibliographyOptions
@@ -13969,9 +14104,9 @@
% Have to have a dummy for this as it's set much earlier but is passed
% through to here where we just ignore it
-\define@key{blx@opt@ldt}{datamodel}{}
+\blx@kv@defkey{blx@opt@ldt}{datamodel}{}
-\define@key{blx@opt@ldt}{backend}{%
+\blx@kv@defkey{blx@opt@ldt}{backend}{%
\ifstrequal{#1}{biber}
{}
{\ifboolexpr{
@@ -13985,30 +14120,30 @@
{}}%
{\blx@err@invopt{backend=#1}{}}}}
-\define@key{blx@opt@ldt}{style}{%
+\blx@kv@defkey{blx@opt@ldt}{style}{%
\def\blx@cbxfile{#1}%
\def\blx@bbxfile{#1}}
-\define@key{blx@opt@ldt}{bibstyle}{%
+\blx@kv@defkey{blx@opt@ldt}{bibstyle}{%
\def\blx@bbxfile{#1}}
-\define@key{blx@opt@ldt}{citestyle}{%
+\blx@kv@defkey{blx@opt@ldt}{citestyle}{%
\def\blx@cbxfile{#1}}
-\define@key{blx@opt@ldt}{natbib}[true]{%
+\blx@kv@defkey{blx@opt@ldt}{natbib}[true]{%
\settoggle{blx@natbib}{#1}}
-\define@key{blx@opt@ldt}{mcite}[true]{%
+\blx@kv@defkey{blx@opt@ldt}{mcite}[true]{%
\settoggle{blx@mcite}{#1}}
-\define@key{blx@opt@ldt}{noerroretextools}[true]{%
+\blx@kv@defkey{blx@opt@ldt}{noerroretextools}[true]{%
\blx@warning@noline{%
The option 'noerroretextools' is deprecated.\MessageBreak
Define the control sequence '\string\blx@noerroretextools'\MessageBreak
before loading biblatex instead}%
\ifstrequal{#1}{true}
{\global\cslet{blx@noerroretextools}\@empty}
- {\csgundef{blx@noerroretextools}}}
+ {\global\csundef{blx@noerroretextools}}}
% load-time and preamble
@@ -14061,7 +14196,7 @@
% unlikely to be corrected as "sorting" is an obvious name for biblatex users
% "sorting" is used in the .bcf for the actual sorting template definitions and is
% an XML format option
-\define@key{blx@opt@pre}{sorting}{%
+\blx@kv@defkey{blx@opt@pre}{sorting}{%
\def\blx@sorting{#1}%
\def\blx@refcontext@sortingtemplatename{#1}}
\blx@DeclareBackendOption{global}[string]{sortingtemplatename}
@@ -14295,6 +14430,14 @@
\def\blx@hook@initlang{\@quotereset\@ne}%
\def\blx@hook@endlang{\blx@postpunct}}
+\DeclareBibliographyOption[string]{langhook}{%
+ \ifstrequal{#1}{captions}
+ {\@firstoftwo}
+ {\ifstrequal{#1}{extras}}
+ {\def\blx@langhook{#1}}
+ {\blx@err@invopt{langhook=#1}{}}}
+
+
\DeclareBiblatexOption{global,type,entry}[string]{indexing}[true]{%
\blx@opt@index{#1}}
\def\blx@opt@index#1{%
@@ -14382,6 +14525,10 @@
\def\blx@opt@backrefsetstyle@memandset{4}
\def\blx@opt@backrefsetstyle@setplusmem{5}
+\newtoggle{blx@backreffloats}
+\DeclareBibliographyOption[boolean]{backreffloats}[true]{%
+ \settoggle{blx@backreffloats}{#1}}
+
\appto\blx@mkhyperref{%
\ifHy@plainpages
\blx@warning@noline{%
@@ -14396,10 +14543,22 @@
references. 'pageanchor=true' is required}%
\fi}
-\DeclareBibliographyOption[string]{block}{%
+\def\blx@optprocess@block#1{%
\ifcsdef{blx@opt@block@#1}
{\csuse{blx@opt@block@#1}}
{\blx@err@invopt{block=#1}{}}}
+
+\DeclareBibliographyOption[string]{block}{%
+ \blx@optprocess@block{#1}}
+
+\blx@kv@defkey{blx@bib1}{block}{}
+\blx@kv@defkey{blx@bib2}{block}{\blx@optprocess@block{#1}}
+\blx@kv@defkey{blx@biblist1}{block}{}
+\blx@kv@defkey{blx@biblist2}{block}{\blx@optprocess@block{#1}}
+
+\blx@kv@defkey{blx@bbs}{block}{\blx@optprocess@block{#1}}
+\blx@kv@defkey{blx@bbg}{block}{\blx@optprocess@block{#1}}
+
\def\blx@opt@block@none{%
\let\blx@bibsetup\@empty
\let\newblockpunct\@empty}
@@ -14623,6 +14782,11 @@
\let\blx@loccitreset\blx@loccitreset@context
\booltrue{citetracker}}
+\newtoggle{blx@trackfloats}
+\DeclareBibliographyOption[boolean]{trackfloats}[true]{%
+ \settoggle{blx@trackfloats}{#1}}
+
+
\DeclareBibliographyOption[boolean]{parentracker}[true]{%
\ifstrequal{#1}{true}
{\let\bibopenparen\blx@bibopenparen
@@ -14783,7 +14947,7 @@
{\blx@err@invopt{#1date=##1}{}}}}%
% Default for new date fields is "comp" but this is overridden below by
% biblatex defaults
- \setkeys{blx@opt@pre}{#1date=comp}%
+ \blx@kv@setkeys{blx@opt@pre}{#1date=comp}%
% Time format options
\DeclareBibliographyOption[string]{#1time}{%
\csdef{blx@timeformat@#1time}{##1}%
@@ -14791,7 +14955,7 @@
{\protected\csedef{blx@imc@print#1time}{\csuse{mktimerange##1}{#1}}}
{\blx@err@invopt{#1time=##1}{}}}%
% Default for new time fields is "24h"
- \setkeys{blx@opt@pre}{#1time=24h}%
+ \blx@kv@setkeys{blx@opt@pre}{#1time=24h}%
% Boolean to determine if times are printed with dates
\newtoggle{blx@#1dateusetime}%
\DeclareBibliographyOption[boolean]{#1dateusetime}{%
@@ -14889,7 +15053,7 @@
\settoggle{blx@labelnumber}{#1}%
\iftoggle{blx@labelnumber}
{}
- {\setkeys{blx@opt@pre}{defernumbers=false}}}
+ {\blx@kv@setkeys{blx@opt@pre}{defernumbers=false}}}
\DeclareBiblatexOption{type,entry}[boolean]{labelnumber}[true]{%
\settoggle{blx@labelnumber}{#1}}
@@ -14966,14 +15130,14 @@
\DeclareBibliographyOption[boolean]{defernumbers}[true]{%
\settoggle{blx@defernumbers}{#1}%
\iftoggle{blx@defernumbers}
- {\setkeys{blx@opt@pre}{labelnumber}%
+ {\blx@kv@setkeys{blx@opt@pre}{labelnumber}%
\let\blx@thelabelnumber\blx@addlabelnumber
\let\abx@aux@number\blx@aux@number}
{\let\blx@thelabelnumber\relax
\let\abx@aux@number\@gobblefive}}
\DeclareBibliographyOption[boolean]{locallabelwidth}[true]{%
- \blx@key@locallabelwidth{\abx@locallabelwidth}{#1}}
+ \blx@key@locallabelwidth{#1}}
\DeclareBibliographyOption[string]{refsection}{%
@@ -15078,11 +15242,11 @@
\def\blx@tempa#1=#2&{#1}%
\edef\blx@tempa{%
\expandafter\blx@tempa\CurrentOption=&}%
- \ifcsundef{KV@blx@opt@ldt@\blx@tempa}
+ \blx@kv@ifkeyundef{blx@opt@ldt}{\blx@tempa}
{\endgroup
\eappto\blx@theoptions{\CurrentOption,}}
{\edef\blx@tempa{\endgroup
- \noexpand\setkeys{blx@opt@ldt}{\CurrentOption}}%
+ \noexpand\blx@kv@setkeys{blx@opt@ldt}{\CurrentOption}}%
\blx@tempa}}
\def\blx@processoptions{%
@@ -15090,21 +15254,64 @@
{}
{\begingroup
\edef\blx@tempa{\endgroup
- \noexpand\setkeys{blx@opt@pre}{\blx@theoptions}}%
+ \noexpand\blx@kv@setkeys{blx@opt@pre}{\blx@theoptions}}%
\blx@tempa}}
%% Initial setup
+\define@key{blx@opt@ldt}{casechanger}[auto]{%
+ \ifcsundef{blx@opt@casechanger@#1}
+ {\blx@err@invopt
+ {casechanger=#1}
+ {Valid options for 'casechanger' are 'auto', 'expl3' and
+ 'latex2e'}}
+ {\csletcs{blx@deferoption@casechanger}{blx@opt@casechanger@#1}}}
+
+
+\csdef{blx@opt@casechanger@auto}{%
+ \RequirePackage{expl3}[2020/04/06]%
+ \@ifpackagelater{expl3}{2020/04/06}
+ {\blx@info{expl3\MessageBreak\csuse{ver@expl3.sty}\MessageBreak
+ is new enough (at least 2020/04/06),\MessageBreak
+ setting 'casechanger=expl3'}%
+ \csuse{blx@opt@casechanger@expl3}}
+ {\blx@info{expl3\MessageBreak\csuse{ver@expl3.sty}\MessageBreak
+ is too old (older than 2020/04/06),\MessageBreak
+ setting 'casechanger=latex2e'}%
+ \csuse{blx@opt@casechanger@latex2e}}}
+
+\csdef{blx@opt@casechanger@latex2e}{%
+ \blx@inputonce{blx-case-latex2e.def}
+ {LaTeX2e (legacy) case changing code}
+ {}{}{}{}}
+\csletcs{blx@opt@casechanger@2e}{blx@opt@casechanger@latex2e}
+
+% Apparently neither \input nor \blx@inputonce ever pops the
+% \ExplSyntaxOff from \ProvidesExplFile, so we do that ourselves.
+\csdef{blx@opt@casechanger@expl3}{%
+ \blx@inputonce{blx-case-expl3.def}
+ {expl3 case changing code}
+ {}{\ExplSyntaxOff}{}{}}
+\csletcs{blx@opt@casechanger@3}{blx@opt@casechanger@expl3}
+
+% default to auto
+\csletcs{blx@deferoption@casechanger}{blx@opt@casechanger@auto}
+
% Set defaults
-\setkeys{blx@opt@ldt}{style=numeric}
-\setkeys{blx@opt@pre}{%
+\blx@kv@setkeys{blx@opt@ldt}{style=numeric}
+\blx@kv@setkeys{blx@opt@pre}{%
sorting=nty,sortlocale=auto,sortcase,sortupper,sortcites=false,
maxnames=3,minnames=1,maxalphanames=3,minalphanames=1,
- maxitems=3,minitems=1,mincrossrefs=2,minxrefs=2,useauthor=true,useeditor=true,
- usetranslator=false,indexing=false,abbreviate=true,dateabbrev=true,dateera=astronomical,
- backref=false,backrefsetstyle=setonly,pagetracker=false,ibidtracker=false,
- idemtracker=false,opcittracker=false,loccittracker=false,citetracker=false,
- citecounter=false,block=none,language=autobib,clearlang=true,autolang=none,
+ maxitems=3,minitems=1,mincrossrefs=2,minxrefs=2,
+ useauthor=true,useeditor=true,usetranslator=false,
+ indexing=false,abbreviate=true,dateabbrev=true,dateera=astronomical,
+ backref=false,backrefsetstyle=setonly,backreffloats=true,
+ pagetracker=false,
+ ibidtracker=false,idemtracker=false,opcittracker=false,loccittracker=false,
+ citetracker=false,trackfloats=false,
+ citecounter=false,
+ block=none,
+ language=autobib,clearlang=true,autolang=none,langhook=captions,
date=comp,labeldate=year,origdate=comp,eventdate=comp,urldate=short,
autopunct=true,punctfont=false,defernumbers=false,timezeros=true,
refsection=none,refsegment=none,citereset=none,hyperref=auto,
@@ -15122,6 +15329,7 @@
% Load compatibility code
\blx@inputonce{blx-compat.def}{compatibility code}{}{}{}{}
+
% Restore catcodes
\blx@catcodes
\undef\blx@catcodes
@@ -15129,6 +15337,44 @@
% Process load-time options
\ProcessOptions*
+% this ultimately loads either
+% blx-case-expl3.def or blx-case-latex2e.def
+\blx@deferoption@casechanger
+
+% This is a bit unfortunate, but we need some more definitions here.
+
+% Language fallback, in order:
+% * explicit option language=<lang>, which overrides everything
+% * langid field of entry
+% * babel/polyglossia lang
+% * main document lang (we should never reach this)
+% * <empty> (we should *definitely* never reach this)
+% Everything here is expandable so that
+% \blx@mksc@lang expands to the language name.
+\def\blx@mksc@lang{%
+ \ifundef\blx@forcelanguagename
+ {\ifundef\abx@field@langid
+ {\ifundef\blx@languagename
+ {\ifundef\blx@main@language
+ {}
+ {\blx@main@language}}
+ {\blx@languagename}}
+ {\abx@field@langid}}
+ {\blx@forcelanguagename}}
+
+\DeclareCaseLangs{%
+ american,british,canadian,
+ english,USenglish,UKenglish,
+ australian,newzealand}
+
+
+% Textcase defines \NoCaseChange as \let\NoCaseChange\@firstofone
+\ifundef\NoCaseChange
+ {\let\NoCaseChange\@firstofone}
+ {}
+
+% That's it for the case change code
+
% Switch to BibTeX support if requested
\iftoggle{blx@bibtex}
{\blx@inputonce{blx-bibtex.def}{BibTeX backend compatibility}{}{}{}{}}
@@ -15166,19 +15412,19 @@
{\blx@warn@conflopt{%
'<namepart>inits' conflicts with 'uniquename=full'.\MessageBreak
Setting 'uniquename=init'}%
- \setkeys{blx@opt@pre}{uniquename=init}}
+ \blx@kv@setkeys{blx@opt@pre}{uniquename=init}}
{}%
\ifdefstrequal\blx@uniquename\blx@opt@uniquename@allfull
{\blx@warn@conflopt{%
'<namepart>inits' conflicts with 'uniquename=allfull'.\MessageBreak
Setting 'uniquename=allinit}%
- \setkeys{blx@opt@pre}{uniquename=allinit}}
+ \blx@kv@setkeys{blx@opt@pre}{uniquename=allinit}}
{}%
\ifdefstrequal\blx@uniquename\blx@opt@uniquename@minfull
{\blx@warn@conflopt{%
'<namepart>inits' conflicts with 'uniquename=minfull'.\MessageBreak
Setting 'uniquename=mininit}%
- \setkeys{blx@opt@pre}{uniquename=mininit}}
+ \blx@kv@setkeys{blx@opt@pre}{uniquename=mininit}}
{}}
{}%
\nottoggle{blx@labeldateparts}
@@ -15186,7 +15432,7 @@
{\blx@warn@conflopt{%
'uniquelist=minyear' requires 'labeldateparts'.\MessageBreak
Setting 'uniquelist=true'}%
- \setkeys{blx@opt@pre}{uniquelist}}
+ \blx@kv@setkeys{blx@opt@pre}{uniquelist}}
{}}
{}%
\def\do#1{%
@@ -15195,37 +15441,37 @@
\ifdefstring\blx@dateera{astronomical}{}
{\blx@warn@conflopt{%
'#1=iso' requires 'dateera=astronomical'.\MessageBreak
- Setting 'dateera=astrononmical'}%
- \setkeys{blx@opt@pre}{dateera=astronomical}}%
+ Setting 'dateera=astronomical'}%
+ \blx@kv@setkeys{blx@opt@pre}{dateera=astronomical}}%
\ifcsstring{blx@timeformat@\blx@datetype time}{24h}%
{}
{\blx@warn@conflopt{%
'#1=iso' requires '\blx@datetype time=24h'.\MessageBreak
Setting '\blx@datetype time=24h'}%
- \setkeys{blx@opt@pre}{\blx@datetype time=24h}}%
+ \blx@kv@setkeys{blx@opt@pre}{\blx@datetype time=24h}}%
\iftoggle{blx@julian}
{\blx@warn@conflopt{%
'#1=iso' requires 'julian=false'.\MessageBreak
Setting 'julian=false'}%
- \setkeys{blx@opt@pre}{julian=false}}
+ \blx@kv@setkeys{blx@opt@pre}{julian=false}}
{}%
\nottoggle{blx@datezeros}
{\blx@warn@conflopt{%
'#1=iso' requires 'datezeros=true'.\MessageBreak
Setting 'datezeros=true'}%
- \setkeys{blx@opt@pre}{datezeros=true}}
+ \blx@kv@setkeys{blx@opt@pre}{datezeros=true}}
{}%
\nottoggle{blx@timezeros}
{\blx@warn@conflopt{%
'#1=iso' requires 'timezeros=true'.\MessageBreak
Setting 'timezeros=true'}%
- \setkeys{blx@opt@pre}{timezeros=true}}
+ \blx@kv@setkeys{blx@opt@pre}{timezeros=true}}
{}%
\nottoggle{blx@seconds}
{\blx@warn@conflopt{%
'#1=iso' requires 'seconds=true'.\MessageBreak
Setting 'seconds=true'}%
- \setkeys{blx@opt@pre}{seconds=true}}
+ \blx@kv@setkeys{blx@opt@pre}{seconds=true}}
{}}
{}}%
\abx@dodates
@@ -15322,5 +15568,7 @@
\def\BiblatexHungarianWarningOff{\global\let\lbx@hu@loadinfo\@empty}
\def\BiblatexLatvianWarningOff{\global\let\lbx@lv@loadinfo\@empty}
+\def\BiblatexSplitbibDefernumbersWarningOff{%
+ \global\let\blx@printbibchecks@suppresswarn\@empty}
\endinput