diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex/biblatex2.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex/biblatex2.sty | 273 |
1 files changed, 219 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex/biblatex2.sty b/Master/texmf-dist/tex/latex/biblatex/biblatex2.sty index 621b68f047c..1a9542da6c6 100644 --- a/Master/texmf-dist/tex/latex/biblatex/biblatex2.sty +++ b/Master/texmf-dist/tex/latex/biblatex/biblatex2.sty @@ -415,6 +415,7 @@ \newtoggle{blx@skipentry} \newtoggle{blx@insert} \newtoggle{blx@lastins} +\newtoggle{blx@keepunit} \newtoggle{blx@debug} \newtoggle{blx@sortcase} \newtoggle{blx@sortupper} @@ -427,7 +428,7 @@ \newtoggle{blx@labelnumber} \newtoggle{blx@labeltitle} \newtoggle{blx@labeltitleyear} -\newtoggle{blx@labelyear} +\newtoggle{blx@labeldate} \newtoggle{blx@natbib} \newtoggle{blx@mcite} \newtoggle{blx@loadfiles} @@ -738,31 +739,36 @@ \PackageError{biblatex}{#1}{#2.}% \endgroup} -\protected\def\blx@warning#1{% - \begingroup - \blx@safe@actives - \PackageWarning{biblatex}{#1\blx@noline}% - \endgroup} \protected\def\blx@warning@noline#1{% \begingroup \blx@safe@actives \PackageWarningNoLine{biblatex}{#1}% \endgroup} +\let\blx@warning\blx@warning@noline +\AtEndOfPackage{ + \protected\def\blx@warning#1{% + \begingroup + \blx@safe@actives + \PackageWarning{biblatex}{#1}% + \endgroup}} + \protected\def\blx@warning@entry#1{% \ifdef\abx@field@entrykey {\blx@warning{#1\MessageBreak at entry '\abx@field@entrykey'}} {\blx@warning{#1}}} -\protected\def\blx@info#1{% - \begingroup - \blx@safe@actives - \PackageInfo{biblatex}{#1\blx@noline}% - \endgroup} -\def\blx@info@noline#1{% +\protected\def\blx@info@noline#1{% \begingroup \blx@safe@actives \PackageInfo{biblatex}{#1\@gobble}% \endgroup} +\let\blx@info\blx@info@noline +\AtEndOfPackage{ + \protected\def\blx@info#1{% + \begingroup + \blx@safe@actives + \PackageInfo{biblatex}{#1}% + \endgroup}} \let\blx@noline\@gobble \AtEndOfPackage{\let\blx@noline\@empty} @@ -2666,6 +2672,50 @@ \setcounter{mincompwidth}{1} \def\abx@rangeproclimit{100000} +% {<string>} +% This mustn't be robust as it's likely to be used mainly tests and so +% needs to be expandable +\newcommand*{\rangelen}[1]{% + \blx@rangelen@range#1\bibrangedash\bibrangedash&} + +\def\blx@rangelen@range#1\bibrangedash#2\bibrangedash#3&{% + \ifblank{#3} + {\blx@rangelen@hyphen#1--&} + {\ifblank{#2} + {0}% n\bibrangedash + {\ifblank{#1} + {0}% \bibrangedash n + {\blx@rangelen@check{#1}{#2}}}}} + +\def\blx@rangelen@hyphen#1-#2-#3&{% + \ifblank{#3} + {1}% n + {\ifblank{#2} + {\ifblank{#1} + {\let\blx@tempb\@empty} + {\def\blx@tempb{#1}}% + \blx@rangelen@hyphen@i#3&} + {\ifblank{#1} + {0}% -n + {\blx@rangelen@check{#1}{#2}}}}} + +\def\blx@rangelen@hyphen@i#1-#2&{% + \ifblank{#1#2} + {0}% n- + {\notblank{#1} + {\ifdefempty\blx@tempb + {0} + {\expandafter\blx@rangelen@check + \expandafter{\blx@tempb}{#1}}} + {\blx@rangelen@hyphen@i#2&}}} + +\def\blx@rangelen@check#1#2{% + \blx@imc@ifinteger{#1} + {\blx@imc@ifinteger{#2} + {\the\numexpr#2-#1\relax}% n-m + {0}} + {0}} + % <*>[<postpro>]{<string>} \newrobustcmd*{\mkcomprange}{% @@ -2897,6 +2947,7 @@ \global\togglefalse{blx@unit}% \global\togglefalse{blx@insert}% \global\togglefalse{blx@lastins}% + \global\togglefalse{blx@keepunit}% \global\let\blx@unitpunct\newunitpunct \blx@imc@resetpunctfont} @@ -2947,21 +2998,38 @@ \global\toggletrue{blx@block}}% \protected\def\blx@imc@newunit{% - \global\let\blx@unitpunct\newunitpunct - \global\toggletrue{blx@unit}}% + \iftoggle{blx@keepunit} + {} + {\global\let\blx@unitpunct\newunitpunct + \global\toggletrue{blx@unit}}} \protected\def\blx@imc@setunit{% \@ifstar\blx@setunit@i\blx@setunit} \long\def\blx@setunit#1{% - \long\gdef\blx@unitpunct{#1}% - \global\toggletrue{blx@unit}}% + \iftoggle{blx@keepunit} + {} + {\long\gdef\blx@unitpunct{#1}% + \global\toggletrue{blx@unit}}} \def\blx@setunit@i{% \iftoggle{blx@lastins} {\blx@setunit} {\@gobble}} +\protected\def\blx@imc@printunit{% + \@ifstar\blx@printunit@i\blx@printunit} + +\def\blx@printunit#1{% + \long\gdef\blx@unitpunct{#1\global\togglefalse{blx@keepunit}}% + \global\toggletrue{blx@keepunit}% + \global\toggletrue{blx@unit}} + +\def\blx@printunit@i{% + \iftoggle{blx@lastins} + {\blx@printunit} + {\@gobble}} + \protected\def\blx@imc@finentry{% \unspace\finentrypunct \blx@postpunct @@ -2988,8 +3056,8 @@ \savelistcs \savename \savenamecs \usedriver \ifinteger \ifnumeral \ifnumerals \ifpages \iffieldint \iffieldnum \iffieldnums \iffieldpages - \mkpageprefix \mkpagetotal \mkpagefirst - \newblock \newunit \setunit \finentry} + \mkpageprefix \mkpagetotal + \newblock \newunit \setunit \printunit \finentry} \appto\blx@blxinit{% \def\ifnatbibmode{\iftoggle{blx@natbib}}% @@ -3744,10 +3812,24 @@ \let\do\blx@entryset@i} \def\blx@entryset@i#1{% - \blx@imc@entrydata{#1}{% - \blx@entryset@precode - \blx@driver{\blx@imc@thefield{entrytype}} - \blx@entryset@postcode}} + \blx@ifdata{#1} + {\begingroup + \blx@resetdata + \blx@getdata{#1}% + \blx@entrysetcount + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \addtocounter{instcount}\@ne + \blx@execute + \blx@beglang + \blx@begunit + \blx@entryset@precode + \blx@driver{\blx@imc@thefield{entrytype}} + \blx@entryset@postcode + \blx@endunit + \blx@endlang + \endgroup} + {\blx@nounit}} \blx@regimcs{% \printtext \printfield \printlist \printnames \printfile @@ -4143,6 +4225,7 @@ \do{columns}% \do{line}% \do{lines}% + \do{nodate}% \do{verse}% \do{verses}% \do{section}% @@ -4165,8 +4248,8 @@ \do{datacd}% \do{audiocd}% \do{version}% - \do{doi}% \do{url}% + \do{urlfrom}% \do{urlseen}% \do{file}% \do{inpreparation}% @@ -4216,6 +4299,7 @@ \do{langbrazilian}% \do{langcatalan}% \do{langcroatian}% + \do{langczech}% \do{langdanish}% \do{langdutch}% \do{langenglish}% @@ -4234,6 +4318,7 @@ \do{frombrazilian}% \do{fromcatalan}% \do{fromcroatian}% + \do{fromczech}% \do{fromdanish}% \do{fromdutch}% \do{fromenglish}% @@ -4248,7 +4333,6 @@ \do{fromrussian}% \do{fromspanish}% \do{fromswedish}% - \do{countryct}% \do{countryde}% \do{countryep}% \do{countryeu}% @@ -4626,6 +4710,8 @@ \protected\def\blx@imc@printdate{} \protected\def\blx@imc@printdateextra{} +\protected\def\blx@imc@printdatelabel{} +\protected\def\blx@imc@printdateextralabel{} \protected\def\blx@imc@printurldate{} \protected\def\blx@imc@printeventdate{} \protected\def\blx@imc@printorigdate{} @@ -4648,8 +4734,8 @@ {\egroup#1}} \blx@regimcs{% - \printdate \printdateextra \printurldate \printeventdate - \printorigdate \stripzeros \mkdatezeros} + \printdate \printdateextra \printdatelabel \printdateextralabel + \printurldate \printeventdate \printorigdate \stripzeros \mkdatezeros} % {<language>}{<strings>} @@ -4668,6 +4754,7 @@ \def\blx@endlang{\endgroup} \let\blx@hook@endlang\@empty \let\blx@hook@initlang\@empty +\let\blx@imc@mainlang\@empty \def\blx@hyphenreset{% \ifcsundef{l@\blx@languagename} {} @@ -4700,6 +4787,7 @@ \csname\blx@thelangenv\expandafter\endcsname \expandafter{\abx@field@hyphenation}}}}} {}% + \def\blx@imc@mainlang{\select@language{\bbl@main@language}}% \blx@langsetup\bbl@main@language} {\blx@err@patch{'babel' package}% \blx@mknobabel}} @@ -4710,6 +4798,8 @@ {} {\blx@err@nolang{\blx@languagename}}} +\blx@regimcs{\mainlang} + \newrobustcmd*{\DeclareRedundantLanguages}[2]{% \begingroup \ifblank{#2} @@ -4764,7 +4854,7 @@ \def\regexp#1{\expandafter\zap@space\detokenize{#1} \@empty} % Have to do this otherwise the '~'s in the .bcf strings are not expanded -% This is done for the .bcf later in the style but since we have to do all the +% This is done for the .bcf later but since we have to do all the % data model things much earlier, have to set this here and reset on finishing \let\blx@tsave~ \let~\space @@ -4816,6 +4906,7 @@ % which need to be dealt with along with data model fields in places \def\abx@dointernalfields{% \do{childentrykey}% + \do{clonesourcekey}% \do{entrykey}% \do{entryset}% \do{entrysetcount}% @@ -4829,7 +4920,7 @@ \do{labelnumber}% \do{labeltitle}% \do{labeltitleyear}% - \do{labelyear}% + \do{labeldate}% \do{localnumber}% \do{namehash}% \do{prefixnumber}% @@ -5308,8 +5399,8 @@ \iftoggle{blx@labeltitleyear} {\blx@bbl@labeltitleyear} {}% - \iftoggle{blx@labelyear} - {\blx@bbl@labelyear} + \iftoggle{blx@labeldate} + {\blx@bbl@labeldate} {}% \blx@bbl@prefixnumber} {}% @@ -5348,7 +5439,7 @@ \csuse{abx@ffd@*@shorthandwidth}{\abx@field@shorthand}}}} \def\blx@bbl@labelnumber{% - % Used at endentry + % Used at endentry, when reading .bbl % only do this for the global sorting list otherwise we increment % the labelnumbers for each sortlist \ifdefstrequal{\blx@slist@name}{\blx@sorting} @@ -5417,7 +5508,7 @@ \global\c@maxextratitleyear\abx@field@extratitleyear\relax \fi}} -\def\blx@bbl@labelyear{% +\def\blx@bbl@labeldate{% \ifundef\abx@field@extrayear {} {\ifnum\abx@field@extrayear>\c@maxextrayear @@ -5506,11 +5597,17 @@ {} {\csgdef{blx@labelnumber@#3}{#4}}} +% Here we mustn't change the checksum if we used localnumbers from the +% .aux file as this means that deferred numbering is +% complete. Otherwise we get in an endless rerun loop because the +% checksum due to number changes is always different. \AtEndDocument{% \def\abx@aux@number#1#2#3#4{% \ifblank{#4} {} - {\blx@addchecksum{#1}{#4}}}} + {\nottoggle{blx@localnumber} + {\blx@addchecksum{#1}{#4}} + {}}}} \AtEndDocument{% % Here we run some tests to decide if we need to issue re-run @@ -5567,6 +5664,7 @@ {}% \endgroup} +% Called as part of bib output for an entry % Only used when defernumbers=true \def\blx@addlabelnumber{% \begingroup @@ -5585,7 +5683,13 @@ \blx@bbl@addentryfield{\abx@field@entrykey}{\the\c@refsection}% {localnumber}{\abx@field@localnumber}}% \listxadd\blx@localnumaux{\string\abx@aux@number{\the\c@instcount}{\abx@field@entrykey}{\the\c@refsection}{\abx@field@localnumber}}} - {}} + % If localnumbers were already in the .aux, add them + % again from the .aux. This prevents some cycling + % problems where pagebreaks change after localnumber + % settles down and then we need another run which then + % regenerates localnumber requiring another run but then + % the pagebreaks change back again ... etc. + {\listxadd\blx@localnumaux{\string\abx@aux@number{\the\c@instcount}{\abx@field@entrykey}{\the\c@refsection}{\abx@field@localnumber}}}} {}}% {}} {}% @@ -6174,6 +6278,10 @@ {} {\letcs\blx@tempa{blx@sbib@\blx@tempe}}}% \blx@safe@actives + % Must reset omitnumbers as it's a global macro and if we don't, any + % \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@rest@actives \csxappto{blx@xml@slistsbib}{\blx@xml@slist{entry}{\blx@tempe}{\blx@tempc}{\blx@tempd}}% @@ -6324,6 +6432,7 @@ \fi \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} @@ -6427,6 +6536,12 @@ \@onlypreamble\AtBeginBibliography \@onlypreamble\AtEveryBibitem +\newrobustcmd*{\AtNextBibliography}{% + \ifundef\blx@hook@bibinit@next + {\gdef\blx@hook@bibinit@next{\global\undef\blx@hook@bibinit@next}} + {}% + \gappto\blx@hook@bibinit@next} + % page tracker \def\blx@pagetracker@context{% @@ -7692,7 +7807,9 @@ {\blx@xsanitizeafter{\forcsvlist\blx@nocite@do}{#1}}}}% \@esphack} -\def\blx@nocite@do#1{\blx@citation{#1}\blx@msg@cundef} +\def\blx@nocite@do#1{% + \global\advance\csname blx@sectionciteorder@\the\c@refsection\endcsname\@ne + \blx@citation{#1}\blx@msg@cundef} % {<macro>}[<arg1>][<arg2>]{<arg3>} % => <macro>{<arg1>}{<arg2>}{<arg3>} @@ -8749,8 +8866,8 @@ \blx@xml@toggle{labeltitle}% \blx@xml@mvalue{labeltitlespec}{\blx@bcf@labeltitlespec}% \blx@xml@toggle{labeltitleyear}% - \blx@xml@toggle{labelyear}% - \blx@xml@mvalue{labelyearspec}{\blx@bcf@labelyearspec}% + \blx@xml@toggle{labeldate}% + \blx@xml@mvalue{labeldatespec}{\blx@bcf@labeldatespec}% \blx@xml@svalue{maxalphanames}{\blx@maxalphanames}% \blx@xml@svalue{maxbibnames}{\blx@maxbibnames}% \blx@xml@svalue{maxcitenames}{\blx@maxcitenames}% @@ -8785,11 +8902,11 @@ {\csuse{blx@bcf@labeltitlespec@#1}} {\blx@bcf@labeltitlespec}}% \blx@xml@toggle{labeltitleyear}% - \blx@xml@toggle{labelyear}% - \blx@xml@mvalue{labelyearspec}{% - \ifcsdef{blx@bcf@labelyearspec@#1} - {\csuse{blx@bcf@labelyearspec@#1}} - {\blx@bcf@labelyearspec}}% + \blx@xml@toggle{labeldate}% + \blx@xml@mvalue{labeldatespec}{% + \ifcsdef{blx@bcf@labeldatespec@#1} + {\csuse{blx@bcf@labeldatespec@#1}} + {\blx@bcf@labeldatespec}}% \blx@xml@svalue{maxalphanames}{\blx@maxalphanames}% \blx@xml@svalue{maxbibnames}{\blx@maxbibnames@type}% \blx@xml@svalue{maxcitenames}{\blx@maxcitenames@type}% @@ -9163,8 +9280,9 @@ \blx@xml@labelalpha@element{\the\blx@tempcnta}{\blx@tempb}}} \newcommand*{\blx@latem@literal}[1]{% + \blx@xmlsanitizeafter{\def\blx@temps}{#1}% \eappto\blx@tempb{% - \blx@xml@labelalpha@part{}{#1}}} + \blx@xml@labelalpha@part{}{\expandafter\regexp\expandafter{\blx@temps}}}} \newcommand*{\blx@latem@field}[2][]{% \let\blx@tempc\@empty @@ -9221,6 +9339,13 @@ \eappto\blx@tempc{ ifnamecount="#1"}} \define@key{blx@latem@field}{names}{% \eappto\blx@tempc{ namecount="#1"}} +\define@key{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 + \ifstrequal{#1}{left} + {\eappto\blx@tempc{ pad\string_side="left"}} + {\eappto\blx@tempc{ pad\string_side="right"}}} % [<exceptions>]{<options>} @@ -9456,18 +9581,23 @@ \@onlypreamble\DeclareLabeltitle \newrobustcmd*{\DeclareLabelyear}[2][]{% + \blx@warning@noline{% + 'DeclareLabelyear' is deprecated, please use 'DeclareLabeldate'}} + +\newrobustcmd*{\DeclareLabeldate}[2][]{% \begingroup \let\blx@tempa\@empty - \def\blx@tempb{labelyearspec}% - \let\field\blx@ordered@field + \def\blx@tempb{labeldatespec}% + \let\field\blx@orderedld@field + \let\literal\blx@orderedld@literal \ifblank{#1} - {\global\cslet{blx@bcf@labelyearspec}\@empty} + {\global\cslet{blx@bcf@labeldatespec}\@empty} {\def\blx@tempa{#1}% - \def\do##1{\global\cslet{blx@bcf@labelyearspec@##1}\@empty}% + \def\do##1{\global\cslet{blx@bcf@labeldatespec@##1}\@empty}% \expandafter\docsvlist\expandafter{#1}}% #2% \endgroup} -\@onlypreamble\DeclareLabelyear +\@onlypreamble\DeclareLabeldate \newcommand*{\blx@ordered@field}[2][]{% \let\blx@tempc\@empty @@ -9481,6 +9611,26 @@ \csxappto{blx@bcf@\blx@tempb @##1}{\noexpand\blx@xml@ordered{\the\blx@tempcnta}{\blx@tempc}{#2}}}% \expandafter\docsvlist\expandafter{\blx@tempa}}} +\newcommand*{\blx@orderedld@field}[2][]{% + \let\blx@tempc\@empty + \ifblank{#1} + {} + {\setkeys{blx@ordered@field}{#1}}% + \advance\blx@tempcnta\@ne + \ifdefempty{\blx@tempa} + {\csxappto{blx@bcf@\blx@tempb}{\noexpand\blx@xml@ordered{\the\blx@tempcnta}{ type="field"\blx@tempc}{#2}}} + {\def\do##1{\blx@addtypeopt{##1}% + \csxappto{blx@bcf@\blx@tempb @##1}{\noexpand\blx@xml@ordered{\the\blx@tempcnta}{\blx@tempc}{#2}}}% + \expandafter\docsvlist\expandafter{\blx@tempa}}} + +\newcommand*{\blx@orderedld@literal}[1]{% + \advance\blx@tempcnta\@ne + \ifdefempty{\blx@tempa} + {\csxappto{blx@bcf@\blx@tempb}{\noexpand\blx@xml@ordered{\the\blx@tempcnta}{ type="string"}{#1}}} + {\def\do##1{\blx@addtypeopt{##1}% + \csxappto{blx@bcf@\blx@tempb @##1}{\noexpand\blx@xml@ordered{\the\blx@tempcnta}{ type="string"}{#1}}}% + \expandafter\docsvlist\expandafter{\blx@tempa}}} + \define@key{blx@ordered@field}{form}{% \appto\blx@tempc{ form="#1"}} \define@key{blx@ordered@field}{lang}{% @@ -10124,6 +10274,12 @@ \protected\def\blx@imc@printdateextra{\csuse{mkbibrange#1extra}{}}} {\blx@err@invopt{date=#1}{}}} +\DeclareBibliographyOption{datelabel}{% + \ifcsdef{mkbibrange#1} + {\protected\def\blx@imc@printdatelabel{\csuse{mkbibrange#1}{label}}% + \protected\def\blx@imc@printdateextralabel{\csuse{mkbibrange#1extra}{label}}} + {\blx@err@invopt{datelabel=#1}{}}} + \DeclareBibliographyOption{urldate}{% \ifcsdef{mkbibrange#1} {\protected\def\blx@imc@printurldate{\csuse{mkbibrange#1}{url}}} @@ -10140,7 +10296,7 @@ {\blx@err@invopt{origdate=#1}{}}} \DeclareBibliographyOption{alldates}{% - \ExecuteBibliographyOptions{date=#1,urldate=#1,eventdate=#1,origdate=#1}} + \ExecuteBibliographyOptions{date=#1,datelabel=#1,urldate=#1,eventdate=#1,origdate=#1}} \DeclareBibliographyOption{datezeros}[true]{% \ifstrequal{#1}{true} @@ -10197,10 +10353,19 @@ \DeclareTypeOption{labeltitleyear}[true]{% \settoggle{blx@labeltitleyear}{#1}} +\DeclareBibliographyOption{labeldate}[true]{% + \settoggle{blx@labeldate}{#1}} +\DeclareTypeOption{labeldate}[true]{% + \settoggle{blx@labeldate}{#1}} + \DeclareBibliographyOption{labelyear}[true]{% - \settoggle{blx@labelyear}{#1}} + \blx@warning@noline{% + 'labelyear' option is deprecated, use 'labeldate' instead}% + \settoggle{blx@labeldate}{#1}} \DeclareTypeOption{labelyear}[true]{% - \settoggle{blx@labelyear}{#1}} + \blx@warning@noline{% + 'labelyear' option is deprecated, use 'labeldate' instead}% + \settoggle{blx@labeldate}{#1}} \DeclareBibliographyOption{uniquelist}[true]{% \ifcsdef{blx@opt@uniquelist@#1} @@ -10415,7 +10580,7 @@ backref=false,backrefsetstyle=setonly,pagetracker=false,ibidtracker=false, idemtracker=false,opcittracker=false,loccittracker=false,citetracker=false, citecounter=false,block=none,language=auto,clearlang=true,babel=none, - date=comp,origdate=comp,eventdate=comp,urldate=short,autopunct=true, + date=comp,datelabel=comp,origdate=comp,eventdate=comp,urldate=short,autopunct=true, punctfont=false,defernumbers=false,refsection=none,refsegment=none, citereset=none,hyperref=auto,parentracker,maxparens=3, bibencoding=auto,bibwarn} @@ -10480,10 +10645,10 @@ \setkeys{blx@opt@pre}{uniquename=mininit}} {}} {}% - \nottoggle{blx@labelyear} + \nottoggle{blx@labeldate} {\ifnumequal\blx@uniquelist\blx@opt@uniquelist@minyear {\blx@warn@conflopt{% - 'uniquelist=minyear' requires 'labelyear'.\MessageBreak + 'uniquelist=minyear' requires 'labeldate'.\MessageBreak Setting 'uniquelist=true'}% \setkeys{blx@opt@pre}{uniquelist}} {}} |