diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex/biblatex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex/biblatex.sty | 1769 |
1 files changed, 1427 insertions, 342 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty index 98fd4dd7ca4..f95ba1aaee9 100644 --- a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty +++ b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty @@ -11,8 +11,8 @@ % particular purpose. % Set up the version strings here -\def\abx@date{2016/05/14} -\def\abx@version{3.4} +\def\abx@date{2016/09/07} +\def\abx@version{3.5} \def\abx@bbxid{\abx@date\space v\abx@version\space biblatex bibliography style (PK/JW/AB)} \def\abx@cbxid{\abx@date\space v\abx@version\space biblatex citation style (PK/JW/AB)} \def\abx@lbxid{\abx@date\space v\abx@version\space biblatex localization (PK/JW/AB)} @@ -21,19 +21,18 @@ % This is not updated by build script as the control file version % does not necessarily change with the package version. % This is used when writing the .bcf -\def\blx@bcfversion{3.1} +\def\blx@bcfversion{3.2} % This is not updated by build script as the bbl version % does not necessarily change with the package version. % This is used when checking the .bbl -\def\blx@bblversion{2.7} +\def\blx@bblversion{2.8} \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{biblatex} [\abx@date\space v\abx@version\space programmable bibliographies (PK/JW/AB)] %% Dependencies -\RequirePackage{iftex} \RequirePackage{pdftexcmds} \RequirePackage{etoolbox} \RequirePackage{keyval} @@ -88,7 +87,7 @@ cite,citeref,drftcite,footbib,inlinebib,jurabib,mcite,mciteplus, mlbib,multibbl,multibib,natbib,opcit,overcite,splitbib,ucs}% \def\blx@langstrings{}% - % Set up sortlocale defaults + % Set up sortlocale defaults and default language if babel/polyglossia is not loaded \ifdefstring\blx@sortlocale{auto} {\ifdef\bbl@main@language% babel or polyglossia is loaded {\edef\blx@sortlocale{\bbl@main@language}} @@ -187,6 +186,7 @@ \scr@saved@footnotetext,% koma-script 3.x \l@dold@footnotetext,% ledmac \l@doldold@footnotetext,% ledmac + \predefinedfootnotetext,% linguex \@fntORI}% frenchle \iftoggle{blx@tempa}% ams classes {\patchcmd\@footnotetext @@ -496,7 +496,7 @@ \newtoggle{blx@labelnumber} \newtoggle{blx@labeltitle} \newtoggle{blx@labeltitleyear} -\newtoggle{blx@labeldate} +\newtoggle{blx@labeldateparts} \newtoggle{blx@natbib} \newtoggle{blx@mcite} \newtoggle{blx@loadfiles} @@ -505,9 +505,9 @@ \newtoggle{blx@xrefsource} \newtoggle{blx@uniqueprimaryauthor} \newtoggle{blx@uniquetitle} +\newtoggle{blx@uniquebaretitle} +\newtoggle{blx@uniquework} \newtoggle{blx@terseinits} -\newtoggle{blx@giveninits} -\newtoggle{blx@sortgiveninits} \newtoggle{blx@useprefix} \newtoggle{blx@addset} \newtoggle{blx@setonly} @@ -534,16 +534,11 @@ % Special fields which need resolution using the information provided by biber \listadd\abx@rfields{labeltitle} \def\abx@dorfields{% - \dolistcsloop{abx@rfields}% + \dolistloop\abx@rfields% } -% Just in case we ever have non-name lists to instantiate -%\listadd\abx@rlists{} -% \def\abx@dorlists{% -% \dolistcsloop{abx@rlists}% -% } \listadd\abx@rnames{labelname} \def\abx@dornames{% - \dolistcsloop{abx@rnames}% + \dolistloop\abx@rnames% } % Used to track default refcontexts for citations @@ -592,9 +587,9 @@ \ifcsundef{abx@name@legacy@warning@#1}{\blx@warning@noline{Name '#1' deprecated. #2}}{}% \global\csdef{abx@name@legacy@warning@#1}{}}}% -\DeprecateField{prefixnumber}{Please use 'labelprefix' instead} % Biblatex v3.4 +\DeprecateField{prefixnumber}{Please use 'labelprefix' instead} -%% Initialization +%% Initialisation \def\blx@blxinit{% \let\blx@blxinit\relax \blx@initunit} @@ -622,7 +617,6 @@ {}} %% Auxiliary commands - \protected\def\blx@safe@actives{% \let\blx@if@safe@actives\if@safe@actives \let\if@safe@actives\iftrue} @@ -2092,6 +2086,8 @@ {\blx@ifnamesequal@iii#1% \blx@ifnamesequal@ii}} +% 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}% @@ -2766,7 +2762,7 @@ \addthinspace\addnbthinspace\addlowpenspace \addhighpenspace\addlpthinspace\addhpthinspace \adddotspace\addabbrvspace\&\psq\psqq - \bibrangedash\bibdatedash\textendash\textemdash\bibrangessep} + \bibrangedash\bibdaterangesep\bibtimerangesep\textendash\textemdash\bibrangessep} \DeclarePageCommands{\pno\ppno} % *{<code>} @@ -3123,7 +3119,15 @@ {\blx@warn@delimuse{#2}{#1}}}} \newcommand*{\delimcontext}[1]{% - \edef\blx@delimcontext{#1}} + \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} + +\def\blx@delimcontextalias#1{% + \ifcsdef{blx@delimcontextalias@#1} + {\csuse{blx@delimcontextalias@#1}} + {#1}} + +\newcommand*{\DeclareDelimcontextAlias}[2]{% + \csgdef{blx@delimcontextalias@#1}{#2}} % {<init>}{<entrytype>} \protected\def\blx@imc@usedriver#1#2{% @@ -3268,12 +3272,12 @@ \def\iffootnote{\iftoggle{blx@footnote}}% \def\ifuseprefix{\iftoggle{blx@useprefix}}% \def\ifterseinits{\iftoggle{blx@terseinits}}% - \def\iffirstinits{\iftoggle{blx@giveninits}}% legacy name for \ifgiveninits - \def\ifgiveninits{\iftoggle{blx@giveninits}}% \def\ifcrossrefsource{\iftoggle{abx@bool@crossrefsource}}% \def\ifxrefsource{\iftoggle{abx@bool@xrefsource}}% \def\ifsingletitle{\iftoggle{abx@bool@singletitle}}% \def\ifuniquetitle{\iftoggle{abx@bool@uniquetitle}}% + \def\ifuniquebaretitle{\iftoggle{abx@bool@uniquebaretitle}}% + \def\ifuniquework{\iftoggle{abx@bool@uniquework}}% \def\ifuniqueprimaryauthor{\iftoggle{abx@bool@uniqueprimaryauthor}}% \def\ifandothers#1{\iftoggle{abx@bool@more#1}}% \protected\def\pno{\bibstring{page}}% @@ -3379,8 +3383,11 @@ \newrobustcmd*{\MakeSentenceCase}{% \@ifstar\blx@mksc@i\blx@mksc@ii} -% if we have option language=<lang>, then this overrides -% langid field, otherwise, we try than, otherwise try main doc lang +% 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 @@ -3390,9 +3397,13 @@ {\xifinlist\abx@field@langid\blx@cmksc@lang {\blx@mksc@ii} {\@firstofone}} - {\xifinlist\bbl@main@language\blx@cmksc@lang - {\blx@mksc@ii} - {\@firstofone}}}} + {\ifdef\bbl@main@language + {\xifinlist\bbl@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 @@ -4508,6 +4519,7 @@ \do{langdanish}% \do{langdutch}% \do{langenglish}% + \do{langestonian}% \do{langfinnish}% \do{langfrench}% \do{langgerman}% @@ -4531,6 +4543,7 @@ \do{fromdanish}% \do{fromdutch}% \do{fromenglish}% + \do{fromestonian}% \do{fromfinnish}% \do{fromfrench}% \do{fromgerman}% @@ -4564,6 +4577,17 @@ \do{patreqfr}% \do{patrequk}% \do{patrequs}% + \do{commonera}% + \do{beforecommonera}% + \do{annodomini}% + \do{beforechrist}% + \do{circa}% + \do{spring}% + \do{summer}% + \do{autumn}% + \do{winter}% + \do{am}% + \do{pm}% } \newrobustcmd*{\NewBibliographyString}[1]{% @@ -4763,98 +4787,224 @@ % auxiliary macros % {<field base name>} - -\newrobustcmd*{\mkbibrangeshort}{% - \mkbibrangefull{short}} - -\newrobustcmd*{\mkbibrangelong}{% - \mkbibrangefull{long}} - -\newrobustcmd*{\mkbibrangeterse}{% - \mkbibrangetrunc{short}} - -\newrobustcmd*{\mkbibrangecomp}{% - \mkbibrangetrunc{long}} - -\newrobustcmd*{\mkbibrangeshortextra}{% - \mkbibrangefullextra{short}} - -\newrobustcmd*{\mkbibrangelongextra}{% - \mkbibrangefullextra{long}} - -\newrobustcmd*{\mkbibrangeterseextra}{% - \mkbibrangetruncextra{short}} - -\newrobustcmd*{\mkbibrangecompextra}{% - \mkbibrangetruncextra{long}} - -% {<short|long>}{<basename>} - -\newrobustcmd*{\mkbibrangefull}[2]{% +\newrobustcmd*{\mkdaterangeshort}{% + \mkdaterangefull{short}} + +\newrobustcmd*{\mkdaterangelong}{% + \mkdaterangefull{long}} + +\newrobustcmd*{\mkdaterangeterse}{% + \mkdaterangetrunc{short}} + +\newrobustcmd*{\mkdaterangecomp}{% + \mkdaterangetrunc{long}} + +\newrobustcmd*{\mkdaterangeshortextra}{% + \mkdaterangefullextra{short}} + +\newrobustcmd*{\mkdaterangelongextra}{% + \mkdaterangefullextra{long}} + +\newrobustcmd*{\mkdaterangeterseextra}{% + \mkdaterangetruncextra{short}} + +\newrobustcmd*{\mkdaterangecompextra}{% + \mkdaterangetruncextra{long}} + +\def\blx@metadateinfo#1{% + \letcs\ifdateera{if#1dateera}% + \letcs\ifenddateera{if#1enddateera}% + \letcs\ifdatecirca{if#1datecirca}% + \letcs\ifenddatecirca{if#1enddatecirca}% + \letcs\ifdatejulian{if#1datejulian}% + \letcs\ifenddatejulian{if#1enddatejulian}% + \letcs\ifdateuncertain{if#1dateuncertain}% + \letcs\ifenddateuncertain{if#1enddateuncertain}} + +\expandafter\newrobustcmd\expandafter*\csname mktimerange24h\endcsname{% + \mktimerange{24h}} + +\expandafter\newrobustcmd\expandafter*\csname mktimerange12h\endcsname{% + \mktimerange{12h}} + +\expandafter\newrobustcmd\expandafter*\csname mktimerange24hcomp\endcsname[1]{% + \iffieldundef{#1hour}{} + {\ifboolexpr{test {\iffieldundef{#1endhour}} + or + test {\iffieldequalstr{#1endhour}{}}} + {\mktimerange{24h}{#1}} + {\iffieldsequal{#1hour}{#1endhour} + % 14:xx:xx 14:xx:xx + {\iffieldsequal{#1minute}{#1endminute} + % 14:13:xx 14:13:xx + {\toggletrue{blx@seconds}% + \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}{}{}% + \bibtimerangesep + \csuse{mkbibtime24h}{}{#1endminute}{}{}}}} + % 14:xx:xx 15:xx:xx + {\mktimerange{24h}{#1}}}}} + +% {<24h|24hcomp|12h>}{<datetype>} +\newrobustcmd*{\mktimerange}[2]{% + \iffieldundef{#2hour}{} + {\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}}}}}} + +% {<datetype>}{''|end} +\newrobustcmd*{\blx@timepre}[2]{% + \iftoggle{blx@timezones}{} + {\blx@imc@clearfield{#1#2timezone}}% + \iftoggle{blx@seconds}{} + {\blx@imc@clearfield{#1#2second}}} + +% {<short|long>}{<datetype>} +\newrobustcmd*{\mkdaterangefull}[2]{% + \blx@metadateinfo{#2}% \iffieldundef{#2year} {} - {\printtext[#2date]{% - \csuse{mkbibdate#1}{#2year}{#2month}{#2day}% + {\datecircaprint + \printtext[#2date]{% + % Such a season component can only come from an EDTF 5.1.5 season which replaces + % a normal month so if it exists, we know that a normal date print is ruled out + \iffieldundef{#2season} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}% + % Optionally print the time after the date + \blx@printtime{#2}{}} + {\csuse{mkbibseasondate#1}{#2year}{#2season}}% + \dateuncertainprint + \dateeraprint{#2year}% \iffieldundef{#2endyear} {} {\iffieldequalstr{#2endyear}{} - {\mbox{\bibdatedash}} - {\bibdatedash - \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}} - -\newrobustcmd*{\mkbibrangetrunc}[2]{% + {\mbox{\bibdaterangesep}} + {\bibdaterangesep + \enddatecircaprint + \iffieldundef{#2season} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}% + % Optionally print the time after the date + \blx@printtime{#2}{end}} + {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}% + \enddateuncertainprint + \dateeraprint{#2endyear}}}}}} + +\newrobustcmd*{\mkdaterangetrunc}[2]{% + \blx@metadateinfo{#2}% \iffieldundef{#2year} {} - {\printtext[#2date]{% - \iffieldsequal{#2year}{#2endyear} - {\iffieldsequal{#2month}{#2endmonth} - {\csuse{mkbibdate#1}{}{}{#2day}} - {\csuse{mkbibdate#1}{}{#2month}{#2day}}} - {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}% + {\datecircaprint + \printtext[#2date]{% + % Such a season component can only come from an EDTF 5.1.5 season which replaces + % a normal month so if it exists, we know that a normal date print is ruled out + \iffieldundef{#2season} + {\iffieldsequal{#2year}{#2endyear} + {\iffieldsequal{#2month}{#2endmonth} + {\csuse{mkbibdate#1}{}{}{#2day}} + {\csuse{mkbibdate#1}{}{#2month}{#2day}}} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}% + \iffieldsequal{#2dateera}{#2enddateera}{} + {\dateeraprint{#2year}}}} + {\iffieldsequal{#2year}{#2endyear} + {\csuse{mkbibseasondate#1}{}{#2season}} + {\csuse{mkbibseasondate#1}{#2year}{#2season}% + \iffieldsequal{#2dateera}{#2enddateera}{} + {\dateeraprint{#2year}}}}% + \dateuncertainprint \iffieldundef{#2endyear} {} {\iffieldequalstr{#2endyear}{} - {\mbox{\bibdatedash}} - {\bibdatedash - \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}} - -\newrobustcmd*{\mkbibrangefullextra}[2]{% + {\mbox{\bibdaterangesep}} + {\bibdaterangesep + \enddatecircaprint + \iffieldundef{#2season} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}} + {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}% + \enddateuncertainprint + \dateeraprint{#2endyear}}}}}} + +\newrobustcmd*{\mkdaterangefullextra}[2]{% + \blx@metadateinfo{#2}% \iffieldundef{#2year} {} - {\printtext[#2date]{% + {\datecircaprint + \printtext[#2date]{% \printtext{% - \csuse{mkbibdate#1}{#2year}{#2month}{#2day}}% + % Such a season component can only come from an EDTF 5.1.5 season which replaces + % a normal month so if it exists, we know that a normal date print is ruled out + \iffieldundef{#2season} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}% + % Optionally print the time after the date + \blx@printtime{#2}{}} + {\csuse{mkbibseasondate#1}{#2year}{#2season}}% + \dateuncertainprint + \dateeraprint{#2year}% \iffieldundef{#2endyear} {\printfield{extrayear}} {\iffieldequalstr{#2endyear}{} {\printfield{extrayear}% - \printtext{\mbox{\bibdatedash}}} + \printtext{\mbox{\bibdaterangesep}}} {\printtext{% - \bibdatedash - \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}% - \printfield{extrayear}}}}}}} - -\newrobustcmd*{\mkbibrangetruncextra}[2]{% + \bibdaterangesep + \enddatecircaprint + \iffieldundef{#2season} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}% + % Optionally print the time after the date + \blx@printtime{#2}{end}} + {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}}% + \printfield{extrayear}% + \enddateuncertainprint + \dateeraprint{#2endyear}}}}}}} + +\newrobustcmd*{\mkdaterangetruncextra}[2]{% + \blx@metadateinfo{#2}% \iffieldundef{#2year} {} - {\printtext[#2date]{% + {\datecircaprint + \printtext[#2date]{% \printtext{% - \iffieldsequal{#2year}{#2endyear} - {\iffieldsequal{#2month}{#2endmonth} - {\csuse{mkbibdate#1}{}{}{#2day}} - {\csuse{mkbibdate#1}{}{#2month}{#2day}}} - {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}}% + % Such a season component can only come from an EDTF 5.1.5 season which replaces + % a normal month so if it exists, we know that a normal date print is ruled out + \iffieldundef{#2season} + {\iffieldsequal{#2year}{#2endyear} + {\iffieldsequal{#2month}{#2endmonth} + {\csuse{mkbibdate#1}{}{}{#2day}} + {\csuse{mkbibdate#1}{}{#2month}{#2day}}} + {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}% + \iffieldsequal{#2dateera}{#2enddateera}{} + {\dateeraprint{#2year}}}} + {\iffieldsequal{#2year}{#2endyear} + {\csuse{mkbibseasondate#1}{}{#2season}} + {\csuse{mkbibseasondate#1}{#2year}{#2season} + \iffieldsequal{#2dateera}{#2enddateera}{} + {\dateeraprint{#2year}}}}% + \dateuncertainprint \iffieldundef{#2endyear} {\printfield{extrayear}} {\iffieldequalstr{#2endyear}{} {\printfield{extrayear}% - \printtext{\mbox{\bibdatedash}}} + \printtext{\mbox{\bibdaterangesep}}} {\printtext{% - \bibdatedash - \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}% - \printfield{extrayear}}}}}}} - -\newrobustcmd*{\mkbibrangeyear}[1]{% + \bibdaterangesep + \enddatecircaprint + \iffieldundef{#2season} + {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}} + {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}}% + \printfield{extrayear}% + \enddateuncertainprint + \dateeraprint{#2endyear}}}}}}} + +\newrobustcmd*{\mkdaterangeyear}[1]{% \blx@imc@clearfield{#1month}% \blx@imc@clearfield{#1day}% \blx@imc@clearfield{#1endmonth}% @@ -4862,9 +5012,77 @@ \iffieldsequal{#1year}{#1endyear} {\blx@imc@clearfield{#1endyear}} {}% - \mkbibrangefull{short}{#1}} + \mkdaterangefull{short}{#1}} -\newrobustcmd*{\mkbibrangeyearextra}[1]{% +% {<datetype>} +\newrobustcmd*{\mkdaterangeymd}[1]{% + \blx@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\datecircaprint + \printtext[#1date]{% + % Such a season component can only come from an EDTF 5.1.5 season which replaces + % a normal month so if it exists, we know that a normal date print is ruled out + \iffieldundef{#1season} + {\blx@ymddate{#1}{}% + % Optionally print the time after the date + \blx@printtime{#1}{}} + {\csuse{mkbibseasondateshort}{#1year}{#1season}}% + \dateuncertainprint + \dateeraprint{#1year}% + \iffieldundef{#1endyear} + {} + {\iffieldequalstr{#1endyear}{} + {\mbox{\bibdaterangesep}} + {\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}}}}}} + +% {<datetype>} +\newrobustcmd*{\mkdaterangeymdextra}[1]{% + \blx@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\datecircaprint + \printtext[#1date]{% + % Such a season component can only come from an EDTF 5.1.5 season which replaces + % a normal month so if it exists, we know that a normal date print is ruled out + \iffieldundef{#1season} + {\blx@ymddate[extrayear]{#1}{}% + % Optionally print the time after the date + \blx@printtime{#1}{}} + {\csuse{mkbibseasondateshort}{#1year}{#1season}}% + \dateuncertainprint + \dateeraprint{#1year}% + \iffieldundef{#1endyear} + {} + {\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}}}% + \enddateuncertainprint + \dateeraprint{#1endyear}}}}}} + +% [extrayear]{<datetype>}{''|end} +\newrobustcmd*{\blx@ymddate}[3][]{% + \dateeraprintpre{#2#3year}% + \mkyearzeros{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\bibdatesep\mkmonthzeros{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\bibdatesep\mkdayzeros{\thefield{#2#3day}}}} + +\newrobustcmd*{\mkdaterangeyearextra}[1]{% \blx@imc@clearfield{#1month}% \blx@imc@clearfield{#1day}% \blx@imc@clearfield{#1endmonth}% @@ -4872,44 +5090,139 @@ \iffieldsequal{#1year}{#1endyear} {\blx@imc@clearfield{#1endyear}} {}% - \mkbibrangefullextra{short}{#1}} + \mkdaterangefullextra{short}{#1}} + +% {<datetype>}{'' | end} +\newrobustcmd*{\blx@printtime}[2]{% + \ifboolexpr{% + togl {blx@#1dateusetime} + and + not test {\iffieldundef{#1#2hour}}} + {\blx@timepre{#1}{#2}% + \printtext{\bibdatetimesep}% + \printtext[#1time]{\csuse{mkbibtime\csuse{blx@timeformat@#1time}}{#1#2hour}{#1#2minute}{#1#2second}{#1#2timezone}}} + {}} -\expandafter\newrobustcmd -\expandafter*\csname mkbibrangeiso8601\endcsname[1]{% +\newrobustcmd*{\mkdaterangeedtf}[1]{% + \blx@metadateinfo{#1}% + \def\bibdatetimesep{T}% \iffieldundef{#1year} {} {\printtext[#1date]{% - \blx@isodate{#1year}{#1month}{#1day}% + \blx@edtfdate{#1}{}% + \ifboolexpr{% + togl {blx@#1dateusetime} + and + not test {\iffieldundef{#1hour}}} + {\printtext{\bibdatetimesep}% + \blx@edtftime{#1}{}} + {}% + \dateuncertainprint + \datecircaprintedtf \iffieldundef{#1endyear} {} - {\addslash\blx@isodate{#1endyear}{#1endmonth}{#1endday}}}}} + {\addslash + \blx@edtfdate{#1}{end}% + \ifboolexpr{% + togl {blx@#1dateusetime} + and + not test {\iffieldundef{#1endhour}}} + {\printtext{\bibdatetimesep}% + \blx@edtftime{#1}{end}} + {}% + \enddateuncertainprint + \enddatecircaprintedtf}}}} +\cslet{mkdaterangeiso8601}\mkdaterangeedtf% Legacy option support -\expandafter\newrobustcmd -\expandafter*\csname mkbibrangeiso8601extra\endcsname[1]{% +\newrobustcmd*{\mkdaterangeedtfextra}[1]{% + \blx@metadateinfo{#1}% + \def\bibdatetimesep{T}% \iffieldundef{#1year} {} {\printtext[#1date]{% - \blx@isodate[extrayear]{#1year}{#1month}{#1day}% + \blx@edtfdate[extrayear]{#1}{}% + \ifboolexpr{% + togl {blx@#1dateusetime} + and + not test {\iffieldundef{#1hour}}} + {\printtext{\bibdatetimesep}% + \blx@edtftime{#1}{}} + {}% + \dateuncertainprint + \datecircaprintedtf \iffieldundef{#1endyear} {} - {\addslash\blx@isodate{#1endyear}{#1endmonth}{#1endday}}}}} - -\newrobustcmd*{\blx@isodate}[4][]{% - \thefield{#2}\ifblank{#1}{}{\printfield{#1}}% - \iffieldundef{#3}{}{\mbox{-}\thefield{#3}}% - \iffieldundef{#4}{}{\mbox{-}\thefield{#4}}} + {\addslash + \blx@edtfdate{#1}{end}}% + \ifboolexpr{% + togl {blx@#1dateusetime} + and + not test {\iffieldundef{#1endhour}}} + {\printtext{\bibdatetimesep}% + \blx@edtftime{#1}{end}} + {}% + \enddateuncertainprint + \enddatecircaprintedtf}}} +\cslet{mkdaterangeiso8601extra}\mkdaterangeedtfextra% Legacy option support + +% [extrayear]{<datetype>}{''|end} +\newrobustcmd*{\blx@edtfdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + % Such a season component can only come from an EDTF 5.1.5 season which replaces + % a normal month so if it exists, we know that a normal date print is ruled out + \iffieldundef{#2#3season} + {\iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + {\hyphen\blx@seasonmap{\thefield{#2#3season}}}} + +\def\blx@seasonmap#1{% + \blx@xifstrcmp{#1}{spring}{21} + {\blx@xifstrcmp{#1}{summer}{22} + {\blx@xifstrcmp{#1}{autumn}{23} + {\blx@xifstrcmp{#1}{winter}{24}{}}}}} + +\newrobustcmd*{\blx@edtftime}[2]{% + \blx@imc@forcezerosmdt{\thefield{#1#2hour}}% + :\blx@imc@forcezerosmdt{\thefield{#1#2minute}}% + :\blx@imc@forcezerosmdt{\thefield{#1#2second}}% + \iftoggle{blx@timezones} + {\mkbibtimezone{\thefield{#1#2timezone}}} + {}} -\newrobustcmd*{\mkbibdatelong}[3]{} -\newrobustcmd*{\mkbibdateshort}[3]{} +% times +\newrobustcmd*{\bibtimesep}{:} +\newrobustcmd*{\bibtimerangesep}{\textendash} +\newrobustcmd*{\bibutctimezone}{Z} +\newrobustcmd*{\bibtimezonesep}{} +\newrobustcmd*{\bibtzminsep}{\bibtimesep} +% dates +\newrobustcmd*{\bibdateuncertain}{?} +\newrobustcmd*{\bibdateeraprefix}{\textminus} +\newrobustcmd*{\bibdateeraendprefix}{\,\bibdateeraprefix} +\newrobustcmd*{\bibdatesep}{\hyphen} +\newrobustcmd*{\bibdaterangesep}{\bibrangedash} +\newrobustcmd*{\bibdatedash}{\bibrangedash}%LEGACY(<3.5) +% date+times +\newrobustcmd*{\bibdatetimesep}{\space} +% ranges \newrobustcmd*{\bibrangedash}{\textendash} \newrobustcmd*{\bibrangessep}{,\space} -\newrobustcmd*{\bibdatedash}{\bibrangedash} +% formatters +\newrobustcmd*{\mkbibtimezone}[1]{\blx@xifstrcmp{#1}{UTC}{\bibutctimezone}{#1}} +\newrobustcmd*{\mkbibdatelong}[3]{} +\newrobustcmd*{\mkbibdateshort}[3]{} +\newrobustcmd*{\mkbibseasondateshort}[2]{} +\newrobustcmd*{\mkbibseasondatelong}[2]{} +\expandafter\newrobustcmd\expandafter*\csname mkbibtime24h\endcsname[4]{} +\expandafter\newrobustcmd\expandafter*\csname mkbibtime12h\endcsname[4]{} \newrobustcmd*{\finalandcomma}{} \newrobustcmd*{\finalandsemicolon}{} \newrobustcmd*{\mkbibordinal}[1]{#1} \newrobustcmd*{\mkbibmascord}{\mkbibordinal} \newrobustcmd*{\mkbibfemord}{\mkbibordinal} \newrobustcmd*{\mkbibneutord}{\mkbibordinal} +\newrobustcmd*{\mkbibseason}[1]{\abx@bibseason{#1}} \newrobustcmd*{\mkbibmonth}[1]{% \ifcase0#1\relax \blx@warning@entry{Month out of range or not an integer}% @@ -4929,10 +5242,31 @@ \blx@warning@entry{Month out of range}#1% \fi} -\protected\def\blx@imc@printdatelabel{} -\protected\def\blx@imc@printdateextralabel{} - -\let\blx@imc@mkdatezeros\@firstofone +% strip leading zeros and prepend zero for month/day/timeparts +% Allow for non numeric labelyear values +\protected\def\blx@imc@forcezerosmdt#1{% + \IfInteger{#1} + {\ifnumless{#1}{10} + {0\the\numexpr(#1)\relax} + {#1}} + {#1}} + +% strip leading zeros and prepend zero(s) for year +% Allow for non numeric labelyear values +\protected\def\blx@imc@forcezerosy#1{% + \IfInteger{#1} + {\ifnumless{#1}{10}% 1-digit year + {000\the\numexpr(#1)\relax} + {\ifnumless{#1}{100}% 2-digit year + {00\the\numexpr(#1)\relax} + {\ifnumless{#1}{1000}% 3-digit year + {0\the\numexpr(#1)\relax} + {#1}}}} + {#1}} + +\let\blx@imc@mkyearzeros\blx@imc@forcezerosy +\let\blx@imc@mkmonthzeros\blx@imc@forcezerosmdt +\let\blx@imc@mkdayzeros\blx@imc@forcezerosmdt \protected\def\blx@imc@stripzeros#1{% \begingroup \setbox\@tempboxa=\hbox\bgroup @@ -4949,7 +5283,28 @@ \@tempcnta#1\relax} {\egroup#1}} -\blx@regimcs{\printdatelabel \printdateextralabel \printorigdate \stripzeros \mkdatezeros} +\let\blx@imc@printlabeldate\@empty +\let\blx@imc@printlabeltime\@empty +\let\blx@imc@printlabeldateextra\@empty + +\blx@regimcs{\printlabeldate \printlabeltime \printlabeldateextra \stripzeros \forcezerosy \forcezerosmdt \mkyearzeros \mkmonthzeros \mkdayzeros \mktimezeros} + +\protected\def\mkdatezeros{% + \blx@warning@noline{% + '\string\mkdatezeros' is deprecated, please use '\string\mkyearzeros',\MessageBreak + '\string\mkmonthzeros' or '\string\mkdayzeros' as appropriate. \MessageBreak + falling back to '\string\mkmonthzeros'}% + \mkmonthzeros} + +\protected\def\printdatelabel{% + \blx@warning@noline{% + '\string\printdatelabel' is deprecated, please use '\string\printlabeldate'}% + \blx@imc@printlabeldate} + +\protected\def\printdatelabelextra{% + \blx@warning@noline{% + '\string\printdatelabelextra' is deprecated, please use '\string\printlabeldateextra'}% + \blx@imc@printlabeldateextra} % User macro for retrieving currrent language \def\currentlang{\blx@languagename} @@ -5143,21 +5498,20 @@ %% Biber equivalents to bibtex data interface -\def\abx@doentrytypes{\dolistcsloop{blx@datamodel@entrytypes}} +\def\abx@doentrytypes{\dolistloop\blx@datamodel@entrytypes} % fields which can be used as labels - we auto-create some macros for these -\def\abx@dolabelfields{\dolistcsloop{blx@datamodel@labelfields}} +\def\abx@dolabelfields{\dolistloop\blx@datamodel@labelfields} -\def\abx@donames{\dolistcsloop{blx@datamodel@names}} +\def\abx@donames{\dolistloop\blx@datamodel@names} +\def\abx@donameparts{\expandafter\docsvlist\expandafter{\blx@datamodel@constant@nameparts}} -\def\abx@dofields{\dolistcsloop{blx@datamodel@fields}} +\def\abx@dofields{\dolistloop\blx@datamodel@fields} \def\abx@dolists{% - \dolistcsloop{blx@datamodel@lists}% + \dolistloop\blx@datamodel@lists% \do{pageref}} -\def\abx@dodates{\dolistcsloop{blx@datamodel@dates}} - % Used to pass regexps to .bcf \def\regexp#1{\expandafter\zap@space\detokenize{#1} \@empty} @@ -5239,6 +5593,22 @@ {} {\listcsgadd{#2@#1}{#3}}} +% date, eventdate, urldate etc. +\def\abx@dodates{\dolistloop\blx@datamodel@dates} +% year, endyear, month, endmonth etc. +\def\abx@dodateparts{\expandafter\docsvlist\expandafter{\blx@dateparts}} + +% '', event, url, orig etc. +\def\do#1{% + \StrCut{#1}{date}\blx@datetype\blx@tempnull + \listxadd\blx@datetypes{\blx@datetype}} +\abx@dodates +% main date field has an empty prefix (''date) which can't be added to a list +% and so do it explicity +% This is one of the few (only?) hard-coded datamodel assumptions but it is +% very unlikely that anyone would *remove* the main date field in a custom application ... +\def\abx@dodatetypes{\do{}\dolistloop\blx@datetypes} + % per-entry inheritance blocking option for biber \blx@collectopts{string}{blx@entryopts}{noinherit} @@ -5326,12 +5696,69 @@ {\define@key{blx@opt@ent}{#1}[#2]{#3}}} {\blx@err@optdef{#1}}} -% These are internal fields which are not part of the data model but +% Sanity check on date field names - they *must* end in 'date' to make things easier/possible later +\def\do#1{% + \IfEndWith{#1}{date} + {} + {\blx@error + {Invalid date field name '#1'} + {Date fields in the datemodel must end in the string 'date' but '#1' doesn't}}} +\abx@dodates + +% date meta-information option fallbacks +\def\do#1{% + \cslet{#1datecircaprint}\@empty + \cslet{#1enddatecircaprint}\@empty + \cslet{#1datecircaprintedtf}\@empty + \cslet{#1enddatecircaprintedtf}\@empty + \cslet{#1dateuncertainprint}\@empty + \cslet{#1enddateuncertainprint}\@empty + \cslet{#1dateeraprint}\@gobble + \cslet{#1dateeraprintpre}\@gobble + \csdef{if#1dateera}##1{\@secondoftwo}% + \csdef{if#1enddateera}##1{\@secondoftwo}% + \cslet{if#1datecirca}\@secondoftwo + \cslet{if#1enddatecirca}\@secondoftwo + \cslet{if#1datejulian}\@secondoftwo + \cslet{if#1enddatejulian}\@secondoftwo + \cslet{if#1dateuncertain}\@secondoftwo + \cslet{if#1enddateuncertain}\@secondoftwo} +\abx@dodatetypes +\do{labeldate} + +% These are internal fields/booleans which are not part of the data model but % which need to be dealt with along with data model fields in places +\def\do#1{% + \listxadd\blx@datemetafields{#1dateera}% + \listxadd\blx@datemetafields{#1enddateera}% + \listxadd\blx@datemetafields{#1dateunspecified}} +\abx@dodatetypes + +\def\do#1{% + \listxadd\blx@datemetabooleans{#1datecirca}% + \listxadd\blx@datemetabooleans{#1enddatecirca}% + \listxadd\blx@datemetabooleans{#1datejulian}% + \listxadd\blx@datemetabooleans{#1enddatejulian}% + \listxadd\blx@datemetabooleans{#1dateuncertain}% + \listxadd\blx@datemetabooleans{#1enddateuncertain}} +\abx@dodatetypes + +\def\do#1{% + \listxadd\blx@namepartmetafields{#1namehash}% + \listxadd\blx@namepartmetafields{#1fullhash}} +\abx@donameparts + +\def\do#1{% + \listxadd\blx@labeldatepartfields{label#1}} +\abx@dodateparts + \def\abx@dointernalfields{% \do{childentrykey}% \do{clonesourcekey}% - \do{datelabelsource}% + \do{labeldate}% + \do{labeldatesource}% + \do{labeldateera}% + \do{labelenddateera}% \do{entrykey}% \do{entryset}% \do{entrysetcount}% @@ -5343,59 +5770,223 @@ \do{fullhash}% \do{labelalpha}% \do{labelnumber}% + \do{labelprefix}% \do{labeltitleyear}% - \do{labeldate}% \do{localnumber}% \do{namehash}% - \do{labelprefix}% + \do{options}% \do{sortinit}% - \do{sortinithash}} + \do{sortinithash}% + \forlistloop{\do}\blx@datemetafields + \forlistloop{\do}\blx@namepartmetafields + \forlistloop{\do}\blx@labeldatepartfields} \def\abx@dobooleans{% \do{crossrefsource}% \do{xrefsource}% \do{singletitle}% \do{uniquetitle}% - \do{uniqueprimaryauthor}} + \do{uniquebaretitle}% + \do{uniquework}% + \do{uniqueprimaryauthor}% + \forlistloop{\do}\blx@datemetabooleans} % Date datatype fields \def\do#1{% - \protected\csdef{blx@imc@print#1}{}% - \protected\csdef{blx@imc@print#1extra}{}} -\abx@dodates + \protected\csdef{blx@imc@print#1date}{}% + \protected\csdef{blx@imc@print#1dateextra}{}% + \protected\csdef{blx@imc@print#1time}{}} +\abx@dodatetypes % \blx@regimcs doesn't work in do-lists nicely so use internal macro it calls \def\do#1{% - \xappto\blx@blxinit{\csletcs{print#1}{blx@imc@print#1}}% - \xappto\blx@blxinit{\csletcs{print#1extra}{blx@imc@print#1extra}}} -\abx@dodates + \xappto\blx@blxinit{\csletcs{print#1date}{blx@imc@print#1date}}% + \xappto\blx@blxinit{\csletcs{print#1time}{blx@imc@print#1time}}% + \xappto\blx@blxinit{\csletcs{print#1dateextra}{blx@imc@print#1dateextra}}} +\abx@dodatetypes + +% Set up circa, julian and uncertain date internals +\def\blx@imc@ifdatemeta@i#1#2{% + \appto\blx@blxinit{% + \csdef{if#1date#2}{\iftoggle{abx@bool@#1date#2}}% + \csdef{if#1enddate#2}{\iftoggle{abx@bool@#1enddate#2}}% + \appto\blx@TE@hook{% + \csdef{if#1date#2}{\blx@TE{\iftoggle{abx@bool@#1date#2}}}% + \csdef{if#1enddate#2}{\blx@TE{\iftoggle{abx@bool@#1enddate#2}}}}}} + +% Set up date era internals +\def\blx@imc@ifdatemeta@ii#1{% + \appto\blx@blxinit{% + \csdef{if#1dateera}##1{\ifcsstring{abx@field@#1dateera}{##1}}% + \csdef{if#1enddateera}##1{\ifcsstring{abx@field@#1enddateera}{##1}}% + \appto\blx@TE@hook{% + \csdef{if#1dateera}##1{\blx@TE{\ifcsstring{abx@field@#1dateera}{##1}}}% + \csdef{if#1enddateera}##1{\blx@TE{\ifcsstring{abx@field@#1enddateera}{##1}}}}}} + +% Create date meta information boolean tests +\def\do#1{% + \blx@imc@ifdatemeta@i{#1}{circa}% + \blx@imc@ifdatemeta@i{#1}{julian}% + \blx@imc@ifdatemeta@i{#1}{uncertain}} +\abx@dodatetypes + +% Create date meta information field tests +\def\do#1{% + \blx@imc@ifdatemeta@ii{#1}} +\abx@dodatetypes + +% Resolve date meta information tests and print routines for labeldate +% We have to test here, in each \def, whether the labeldatesource +% is a real date field or not. If it's not, then we don't want to use +% any of the meta-information and so make the conditionals always return false +% This can't be neater by testing for the \abx@field@labeldatesource value +% earlier because its not available until the tests are in scope. +\appto\blx@blxinit{% + \ifdefstring\blx@dateera{astronomical} + {\protected\def\dateeraprintpre#1{% + \iffieldnum{#1} + {\begingroup + \let\blx@tempa\@empty + \IfEndWith{#1}{endyear} + {\StrCut{#1}{endyear}\blx@datetype\blx@tempnull + \def\blx@tempa{end}} + {\StrCut{#1}{year}\blx@datetype\blx@tempnull}% + \csuse{if\blx@datetype\blx@tempa dateera}{bce} + {\ifnumless{0-\thefield{#1}}{0} + {\printtext{\csuse{bibdateera\blx@tempa prefix}}} + {}} + {}% + \endgroup} + {}}} + {\protected\def\dateeraprint#1{% + \iffieldnum{#1} + {\begingroup + \let\blx@tempa\@empty + \IfEndWith{#1}{endyear} + {\StrCut{#1}{endyear}\blx@datetype\blx@tempnull + \def\blx@tempa{end}} + {\StrCut{#1}{year}\blx@datetype\blx@tempnull}% + \csuse{if\blx@datetype\blx@tempa dateera}{bce} + {\ifnum\numexpr0-\thefield{#1}\relax<\blx@dateeraauto + \printtext{\printdelim{dateeradelim}\bibstring{\blx@dateera@bce}}\relax + \fi} + {\ifnumless{\thefield{#1}}\blx@dateeraauto + {\printtext{\printdelim{dateeradelim}\bibstring{\blx@dateera@ce}}} + {}}% + \endgroup} + {}}}% + \iftoggle{blx@labeldateparts} + {\def\iflabeldateera#1{% start era + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\ifcsstring{abx@field@\abx@field@labeldatesource dateera}{#1}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabeldateera#1{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\ifcsstring{abx@field@\abx@field@labeldatesource dateera}{#1}}} + {\@secondoftwo}}}% + % end era + \def\iflabelenddateera#1{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\ifcsstring{abx@field@\abx@field@labeldatesource enddateera}{#1}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabelenddateera#1{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\ifcsstring{abx@field@\abx@field@labeldatesource enddateera}{#1}}} + {\@secondoftwo}}}% + % start circa + \def\iflabeldatecirca{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\iftoggle{abx@bool@\abx@field@labeldatesource datecirca}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabeldatecirca{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\iftoggle{abx@bool@\abx@field@labeldatesource datecirca}}} + {\@secondoftwo}}}% + % end circa + \def\iflabelenddatecirca{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\iftoggle{abx@bool@\abx@field@labeldatesource enddatecirca}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabelenddatecirca{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\iftoggle{abx@bool@\abx@field@labeldatesource enddatecirca}}} + {\@secondoftwo}}}% + % start julian + \def\iflabeldatejulian{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\iftoggle{abx@bool@\abx@field@labeldatesource datejulian}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabeldatejulian{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\iftoggle{abx@bool@\abx@field@labeldatesource datejulian}}} + {\@secondoftwo}}}% + % end julian + \def\iflabelenddatejulian{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\iftoggle{abx@bool@\abx@field@labeldatesource enddatejulian}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabelenddatejulian{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\iftoggle{abx@bool@\abx@field@labeldatesource enddatejulian}}} + {\@secondoftwo}}}% + % start uncertain + \def\iflabeldateuncertain{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\iftoggle{abx@bool@\abx@field@labeldatesource dateuncertain}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabeldateuncertain{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\iftoggle{abx@bool@\abx@field@labeldatesource dateuncertain}}} + {\@secondoftwo}}}% + % end uncertain + \def\iflabelenddateuncertain{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\iftoggle{abx@bool@\abx@field@labeldatesource enddateuncertain}} + {\@secondoftwo}}% + \appto\blx@TE@hook{\def\iflabelenddateuncertain{% + \xifinlist{\abx@field@labeldatesource date}\blx@datamodel@dates + {\blx@TE{\iftoggle{abx@bool@\abx@field@labeldatesource enddateuncertain}}} + {\@secondoftwo}}}}% + {}} % Name toggles like \ifauthor etc. need to be dynamically created for all % name datatypes in the data model and we have to do this here after the % datamodel is available. Need to be careful about expansions here as these % go into hooks to be executed later -% Define name toggles -\def\do#1{\newtoggle{blx@use#1}\toggletrue{blx@use#1}} -\abx@donames - -% Define name toggle checking macros -\let\blx@nametoggles\@empty -\def\do#1{\gappto\blx@nametoggles{\expandafter\def\csname ifuse#1\endcsname{\iftoggle{blx@use#1}}}} -\abx@donames -\eappto\blx@blxinit{\expandafter\expandonce\noexpand\blx@nametoggles} - -% Define ifthen interface name toggle checking macros -\let\blx@nametogglesit\@empty -\def\do#1{\gappto\blx@nametogglesit{\expandafter\def\csname ifuse#1\endcsname{\blx@TE{\iftoggle{blx@use#1}}}}} -\abx@donames -\expandafter\def\expandafter\blx@nametogglesite\expandafter{\expandonce\blx@nametogglesit} -\appto\blx@blxinit{\appto\blx@TE@hook{\blx@nametogglesite}} +% toggle to say if we have set any <name>inits to true. Used for conflict +% tests with uniquename settings (see \AtEndPreamble below) +\newtoggle{abx@bool@xinits} +% define <name>inits options and tests (terseinits is global for all initials) +\def\do#1{% + \newtoggle{abx@bool@#1inits}% + \appto\blx@blxinit{% + \csdef{if#1inits}{\iftoggle{abx@bool@#1inits}}% + \appto\blx@TE@hook{% + \csdef{if#1inits}{\blx@TE{\iftoggle{abx@bool@#1inits}}}}}% + \DeclareBibliographyOption[boolean]{#1inits}[true]{% + \toggletrue{abx@bool@#1inits}% + \toggletrue{abx@bool@xinits}}} +\abx@donameparts + +%LEGACY(<3.3) legacy name for \ifgiveninits which is autogenerated now +\def\iffirstinits{ + \blx@warning@noline{% + '\string\iffirstinits' is deprecated, use '\string\ifgiveninits'}% + \iftoggle{abx@bool@giveninits}} -% Define \ifuse<name> options scope for biber -\def\do#1{\blx@collectopts{boolean}{blx@globalopts}{use#1}% - \blx@collectopts{boolean}{blx@typeopts}{use#1}% - \blx@collectopts{boolean}{blx@entryopts}{use#1}} +\def\do#1{% + % Define use<name> options scope for biber + \blx@collectopts{boolean}{blx@globalopts}{use#1}% + \blx@collectopts{boolean}{blx@typeopts}{use#1}% + \blx@collectopts{boolean}{blx@entryopts}{use#1}% + % Define name toggles + \newtoggle{blx@use#1}\toggletrue{blx@use#1}% + % Define tests + \appto\blx@blxinit{% + \csdef{ifuse#1}{\iftoggle{blx@use#1}}% + \appto\blx@TE@hook{% + \csdef{ifuse#1}{\blx@TE{\iftoggle{blx@use#1}}}}}} \abx@donames %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -5434,7 +6025,6 @@ \abx@dolists \let\do\blx@imc@clearfield \abx@dofields - \do{options}\do{labelyear}\do{labelmonth}\do{labelday}\do{datelabelsource}% \abx@dointernalfields \def\do##1{\togglefalse{abx@bool@##1}}% \abx@dobooleans @@ -5462,7 +6052,6 @@ \abx@dofields \let\do\blx@saverelfield \dolistloop\abx@dorelfields - \do{options}\do{labelyear}\do{labelmonth}\do{labelday}\do{datelabelsource}% \abx@dointernalfields \let\do\blx@savebool \abx@dobooleans @@ -5649,6 +6238,7 @@ \ifdefvoid\currentfield{}{\let\blx@tempa\currentfield}% \ifdefvoid\currentlist{}{\let\blx@tempa\currentlist}% \ifdefvoid\currentname{}{\let\blx@tempa\currentname}% + \blx@resolve@annotation@label{\blx@tempa}% \ifinlistcs{#1}{abx@annotation@field@\blx@tempa}} % {<annotation>} @@ -5656,6 +6246,7 @@ \ifdefvoid\currentfield{}{\let\blx@tempa\currentfield}% \ifdefvoid\currentlist{}{\let\blx@tempa\currentlist}% \ifdefvoid\currentname{}{\let\blx@tempa\currentname}% + \blx@resolve@annotation@label{\blx@tempa}% \ifinlistcs{#1}{abx@annotation@item@\blx@tempa @\the\value{listcount}}} % {<part>}{<annotation>} @@ -5663,8 +6254,15 @@ \ifdefvoid\currentfield{}{\let\blx@tempa\currentfield}% \ifdefvoid\currentlist{}{\let\blx@tempa\currentlist}% \ifdefvoid\currentname{}{\let\blx@tempa\currentname}% + \blx@resolve@annotation@label{\blx@tempa}% \ifinlistcs{#2}{abx@annotation@part@\blx@tempa @\the\value{listcount}@#1}} +% {<fieldname>} +\def\blx@resolve@annotation@label#1{% + \ifcsundef{abx@field@#1source} + {}% + {\letcs\blx@tempa{abx@field@#1source}}} + \begingroup \catcode`\<=12 \catcode`\>=12 @@ -5791,29 +6389,143 @@ \def\blx@getdata#1{% \csuse{blx@data@\the\c@refsection @\blx@refcontext@context @#1}% - % Here we resolve label* bib fields to their real fields. Doing this here - % dynamically means that we can vary the field chosen depending on the refcontext. - % biber used to resolve these and materialise them in the .bbl but this - % means a static resolution which is independent of the document context. + \blx@adjustyears + \blx@getlabeldata + \blx@setcitecounter} + +\def\blx@adjustyears{% + % All dates by default are output from biber in astronomical era with a year 0 + % So, if we are ouputting BCE/BC era, we need to adjust the years by +1 \def\do##1{% - \ifcsdef{abx@field@##1source} - {\expandafter\def\csname abx@field@##1\endcsname{\csuse{abx@field@\csuse{abx@field@##1source}}}}% + \ifdefstring\blx@dateera{astronomical} + {} + {\ifcsdef{abx@field@##1year} + {\csuse{if##1dateera}{bce} + {\csedef{abx@field@##1year}{\number\numexpr\csuse{abx@field@##1year}+1}} + {}} + {}% + \ifcsdef{abx@field@##1endyear} + {\csuse{if##1enddateera}{bce} + {\csedef{abx@field@##1endyear}{\number\numexpr\csuse{abx@field@##1endyear}+1}} + {}} + {}}% {}}% + \abx@dodatetypes} + +\def\blx@getlabeldata{% + % Here we resolve label* bib fields to their real fields. In fact, currently biber resolves + % the label* fields too, as it needs to do this to generate various internal + % counters for tracking things like singletitle etc. internally. However, it does not output + % the resolved values to the .bbl. It is conceptually neater to have just the calculated label* + % source field in the .bbl and let biblatex resolve the label* field using the label*source + % fields. However, currently there is no way/need to vary the label* resolution to pick up a + % different target field in biblatex and so practically, this resolution is being done twice, + % once by biber, once by biblatex. It is possible in the future that it would be useful to + % to change the resolution of the label* fields dynamically in a style/document and so this + % biblatex-side resolution remains. + % + % An unanswered question is whether such dynamic resolution causes problems due to the fact + % that biber uses the label* field to generate counters internally and changing the + % label* field resolution in biblatex would occur after such counters have been used to + % generate the .bbl + % This could all be removed from biblatex if necessary and biber could output all resolved + % label* fields to the .bbl but then it potentially removes control of such things from + % macros + % + % fields + \def\do##1{% + \ifcsundef{abx@field@##1source} + {}% + {\csletcs{abx@field@##1}{abx@field@\csuse{abx@field@##1source}}}}% \dolistloop\abx@rfields% - % Just in case we ever have non-name lists to instantiate - % \def\do##1{% - % \ifcsdef{abx@field@##1source} - % {\csname c@##1\expandafter\endcsname\expandafter\the\csname c@\csuse{abx@field@##1source}\endcsname - % \csletcs{abx@list@##1}{abx@list@\csuse{abx@field@##1source}}} - % {}}% - % \dolistloop\abx@rlists% + % names \def\do##1{% - \ifcsdef{abx@field@##1source} + \ifcsundef{abx@field@##1source} + {} {\csname c@##1\expandafter\endcsname\expandafter\the\csname c@\csuse{abx@field@##1source}\endcsname - \csletcs{abx@name@##1}{abx@name@\csuse{abx@field@##1source}}} - {}}% + \csletcs{abx@name@##1}{abx@name@\csuse{abx@field@##1source}}}}% \dolistloop\abx@rnames% - \blx@setcitecounter} + % Resolve labeldate + % Note that here we can't refer to labelyear as this is where we create it, hence the + % complications in constructing test names etc. + % This also shows why biber shouldn't resolve labeldate fields as we have to add + % circa/uncertain/era etc. information to them and that has to be done here. + \ifundef\abx@field@labeldatesource + {} + {\ifcsundef{abx@field@\abx@field@labeldatesource year} + % \DeclareLabeldate resolved to a literal/localisation string or a non-date field + % 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}} + % \DeclareLabeldate resolved to a non-date field. Not safe to \edef because + % such contents could contain arbitrary macros, unlike ETDT sourced labeldatesource values + {\def\abx@field@labelyear{\csuse{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}}} + {}}}} \def\blx@getdata@cite#1{% \ifcsdef{blx@setc@\the\c@refsection @#1} @@ -5964,7 +6676,7 @@ \iftoggle{blx@labeltitleyear} {\blx@bbl@labeltitleyear} {}% - \iftoggle{blx@labeldate} + \iftoggle{blx@labeldateparts} {\blx@bbl@labeldate} {}} {}% @@ -6202,7 +6914,7 @@ % rerun biber toggle so defernums doesn't consume the localnumbers % in the .aux but instead, re-writes them, which is what we need. \begingroup - \def\do#1{\ifinlist{#1}{\blx@cites}{}{\blx@logreq@active{}}\relax}% + \def\do#1{\ifinlist{#1}\blx@cites{}{\blx@logreq@active{}}\relax}% \dolistloop\blx@lastcites % Special case - if we are using sortscheme "none" anywhere, then changes % in citation order matter and we need to re-run biber. So a special test @@ -6212,26 +6924,26 @@ % lastcite lists as strings and comparing them. This doesn't apply % to biblist sortschemes as nobody wants to sort biblists with % "none", since it makes no sense - \ifinlist{none}{\blx@sortschemes} + \ifinlist{none}\blx@sortschemes {\ifdefstrequal{\blx@cites}{\blx@lastcites} {} {\blx@logreq@active{}}} {}% % Test if we removed any mention of a reference context since last run % If we did, we need to re-run biber - \def\do#1{\ifinlist{#1}{\blx@refcontexts}{}{\blx@logreq@active{}}\relax}% + \def\do#1{\ifinlist{#1}\blx@refcontexts{}{\blx@logreq@active{}}\relax}% \dolistloop\blx@lastrefcontexts % Test if we added any mention of a reference context since last run % If we did, we need to re-run biber - \def\do#1{\ifinlist{#1}{\blx@lastrefcontexts}{}{\blx@logreq@active{}}\relax}% + \def\do#1{\ifinlist{#1}\blx@lastrefcontexts{}{\blx@logreq@active{}}\relax}% \dolistloop\blx@refcontexts % Test if we removed any mention of a biblist since last run. % If we did, we need to re-run biber - \def\do#1{\ifinlist{#1}{\blx@biblists}{}{\blx@logreq@active{}}\relax}% + \def\do#1{\ifinlist{#1}\blx@biblists{}{\blx@logreq@active{}}\relax}% \dolistloop\blx@lastbiblists % Test to see if we added any mention of a biblist since last run. % If we did, we need to re-run biber - \def\do#1{\ifinlist{#1}{\blx@lastbiblists}{}{\blx@logreq@active{}}\relax}% + \def\do#1{\ifinlist{#1}\blx@lastbiblists{}{\blx@logreq@active{}}\relax}% \dolistloop\blx@biblists % If we have to run biber or latex again and we are using defernumbers, % don't write the localnumber information to the .aux file yet as we will @@ -6324,7 +7036,6 @@ \blx@tempa} %% Data input - \def\blx@bblinput{% \begingroup \blx@info@noline{Trying to load bibliographic data..}% @@ -6477,9 +7188,13 @@ \define@key{blx@bib1}{title}{} \define@key{blx@bib1}{prenote}{} \define@key{blx@bib1}{postnote}{} -\define@key{blx@bib1}{resetnumbers}[]{} \define@key{blx@bib1}{omitnumbers}[]{} -\define@key{blx@bib1}{prefixnumbers}{}% legacy name for labelprefix +\define@key{blx@bib1}{prefixnumbers}{}%LEGACY(<3.4) legacy name for labelprefix +% 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]{% + \toggletrue{blx@resetnumsexplicit}} \define@key{blx@bib2}{section}{} \define@key{blx@bib2}{sorting}{} @@ -6764,6 +7479,11 @@ \blx@bibheading\blx@theheading\blx@thetitle \endgroup} +% We use this to determine whether an explicit value for resetnumbers is passed to +% \printbibliography, if not, then we use the default behaviour where a labelprefix forces +% a reset. It is useful that we have a 2-pass structure for \printbibliography keys anyway. +\newtoggle{blx@resetnumsexplicit} + % [<options>] \newrobustcmd*{\printbibliography}{% \begingroup @@ -6774,9 +7494,6 @@ {\blx@printbibliography[]}} \def\blx@printbibliography[#1]{% - \ifdefempty\blx@refcontext@labelprefix - {} - {\csnumdef{blx@labelnumber@\the\c@refsection}{0}}% \toggletrue{blx@tempa}% \toggletrue{blx@tempb}% \def\blx@theheading{bibliography}% @@ -6800,7 +7517,16 @@ { locale="\csuse{blx@sortdef@locale@\blx@refcontext@sorting}"} {}}{% \csuse{blx@sorting@\blx@refcontext@sorting}}}% - \setkeys{blx@bib1}{#1}% Set section only, if present ... + % + \togglefalse{blx@resetnumsexplicit}% + \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} + {} + {\ifdefempty\blx@refcontext@labelprefix + {} + {\setkeys{blx@bib2}{resetnumbers}}}% \blx@rest@actives \ifcsvoid{blx@slist@entry@\blx@tempe @\blx@refcontext@context} {} @@ -7215,7 +7941,7 @@ \blx@printbibchecks % Add the sortscheme to the list of sortschemes for this biblist % so we can compare on next run - \xifinlist{\blx@tempc}{\blx@biblists} + \xifinlist\blx@tempc\blx@biblists {} {\listxadd\blx@biblists\blx@tempc \blx@auxwrite\@mainaux{}{\string\abx@aux@biblist{\blx@tempc}}}% @@ -7325,15 +8051,35 @@ {\printfield{shorttitle}}} % Reference contexts +\newcommand*{\DeclareRefcontext}[2]{% + \csgdef{blx@refcontext@name@#1}{#2}} +\@onlypreamble\DeclareRefcontext + \def\newrefcontext{% \endrefcontext \refcontext} -\def\refcontext[#1]{% +% Backwards compat for older \refcontext[] format +\def\refcontext{% + \@ifnextchar[%] + {\refcontext@i} + {\refcontext@i[]}} + +\def\refcontext@i[#1]{% + \@ifnextchar\bgroup + {\refcontext@ii[#1]} + {\refcontext@ii[#1]{}}} + +\newcommand*{\refcontext@ii}[2][]{% \iftoggle{blx@refcontext} {\blx@err@nestenv{refcontext}% \endrefcontext} {\toggletrue{blx@refcontext}% + % Set refcontext from named refcontext, if given + \ifblank{#2} + {} + {\edef\z{\noexpand\setkeys{blx@refcontext}{\csuse{blx@refcontext@name@#2}}}\z}% + % Override with explicit refcontext keyvals, if given \setkeys{blx@refcontext}{#1}% % Add the sortscheme to the list of sortschemes so we can track % special cases like sorting=none which need cite order change detection @@ -7373,7 +8119,7 @@ Option 'labelprefix' requires global\MessageBreak 'defernumbers=true'}} {}}} -\define@key{blx@refcontext}{prefixnumbers}{% legacy +\define@key{blx@refcontext}{prefixnumbers}{%LEGACY(<3.3) \blx@warning@noline{% prefixnumbers option to \string\newrefcontext\space has been renamed, use 'labelprefix' option instead}% @@ -7983,7 +8729,7 @@ \blx@tempcnta\z@ \blx@tempcntb\z@ \let\blx@tempa\@empty - \forcsvlist\blx@citeadd{#1}% + \forcsvlist\blx@citeadd{#1}% adds to \blx@tempa \blx@thenotecheck \ifnum\blx@tempcnta>\z@ \ifnum\blx@tempcntb>\z@ @@ -7991,6 +8737,8 @@ \fi \fi \letcs\blx@tempb{blx@slist@centry@\the\c@refsection @\blx@refcontext@context}% + % \blx@tempb is a sorted list of all cites, \blx@tempa is the list of cites to + % sort using this list \blx@thecitesort \edef\blx@tempa{\endgroup \c@citecount\z@ @@ -8041,13 +8789,9 @@ % made (a bit strangely but some styles do this) inside a biblist % which never appear in any printed bib/biblist and therefore have no default % refcontext defined - % However, only do this if sortcites is not used for in this case, by default we - % want to use the current refcontext in which the cites occur - \ifbool{sortcites} - {} - {\ifcsdef{blx@assignedrefcontextbib@\the\c@refsection @#1} - {\letcs\blx@refcontext@context{blx@assignedrefcontextbib@\the\c@refsection @#1}} - {\edef\blx@refcontext@context{\blx@sorting/global/}}}% + \ifcsdef{blx@assignedrefcontextbib@\the\c@refsection @#1} + {\letcs\blx@refcontext@context{blx@assignedrefcontextbib@\the\c@refsection @#1}} + {\edef\blx@refcontext@context{\blx@sorting/global/}}% % assignment via keyword list \ifdef\blx@assignedrefcontextkeywlist {\def\do##1{% @@ -8137,7 +8881,6 @@ \let\blx@refcontext@context\blx@refcontext@context@saved} % cite counter - \def\blx@citecounter@global{% \ifbool{@filesw} {\ifbool{citetracker} @@ -8159,7 +8902,6 @@ {}} % {<refsection>}{<entrykey>} - \protected\def\blx@aux@count#1#2{% \csnumgdef{blx@count@#1@\detokenize{#2}}{\csuse{blx@count@#1@\detokenize{#2}}+1}} \protected\def\blx@aux@fncount#1#2{% @@ -8185,7 +8927,6 @@ \relax} % cite tracker - \def\blx@citetracker@global{% \ifbool{citetracker} {\xifinlistcs\abx@field@entrykey{blx@bsee@\the\c@refsection} @@ -8217,7 +8958,6 @@ \global\cslet{blx@saved@fsee@\the\c@refsection}\@empty} % ibidem tracker - \def\blx@ibidtracker@global{% \ifbool{citetracker} {\global\let\blx@lastkey@text\abx@field@entrykey} @@ -8268,7 +9008,6 @@ \global\undef\blx@saved@lastkey@foot} % idem tracker - \def\blx@idemtracker@global{% \ifbool{citetracker} {\global\let\blx@lasthash@text\abx@field@fullhash} @@ -8314,7 +9053,6 @@ \global\undef\blx@saved@lasthash@foot} % opcit tracker - \def\blx@opcittracker@global{% \ifbool{citetracker} {\blx@opcit@tracker{text}} @@ -8403,7 +9141,6 @@ \endgroup} % loccit tracker - \def\blx@loccittracker@global{% \ifbool{citetracker} {\blx@loccit@tracker{text}} @@ -8582,7 +9319,6 @@ \fi} % hyperref interface - \appto\blx@mkhyperref{% \protected\def\blx@imc@bibhyperref{% \@ifnextchar[%] @@ -9204,15 +9940,14 @@ \def\iffootnote{\blx@TE{\iftoggle{blx@footnote}}}% \def\ifuseprefix{\blx@TE{\iftoggle{blx@useprefix}}}% \def\ifterseinits{\blx@TE{\iftoggle{blx@terseinits}}}% - \def\iffirstinits{\blx@TE{\iftoggle{blx@giveninits}}}% legacy name for \ifgiveninits - \def\ifgiveninits{\blx@TE{\iftoggle{blx@giveninits}}}% \def\ifsingletitle{\blx@TE{\iftoggle{abx@bool@singletitle}}}% \def\ifuniquetitle{\blx@TE{\iftoggle{abx@bool@uniquetitle}}}% + \def\ifuniquebaretitle{\blx@TE{\iftoggle{abx@bool@uniquebaretitle}}}% + \def\ifuniquework{\blx@TE{\iftoggle{abx@bool@uniquework}}}% \def\ifuniqueprimaryauthor{\blx@TE{\iftoggle{abx@bool@uniqueprimaryauthor}}}% \def\ifandothers#1{\blx@TE{\iftoggle{abx@bool@more#1}}}}} % {<listmacro>}{<filtercsname>} => matches in <listmacro> - \protected\def\blx@bibfilter#1#2{% \begingroup \edef\blx@do##1{% @@ -9230,7 +9965,6 @@ \blx@tempa} %% Auxiliary macros - \newrobustcmd*{\mkbibquote}{\enquote} \protected\def\blx@imc@mkbibquote{% \blx@ifuspunct\blx@usquote\enquote} @@ -9629,6 +10363,13 @@ \xdef\blx@xml@sourcemap@step#1{% ~~~~~~~~<bcf:map\string_step#1/>\blx@nl} +\xdef\blx@xml@labelalphanametemplate#1#2{% + ~~<bcf:labelalphanametemplate type="#1">\blx@nl + #2% + ~~</bcf:labelalphanametemplate>\blx@nl} +\xdef\blx@xml@labelalphanametemplatenamepart#1#2#3{% + ~~~~<bcf:namepart #1#2>#3</bcf:namepart>\blx@nl} + \xdef\blx@xml@labelalphatemplate#1#2{% ~~<bcf:labelalphatemplate type="#1">\blx@nl #2% @@ -9648,9 +10389,9 @@ ~~~~<bcf:defaults#1>\blx@nl #2% ~~~~</bcf:defaults>\blx@nl} -\xdef\blx@xml@inherit@data#1{% - ~~~~<bcf:inherit>\blx@nl - #1% +\xdef\blx@xml@inherit@data#1#2{% + ~~~~<bcf:inherit#1>\blx@nl + #2% ~~~~</bcf:inherit>\blx@nl} \xdef\blx@xml@inherit@type#1#2#3{% ~~~~~~<bcf:type\string_pair source="#1" target="#2"#3/>\blx@nl} @@ -9687,6 +10428,14 @@ \xdef\blx@xml@nolabelwidthcount#1{% ~~~~<bcf:nolabelwidthcount value="#1"/>\blx@nl} +\xdef\blx@xml@uniquenametemplate#1{% + ~~<bcf:uniquenametemplate>\blx@nl% + #1% + ~~</bcf:uniquenametemplate>\blx@nl} + +\xdef\blx@xml@uniquenametemplatenamepart#1#2#3{% + ~~~~<bcf:namepart #1#2>#3</bcf:namepart>\blx@nl} + \xdef\blx@xml@sortingnamekey#1#2{% ~~<bcf:sortingnamekey keyscheme="#1">\blx@nl% #2% @@ -9778,8 +10527,10 @@ \blx@xml@toggle{labeltitle}% \blx@xml@mvalue{labeltitlespec}{\blx@bcf@labeltitlespec}% \blx@xml@toggle{labeltitleyear}% - \blx@xml@toggle{labeldate}% + \blx@xml@toggle{labeldateparts}% \blx@xml@mvalue{labeldatespec}{\blx@bcf@labeldatespec}% + \blx@xml@toggle{julian}% + \blx@xml@svalue{gregorianstart}{\blx@gregorianstart}% \blx@xml@svalue{maxalphanames}{\blx@maxalphanames}% \blx@xml@svalue{maxbibnames}{\blx@maxbibnames}% \blx@xml@svalue{maxcitenames}{\blx@maxcitenames}% @@ -9796,6 +10547,8 @@ \blx@xml@svalue{uniquename}{\blx@uniquename}% \blx@xml@toggle{uniqueprimaryauthor}% \blx@xml@toggle{uniquetitle}% + \blx@xml@toggle{uniquebaretitle}% + \blx@xml@toggle{uniquework}% \blx@xml@toggle{useprefix}% \blx@xml@nametoggles }% @@ -9815,7 +10568,7 @@ {\csuse{blx@bcf@labeltitlespec@#1}} {\blx@bcf@labeltitlespec}}% \blx@xml@toggle{labeltitleyear}% - \blx@xml@toggle{labeldate}% + \blx@xml@toggle{labeldateparts}% \blx@xml@mvalue{labeldatespec}{% \ifcsdef{blx@bcf@labeldatespec@#1} {\csuse{blx@bcf@labeldatespec@#1}} @@ -9836,6 +10589,8 @@ \blx@xml@svalue{uniquename}{\blx@uniquename}% \blx@xml@toggle{uniqueprimaryauthor}% \blx@xml@toggle{uniquetitle}% + \blx@xml@toggle{uniquebaretitle}% + \blx@xml@toggle{uniquework}% \blx@xml@toggle{useprefix}% \blx@xml@nametoggles }% @@ -9864,7 +10619,6 @@ \blx@xml@svalue{mincrossrefs}{\blx@mincrossrefs}% \blx@xml@svalue{minxrefs}{\blx@minxrefs}% \blx@xml@toggle{sortcase}% - \blx@xml@toggle{sortgiveninits}% \blx@xml@toggle{sortupper}% }% \blx@xml@comment{BIBLATEX OPTIONS}% @@ -9943,28 +10697,29 @@ {\eappto\blx@tempa{% \blx@xml@comment{SOURCEMAP}% \blx@xml@sourcemap{% - \ifcsdef{blx@sourcemap@user} - {\csuse{blx@sourcemap@user}} - {}% - \ifcsdef{blx@sourcemap@style} - {\csuse{blx@sourcemap@style}} - {}% - \ifcsdef{blx@sourcemap@defaults@bibtex} - {\csuse{blx@sourcemap@defaults@bibtex}} - {}% - \ifcsdef{blx@sourcemap@defaults@biblatexml} - {\csuse{blx@sourcemap@defaults@biblatexml}} - {}% - \ifcsdef{blx@sourcemap@defaults@endnotexml} - {\csuse{blx@sourcemap@defaults@endnotexml}} - {}% - \ifcsdef{blx@sourcemap@defaults@ris} - {\csuse{blx@sourcemap@defaults@ris}} - {}% - \ifcsdef{blx@sourcemap@defaults@zoterordfxml} - {\csuse{blx@sourcemap@defaults@zoterordfxml}} - {}}}} + \ifdef\blx@sourcemap@user + {\blx@sourcemap@user} + {}% + \ifdef\blx@sourcemap@style + {\blx@sourcemap@style} + {}% + \ifdef\blx@sourcemap@defaults@bibtex + {\blx@sourcemap@defaults@bibtex} + {}% + \ifdef\blx@sourcemap@defaults@biblatexml + {\blx@sourcemap@defaults@biblatexml} + {}}}} {}% + % labelalpha name template + \eappto\blx@tempa{% + \blx@xml@comment{LABELALPHA NAME TEMPLATE}}% + \def\do##1{% + \eappto\blx@tempa{% + \blx@xml@labelalphanametemplate{##1}{% + \csuse{blx@labelalphanametemplate@##1}}% + }% + }% + \dolistloop\blx@lantem@type % labelalpha template \eappto\blx@tempa{% \blx@xml@comment{LABELALPHA TEMPLATE}}% @@ -10026,6 +10781,9 @@ \def\do##1{% \eappto\blx@tempa{\blx@xml@transliteration{##1}{\csuse{blx@translit@##1}}}}% \dolistloop\blx@translits}% + % uniquenametemplate + \eappto\blx@tempa{\blx@xml@comment{UNIQUENAME TEMPLATE}}% + \eappto\blx@tempa{\blx@xml@uniquenametemplate{\blx@uniquenametemplate}}% % sortingnamekey \eappto\blx@tempa{\blx@xml@comment{SORTING NAME KEY}}% \def\do##1{% @@ -10212,7 +10970,7 @@ \let\maps\blx@stylesourcemap@maps \let\blx@tempa\@empty #1% - \csxdef{blx@sourcemap@style}{\blx@tempa}% + \xappto\blx@sourcemap@style\blx@tempa% \endgroup} \@onlypreamble\DeclareStyleSourcemap @@ -10287,6 +11045,8 @@ {}} \define@key{blx@sourcemap@map}{foreach}{% characters \eappto\blx@tempm{ map\string_foreach="#1"}} +\define@key{blx@sourcemap@map}{refsection}{% integer + \eappto\blx@tempm{ refsection="#1"}} \newcommand*{\blx@sourcemap@perdatasource}[1]{% \eappto\blx@tempe{% @@ -10316,6 +11076,8 @@ {}} \define@key{blx@sourcemap@step}{fieldsource}{% characters \eappto\blx@tempf{ map\string_field\string_source="#1"}} +\define@key{blx@sourcemap@step}{notfield}{% characters + \eappto\blx@tempf{ map\string_notfield="#1"}} \define@key{blx@sourcemap@step}{fieldtarget}{% characters \eappto\blx@tempf{ map\string_field\string_target="#1"}} \define@key{blx@sourcemap@step}{fieldset}{% characters @@ -10364,12 +11126,68 @@ \define@key{blx@sourcemap@step}{replace}{% characters \eappto\blx@tempf{ map\string_replace="#1"}} -%%% +% [<entrytype>]{<spec>} +\newrobustcmd*{\DeclareLabelalphaNameTemplate}[2][]{% + \ifblank{#1} + {\blx@lantem{#2}{global}} + {\forcsvlist{\blx@lantem{#2}}{#1}}} +\@onlypreamble\DeclareLabelalphaNameTemplate +\blx@collectopts{xml}{blx@globalopts}{labelalphanametemplate}% for passing to the .bcf +\blx@collectopts{xml}{blx@typeopts}{labelalphanametemplate}% for passing to the .bcf +\def\blx@lantem#1#2{% + \begingroup + \let\namepart\blx@lantem@namepart + \let\blx@tempa\@empty + \blx@tempcnta\z@ + #1% + \ifdef\blx@lantem@type + {\ifinlist{#2}\blx@lantem@type + {\global\cslet{blx@labelalphanametemplate@#2}\blx@tempa} + {\listgadd\blx@lantem@type{#2}% + \global\cslet{blx@labelalphanametemplate@#2}\blx@tempa}} + {\listgadd\blx@lantem@type{#2}% + \global\cslet{blx@labelalphanametemplate@#2}\blx@tempa}% + \endgroup} + +\newcommand*{\blx@lantem@namepart}[2][]{% + \advance\blx@tempcntb\@ne + \edef\blx@tempe{order="\the\blx@tempcntb"}% + \let\blx@tempc\@empty + \ifblank{#1} + {} + {\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 + \ifstrequal{#1}{true} + {\appto\blx@tempc{ use="1"}} + {}} + +\define@key{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 + \ifstrequal{#1}{true} + {\appto\blx@tempc{ substring\string_compound="1"}} + {}} + +\define@key{blx@lantem@namepart}{strwidth}{% integer + \eappto\blx@tempc{ substring\string_width="#1"}} + +\define@key{blx@lantem@field}{strside}{% left|right + \ifstrequal{#1}{right} + {\eappto\blx@tempc{ substring\string_side="right"}} + {\eappto\blx@tempc{ substring\string_side="left"}}} + +% [<entrytype>]{<spec>} \newrobustcmd*{\DeclareLabelalphaTemplate}[2][]{% \ifblank{#1} - {\blx@latem{#2}{global}} - {\forcsvlist{\blx@latem{#2}}{#1}}} + {\blx@latem{#2}{global}} + {\forcsvlist{\blx@latem{#2}}{#1}}} \@onlypreamble\DeclareLabelalphaTemplate \blx@collectopts{xml}{blx@globalopts}{labelalphatemplate}% for passing to the .bcf \blx@collectopts{xml}{blx@typeopts}{labelalphatemplate}% for passing to the .bcf @@ -10383,10 +11201,10 @@ \let\blx@tempa\@empty #1% \ifdef\blx@latem@type - {\ifinlist{#2}{\blx@latem@type} + {\ifinlist{#2}\blx@latem@type {\global\cslet{blx@labelalphatemplate@#2}\blx@tempa} {\listgadd\blx@latem@type{#2}% - \global\cslet{blx@labelalphatemplate@#2}\blx@tempa}}% + \global\cslet{blx@labelalphatemplate@#2}\blx@tempa}} {\listgadd\blx@latem@type{#2}% \global\cslet{blx@labelalphatemplate@#2}\blx@tempa}% \endgroup} @@ -10411,6 +11229,23 @@ \eappto\blx@tempb{% \blx@xml@labelalpha@part{\blx@tempc}{#2}}} +% Legacy options moved to \namepart in \DeclareLabelalphaNameTemplate +\define@key{blx@latem@field}{compound}{% deprecated + \blx@warning@noline{% + Ignored 'compound' option to \string\field\space in \string\DeclareLabelalphaNameTemplate\MessageBreak + This is now the 'compound' option of \string\namepart\space in\MessageBreak + \string\DeclareLabelalphaNameTemplate}} +\define@key{blx@latem@field}{pcompound}{% deprecated + \blx@warning@noline{% + Ignored 'pcompound' option to \string\field\space in \string\DeclareLabelalphaNameTemplate\MessageBreak + This is now the 'compound' option of \string\namepart\space in\MessageBreak + \string\DeclareLabelalphaNameTemplate}} +\define@key{blx@latem@field}{pstrwidth}{% deprecated + \blx@warning@noline{% + Ignored 'pstrwidth' option to \string\field\space in \string\DeclareLabelalphaNameTemplate\MessageBreak + This is now the 'strwidth' option of \string\namepart\space in\MessageBreak + \string\DeclareLabelalphaNameTemplate}} + \define@key{blx@latem@field}{uppercase}[true]{% true|false \ifstrequal{#1}{true} {\appto\blx@tempc{ uppercase="1"}} @@ -10425,8 +11260,6 @@ {}} \define@key{blx@latem@field}{strwidth}{% integer \eappto\blx@tempc{ substring\string_width="#1"}} -\define@key{blx@latem@field}{pstrwidth}{% integer - \eappto\blx@tempc{ substring\string_pwidth="#1"}} \define@key{blx@latem@field}{varwidth}[true]{% "v" \ifstrequal{#1}{true} {\appto\blx@tempc{ substring\string_width="v"}} @@ -10447,14 +11280,6 @@ \ifstrequal{#1}{right} {\eappto\blx@tempc{ substring\string_side="right"}} {\eappto\blx@tempc{ substring\string_side="left"}}} -\define@key{blx@latem@field}{compound}[true]{% true|false - \ifstrequal{#1}{true} - {\appto\blx@tempc{ substring\string_compound="1"}} - {}} -\define@key{blx@latem@field}{pcompound}[true]{% true|false - \ifstrequal{#1}{true} - {\appto\blx@tempc{ substring\string_pcompound="1"}} - {}} \define@key{blx@latem@field}{namessep}{% \eappto\blx@tempc{ namessep="#1"}} \define@key{blx@latem@field}{ifnames}{% @@ -10472,15 +11297,16 @@ {\eappto\blx@tempc{ pad\string_side="right"}}} % [<exceptions>]{<options>} - \newrobustcmd*{\DefaultInheritance}[2][]{% \begingroup + \let\blx@tempf\@empty \ifblank{#2} {} {\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}"}% + override\string_target="\iftoggle{blx@inherit@override}{true}{false}"% + \blx@tempf}% \let\blx@tempb\@empty \let\except\blx@inherit@except #1% @@ -10496,9 +11322,10 @@ \settoggle{blx@inherit@all}{#1}} \define@key{blx@inherit@default}{override}[true]{% true|false \settoggle{blx@inherit@override}{#1}} +\define@key{blx@inherit@default}{ignore}{% csv list + \edef\blx@tempf{ ignore="#1"}} % {<source>}{<target>}{<options>} - \newcommand*{\blx@inherit@except}[3]{% \let\blx@tempc\@empty \ifblank{#3} @@ -10511,18 +11338,24 @@ \eappto\blx@tempc{ inherit\string_all="#1"}} \define@key{blx@inherit@except}{override}[true]{% true|false \eappto\blx@tempc{ override\string_target="#1"}} +\define@key{blx@inherit@except}{ignore}{% csv list + \eappto\blx@tempc{ ignore="#1"}} % {<type,type,...>}{<type,type,...>}{<spec>} -\newrobustcmd*{\DeclareDataInheritance}[3]{% +\newrobustcmd*{\DeclareDataInheritance}[4][]{% \begingroup \let\blx@tempa\@empty - \forcsvlist{\blx@inherit@i{#2}}{#1}% + \let\blx@tempf\@empty + \ifblank{#1} + {} + {\setkeys{blx@inherit}{#1}}% + \forcsvlist{\blx@inherit@i{#3}}{#2}% \let\blx@tempb\@empty \let\inherit\blx@inherit@field \let\noinherit\blx@inherit@block - #3% + #4% \xappto\blx@inherit@data{% - \blx@xml@inherit@data{% + \blx@xml@inherit@data{\blx@tempf}{% \blx@tempa \blx@tempb}}% \endgroup} @@ -10548,6 +11381,9 @@ \newcommand*{\blx@inherit@block}[1]{% \eappto\blx@tempb{\blx@xml@inherit@block{#1}}} +\define@key{blx@inherit}{ignore}{% csv list + \edef\blx@tempf{ ignore="#1"}} + \define@key{blx@inherit@field}{override}[true]{% true|false \ifstrequal{#1}{true} {\edef\blx@tempc{ override\string_target="true"}} @@ -10611,6 +11447,38 @@ \eappto\blx@tempb{% \blx@xml@translit{#1}{#2}{#3}}} +% {<spec>} +\newrobustcmd*{\DeclareUniquenameTemplate}[1]{% + \begingroup + \let\namepart\blx@untemp@namepart + \let\blx@tempa\@empty + \blx@tempcnta\z@ + #1% + \global\let\blx@uniquenametemplate\blx@tempa + \endgroup} +\@onlypreamble\DeclareUniquenameTemplate +\blx@collectopts{xml}{blx@globalopts}{uniquenametemplate}% for passing to the .bcf + +\newcommand*{\blx@untemp@namepart}[2][]{% + \advance\blx@tempcntb\@ne + \edef\blx@tempe{order="\the\blx@tempcntb"}% + \let\blx@tempc\@empty + \ifblank{#1} + {} + {\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 + \ifstrequal{#1}{true} + {\appto\blx@tempc{ use="1"}} + {}} + +\define@key{blx@untemp@namepart}{base}[true]{% base option for namepart true|false + \ifstrequal{#1}{true} + {\appto\blx@tempc{ base="1"}} + {}} + % [<specname>]{<spec>} \newrobustcmd*{\DeclareSortingNamekeyScheme}[2][]{% \begingroup @@ -10668,6 +11536,11 @@ {\appto\blx@tempc{ use="1"}} {\appto\blx@tempc{ use="0"}}} +\define@key{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"}}} + % {<name>}{<spec>} \newrobustcmd*{\DeclareSortingScheme}[3][]{% \ifblank{#1} @@ -10675,9 +11548,15 @@ {\setkeys{blx@sortdef@sorting}{#1}% \csxdef{blx@sortdef@locale@#2}{\blx@templ}}% \begingroup + \def\name{%LEGACY(<2.0) + \blx@warning@noline{% + '\string\name' is deprecated in sorting specifications, please use '\string\field'}% + \blx@sortdef@field}% + \def\list{%LEGACY(<2.0) + \blx@warning@noline{% + '\string\list' is deprecated in sorting specifications, please use '\string\field'}% + \blx@sortdef@field}% \let\sort\blx@sortdef@sort - \let\name\blx@sortdef@field% legacy pre-biblatex 2.0 compat - \let\list\blx@sortdef@field% legacy pre-biblatex 2.0 compat \let\field\blx@sortdef@field \let\literal\blx@sortdef@literal \def\citeorder{\blx@sortdef@field{citeorder}}% @@ -10794,7 +11673,6 @@ \appto\blx@tempa{\blx@xml@exclude{#1}}} % [<type,type,...>]{<field,field,...>} - \newrobustcmd*{\DeclareLabelname}[2][]{% \begingroup \let\blx@tempa\@empty @@ -10906,7 +11784,7 @@ \def\blx@addtypeopt#1{% \notblank{#1} {\ifdef\blx@opts@type - {\ifinlist{#1}{\blx@opts@type} + {\ifinlist{#1}\blx@opts@type {} {\listgadd\blx@opts@type{#1}}} {\listgadd\blx@opts@type{#1}}} @@ -11162,6 +12040,22 @@ #3=#4} {}} +% Legacy for giveninits +\DeclareBibliographyOption[boolean]{firstinits}[true]{% + \blx@warning@noline{% + 'firstinits' option is deprecated, use 'giveninits' instead}% + \settoggle{abx@bool@giveninits}{#1}} + +% Legacy for sortfirstinits/sortgiveninits +\DeclareBibliographyOption[boolean]{sortfirstinits}[true]{% + \blx@warning@noline{% + 'sortfirstinits' option is deprecated, use 'inits' option\MessageBreak + to \string\namepart\space in \string\DeclareSortingNamekeyScheme}} +\DeclareBibliographyOption[boolean]{sortgiveninits}{% + \blx@warning@noline{% + 'sortgiveninits' option is deprecated, use 'inits' option\MessageBreak + to \string\namepart\space in \string\DeclareSortingNamekeyScheme}} + \DeclareBibliographyOption[boolean]{terseinits}[true]{% \ifstrequal{#1}{true} {\toggletrue{blx@terseinits} @@ -11173,24 +12067,6 @@ \renewrobustcmd*{\bibinitdelim}{\addnbspace} \renewrobustcmd*{\bibinithyphendelim}{\adddot\mbox{-}}}} -% Legacy for giveninits -\DeclareBibliographyOption[boolean]{firstinits}[true]{% - \blx@warning@noline{% - 'firstinits' option is deprecated, use 'giveninits' instead}% - \settoggle{blx@giveninits}{#1}} - -% Legacy for sortgiveninits -\DeclareBibliographyOption[boolean]{sortfirstinits}[true]{% - \blx@warning@noline{% - 'sortfirstinits' option is deprecated, use 'sortgiveninits' instead}% - \settoggle{blx@sortgiveninits}{#1}} - -\DeclareBibliographyOption[boolean]{giveninits}[true]{% - \settoggle{blx@giveninits}{#1}} - -\DeclareBibliographyOption[boolean]{sortgiveninits}[true]{% - \settoggle{blx@sortgiveninits}{#1}} - \DeclareBibliographyOption[boolean]{abbreviate}[true]{% \ifstrequal{#1}{true} {\def\abx@str{abx@sstr}} @@ -11198,8 +12074,10 @@ \DeclareBibliographyOption[boolean]{dateabbrev}[true]{% \ifstrequal{#1}{true} - {\let\abx@bibmonth\blx@imc@bibsstring} - {\let\abx@bibmonth\blx@imc@biblstring}} + {\let\abx@bibmonth\blx@imc@bibsstring + \let\abx@bibseason\blx@imc@bibsstring} + {\let\abx@bibmonth\blx@imc@biblstring + \let\abx@bibseason\blx@imc@biblstring}} \DeclareBibliographyOption[string]{sortlocale}{% \edef\blx@sortlocale{\detokenize{#1}}} @@ -11591,44 +12469,207 @@ {\blx@err@invopt{maxparens=#1}{}} {\setcounter{maxparens}{#1}}} +\newtoggle{blx@labeldateusetime} +\DeclareBibliographyOption[boolean]{labeldateusetime}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{blx@labeldateusetime}} + {\togglefalse{blx@labeldateusetime}}} + +\DeclareBibliographyOption[string]{labeldate}{% + % 'true' or 'false' means that the user thinks that this is the old 'labeldate' + % option which is now 'labeldateparts' (which is a boolean). + \ifboolexpr{% + test {\ifstrequal{#1}{true}} + or + test {\ifstrequal{#1}{false}}} + {\blx@warning@noline{% + 'labeldate' option used to determine whether to provide label date fields and\MessageBreak + extrayear field is renamed to 'labeldateparts', setting this instead. This option is + now used to set the format of the labeldate}% + \settoggle{blx@labeldateparts}{#1}} + {\ifstrequal{#1}{iso8601} + {\blx@warning@noline{% + 'iso8601' date format specifier is deprecated, use 'edtf' instead}% + \def\blx@dateformat@labeldate{edtf}% + \renewrobustcmd*{\bibdateeraendprefix}{\bibdateeraprefix}} + {\def\blx@dateformat@labeldate{#1}}% + \ifstrequal{#1}{ymd} + {\renewrobustcmd*{\bibdaterangesep}{\slash}% + \renewrobustcmd*{\bibtimerangesep}{\slash}% + \renewrobustcmd*{\bibdateeraendprefix}{\bibdateeraprefix}} + {}% + \ifstrequal{#1}{edtf}% bibdaterangesep hard-coded to slash, no extra space before prefices + {\renewrobustcmd*{\bibdateeraendprefix}{\bibdateeraprefix}} + {}% + \ifcsdef{mkdaterange#1} + {\protected\def\blx@imc@printlabeldate{\csuse{mkdaterange#1}{label}} + \protected\def\blx@imc@printlabeldateextra{\csuse{mkdaterange#1extra}{label}}} + {\ifcsdef{mkbibrange#1}%LEGACY(<3.5) + {\protected\def\blx@imc@printlabeldate{\csuse{mkbibrange#1}{label}} + \protected\def\blx@imc@printlabeldateextra{\csuse{mkbibrange#1extra}{label}}} + {\blx@err@invopt{labeldate=#1}{}}}}} + \DeclareBibliographyOption[string]{datelabel}{% - \ifcsdef{mkbibrange#1} - {\protected\def\blx@imc@printdatelabel{% - \blx@imc@iffieldundef{year} - {\csuse{mkbibrange#1}{label}} - {\csuse{mkbibrange#1}{}}}% - \protected\def\blx@imc@printdateextralabel{% - \blx@imc@iffieldundef{year} - {\csuse{mkbibrange#1extra}{label}} - {\csuse{mkbibrange#1extra}{}}}} - {\blx@err@invopt{datelabel=#1}{}}} + \blx@warning@noline{% + 'datelabel' option is deprecated, use 'labeldate' instead}% + \setkeys{blx@opt@pre}{labeldate=#1}} +\DeclareBibliographyOption[string]{labeltime}{% + \ifcsdef{mktimerange#1} + {\def\blx@timeformat@labeltime{#1}% + \protected\def\blx@imc@printlabeltime{\csuse{mktimerange#1}{label}}} + {\blx@err@invopt{labeltime=#1}{}}} -\def\do#1{% - \DeclareBibliographyOption[string]{#1}{% - \StrCut{#1}{date}\blx@datetype\blx@tempnull - \ifcsdef{mkbibrange##1} - {\protected\csedef{blx@imc@print#1}{\noexpand\csuse{mkbibrange##1}{\blx@datetype}}} - {\blx@err@invopt{#1=##1}{}}% - \ifcsdef{mkbibrange##1extra} - {\protected\csedef{blx@imc@print#1extra}{\noexpand\csuse{mkbibrange##1extra}{\blx@datetype}}} - {}}} -\abx@dodates +% Date meta-information +\DeclareBibliographyOption[string]{dateera}{% + \ifboolexpr{% + test {\ifstrequal{#1}{astronomical}} + or + test {\ifstrequal{#1}{secular}} + or + test {\ifstrequal{#1}{christian}}} + {\def\blx@dateera{#1}% + \ifstrequal{#1}{secular} + {\def\blx@dateera@bce{beforecommonera}% + \def\blx@dateera@ce{commonera}} + {}% + \ifstrequal{#1}{christian} + {\def\blx@dateera@bce{beforechrist}% + \def\blx@dateera@ce{annodomini}} + {}} + {\blx@err@invopt{dateera=#1}{}}} -% Default for new date fields is "comp" but this is overridden below by -% biblatex defaults -\def\do#1{\setkeys{blx@opt@pre}{#1=comp}} -\abx@dodates +% Effectively turns off dateeraauto since it's only used on ce dates which +% are never less than zero (as that would be a bce date) +\numdef\blx@dateeraauto{0} +\DeclareBibliographyOption[integer]{dateeraauto}{% + \numdef\blx@dateeraauto{#1}} + +\newtoggle{blx@datecirca} +\DeclareBibliographyOption[boolean]{datecirca}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{blx@datecirca}% + \protected\def\datecircaprint{% + \ifdatecirca{\bibstring{circa}\printdelim{datecircadelim}}{}}% + \protected\def\enddatecircaprint{% + \ifenddatecirca{\bibstring{circa}\printdelim{datecircadelim}}{}}% + \protected\def\datecircaprintedtf{% + \ifdatecirca{\textasciitilde}{}}% + \protected\def\enddatecircaprintedtf{% + \ifenddatecirca{\textasciitilde}{}}} + {\togglefalse{blx@datecirca}}} + +\newtoggle{blx@dateuncertain} +\DeclareBibliographyOption[boolean]{dateuncertain}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{blx@dateuncertain}% + \protected\def\dateuncertainprint{% + \ifdateuncertain{\bibdateuncertain}{}}% + \protected\def\enddateuncertainprint{% + \ifenddateuncertain{\bibdateuncertain}{}}} + {\togglefalse{blx@dateuncertain}}} + +% *time format options - auto-created for all datamodel date fields +% *date format options - auto-created for all datamodel date fields +% *dateusetime options - auto-created for all datamodel date fields +% Date metadata toggles are defined in one of the \abx@dobooleans calls +\def\do#1{% + \DeclareBibliographyOption[string]{#1date}{% + \ifstrequal{##1}{iso8601} + {\blx@warning@noline{'iso8601' date format specifier is deprecated, use 'edtf' instead}% + \csdef{blx@dateformat@#1date}{edtf}} + {\csdef{blx@dateformat@#1date}{##1}}% + \ifstrequal{##1}{ymd} + {\renewrobustcmd*{\bibdaterangesep}{\slash}% + \renewrobustcmd*{\bibtimerangesep}{\slash}% + \renewrobustcmd*{\bibdateeraendprefix}{\bibdateeraprefix}} + {}% + \ifcsdef{mkdaterange##1} + {\protected\csedef{blx@imc@print#1date}{\noexpand\csuse{mkdaterange##1}{#1}}% + \protected\csedef{blx@imc@print#1dateextra}{\noexpand\csuse{mkdaterange##1extra}{#1}}} + {\ifcsdef{mkbibrange##1}%LEGACY(<3.5) + {\blx@warning@noline{% + '\string\mkbibrange##1(extra)' date range macro in style is deprecated,\MessageBreak + please define '\string\mkdaterange##1(extra)' instead}% + \protected\csedef{blx@imc@print#1date}{\noexpand\csuse{mkbibrange##1}{#1}}% + \protected\csedef{blx@imc@print#1dateextra}{\noexpand\csuse{mkbibrange##1extra}{#1}}} + {\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}% + % Time format options + \DeclareBibliographyOption[string]{#1time}{% + \csdef{blx@timeformat@#1time}{##1}% + \ifcsdef{mktimerange##1} + {\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}% + % Boolean to determine if times are printed with dates + \newtoggle{blx@#1dateusetime}% + \DeclareBibliographyOption[boolean]{#1dateusetime}{% + \ifstrequal{##1}{true} + {\toggletrue{blx@#1dateusetime}} + {\togglefalse{blx@#1dateusetime}}}} +\abx@dodatetypes + +\DeclareBibliographyOption[string]{alldatesusetime}{% + \def\do##1{\ExecuteBibliographyOptions{##1usetime=#1}}% + \abx@dodates + \do{labeldate}} \DeclareBibliographyOption[string]{alldates}{% - \ExecuteBibliographyOptions{datelabel=#1}% \def\do##1{\ExecuteBibliographyOptions{##1=#1}}% - \abx@dodates} + \abx@dodates + \do{labeldate}} + +\DeclareBibliographyOption[string]{alltimes}{% + \def\do##1{% + \ExecuteBibliographyOptions{##1time=#1}}% + \abx@dodatetypes + \do{label}} +\newtoggle{blx@julian} +\def\blx@gregorianstart{1582-10-15} +\DeclareBibliographyOption[boolean]{julian}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{blx@julian}} + {\togglefalse{blx@julian}}} + +\DeclareBibliographyOption[string]{gregorianstart}{% + \def\blx@gregorianstart{#1}} + +\newtoggle{blx@datezeros}\toggletrue{blx@datezeros} \DeclareBibliographyOption[boolean]{datezeros}[true]{% \ifstrequal{#1}{true} - {\let\blx@imc@mkdatezeros\@firstofone} - {\let\blx@imc@mkdatezeros\blx@imc@stripzeros}} + {\toggletrue{blx@datezeros}% + \let\blx@imc@mkyearzeros\blx@imc@forcezerosy + \let\blx@imc@mkmonthzeros\blx@imc@forcezerosmdt + \let\blx@imc@mkdayzeros\blx@imc@forcezerosmdt} + {\togglefalse{blx@datezeros}% + \let\blx@imc@mkyearzeros\blx@imc@stripzeros + \let\blx@imc@mkmonthzeros\blx@imc@stripzeros + \let\blx@imc@mkdayzeros\blx@imc@stripzeros}} + +\newtoggle{blx@timezeros}\toggletrue{blx@timezeros} +\DeclareBibliographyOption[boolean]{timezeros}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{blx@timezeros}% + \let\blx@imc@mktimezeros\blx@imc@forcezerosmdt} + {\togglefalse{blx@timezeros}% + \let\blx@imc@mktimezeros\blx@imc@stripzeros}} + +\newtoggle{blx@timezones} +\DeclareBibliographyOption[boolean]{timezones}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{blx@timezones}} + {\togglefalse{blx@timezones}}} + +\newtoggle{blx@seconds} +\DeclareBibliographyOption[boolean]{seconds}[true]{% + \ifstrequal{#1}{true} + {\toggletrue{blx@seconds}} + {\togglefalse{blx@seconds}}} \DeclareBibliographyOption[string]{autocite}{% \ifcsundef{blx@acite@#1} @@ -11680,19 +12721,19 @@ \DeclareTypeOption[boolean]{labeltitleyear}[true]{% \settoggle{blx@labeltitleyear}{#1}} -\DeclareBibliographyOption[boolean]{labeldate}[true]{% - \settoggle{blx@labeldate}{#1}} -\DeclareTypeOption[boolean]{labeldate}[true]{% - \settoggle{blx@labeldate}{#1}} +\DeclareBibliographyOption[boolean]{labeldateparts}[true]{% + \settoggle{blx@labeldateparts}{#1}} +\DeclareTypeOption[boolean]{labeldateparts}[true]{% + \settoggle{blx@labeldateparts}{#1}} \DeclareBibliographyOption[boolean]{labelyear}[true]{% \blx@warning@noline{% - 'labelyear' option is deprecated, use 'labeldate' instead}% - \settoggle{blx@labeldate}{#1}} + 'labelyear' option is deprecated, use 'labeldateparts' instead}% + \settoggle{blx@labeldateparts}{#1}} \DeclareTypeOption[boolean]{labelyear}[true]{% \blx@warning@noline{% - 'labelyear' option is deprecated, use 'labeldate' instead}% - \settoggle{blx@labeldate}{#1}} + 'labelyear' option is deprecated, use 'labeldateparts' instead}% + \settoggle{blx@labeldateparts}{#1}} \DeclareBibliographyOption[boolean]{uniquelist}[true]{% \ifcsdef{blx@opt@uniquelist@#1} @@ -11741,6 +12782,16 @@ \DeclareTypeOption[boolean]{uniquetitle}[true]{% \settoggle{blx@uniquetitle}{#1}} +\DeclareBibliographyOption[boolean]{uniquebaretitle}[true]{% + \settoggle{blx@uniquebaretitle}{#1}} +\DeclareTypeOption[boolean]{uniquebaretitle}[true]{% + \settoggle{blx@uniquebaretitle}{#1}} + +\DeclareBibliographyOption[boolean]{uniquework}[true]{% + \settoggle{blx@uniquework}{#1}} +\DeclareTypeOption[boolean]{uniquework}[true]{% + \settoggle{blx@uniquework}{#1}} + \DeclareBibliographyOption[boolean]{uniqueprimaryauthor}[true]{% \settoggle{blx@uniqueprimaryauthor}{#1}} @@ -11909,42 +12960,37 @@ %% Initial setup % Set defaults - \setkeys{blx@opt@ldt}{style=numeric} \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, + 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, - date=comp,datelabel=year,origdate=comp,eventdate=comp,urldate=short, - autopunct=true,punctfont=false,defernumbers=false, + 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, - parentracker,maxparens=3,bibencoding=auto,bibwarn} + parentracker,maxparens=3,bibencoding=auto,bibwarn,timezones=false, + seconds=false,julian=false,labeltime=24h} % Load compatibility code - \blx@inputonce{blx-compat.def}{compatibility code}{}{}{}{} % Restore catcodes - \blx@catcodes \undef\blx@catcodes % Process load-time options - \ProcessOptions* % Switch to BibTeX support if requests - \iftoggle{blx@bibtex} {\blx@inputonce{blx-bibtex.def}{BibTeX backend compatibility}{}{}{}{}} {} % Load citation and bibliography styles, configuration file - \blx@inputonce{biblatex.def}{generic definitions}{}{}{}{} \iftoggle{blx@natbib} {\blx@inputonce{blx-natbib.def}{natbib compatibility}{}{}{}{}} @@ -11959,45 +13005,84 @@ \blx@inputonce{biblatex.cfg}{configuration file}{}{}{}{} % Process preamble options - \blx@processoptions % Deferred setup at end of preamble - \AtEndPreamble{% \blx@checkoptions@global \c@maxnames\blx@maxcitenames\relax \c@minnames\blx@mincitenames\relax \c@maxitems\blx@maxitems\relax \c@minitems\blx@minitems\relax - \iftoggle{blx@giveninits} + \iftoggle{abx@bool@xinits} {\ifnumequal\blx@uniquename\blx@opt@uniquename@full {\blx@warn@conflopt{% - 'giveninits' conflicts with 'uniquename=full'.\MessageBreak + '<namepart>inits' conflicts with 'uniquename=full'.\MessageBreak Setting 'uniquename=init'}% \setkeys{blx@opt@pre}{uniquename=init}} {}% \ifnumequal\blx@uniquename\blx@opt@uniquename@allfull {\blx@warn@conflopt{% - 'giveninits' conflicts with 'uniquename=allfull'.\MessageBreak + '<namepart>inits' conflicts with 'uniquename=allfull'.\MessageBreak Setting 'uniquename=allinit}% \setkeys{blx@opt@pre}{uniquename=allinit}} {}% \ifnumequal\blx@uniquename\blx@opt@uniquename@minfull {\blx@warn@conflopt{% - 'giveninits' conflicts with 'uniquename=minfull'.\MessageBreak + '<namepart>inits' conflicts with 'uniquename=minfull'.\MessageBreak Setting 'uniquename=mininit}% \setkeys{blx@opt@pre}{uniquename=mininit}} {}} {}% - \nottoggle{blx@labeldate} + \nottoggle{blx@labeldateparts} {\ifnumequal\blx@uniquelist\blx@opt@uniquelist@minyear {\blx@warn@conflopt{% - 'uniquelist=minyear' requires 'labeldate'.\MessageBreak + 'uniquelist=minyear' requires 'labeldateparts'.\MessageBreak Setting 'uniquelist=true'}% \setkeys{blx@opt@pre}{uniquelist}} {}} - {}} + {}% + \def\do#1{% + \ifcsstring{blx@dateformat@#1}{edtf} + {\StrCut{#1}{date}\blx@datetype\blx@tempnull + \ifdefstring\blx@dateera{astronomical}{} + {\blx@warn@conflopt{% + '#1=edtf' requires 'dateera=astronomical'.\MessageBreak + Setting 'dateera=astrononmical'}% + \setkeys{blx@opt@pre}{dateera=astronomical}}% + \ifcsstring{blx@timeformat@\blx@datetype time}{24h}% + {} + {\blx@warn@conflopt{% + '#1=edtf' requires '\blx@datetype time=24h'.\MessageBreak + Setting '\blx@datetype time=24h'}% + \setkeys{blx@opt@pre}{\blx@datetype time=24h}}% + \iftoggle{blx@julian} + {\blx@warn@conflopt{% + '#1=edtf' requires 'julian=false'.\MessageBreak + Setting 'julian=false'}% + \setkeys{blx@opt@pre}{julian=false}} + {}% + \nottoggle{blx@datezeros} + {\blx@warn@conflopt{% + '#1=edtf' requires 'datezeros=true'.\MessageBreak + Setting 'datezeros=true'}% + \setkeys{blx@opt@pre}{datezeros=true}} + {}% + \nottoggle{blx@timezeros} + {\blx@warn@conflopt{% + '#1=edtf' requires 'timezeros=true'.\MessageBreak + Setting 'timezeros=true'}% + \setkeys{blx@opt@pre}{timezeros=true}} + {}% + \nottoggle{blx@seconds} + {\blx@warn@conflopt{% + '#1=edtf' requires 'seconds=true'.\MessageBreak + Setting 'seconds=true'}% + \setkeys{blx@opt@pre}{seconds=true}} + {}} + {}}% + \abx@dodates + \do{labeldate}} \def\blx@checkencoding{% \ifdef\blx@texencoding |