diff options
author | Karl Berry <karl@freefriends.org> | 2011-01-08 00:40:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-01-08 00:40:13 +0000 |
commit | 686b506d441e4258181e3c918e94f3bc767b9b34 (patch) | |
tree | 76447946afa14a129ad641b43ec73b7bcbbacc85 /Master/texmf-dist/tex/latex/biblatex/biblatex.sty | |
parent | 3fa71c8703f40728cf20c8d9f6ed721cbe9bfd44 (diff) |
biblatex 1.1 (5jan11)
git-svn-id: svn://tug.org/texlive/trunk@20968 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex/biblatex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/biblatex/biblatex.sty | 1492 |
1 files changed, 883 insertions, 609 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty index cb8272e6568..47318578479 100644 --- a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty +++ b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty @@ -1,6 +1,6 @@ -% $Id: biblatex.sty,v 1.0 2010/11/19 16:16:35 lehman stable $ +% $Id: biblatex.sty,v 1.1 2011/01/05 21:45:11 lehman stable $ -% Copyright (c) 2006-2010 Philipp Lehman. +% Copyright (c) 2006-2011 Philipp Lehman. % % Permission is granted to copy, distribute and/or modify this % software under the terms of the LaTeX Project Public License @@ -21,13 +21,13 @@ \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{biblatex} -[\abx@rcsid $Id: biblatex.sty,v 1.0 2010/11/19 16:16:35 lehman stable $ +[\abx@rcsid $Id: biblatex.sty,v 1.1 2011/01/05 21:45:11 lehman stable $ programmable bibliographies] \def\blx@bblversion$#1: #2 ${#2} -\edef\blx@bblversion{\blx@bblversion$Revision: 1.0 $} +\edef\blx@bblversion{\blx@bblversion$Revision: 1.1 $} -%% Compatibility and requirements +%% Dependencies \RequirePackage{etoolbox} \RequirePackage{keyval} @@ -35,15 +35,38 @@ \RequirePackage{ifthen} \RequirePackage{url} -\@ifpackagelater{etoolbox}{2010/08/21} +\@ifpackagelater{etoolbox}{2010/11/29} {} {\PackageError{biblatex} {Outdated 'etoolbox' package} - {Upgrade to etoolbox v2.0 (2010/08/21) or later.\MessageBreak + {Upgrade to etoolbox v2.1 (2010/11/29) or later.\MessageBreak I found: '\csuse{ver@etoolbox.sty}'.\MessageBreak This is a fatal error. I'm aborting now.}% \endinput} +%% Category codes + +\def\blx@docatcodes{% + \do\=\do\<\do\>\do\-\do\"\do\'\do\`\do\.% + \do\,\do\;\do\:\do\!\do\?\do\/} +\def\do#1{\catcode\number`#1=\the\catcode`#1\relax} +\edef\blx@catcodes{\blx@docatcodes\do\^\do\~\do\&\do\|} +\let\do\noexpand + +\def\blx@saneccodes{% + \catcode`\~=\active + \let\do\@makeother + \blx@docatcodes + \let\do\noexpand} + +\blx@saneccodes +\catcode`\&=3 +\catcode`\|=3 +\catcode`\^=7 +\def\blx@nl{^^J} + +%% Compatibility + \AtEndPreamble{% \def\do#1{% \@ifpackageloaded{#1} @@ -183,14 +206,14 @@ {Outdated 'csquotes' package} {Upgrade to csquotes v4.4 (2009/05/30) or later.\MessageBreak I found: '\csuse{ver@csquotes.sty}'}}% + \BlockquoteDisable{\let\blx@thecheckpunct\@gobble}% \@ifpackagelater{csquotes}{2009/08/27} {\appto\@blockquote@prehook{\abx@savetrackers}% \appto\@blockquote@posthook{\abx@resttrackers\abx@cleartrackers}} - {\BlockquoteDisable{\let\blx@thecheckpunct\@gobble}}% + {}% \@ifpackagelater{csquotes}{2010/06/09} {} - {\newcommand*{\@quotereset}{}% - \newcount\@quotereset}} + {\newcommand*{\@quotereset}{}\newcount\@quotereset}} {\@ifpackageloaded{babel} {\blx@warning@noline{% 'babel' detected but 'csquotes' missing.\MessageBreak @@ -228,29 +251,30 @@ \appto\blx@setsfcodes{% \sfcode`\`=\z@ \sfcode`\'=\z@}}% - \addtocontents{toc}{% - \string\boolfalse{citerequest}% - \string\boolfalse{citetracker}% - \string\boolfalse{pagetracker}% - \string\boolfalse{backtracker}}% - \addtocontents{lof}{% - \string\boolfalse{citerequest}% - \string\boolfalse{citetracker}% - \string\boolfalse{pagetracker}% - \string\boolfalse{backtracker}}% - \addtocontents{lot}{% - \string\boolfalse{citerequest}% - \string\boolfalse{citetracker}% - \string\boolfalse{pagetracker}% - \string\boolfalse{backtracker}}% \let\do\noexpand} \begingroup \@makeother\# +% \relax: gobble newline -> titletoc.sty \AtEndPreamble{% + \addtocontents{toc}{% + \boolfalse{citerequest}% + \boolfalse{citetracker}% + \boolfalse{pagetracker}% + \boolfalse{backtracker}\relax}% + \addtocontents{lof}{% + \boolfalse{citerequest}% + \boolfalse{citetracker}% + \boolfalse{pagetracker}% + \boolfalse{backtracker}\relax}% + \addtocontents{lot}{% + \boolfalse{citerequest}% + \boolfalse{citetracker}% + \boolfalse{pagetracker}% + \boolfalse{backtracker}\relax}% \patchcmd\addtocontents {\string\@writefile} - {\string\@writefile{#1}{\string\defcounter{refsection}{\the\c@refsection}}\blx@nl + {\string\@writefile{#1}{\defcounter{refsection}{\the\c@refsection}\relax}% \string\@writefile} {} {\blx@err@patch{\string\addtocontents}}} @@ -261,27 +285,6 @@ % trick showkeys into believing we're havard \let\HAR@checkdef\@empty -%% Category codes - -\def\blx@docatcodes{% - \do\=\do\<\do\>\do\-\do\"\do\'\do\`\do\.% - \do\,\do\;\do\:\do\!\do\?\do\/} -\def\do#1{\catcode\number`#1=\the\catcode`#1\relax} -\edef\blx@catcodes{\blx@docatcodes\do\^\do\~\do\&\do\|} -\let\do\noexpand - -\def\blx@saneccodes{% - \catcode`\~=\active - \let\do\@makeother - \blx@docatcodes - \let\do\noexpand} - -\blx@saneccodes -\catcode`\&=3 -\catcode`\|=3 -\catcode`\^=7 -\def\blx@nl{^^J} - %% Allocation \providecommand{\@gobblefive}[5]{} @@ -314,6 +317,8 @@ \def\theminitems{\the\c@minitems} \newcounter{uniquename} \def\theuniquename{\the\c@uniquename} +\newcounter{saveduniquename} +\def\thesaveduniquename{\the\c@saveduniquename} \newcounter{refsection} \def\therefsection{\the\c@refsection} \newcounter{refsegment} @@ -341,6 +346,13 @@ \newcount\blx@parenlevel@text \newcount\blx@parenlevel@foot +\def\blx@backend{0} +\def\blx@uniquename{0} +\def\blx@maxbibnames{\c@maxnames} +\def\blx@minbibnames{\c@minnames} +\def\blx@maxcitenames{\c@maxnames} +\def\blx@mincitenames{\c@minnames} + \newlength{\labelnumberwidth} \newlength{\labelalphawidth} \newlength{\shorthandwidth} @@ -365,6 +377,7 @@ \newtoggle{blx@runbtx} \newtoggle{blx@block} \newtoggle{blx@unit} +\newtoggle{blx@skipentry} \newtoggle{blx@insert} \newtoggle{blx@lastins} \newtoggle{blx@debug} @@ -379,6 +392,7 @@ \newtoggle{blx@labelnumber} \newtoggle{blx@labelyear} \newtoggle{blx@natbib} +\newtoggle{blx@mcite} \newtoggle{blx@loadfiles} \newtoggle{blx@singletitle} \newtoggle{blx@terseinits} @@ -399,9 +413,6 @@ \newtoggle{blx@citeindex} \newtoggle{blx@bibindex} -\def\blx@backend{0} -\def\blx@uniquename{0} - \newread\blx@auxin \newwrite\blx@auxout @@ -421,6 +432,7 @@ \edef\blx@auxfile@bibtex{\jobname} \let\blx@auxout@bibtex\@mainaux \newcommand*{\labelalphaothers}{+} +\newcommand*{\sortalphaothers}{\labelalphaothers} \newcommand*{\blxauxsuffix}{-blx} \begingroup @@ -545,6 +557,37 @@ \blx@safe@actives \let\protect\string} +% {<code>}{<string>} => <code>{<string>} + +\begingroup +\catcode`\<=\active +\catcode`\>=\active +\catcode`\&=\active +\catcode`\"=\active +\catcode`\'=\active +\protected\gdef\blx@xmlsanitizeafter#1#2{% + \begingroup + \abx@hook@xsanitize + \def\blx@tempa{\endgroup#1}% + \edef\blx@tempb{#2}% + \let\do\@makeother\dospecials + \catcode`\<=\active + \catcode`\>=\active + \catcode`\&=\active + \catcode`\"=\active + \catcode`\'=\active + \edef<{\string<\string;}% + \edef>{\string>\string;}% + \edef&{\string&\string;}% + \edef"{\string"\string;}% + \edef'{\string&apos\string;}% + \endlinechar\m@ne + \everyeof{\noexpand}% + \edef\blx@tempb{\scantokens\expandafter{\blx@tempb}}% + \expandafter\blx@tempa + \expandafter{\detokenize\expandafter{\blx@tempb}}} +\endgroup + % {<file>}{<message>}{<preload>}{<postload>}{<success>}{<failure>} \protected\long\def\blx@inputonce#1#2#3#4#5#6{% @@ -870,6 +913,32 @@ \def\blx@msg@cundefon#1{% Citation '#1' on page \the\c@page\space undefined} +\newrobustcmd*{\RequireBiber}[1][2]{% + \ifnumgreater{#1}\blx@reqbiber + {\numgdef\blx@reqbiber{#1}} + {}} +\@onlypreamble\RequireBiber +\let\blx@reqbiber\z@ + +\def\blx@checkbackend#1{% + \ifnumequal\blx@backend\blx@backend@biber + {} + {\ifcase\blx@reqbiber + \or + \blx@info@noline{% + backend=biber recommended by #1}% + \or + \blx@warning@noline{% + backend=biber required by #1.\MessageBreak + Some features may not work properly}% + \else + \blx@error + {backend=biber required by #1} + {The selected style or one of the .bib files + requires backend=biber.\MessageBreak It will + not work at all with any other backend}% + \fi}} + % \blx@list@active active aux files (basename) % [internal list] % \blx@list@inactive inactive aux files (basename) @@ -2169,19 +2238,14 @@ {\blx@imc@iffieldequals{fullhash}\blx@lasthash@foot} {\blx@imc@iffieldequals{fullhash}\blx@lasthash@text}} -\def\blx@ifciteidem@strict{% - \blx@ifcitesingle - {\blx@ifciteidem@global} - {\@secondoftwo}}% +\let\blx@ifciteidem@strict\blx@ifciteidem@global \def\blx@ifciteidem@constrict{% - \blx@ifcitesingle - {\iftoggle{blx@footnote} - {\blx@ifmpfncheck - {\blx@imc@iffieldequals{fullhash}\blx@lasthash@foot} - {\@secondoftwo}} - {\blx@imc@iffieldequals{fullhash}\blx@lasthash@text}} - {\@secondoftwo}}% + \iftoggle{blx@footnote} + {\blx@ifmpfncheck + {\blx@imc@iffieldequals{fullhash}\blx@lasthash@foot} + {\@secondoftwo}} + {\blx@imc@iffieldequals{fullhash}\blx@lasthash@text}} % {<true>}{<false>} @@ -3018,12 +3082,80 @@ %% Main formatting commands -% {<name>}{<definition>} +% [<entrytype>]{<name>}{<definiton>} + +\newrobustcmd*{\DeclareNameFormat}{% + \@ifstar + {\blx@defformat\blx@defnameformat{nfd}*} + {\blx@defformat\blx@defnameformat{nfd}{}}} +\newrobustcmd*{\DeclareIndexNameFormat}{% + \@ifstar + {\blx@defformat\blx@defnameformat{nid}*} + {\blx@defformat\blx@defnameformat{nid}{}}} + +\newrobustcmd*{\DeclareListFormat}{% + \@ifstar + {\blx@defformat\blx@defplainformat{lfd}*} + {\blx@defformat\blx@defplainformat{lfd}{}}} +\newrobustcmd*{\DeclareIndexListFormat}{% + \@ifstar + {\blx@defformat\blx@defplainformat{lid}*} + {\blx@defformat\blx@defplainformat{lid}{}}} + +\newrobustcmd*{\DeclareFieldFormat}{% + \@ifstar + {\blx@defformat\blx@defplainformat{ffd}*} + {\blx@defformat\blx@defplainformat{ffd}{}}} +\newrobustcmd*{\DeclareIndexFieldFormat}{% + \@ifstar + {\blx@defformat\blx@defplainformat{fid}*} + {\blx@defformat\blx@defplainformat{fid}{}}} + +% {<macro>}{<class>}{<*>} + +\def\blx@defformat#1#2#3{% + \@ifnextchar[%] + {\blx@defformat@i{#1}{#2}{#3}} + {\blx@defformat@i{#1}{#2}{#3}[*]}} + +% {<macro>}{<class>}{<*>}[<entrytype>]{<name>} + +\def\blx@defformat@i#1#2#3[#4]#5{% + \notblank{#3} + {\blx@resetformat{#2}{#5}} + {}% + \def\blx@defformat@a{#2}% + \def\blx@defformat@b{#4}% + \blx@xsanitizeafter{\def\blx@defformat@c}{#5}% + \afterassignment\blx@defformat@ii + #1} + +\def\blx@defformat@ii{% + \expandafter\forcsvlist + \expandafter\blx@defformat@iii + \expandafter{\blx@defformat@b}} + +\def\blx@defformat@iii#1{% + \cslet{abx@\blx@defformat@a @#1@\blx@defformat@c}\blx@defformat@d} + +\def\blx@defplainformat{% + \long\def\blx@defformat@d##1} + +\def\blx@defnameformat{% + \long\def\blx@defformat@d##1##2##3##4##5##6##7##8} -\def\blx@defformat#1{% +\def\blx@resetformat#1#2{% + \let\blx@saved@do\do + \def\do##1{\blx@resetformat@i{#1}{#2}{##1}}% \blx@safe@actives - \afterassignment\blx@rest@actives - \long\csdef{#1}} + \abx@dotypes + \blx@rest@actives + \let\do\blx@saved@do} + +\def\blx@resetformat@i#1#2#3{% + \ifcsdef{abx@#1@#3@#2} + {\csundef{abx@#1@#3@#2}} + {}} % {<name>}{<name>} @@ -3073,23 +3205,6 @@ \newrobustcmd*{\restorelistformat}[2][*]{\blx@restore{abx@lfd@#1@#2}} \newrobustcmd*{\restorenameformat}[2][*]{\blx@restore{abx@nfd@#1@#2}} -% [<entrytype>]{<name>}{<definiton>} - -\newrobustcmd*{\DeclareNameFormat}[2][*]{% - \blx@defformat{abx@nfd@#1@#2}##1##2##3##4##5##6##7##8} -\newrobustcmd*{\DeclareIndexNameFormat}[2][*]{% - \blx@defformat{abx@nid@#1@#2}##1##2##3##4##5##6##7##8} - -\newrobustcmd*{\DeclareListFormat}[2][*]{% - \blx@defformat{abx@lfd@#1@#2}##1} -\newrobustcmd*{\DeclareIndexListFormat}[2][*]{% - \blx@defformat{abx@lid@#1@#2}##1} - -\newrobustcmd*{\DeclareFieldFormat}[2][*]{% - \blx@defformat{abx@ffd@#1@#2}##1} -\newrobustcmd*{\DeclareIndexFieldFormat}[2][*]{% - \blx@defformat{abx@fid@#1@#2}##1} - % [<entrytype>]{<alias>}[<entrytype>]{<name>} \newrobustcmd*{\DeclareNameAlias}{\blx@defalias{nfd}} @@ -3343,22 +3458,25 @@ \long\def\blx@listbreak#1&{} -% {<key>}{<code>} +% <*>{<key>}{<code>} \protected\def\blx@imc@entrydata{% - \blx@xsanitizeafter\blx@imc@entrydata@i} + \@ifstar + {\blx@xsanitizeafter{\blx@imc@entrydata@i\blx@saveentry}} + {\blx@xsanitizeafter{\blx@imc@entrydata@i{}}}} -\long\def\blx@imc@entrydata@i#1#2{% - \blx@ifdata{#1} +\long\def\blx@imc@entrydata@i#1#2#3{% + \blx@ifdata{#2} {\begingroup + #1% \blx@resetdata - \blx@getdata{#1}% + \blx@getdata{#2}% \blx@entrysetcount \blx@setoptions@type\abx@field@entrytype \blx@setoptions@entry \addtocounter{instcount}\@ne \blx@execute - \blx@beglang#2\blx@endlang + \blx@beglang#3\blx@endlang \endgroup} {}} @@ -3366,8 +3484,8 @@ \blx@imc@iffieldundef{entrykey} {} {\begingroup - \long\def\blx@set@precode{#1}% - \long\def\blx@set@postcode{#2}% + \long\def\blx@entryset@precode{#1}% + \long\def\blx@entryset@postcode{#2}% \let\finentry\blx@finentry@inset \let\do\blx@entryset \blx@imc@docsvfield{entryset}% @@ -3379,18 +3497,18 @@ \blx@imc@clearlist{pageref}% \blx@getdata{#1}% \def\abx@field@entrysetcount{1}% - \blx@set@precode + \blx@entryset@precode \blx@driver{\blx@imc@thefield{entrytype}}% - \blx@set@postcode + \blx@entryset@postcode \endgroup} {}% \let\do\blx@entryset@i} \def\blx@entryset@i#1{% \blx@imc@entrydata{#1}{% - \blx@set@precode + \blx@entryset@precode \blx@driver{\blx@imc@thefield{entrytype}} - \blx@set@postcode}} + \blx@entryset@postcode}} \blx@regimcs{% \printtext \printfield \printlist \printnames \printfile @@ -4306,6 +4424,53 @@ %% Bibtex data interface +\def\abx@dotypes{% + \do{set}% + \do{article}% + \do{book}% + \do{bookinbook}% + \do{booklet}% + \do{collection}% + \do{inbook}% + \do{incollection}% + \do{inproceedings}% + \do{manual}% + \do{misc}% + \do{online}% + \do{patent}% + \do{periodical}% + \do{proceedings}% + \do{report}% + \do{suppbook}% + \do{suppcollection}% + \do{suppperiodical}% + \do{thesis}% + \do{unpublished}% + \do{artwork}% + \do{audio}% + \do{commentary}% + \do{image}% + \do{inreference}% + \do{jurisdiction}% + \do{legal}% + \do{legislation}% + \do{letter}% + \do{movie}% + \do{music}% + \do{performance}% + \do{reference}% + \do{review}% + \do{software}% + \do{standard}% + \do{video}% + \do{customa}% + \do{customb}% + \do{customc}% + \do{customd}% + \do{custome}% + \do{customf}% +} + \def\abx@donames{% \do{labelname}% \do{author}% @@ -4346,14 +4511,16 @@ } \def\abx@dofields{% + \do{crossref}% + \do{xref}% \do{entrykey}% \do{childentrykey}% \do{entrytype}% \do{entrysubtype}% \do{entryset}% \do{entrysetcount}% - \do{crossref}% - \do{xref}% + \do{related}% + \do{relatedtype}% \do{hyphenation}% \do{keywords}% \do{authortype}% @@ -4478,7 +4645,9 @@ \def\do#1{% \newcounter{#1}% + \newcounter{saved#1}% \csedef{the#1}{\noexpand\the\expandonce{\csname c@#1\endcsname}}% + \csedef{thesaved#1}{\noexpand\the\expandonce{\csname c@saved#1\endcsname}}% \appto\abx@dobooleans{\do{more#1}}} \abx@donames \abx@dolists @@ -4486,7 +4655,7 @@ \abx@dobooleans \protected\def\blx@resetdata{% - \let\blx@savedo\do + \let\blx@saved@do\do \let\do\blx@imc@clearname \abx@donames \let\do\blx@imc@clearlist @@ -4496,7 +4665,36 @@ \def\do##1{\togglefalse{abx@bool@##1}}% \abx@dobooleans \c@uniquename\z@ - \let\do\blx@savedo} + \let\do\blx@saved@do} + +\protected\def\blx@saveentry{% + \let\blx@saved@do\do + \let\do\blx@savename + \abx@donames + \let\do\blx@savelist + \abx@dolists + \let\do\blx@savefield + \abx@dofields\do{execute}\do{options}% + \let\do\blx@savebool + \abx@dobooleans + \c@saveduniquename\c@uniquename + \let\do\blx@saved@do} + +\protected\def\blx@savename#1{% + \csletcs{etb@tgl@abx@bool@moresaved#1}{etb@tgl@abx@bool@more#1}% + \csletcs{abx@name@saved#1}{abx@name@#1}% + \csname c@saved#1\endcsname\csname c@#1\endcsname} + +\protected\def\blx@savelist#1{% + \csletcs{etb@tgl@abx@bool@moresaved#1}{etb@tgl@abx@bool@more#1}% + \csletcs{abx@list@saved#1}{abx@list@#1}% + \csname c@saved#1\endcsname\csname c@#1\endcsname} + +\protected\def\blx@savefield#1{% + \csletcs{abx@field@saved#1}{abx@field@#1}} + +\protected\def\blx@savebool#1{% + \csletcs{abx@bool@saved#1}{abx@bool@#1}} % {<code>} @@ -4691,14 +4889,14 @@ % {<entrykey>} -\protected\def\blx@bbl@xref#1{% +\protected\def\blx@bbl@xref#1{% BibTeX only \ifcsdef{blx@refp@\the\c@refsection @\detokenize{#1}} {} {\listcsxadd{blx@refs@\the\c@refsection}{\detokenize{#1}}}% \listcsxadd{blx@refp@\the\c@refsection @\detokenize{#1}}{\abx@field@entrykey}% \csxdef{blx@refc@\the\c@refsection @\abx@field@entrykey}{\detokenize{#1}}} -\def\blx@addxref#1{% +\def\blx@addxref#1{% BibTeX only \blx@ifdata{#1} {\begingroup \def\do##1{% @@ -4767,6 +4965,8 @@ % section -> keys [internal list] % \blx@catg@<category> category hash, global % category -> keys [internal list] +% \blx@set@<section>@<entrykey> parent -> child mapping (dynamic entry sets) +% key -> key,key,... [csv list] % \blx@setp@<section>@<entrykey> parent -> child mapping (entry sets) % key -> key,key,... [csv list] % \blx@setc@<section>@<entrykey> child -> parent mapping (entry sets) @@ -4777,10 +4977,13 @@ % key -> pages [internal list] % \blx@refs@<section> xref hash, temporary % section -> parents [internal list] +% (BibTeX only) % \blx@refp@<section>@<entrykey> parent -> child mapping (xrefs), temporary % key -> keys [internal list] +% (BibTeX only) % \blx@refc@<section>@<entrykey> child -> parent mapping (xrefs) % key -> key [internal list] +% (BibTeX only) \def\blx@ifdata#1{% \ifcsdef{blx@data@\the\c@refsection @#1}} @@ -4866,24 +5069,23 @@ \ifcsundef{blx@pref@\the\c@refsection @\abx@field@entrykey} {} {\blx@addpageref{\abx@field@entrykey}}% - \iftoggle{blx@setonly} + \nottoggle{blx@setonly} + {\listcsxadd{blx@sort@\the\c@refsection}{\abx@field@entrykey}} {\global\toggletrue{blx@addset}% \toggletrue{blx@skipbib}% \toggletrue{blx@skiplos}% - \toggletrue{blx@skiplab}} - {\listcsxadd{blx@sort@\the\c@refsection}{\abx@field@entrykey}}% - \iftoggle{blx@skipbib} - {} + \toggletrue{blx@skiplab}}% + \nottoggle{blx@skipbib} {\listcsxadd{blx@sbib@\the\c@refsection}{\abx@field@entrykey}% \listcsxadd{blx@type@\the\c@refsection @\abx@field@entrytype}{\abx@field@entrykey}% \ifdef\abx@field@entrysubtype {\listcsxadd{blx@subt@\the\c@refsection @\abx@field@entrysubtype}{\abx@field@entrykey}} - {}}% - \iftoggle{blx@skiplos} - {} - {\blx@bbl@shorthand}% - \iftoggle{blx@skiplab} - {} + {}} + {}% + \nottoggle{blx@skiplos} + {\blx@bbl@shorthand} + {}% + \nottoggle{blx@skiplab} {\iftoggle{blx@labelnumber} {\blx@bbl@labelnumber} {}% @@ -4892,8 +5094,12 @@ {}% \iftoggle{blx@labelyear} {\blx@bbl@labelyear} - {}}% - \blx@bbl@labelname + {}% + \blx@bbl@prefixnumber} + {}% + \ifnumless\blx@backend\blx@backend@biber + {\blx@bbl@labelname} + {}% \blx@bbl@titles \blx@bbl@hooks \endgroup} @@ -4939,14 +5145,17 @@ {\blx@setlabwidth{\labelnumberwidth}{% \csuse{abx@ffd@*@labelnumberwidth}{% \ifdef\abx@field@prefixnumber - {\abx@field@prefixnumber\abx@field@localnumber} - {\abx@field@localnumber}}}}} + {\csuse{abx@ffd@*@prefixnumber}{\abx@field@prefixnumber}} + {}% + \abx@field@localnumber}}}} {\csgappto\blx@bbl@data{% \let\abx@field@labelnumber\abx@field@shorthand}% \iftoggle{blx@skipbib} {} {\blx@setlabwidth{\labelnumberwidth}{% - \csuse{abx@ffd@*@labelnumberwidth}{\abx@field@shorthand}}}}}% + \csuse{abx@ffd@*@labelnumberwidth}{\abx@field@shorthand}}}}}} + +\def\blx@bbl@prefixnumber{% \ifdef\abx@field@prefixnumber {\blx@bbl@fieldedef{prefixnumber}{\abx@field@prefixnumber}} {}} @@ -4964,6 +5173,9 @@ {} {\blx@setlabwidth{\labelalphawidth}{% \csuse{abx@ffd@*@labelalphawidth}{% + \ifdef\abx@field@prefixnumber + {\csuse{abx@ffd@*@prefixnumber}{\abx@field@prefixnumber}} + {}% \csuse{abx@ffd@*@labelalpha}{\abx@field@labelalpha}% \ifundef\abx@field@extraalpha {} @@ -4982,7 +5194,7 @@ \global\c@maxextrayear\abx@field@extrayear\relax \fi}} -\def\blx@bbl@labelname{% +\def\blx@bbl@labelname{% BibTeX only \iftoggle{blx@useauthor} {\ifundef\abx@name@shortauthor {\ifundef\abx@name@author @@ -5084,7 +5296,7 @@ \let\endlossort\blx@bbl@endlossort \let\set\blx@bbl@set \let\inset\blx@bbl@inset - \let\xref\blx@bbl@xref + \let\xref\blx@bbl@xref % BibTeX only \let\keyw\blx@bbl@keyw \let\name\blx@bbl@namedef \let\list\blx@bbl@listdef @@ -5097,7 +5309,7 @@ \let\endverb\blx@bbl@verbend} \def\blx@bblend{% - \ifcsdef{blx@refs@\the\c@refsection} + \ifcsdef{blx@refs@\the\c@refsection}% BibTeX only {\begingroup \let\do\blx@addxref \dolistcsloop{blx@refs@\the\c@refsection}% @@ -5121,15 +5333,10 @@ \AtEndDocument{% \def\abx@aux@number#1#2#3#4{\blx@addchecksum{#1}{#4}}} -% {<entrykey>}{<refsection>}{<numberprefix>} - -\protected\def\blx@aux@numprefix#1#2#3{% - \blx@bbl@addentryfield{\detokenize{#1}}{#2}{prefixnumber}{#3}} - \def\blx@addlabelnumber{% \begingroup - \iftoggle{blx@labelnumber} - {\nottoggle{blx@skiplab} + \nottoggle{blx@skiplab} + {\iftoggle{blx@labelnumber} {\ifundef\abx@field@shorthand {\ifundef\abx@field@localnumber {\iftoggle{blx@omitnumbers} @@ -5143,23 +5350,32 @@ \string\abx@aux@number{\the\c@instcount}{\abx@field@entrykey}% {\the\c@refsection}{\abx@field@localnumber}}} {}} - {}% - \ifdef\blx@prefixnumbers - {\ifundef\abx@field@shorthand - {\edef\abx@field@prefixnumber{\expandonce\blx@prefixnumbers}% - \ifundef\abx@field@prefixnumber - {\blx@bbl@addentryfield{\abx@field@entrykey}{\the\c@refsection}% - {prefixnumber}{\expandonce\abx@field@prefixnumber}} - {}% - \blx@auxwrite\@mainaux{}{% - \string\blx@aux@numprefix{\abx@field@entrykey}% - {\the\c@refsection}{\expandonce\abx@field@prefixnumber}}} - {}} - {}} + {}}% {}} {}% \endgroup} +\def\blx@addprefixnumber{% + \nottoggle{blx@skiplab} + {\ifdef\blx@prefixnumbers + {\ifundef\abx@field@shorthand + {\edef\abx@field@prefixnumber{\expandonce\blx@prefixnumbers}% + \ifundef\abx@field@prefixnumber + {\blx@bbl@addentryfield{\abx@field@entrykey}{\the\c@refsection}% + {prefixnumber}{\expandonce\abx@field@prefixnumber}} + {}% + \blx@auxwrite\@mainaux{}{% + \string\blx@aux@numprefix{\abx@field@entrykey}% + {\the\c@refsection}{\expandonce\abx@field@prefixnumber}}} + {}} + {}} + {}} + +% {<entrykey>}{<refsection>}{<numberprefix>} + +\protected\def\blx@aux@numprefix#1#2#3{% + \blx@bbl@addentryfield{\detokenize{#1}}{#2}{prefixnumber}{#3}} + \def\blx@bbl@lossort{% \begingroup \def\key##1{\listcsxadd{blx@losh@\the\c@refsection}{\detokenize{##1}}}} @@ -5372,6 +5588,14 @@ \def\blx@flt@category#1{% test {\xifinlistcs\blx@flt@item{blx@catg@#1}}} +% {<name>}{<code>} + +\newrobustcmd*{\defbibcheck}[2]{% + \csdef{blx@bibcheck@#1}{% + \togglefalse{blx@skipentry}% + \def\skipentry{\toggletrue{blx@skipentry}}% + #2\undef\skipentry}} + % options \define@key{blx@bib}{section}{% @@ -5519,32 +5743,51 @@ Custom filter '#1' not found.\MessageBreak Skipping this custom filter}}} +\define@key{blx@bib}{check}{\blx@key@bibcheck{#1}} +\define@key{blx@los}{check}{\blx@key@bibcheck{#1}} + +\def\blx@key@bibcheck#1{% + \ifcsdef{blx@bibcheck@#1} + {\letcs\blx@bibcheck{blx@bibcheck@#1}} + {\blx@error + {Hook '#1' undefined} + {The bibliography check '#1' is undefined.\MessageBreak + Use '\defbibcheck' to define it}}} + \define@key{blx@bib}{maxnames}{\blx@key@maxnames{#1}} \define@key{blx@los}{maxnames}{\blx@key@maxnames{#1}} \define@key{blx@bbs}{maxnames}{\blx@key@maxnames{#1}} \define@key{blx@bbg}{maxnames}{\blx@key@maxnames{#1}} \define@key{blx@bbc}{maxnames}{\blx@key@maxnames{#1}} + \def\blx@key@maxnames#1{% \ifnum#1<\c@maxnames \blx@err@confopt{maxnames}{% The value may not be smaller than the global 'maxnames' (=\the\c@maxnames)}% \else - \blx@setmaxnames{#1}% + \blx@setmaxval{names}{#1}% \fi} +\def\blx@setmaxbibnames{% + \c@maxnames=\blx@premaxnames\relax + \c@maxnames=\blx@maxbibnames\relax + \c@minnames=\blx@preminnames\relax + \c@minnames=\blx@minbibnames\relax} + \define@key{blx@bib}{minnames}{\blx@key@minnames{#1}} \define@key{blx@los}{minnames}{\blx@key@minnames{#1}} \define@key{blx@bbs}{minnames}{\blx@key@minnames{#1}} \define@key{blx@bbg}{minnames}{\blx@key@minnames{#1}} \define@key{blx@bbc}{minnames}{\blx@key@minnames{#1}} + \def\blx@key@minnames#1{% \ifnum#1<\c@minnames \blx@err@confopt{minnames}{% The value may not be smaller than the global 'minnames' (=\the\c@minnames)}% \else - \blx@setminnames{#1}% + \blx@setminval{names}{#1}% \fi} \define@key{blx@bib}{maxitems}{\blx@setmaxitems{#1}} @@ -5564,6 +5807,7 @@ \define@key{blx@los}{heading}{\blx@key@heading{#1}} \define@key{blx@bbs}{heading}{\blx@key@heading{#1}} \define@key{blx@bbg}{heading}{\blx@key@heading{#1}} + \def\blx@key@heading#1{% \ifcsundef{blx@head@#1} {\blx@error @@ -5576,6 +5820,7 @@ \define@key{blx@bbs}{env}{\blx@key@env{#1}} \define@key{blx@bbg}{env}{\blx@key@env{#1}} \define@key{blx@bbc}{env}{\blx@key@env{#1}} + \def\blx@key@env#1{% \ifcsundef{blx@env@#1} {\blx@error @@ -5604,6 +5849,7 @@ \define@key{blx@bbs}{postnote}{\blx@key@postnote{#1}} \define@key{blx@bbg}{postnote}{\blx@key@postnote{#1}} \define@key{blx@bbc}{postnote}{\blx@key@postnote{#1}} + \def\blx@key@postnote#1{% \ifcsundef{blx@note@#1} {\blx@error @@ -5630,12 +5876,14 @@ {}} \define@key{blx@bib}{prefixnumbers}{% + \def\blx@prefixnumbers{#1}% \iftoggle{blx@defernumbers} - {\csnumdef{blx@labelnumber@\the\c@refsection}{0}% - \def\blx@prefixnumbers{#1}} - {\blx@warning{% - Option 'prefixnumbers' requires 'defernumbers=true'.\MessageBreak - Ignoring 'prefixnumbers=\detokenize{#1}'}}} + {\csnumdef{blx@labelnumber@\the\c@refsection}{0}} + {\iftoggle{blx@labelnumber} + {\blx@warning{% + Option 'prefixnumbers' requires global\MessageBreak + 'defernumbers=true'}} + {}}} % [<options>] @@ -5676,6 +5924,7 @@ \let\blx@theprenote\@empty \let\blx@thepostnote\@empty \let\blx@thetitle\@empty + \blx@setmaxbibnames \blx@safe@actives \setkeys{blx@bib}{#1}% \blx@rest@actives @@ -5702,6 +5951,7 @@ \let\blx@thepostnote\@empty \let\blx@thetitle\@empty \c@refsection\z@ + \blx@setmaxbibnames \blx@safe@actives \setkeys{blx@bbs}{#1}% \blx@rest@actives @@ -5742,6 +5992,7 @@ \let\blx@thetitle\@empty \c@refsection\z@ \c@refsegment\@ne + \blx@setmaxbibnames \blx@safe@actives \setkeys{blx@bbg}{#1}% \blx@rest@actives @@ -5784,6 +6035,7 @@ \let\blx@thetitle\@empty \c@refsection\z@ \blx@safe@actives + \blx@setmaxbibnames \setkeys{blx@bbc}{#1}% \blx@rest@actives \togglefalse{blx@tempa}% @@ -5867,27 +6119,30 @@ \def\blx@bibitem#1{% \blx@ifdata{#1} - {\global\let\blx@noitem\@empty - \begingroup + {\begingroup \blx@getdata{#1}% \blx@ifdriver{\abx@field@entrytype} - {\blx@setoptions@type\abx@field@entrytype - \blx@setoptions@entry - \blx@thelabelnumber - \addtocounter{instcount}\@ne - \csuse{blx@item@\blx@theenv}\relax - \blx@initsep - \blx@namesep - \csuse{blx@hook@bibitem}% - \blx@execute - \blx@initunit - \blx@anchor - \blx@beglang - \bibsentence - \blx@pagetracker - \blx@driver{\abx@field@entrytype}% - \blx@postpunct - \blx@endlang} + {\blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \blx@addprefixnumber + \addtocounter{instcount}\@ne + \csuse{blx@item@\blx@theenv}\relax + \blx@initsep + \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglang + \bibsentence + \blx@pagetracker + \blx@driver{\abx@field@entrytype}% + \blx@postpunct + \blx@endlang}} {\blx@warning{% No driver for entry type '\abx@field@entrytype'.\MessageBreak @@ -5895,6 +6150,8 @@ \endgroup} {}} +\let\blx@bibcheck\relax + \def\blx@initsep{% \blx@imc@iffieldundef{sortinit} {} @@ -5998,6 +6255,7 @@ \let\blx@thepostnote\@empty \let\blx@thetitle\@empty \let\blx@printbibchecks\relax + \blx@setmaxbibnames \blx@safe@actives \setkeys{blx@los}{#1}% \blx@rest@actives @@ -6050,22 +6308,24 @@ \def\blx@lositem#1{% \blx@ifdata{#1} - {\global\let\blx@noitem\@empty - \begingroup + {\begingroup \blx@getdata{#1}% - \blx@setoptions@type\abx@field@entrytype - \blx@setoptions@entry - \addtocounter{instcount}\@ne - \csuse{blx@item@\blx@theenv}\relax - \csuse{blx@hook@lositem}% - \blx@execute - \blx@initunit - \blx@beglang - \bibsentence - \blx@pagetracker - \blx@driver{shorthands}% - \blx@postpunct - \blx@endlang + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \addtocounter{instcount}\@ne + \csuse{blx@item@\blx@theenv}\relax + \csuse{blx@hook@lositem}% + \blx@execute + \blx@initunit + \blx@beglang + \bibsentence + \blx@pagetracker + \blx@driver{shorthands}% + \blx@postpunct + \blx@endlang}% \endgroup} {}} @@ -6118,14 +6378,16 @@ \def\blx@refsection@biber#1{% \blx@regbibfiles{\jobname}{#1}% + \begingroup + \blx@xmlsanitizeafter{\def\blx@tempa}{#1}% \blx@auxwrite\blx@auxout - {\def\do##1{\blx@bcf@datasource{file}{##1}}} - {\blx@bcf@endsection\blx@nl - \blx@bcf@comment{section \the\c@refsection}% - \blx@bcf@bibdata{\the\c@refsection}{% - \expandafter\docsvlist - \expandafter{#1}}% - \blx@bcf@section{\the\c@refsection}}} + {\def\do##1{\blx@xml@datasource{file}{##1}}} + {\blx@xml@endsection\blx@nl + \blx@xml@comment{section \the\c@refsection}% + \blx@xml@bibdata{\the\c@refsection}{% + \expandafter\docsvlist\expandafter{\blx@tempa}}% + \blx@xml@section{\the\c@refsection}}% + \endgroup} \def\blx@refsection@bibtex#1{% \xdef\blx@auxfile@bibtex{\jobname\the\c@refsection\blxauxsuffix}% @@ -6153,9 +6415,9 @@ \def\blx@endrefsection@biber{% \ifnum\c@refsection>\z@ \blx@auxwrite\blx@auxout{}{% - \blx@bcf@endsection\blx@nl - \blx@bcf@comment{section 0 (cont.)}% - \blx@bcf@section{0}}% + \blx@xml@endsection\blx@nl + \blx@xml@comment{section 0 (cont.)}% + \blx@xml@section{0}}% \fi} \def\blx@endrefsection@bibtex{% @@ -6308,12 +6570,14 @@ \def\blx@citation#1#2{% \ifbool{citerequest} - {\ifcsdef{blx@setp@\the\c@refsection @#1} - {\blx@citation@set{#1}{#2}} - {\ifcsdef{blx@setc@\the\c@refsection @#1} - {\blx@citation@inset{#1}{#2}} - {\blx@citation@entry{#1}{#2}}}% - \ifcsdef{blx@refc@\the\c@refsection @#1} + {\ifnumless\blx@backend\blx@backend@biber % BibTeX only + {\ifcsdef{blx@setp@\the\c@refsection @#1} + {\blx@citation@set{#1}{#2}} + {\ifcsdef{blx@setc@\the\c@refsection @#1} + {\blx@citation@inset{#1}{#2}} + {}}} + {\blx@citation@entry{#1}{#2}}% + \ifcsdef{blx@refc@\the\c@refsection @#1}% BibTeX only {\blx@citation@xref{#1}} {}} {}} @@ -6347,7 +6611,7 @@ {\blx@citation@set{#1}} {\blx@citation@entry{#1}}} -\def\blx@citation@xref#1{% +\def\blx@citation@xref#1{% BibTeX only \begingroup \edef\blx@tempa{blx@refp@\the\c@refsection @% \csname blx@refc@\the\c@refsection @#1\endcsname}% @@ -6378,13 +6642,57 @@ {}} {}} -\def\blx@bibreq#1{% +\protected\def\blx@bibreq#1{% \ifnum\blx@backend=\blx@backend@biber - \blx@auxwrite\blx@auxout{}{\blx@bcf@citekey{#1}}% + \begingroup + \blx@xmlsanitizeafter{\def\blx@tempa}{#1}% + \blx@auxwrite\blx@auxout{}{\blx@xml@citekey{\blx@tempa}}% + \endgroup \else \blx@auxwrite\blx@auxout@bibtex{}{\string\citation{#1}}% \fi} +% {<set>}{<key1,key2,key3>} + +\newrobustcmd*{\defbibentryset}[2]{% + \@bsphack + \begingroup + \blx@xsanitizeafter{\def\blx@tempa}{#1}% + \let\blx@tempb\@empty + \let\blx@tempc\@empty + \blx@xsanitizeafter{\forcsvlist\blx@defentryset@add}{#2}% + \ifcsdef{blx@set@\the\c@refsection @\blx@tempa} + {\expandafter\ifdefequal + \csname blx@set@\the\c@refsection @\blx@tempa\endcsname + \blx@tempb + {} + {\blx@error + {Conflicting definitions of '\blx@tempa'} + {The entry set '\blx@tempa' been defined before.\MessageBreak + old: \blx@tempa\space = % + \csuse{blx@set@\the\c@refsection @\blx@tempa}\MessageBreak + new: \blx@tempa\space = \blx@tempb\MessageBreak + I'm ignoring the new definition}}} + {\global\cslet{blx@set@\the\c@refsection @\blx@tempa}\blx@tempb + \edef\blx@tempa{% + \AfterPreamble{\blx@setreq{\blx@tempa}{\blx@tempb}}}% + \blx@tempa}% + \endgroup + \@esphack} + +\def\blx@defentryset@add#1{% + \edef\blx@tempb{\blx@tempb\blx@tempc#1}% + \def\blx@tempc{,}} + +\protected\def\blx@setreq#1#2{% + \ifnum\blx@backend=\blx@backend@biber + \begingroup + \blx@xmlsanitizeafter{\def\blx@tempa}{#1}% + \blx@xmlsanitizeafter{\def\blx@tempb}{#2}% + \blx@auxwrite\blx@auxout{}{\blx@xml@citeset{\blx@tempa}{\blx@tempb}}% + \endgroup + \fi} + % {<entrykey>,...} \protected\def\blx@citeloop#1{% @@ -6570,16 +6878,11 @@ {\global\let\blx@lasthash@text\abx@field@fullhash}} {}} -\def\blx@idemtracker@strict{% - \blx@ifcitesingle - {\blx@idemtracker@gobal} - {\blx@idemreset@gobal}}% +\let\blx@idemtracker@strict\blx@idemtracker@gobal \def\blx@idemtracker@constrict{% - \blx@ifcitesingle - {\blx@mpfnsave - \blx@idemtracker@context} - {\blx@idemreset@context}}% + \blx@mpfnsave + \blx@idemtracker@context} \def\blx@idemreset@force{% \global\undef\blx@lasthash@text @@ -7828,7 +8131,7 @@ \let\blx@volcite@vol\@gobble \let\blx@volcite@page\@firstofone} -%% Control file writers +%% Control file \begingroup \let~\space @@ -7841,459 +8144,397 @@ \@makeother\- \@makeother\= \@makeother\/ -\xdef\blx@bcf@file{% +\xdef\blx@xml@file{% \blx@sig@bcf\blx@nl \blx@ver@bcf\blx@nl} -\xdef\blx@bcf@endfile{% +\xdef\blx@xml@endfile{% \blx@nl</bcf:controlfile>} -\xdef\blx@bcf@comment#1{% +\xdef\blx@xml@comment#1{% ~~<!-- #1 -->\blx@nl} -\xdef\blx@bcf@options#1#2#3{% +\xdef\blx@xml@options#1#2#3{% ~~<bcf:options% \noexpand\ifblank{#1}{}{ component="#1"}% \noexpand\ifblank{#2}{}{ type="#2"}% >\blx@nl #3% ~~</bcf:options>\blx@nl} -\xdef\blx@bcf@option#1#2{% +\xdef\blx@xml@option#1#2{% ~~~~<bcf:option type="#1">\blx@nl #2% ~~~~</bcf:option>\blx@nl} -\xdef\blx@bcf@ordered#1#2{% +\xdef\blx@xml@ordered#1#2{% ~~~~~~<bcf:value order="#1">#2</bcf:value>\blx@nl} -\xdef\blx@bcf@sorting#1#2{% - ~~<bcf:sorting type="#1">\blx@nl - #2% +\xdef\blx@xml@sorting#1{% + ~~<bcf:sorting>\blx@nl + #1% ~~</bcf:sorting>\blx@nl} -\xdef\blx@bcf@sort#1#2{% +\xdef\blx@xml@presort#1#2{% + ~~~~<bcf:presort\noexpand\ifblank{#1}{}{ type="#1"}>% + #2</bcf:presort>\blx@nl} + +\xdef\blx@xml@sortexclude#1#2{% + ~~~~<bcf:sortexclusion\noexpand\ifblank{#1}{}{ type="#1"}>\blx@nl + #2% + ~~~~</bcf:sortexclusion>\blx@nl} +\xdef\blx@xml@exclude#1{% + ~~~~~~<bcf:exclusion>#1</bcf:exclusion>\blx@nl} +\xdef\blx@xml@sort#1#2{% ~~~~<bcf:sort #1>\blx@nl #2% ~~~~</bcf:sort>\blx@nl} -\xdef\blx@bcf@sortitem#1#2{% +\xdef\blx@xml@sortitem#1#2{% ~~~~~~<bcf:sortitem #1>#2</bcf:sortitem>\blx@nl} -\xdef\blx@bcf@section#1{% +\xdef\blx@xml@section#1{% ~~<bcf:section number="#1">} -\xdef\blx@bcf@endsection{% +\xdef\blx@xml@endsection{% ~~</bcf:section>} -\xdef\blx@bcf@bibdata#1#2{% +\xdef\blx@xml@bibdata#1#2{% ~~<bcf:bibdata section="#1">\blx@nl #2% ~~</bcf:bibdata>\blx@nl} -\xdef\blx@bcf@datasource#1#2{% +\xdef\blx@xml@datasource#1#2{% ~~~~<bcf:datasource type="#1">#2</bcf:datasource>\blx@nl} -\xdef\blx@bcf@citekey#1{% +\xdef\blx@xml@citekey#1{% ~~~~<bcf:citekey>#1</bcf:citekey>} -\xdef\blx@bcf@svalue#1#2{% - \blx@bcf@option{singlevalued}{% +\xdef\blx@xml@citeset#1#2{% + ~~~~<bcf:citekey type="set" members="#2">#1</bcf:citekey>} +\xdef\blx@xml@svalue#1#2{% + \blx@xml@option{singlevalued}{% ~~~~~~<bcf:key>#1</bcf:key>\blx@nl ~~~~~~<bcf:value>#2</bcf:value>\blx@nl}} -\xdef\blx@bcf@mvalue#1#2{% - \blx@bcf@option{multivalued}{% +\xdef\blx@xml@mvalue#1#2{% + \blx@xml@option{multivalued}{% ~~~~~~<bcf:key>#1</bcf:key>\blx@nl #2}} -\xdef\blx@bcf@toggle#1{% - \blx@bcf@svalue{#1}{\noexpand\iftoggle{blx@#1}{1}{0}}} +\xdef\blx@xml@toggle#1{% + \blx@xml@svalue{#1}{\noexpand\iftoggle{blx@#1}{1}{0}}} \endgroup \def\blx@bcf@options@global{% - \blx@bcf@comment{global}% - \blx@bcf@options{biblatex}{global}{% - \iftoggle{blx@labelalpha} - {\blx@bcf@svalue{alphaothers}{\detokenize\expandafter{\labelalphaothers}}} - {}% - \blx@bcf@toggle{labelalpha}% - \blx@bcf@mvalue{labelname}{\blx@bcf@labelname@global}% + \blx@xml@comment{global}% + \blx@xml@options{biblatex}{global}{% + \blx@xml@svalue{alphaothers}{\labelalphaothers}% + \blx@xml@toggle{labelalpha}% + \blx@xml@mvalue{labelname}{\blx@bcf@labelname}% \iftoggle{blx@labelyear} - {\blx@bcf@mvalue{labelyear}{\blx@bcf@labelyear@global}} - {}% - \blx@bcf@svalue{maxitems}{\the\c@maxitems}% - \blx@bcf@svalue{maxnames}{\the\c@maxnames}% - \blx@bcf@svalue{minitems}{\the\c@minitems}% - \blx@bcf@svalue{minnames}{\the\c@minnames}% - \blx@bcf@toggle{singletitle}% - \iftoggle{blx@labelalpha} - {\blx@bcf@svalue{sortalphaothers}{\detokenize\expandafter{\labelalphaothers}}} + {\blx@xml@mvalue{labelyear}{\blx@bcf@labelyear}} {}% - \blx@bcf@svalue{sortlos}{\blx@sortlos}% - \blx@bcf@toggle{terseinits}% - \blx@bcf@svalue{uniquename}{\blx@uniquename}% - \blx@bcf@toggle{useauthor}% - \blx@bcf@toggle{useeditor}% - \blx@bcf@toggle{useprefix}% - \blx@bcf@toggle{usetranslator}% + \blx@xml@svalue{maxitems}{\the\c@maxitems}% + \blx@xml@svalue{maxnames}{\the\c@maxnames}% + \blx@xml@svalue{minitems}{\the\c@minitems}% + \blx@xml@svalue{minnames}{\the\c@minnames}% + \blx@xml@toggle{singletitle}% + \blx@xml@svalue{sortalphaothers}{\sortalphaothers}% + \blx@xml@svalue{sortlos}{\blx@sortlos}% + \blx@xml@toggle{terseinits}% + \blx@xml@svalue{uniquename}{\blx@uniquename}% + \blx@xml@toggle{useauthor}% + \blx@xml@toggle{useeditor}% + \blx@xml@toggle{useprefix}% + \blx@xml@toggle{usetranslator}% }% } \def\blx@bcf@options@type#1{% - \blx@bcf@comment{#1}% - \blx@bcf@options{biblatex}{#1}{% - \blx@bcf@toggle{labelalpha}% - \ifcsdef{blx@bcf@labelname@#1} - {\blx@bcf@mvalue{labelname}{\csuse{blx@bcf@labelname@#1}}} - {}% + \blx@xml@comment{#1}% + \blx@xml@options{biblatex}{#1}{% + \blx@xml@toggle{labelalpha}% + \blx@xml@mvalue{labelname}{% + \ifcsdef{blx@bcf@labelname@#1} + {\csuse{blx@bcf@labelname@#1}} + {\blx@bcf@labelname}}% \iftoggle{blx@labelyear} - {\ifcsdef{blx@bcf@labelyear@#1} - {\blx@bcf@mvalue{labelyear}{\csuse{blx@bcf@labelyear@#1}}} - {}} + {\blx@xml@mvalue{labelyear}{% + \ifcsdef{blx@bcf@labelyear@#1} + {\csuse{blx@bcf@labelyear@#1}} + {\blx@bcf@labelyear}}} {}% - \blx@bcf@toggle{singletitle}% - \blx@bcf@toggle{skipbib}% - \blx@bcf@toggle{skiplab}% - \blx@bcf@toggle{skiplos}% - \blx@bcf@svalue{uniquename}{\blx@uniquename}% - \blx@bcf@toggle{useauthor}% - \blx@bcf@toggle{useeditor}% - \blx@bcf@toggle{useprefix}% - \blx@bcf@toggle{usetranslator}% + \blx@xml@toggle{singletitle}% + \blx@xml@toggle{skipbib}% + \blx@xml@toggle{skiplab}% + \blx@xml@toggle{skiplos}% + \blx@xml@svalue{uniquename}{\blx@uniquename}% + \blx@xml@toggle{useauthor}% + \blx@xml@toggle{useeditor}% + \blx@xml@toggle{useprefix}% + \blx@xml@toggle{usetranslator}% }% } -\AtBeginDocument{% - \ifnum\blx@backend=\blx@backend@biber - \xdef\blx@biber@options{\blx@bcf@options@global}% - \begingroup - \def\do#1{% - \blx@setoptions@type{#1}% - \xappto\blx@biber@options{\blx@bcf@options@type{#1}}}% - \ifdef\blx@opts@type - {\dolistloop\blx@opts@type} - {}% - \def\do#1{% - \ifcsdef{blx@biber@sorting@\blx@sorting @#1}% - {\blx@bcf@comment{#1}% - \csuse{blx@biber@sorting@\blx@sorting @#1}} - {}}% - \xdef\blx@biber@sorting{% - \ifcsdef{blx@biber@sorting@\blx@sorting} - {\dolistcsloop{blx@biber@sorting@\blx@sorting}} - {}}% - \endgroup - \fi} +\edef\blx@ctrl@bibtex{% + \blx@msg@bib + @Control\string{biblatex-control,\blx@nl + \space\space options = \string{% + \blx@bblversion:% + \noexpand\iftoggle{blx@debug}{1}{0}:% + \noexpand\ifnum\noexpand\blx@backend>\noexpand\blx@backend@bibtex + 1:% + \noexpand\else + 0:% + \noexpand\fi + \noexpand\iftoggle{blx@sortcase}{1}{0}:% + \noexpand\iftoggle{blx@terseinits}{1}{0}:% + \noexpand\iftoggle{blx@useprefix}{1}{0}:% + \noexpand\iftoggle{blx@useauthor}{1}{0}:% + \noexpand\iftoggle{blx@useeditor}{1}{0}:% + \noexpand\iftoggle{blx@usetranslator}{1}{0}:% + \noexpand\iftoggle{blx@labelalpha}{1}{0}:% + \noexpand\iftoggle{blx@labelyear}{1}{0}:% + \noexpand\iftoggle{blx@singletitle}{1}{0}:% + \noexpand\blx@uniquename:% + \noexpand\csuse{blx@bibtex@sorting@\noexpand\blx@sorting}:% + \noexpand\blx@sortlos:% + \noexpand\the\c@maxnames:% + \noexpand\the\c@minnames:% + \noexpand\blx@maxline:% + \noexpand\detokenize\noexpand\expandafter{\noexpand\labelalphaothers}% + \string},\blx@nl + \string}% +} -% [<entrytype>]{<name>}{<spec>} +\def\blx@ctrlwrite@bibtex{% + \immediate\openout\blx@auxout\blx@ctrlfile\blxauxsuffix.bib\relax + \blx@auxwrite\blx@auxout{}{\blx@ctrl@bibtex}% + \immediate\closeout\blx@auxout} -\newrobustcmd*{\DeclareSortingScheme}[3][global]{% +\def\blx@ctrlwrite@biber{% \begingroup - \let\item\blx@sortdef@item + \blx@safe@actives + \let\protect\string + \edef\labelalphaothers{\labelalphaothers}% + \edef\sortalphaothers{\sortalphaothers}% + \blx@xmlsanitizeafter{\def\labelalphaothers}{\labelalphaothers}% + \blx@xmlsanitizeafter{\def\sortalphaothers}{\sortalphaothers}% + \edef\blx@tempa{% + \blx@xml@file + \blx@xml@comment{BIBER OPTIONS}% + \blx@xml@options{biber}{global}{% + \blx@xml@svalue{bblencoding}{\blx@inputencoding}% + \blx@xml@svalue{bibencoding}{\blx@bibencoding}% + \blx@xml@toggle{debug}% + \blx@xml@svalue{mincrossrefs}{\blx@mincrossrefs}% + \blx@xml@toggle{sortcase}% + \ifdef\blx@sortlocale + {\blx@xml@svalue{sortlocale}{\blx@sortlocale}} + {}% + \blx@xml@toggle{sortupper}% + }% + \blx@xml@comment{BIBLATEX OPTIONS}% + \blx@bcf@options@global + }% + \ifdef\blx@opts@type + {\def\do##1{% + \begingroup + \blx@setoptions@type{##1}% + \xappto\blx@tempa{\blx@bcf@options@type{##1}}% + \endgroup}% + \dolistloop\blx@opts@type} + {}% + \def\do##1{% + \eappto\blx@bcf@presort{\csuse{blx@bcf@presort@##1}}% + \eappto\blx@bcf@exclude{\csuse{blx@bcf@exclude@##1}}}% + \abx@dotypes + \eappto\blx@tempa{% + \blx@xml@comment{SORTING}% + \blx@xml@sorting{% + \blx@bcf@presort + \blx@bcf@exclude + \csuse{blx@biber@sorting@\blx@sorting}% + }% + }% + \blx@xmlsanitizeafter{\def\blx@bibfiles}{\blx@bibfiles}% + \def\do{\blx@xml@datasource{file}}% + \eappto\blx@tempa{% + \blx@xml@comment{CITATION DATA}% + \blx@xml@comment{section 0}% + \blx@xml@bibdata{0}{\expandafter\docsvlist\expandafter{\blx@bibfiles}}% + \blx@xml@section{0}% + }% + \immediate\openout\blx@auxout\jobname.bcf\relax + \blx@auxwrite\blx@auxout{}{\blx@tempa}% + \global\undef\blx@tempa + \endgroup + \AfterEndDocument{% + \blx@auxwrite\blx@auxout{}{% + \blx@xml@endsection + \blx@xml@endfile}% + \immediate\closeout\blx@auxout}} + +%% Customization + +% {<name>}{<spec>} + +\newrobustcmd*{\DeclareSortingScheme}[2]{% + \begingroup + \let\sort\blx@sortdef@sort + \let\name\blx@sortdef@list + \let\list\blx@sortdef@list \let\field\blx@sortdef@field \let\literal\blx@sortdef@literal + \def\citeorder{\blx@sortdef@field{citeorder}}% \blx@tempcnta\z@ \let\blx@tempa\@empty - #3% - \csxdef{blx@biber@sorting@#2@#1}{\blx@bcf@sorting{#1}{\blx@tempa}}% - \ifcsdef{blx@biber@sorting@#2} - {\ifinlistcs{#1}{blx@biber@sorting@#2} - {} - {\listcsgadd{blx@biber@sorting@#2}{#1}}} - {\listcsgadd{blx@biber@sorting@#2}{#1}}% + #2% + \global\cslet{blx@biber@sorting@#1}\blx@tempa \endgroup} \@onlypreamble\DeclareSortingScheme -\def\blx@sortdef@item#1{% +\newcommand{\blx@sortdef@sort}[2][]{% \advance\blx@tempcnta\@ne \blx@tempcntb\z@ \let\blx@tempb\@empty + \edef\blx@tempc{order="\the\blx@tempcnta"}% + \ifblank{#1} + {} + {\setkeys{blx@sortdef@sort}{#1}}% \let\do\@firstofone - #1% + #2% \eappto\blx@tempa{% - \blx@bcf@sort{order="\the\blx@tempcnta"}{\blx@tempb}}} + \blx@xml@sort{\blx@tempc}{\blx@tempb}}} + +\define@key{blx@sortdef@sort}{pass}{% final|label + \ifstrequal{#1}{label} + {\appto\blx@tempc{ pass="label"}} + {\appto\blx@tempc{ pass="final"}}} +\define@key{blx@sortdef@sort}{direction}{% ascending|descending + \ifstrequal{#1}{ascending} + {\appto\blx@tempc{ sort_direction="ascending"}} + {\appto\blx@tempc{ sort_direction="descending"}}} +\define@key{blx@sortdef@sort}{final}[true]{% true|false + \ifstrequal{#1}{true} + {\appto\blx@tempc{ final="1"}} + {}} +\define@key{blx@sortdef@sort}{sortcase}[true]{% true|false + \ifstrequal{#1}{true} + {\appto\blx@tempc{ sortcase="1"}} + {\appto\blx@tempc{ sortcase="0"}}} +\define@key{blx@sortdef@sort}{sortupper}[true]{% true|false + \ifstrequal{#1}{true} + {\appto\blx@tempc{ sortupper="1"}} + {\appto\blx@tempc{ sortupper="0"}}} + +\def\blx@sortdef@list#1{% + \advance\blx@tempcntb\@ne + \edef\blx@tempd{order="\the\blx@tempcntb"}% + \eappto\blx@tempb{% + \blx@xml@sortitem{\blx@tempd}{#1}}} \newcommand*{\blx@sortdef@field}[2][]{% \advance\blx@tempcntb\@ne - \edef\blx@tempc{order="\the\blx@tempcntb"}% + \edef\blx@tempd{order="\the\blx@tempcntb"}% \ifblank{#1} {} {\setkeys{blx@sortdef@field}{#1}}% \eappto\blx@tempb{% - \blx@bcf@sortitem{\blx@tempc}{#2}}} + \blx@xml@sortitem{\blx@tempd}{#2}}} -\define@key{blx@sortdef@field}{final}[true]{% true|false - \ifstrequal{#1}{true} - {\appto\blx@tempc{ final="1"}} - {}} -\define@key{blx@sortdef@field}{pass}{% final|label - \ifstrequal{#1}{label} - {\appto\blx@tempc{ pass="label"}} - {\appto\blx@tempc{ pass="final"}}} -\define@key{blx@sortdef@field}{direction}{% descending|ascending - \ifstrequal{#1}{ascending} - {\appto\blx@tempc{ sort_direction="ascending"}} - {\appto\blx@tempc{ sort_direction="descending"}}} -\define@key{blx@sortdef@field}{strside}{% left|right - \ifstrequal{#1}{right} - {\appto\blx@tempc{ substring_side="right"}} - {\appto\blx@tempc{ substring_side="left"}}} \define@key{blx@sortdef@field}{padside}{% left|right \ifstrequal{#1}{right} - {\appto\blx@tempc{ pad_side="right"}} - {\appto\blx@tempc{ pad_side="left"}}} -\define@key{blx@sortdef@field}{strwidth}{% integer - \appto\blx@tempc{ substring_width="#1"}} + {\appto\blx@tempd{ pad_side="right"}} + {\appto\blx@tempd{ pad_side="left"}}} \define@key{blx@sortdef@field}{padwidth}{% integer - \appto\blx@tempc{ pad_width="#1"}} + \appto\blx@tempd{ pad_width="#1"}} \define@key{blx@sortdef@field}{padchar}{% character - \appto\blx@tempc{ pad_char="#1"}} + \blx@xmlsanitizeafter{\def\blx@tempe}{#1}% + \eappto\blx@tempd{ pad_char="\blx@tempe"}} +\define@key{blx@sortdef@field}{strside}{% left|right + \ifstrequal{#1}{right} + {\appto\blx@tempd{ substring_side="right"}} + {\appto\blx@tempd{ substring_side="left"}}} +\define@key{blx@sortdef@field}{strwidth}{% integer + \appto\blx@tempd{ substring_width="#1"}} \def\blx@sortdef@literal#1{% \advance\blx@tempcntb\@ne + \blx@xmlsanitizeafter{\def\blx@tempe}{#1}% \eappto\blx@tempb{% - \blx@bcf@sortitem{order="\the\blx@tempcntb"}{#1}}} + \blx@xml@sortitem{order="\the\blx@tempcntb"}{\blx@tempe}}} -\DeclareSortingScheme{none}{% - \item{\field{citeorder}} -} +% [<type,type,...>]{<string>} -\DeclareSortingScheme{debug}{% - \item{\field{entrykey}} -} +\newrobustcmd*{\DeclarePresort}[2][]{% + \begingroup + \blx@xmlsanitizeafter{\def\blx@tempa}{#2}% + \ifblank{#1} + {\xdef\blx@bcf@presort{\blx@xml@presort{}{\blx@tempa}}} + {\notblank{#2} + {\forcsvlist{\blx@defpresort\blx@tempa}{#1}} + {\forcsvlist\blx@undefpresort{#1}}}% + \endgroup} +\@onlypreamble\DeclarePresort -\DeclareSortingScheme{nty}{% - \item{\field[strside=left,strwidth=2]{presort} - \literal{mm}} - \item{\field[final]{sortkey}} - \item{\field{sortname} - \field{author} - \field{editor} - \field{translator} - \field{sorttitle} - \field{title}} - \item{\field{sorttitle} - \field{title}} - \item{\field{sortyear} - \field{year}} - \item{\field[padside=left,padwidth=4,padchar=0]{volume} - \literal{0000}} -} +\def\blx@defpresort#1#2{% + \csxdef{blx@bcf@presort@#2}{\blx@xml@presort{#2}{#1}}} +\def\blx@undefpresort#1{% + \global\csundef{blx@bcf@presort@#1}} -\DeclareSortingScheme{nyt}{% - \item{\field[strside=left,strwidth=2]{presort} - \literal{mm}} - \item{\field[final]{sortkey}} - \item{\field{sortname} - \field{author} - \field{editor} - \field{translator} - \field{sorttitle} - \field{title}} - \item{\field{sortyear} - \field{year}} - \item{\field{sorttitle} - \field{title}} - \item{\field[padside=left,padwidth=4,padchar=0]{volume} - \literal{0000}} -} +\newrobustcmd*{\DeclareSortExclusion}[2]{% + \forcsvlist{\blx@sortexlude{#2}}{#1}} -\DeclareSortingScheme{nyvt}{% - \item{\field[strside=left,strwidth=2]{presort} - \literal{mm}} - \item{\field[final]{sortkey}} - \item{\field{sortname} - \field{author} - \field{editor} - \field{translator} - \field{sorttitle} - \field{title}} - \item{\field{sortyear} - \field{year}} - \item{\field[padside=left,padwidth=4,padchar=0]{volume} - \literal{0000}} - \item{\field{sorttitle} - \field{title}} -} +\def\blx@sortexlude#1#2{% + \begingroup + \ifblank{#1} + {\global\csundef{blx@bcf@exclude@#2}} + {\let\blx@tempa\@empty + \forcsvlist\blx@sortexlude@i{#1}% + \csxdef{blx@bcf@exclude@#2}{% + \blx@xml@sortexclude{#2}{\blx@tempa}}} + \endgroup} -\DeclareSortingScheme{anyt}{% - \item{\field[strside=left,strwidth=2]{presort} - \literal{mm}} - \item{\field[pass=label]{labelalpha}} - \item{\field[final]{sortkey}} - \item{\field[pass=final]{labelalpha}} - \item{\field[pass=final,padside=left,padwidth=4,padchar=0]{extraalpha}} - \item{\field{sortname} - \field{author} - \field{editor} - \field{translator} - \field{sorttitle} - \field{title}} - \item{\field{sortyear} - \field{year}} - \item{\field{sorttitle} - \field{title}} - \item{\field[padside=left,padwidth=4,padchar=0]{volume} - \literal{0000}} -} +\def\blx@sortexlude@i#1{% + \appto\blx@tempa{\blx@xml@exclude{#1}}} -\DeclareSortingScheme{anyvt}{% - \item{\field[strside=left,strwidth=2]{presort} - \literal{mm}} - \item{\field[pass=label]{labelalpha}} - \item{\field[final]{sortkey}} - \item{\field[pass=final]{labelalpha}} - \item{\field[pass=final,padside=left,padwidth=4,padchar=0]{extraalpha}} - \item{\field{sortname} - \field{author} - \field{editor} - \field{translator} - \field{sorttitle} - \field{title}} - \item{\field{sortyear} - \field{year}} - \item{\field[padside=left,padwidth=4,padchar=0]{volume} - \literal{0000}} - \item{\field{sorttitle} - \field{title}} -} +% [<type,type,...>]{<field,field,...>} -\DeclareSortingScheme{ynt}{% - \item{\field[strside=left,strwidth=2]{presort} - \literal{mm}} - \item{\field[final]{sortkey}} - \item{\field{sortyear} - \field{year} - \literal{9999}} - \item{\field{sortname} - \field{author} - \field{editor} - \field{translator} - \field{sorttitle} - \field{title}} - \item{\field{sorttitle} - \field{title}} -} +\newrobustcmd*{\DeclareLabelname}[2][]{% + \blx@defmvalue{labelname}{#1}{#2}} +\@onlypreamble\DeclareLabelname -\DeclareSortingScheme{ydnt}{% - \item{\field[strside=left,strwidth=2]{presort} - \literal{mm}} - \item{\field[final]{sortkey}} - \item{\field[strside=left,strwidth=4,direction=descending]{sortyear} - \field[strside=left,strwidth=4,direction=descending]{year} - \literal{9999}} - \item{\field{sortname} - \field{author} - \field{editor} - \field{translator} - \field{sorttitle} - \field{title}} - \item{\field{sorttitle} - \field{title}} -} +\newrobustcmd*{\DeclareLabelyear}[2][]{% + \blx@defmvalue{labelyear}{#1}{#2}} +\@onlypreamble\Declarelabelyear + +\def\blx@defmvalue#1#2#3{% + \ifblank{#2} + {\expandafter\blx@defmvalue@ii\csname blx@bcf@#1\endcsname{#3}} + {\forcsvlist{\blx@defmvalue@i{#1}{#3}}{#2}}} -\def\blx@deflabel#1#2{% +\def\blx@defmvalue@i#1#2#3{% + \blx@addtypeopt{#3}% + \expandafter\blx@defmvalue@ii\csname blx@bcf@#1@#3\endcsname{#2}} + +\def\blx@defmvalue@ii#1#2{% \begingroup \global\let#1\@empty \blx@tempcnta\z@ \def\do##1{% \advance\blx@tempcnta\@ne - \xappto#1{\noexpand\blx@bcf@ordered{\the\blx@tempcnta}{##1}}}% + \xappto#1{\noexpand\blx@xml@ordered{\the\blx@tempcnta}{##1}}}% \docsvlist{#2}% \endgroup} -% [<entrytype>]{<cslist>} - -\newrobustcmd*{\DeclareLabelname}[1][global]{% - \expandafter\blx@deflabel\csname blx@bcf@labelname@#1\endcsname} -\@onlypreamble\DeclareLabelname - -% [<entrytype>]{<cslist>} - -\newrobustcmd*{\DeclareLabelyear}[1][global]{% - \expandafter\blx@deflabel\csname blx@bcf@labelyear@#1\endcsname} -\@onlypreamble\Declarelabelyear - -\DeclareLabelname{% - shortauthor, - author, - shorteditor, - editor, - translator} - -\DeclareLabelyear{% - year, - eventyear, - origyear, - urlyear} - -\edef\blx@ctrl@bibtex{% - \blx@msg@bib - @Control\string{biblatex-control,\blx@nl - \space\space options = \string{% - \blx@bblversion:% - \noexpand\iftoggle{blx@debug}{1}{0}:% - \noexpand\ifnum\noexpand\blx@backend>\noexpand\blx@backend@bibtex - 1:% - \noexpand\else - 0:% - \noexpand\fi - \noexpand\iftoggle{blx@sortcase}{1}{0}:% - \noexpand\iftoggle{blx@terseinits}{1}{0}:% - \noexpand\iftoggle{blx@useprefix}{1}{0}:% - \noexpand\iftoggle{blx@useauthor}{1}{0}:% - \noexpand\iftoggle{blx@useeditor}{1}{0}:% - \noexpand\iftoggle{blx@usetranslator}{1}{0}:% - \noexpand\iftoggle{blx@labelalpha}{1}{0}:% - \noexpand\iftoggle{blx@labelyear}{1}{0}:% - \noexpand\iftoggle{blx@singletitle}{1}{0}:% - \noexpand\blx@uniquename:% - \noexpand\csuse{blx@bibtex@sorting@\noexpand\blx@sorting}:% - \noexpand\blx@sortlos:% - \noexpand\the\c@maxnames:% - \noexpand\the\c@minnames:% - \noexpand\blx@maxline:% - \noexpand\detokenize\noexpand\expandafter{\noexpand\labelalphaothers}% - \string},\blx@nl - \string}% -} - -\def\blx@bcf@start{% - \blx@bcf@file - \blx@bcf@comment{BIBER OPTIONS}% - \blx@bcf@options{biber}{global}{% - \blx@bcf@svalue{bblencoding}{\blx@inputencoding}% - \blx@bcf@svalue{bibencoding}{\blx@bibencoding}% - \blx@bcf@toggle{debug}% - \blx@bcf@svalue{mincrossrefs}{\blx@mincrossrefs}% - \blx@bcf@toggle{sortcase}% - \ifdef\blx@sortlocale - {\blx@bcf@svalue{sortlocale}{\blx@sortlocale}} - {}% - \blx@bcf@toggle{sortupper}% - }% - \blx@bcf@comment{BIBLATEX OPTIONS}% - \csuse{blx@biber@options}% - \blx@bcf@comment{SORTING}% - \csuse{blx@biber@sorting}% - \blx@bcf@comment{CITATION DATA}% - \blx@bcf@comment{section 0}% -} - -\AtEndPreamble{% - \ifnum\blx@backend=\blx@backend@biber - \begingroup - \def\do#1{\blx@bcf@datasource{file}{#1}}% - \xappto\blx@bcf@start{% - \blx@bcf@bibdata{0}{\expandafter\docsvlist\expandafter{\blx@bibfiles}}% - \blx@bcf@section{0}}% - \endgroup - \fi} - -\def\blx@bcf@end{% - \blx@bcf@endsection - \blx@bcf@endfile -} - %% Package options -% [<entrytype>]{<options>} +% [<entrytype,entrytype,...>]{<options>} \newrobustcmd*{\ExecuteBibliographyOptions}[2][]{% \ifblank{#1} {\setkeys{blx@opt@pre}{#2}} + {\forcsvlist{\blx@typeoptions{#2}}{#1}}} +\@onlypreamble\ExecuteBibliographyOptions + +\def\blx@typeoptions#1#2{% + \blx@addtypeopt{#2}% + \csappto{blx@opts@type@#2}{#1}} + +\def\blx@addtypeopt#1{% + \notblank{#1} {\ifdef\blx@opts@type {\ifinlist{#1}{\blx@opts@type} - {} + {} {\listadd\blx@opts@type{#1}}} - {\listadd\blx@opts@type{#1}}% - \csappto{blx@opts@type@#1}{#2}}} -\@onlypreamble\ExecuteBibliographyOptions + {\listadd\blx@opts@type{#1}}} + {}} % load-time only @@ -8310,6 +8551,9 @@ \define@key{blx@opt@ldt}{natbib}[true]{% \settoggle{blx@natbib}{#1}} +\define@key{blx@opt@ldt}{mcite}[true]{% + \settoggle{blx@mcite}{#1}} + % load-time and preamble \DeclareBibliographyOption{debug}[true]{% @@ -8358,7 +8602,7 @@ \AtEndPreamble{% \ifnum\blx@backend=\blx@backend@biber - \ifcsdef{blx@biber@sorting@\blx@sorting @global} + \ifcsdef{blx@biber@sorting@\blx@sorting} {} {\blx@err@invopt{sorting=\blx@sorting}{}% \def\blx@sorting{nty}}% @@ -8387,35 +8631,54 @@ \def\blx@opt@sortlos@bib{0} \def\blx@opt@sortlos@los{1} -\DeclareBibliographyOption{maxnames}{\blx@setmaxnames{#1}} -\def\blx@setmaxnames#1{% - \ifnum#1<\@ne - \blx@err@invopt{maxnames=#1} - {'maxnames' must be greater than zero}% - \else - \ifnum#1<\c@minnames - \blx@err@confopt{maxnames/minnames} - {'maxnames' must be greater than or equal to 'minnames'}% - \else - \c@maxnames#1\relax - \fi - \fi} - -\DeclareBibliographyOption{minnames}{\blx@setminnames{#1}} -\def\blx@setminnames#1{% - \ifnum#1<\@ne - \blx@err@invopt{minnames=#1} - {'minnames' must be greater than zero}% - \else - \ifnum#1>\c@maxnames - \blx@err@confopt{maxnames/minnames} - {'minnames' must be less than or equal to 'maxnames'}% - \else - \c@minnames#1\relax - \fi - \fi} +\DeclareBibliographyOption{maxnames}{\blx@setmaxval{names}{#1}} +\DeclareBibliographyOption{minnames}{\blx@setminval{names}{#1}} + +\def\blx@setmaxval#1#2{% + \ifnumless{#2}\@ne + {\blx@err@invopt{max#1=#2}{% + 'max#1' must be greater than zero}} + {\ifnumless{#2}{\csname c@min#1\endcsname} + {\blx@err@confopt{max#1/min#1}{% + 'max#1' must be greater than or equal to 'min#1'}} + {\defcounter{max#1}{#2}}}} + +\def\blx@setminval#1#2{% + \ifnumless{#2}\@ne + {\blx@err@invopt{min#1=#2}{% + min#1' must be greater than zero}} + {\ifnumgreater{#2}{\csname c@max#1\endcsname} + {\blx@err@confopt{max#1/min#1}{% + 'min#1' must be less than or equal to 'max#1'}} + {\defcounter{min#1}{#2}}}} + +\DeclareBibliographyOption{maxbibnames}{\blx@defmaxval{bibnames}{#1}} +\DeclareBibliographyOption{minbibnames}{\blx@defminval{bibnames}{#1}} + +\DeclareBibliographyOption{maxcitenames}{\blx@defmaxval{citenames}{#1}} +\DeclareBibliographyOption{mincitenames}{\blx@defminval{citenames}{#1}} + +\def\blx@defmaxval#1#2{% + \ifnumless{#2}\@ne + {\blx@err@invopt{max#1=#2}{% + 'max#1' must be greater than zero}} + {\ifnumless{#2}{\csname blx@min#1\endcsname} + {\blx@err@confopt{max#1/min#1}{% + 'max#1' must be greater than or equal to 'min#1'}} + {\csnumdef{blx@max#1}{#2}}}} + +\def\blx@defminval#1#2{% + \ifnumless{#2}\@ne + {\blx@err@invopt{min#1=#2}{% + min#1' must be greater than zero}} + {\ifnumgreater{#2}{\csname blx@max#1\endcsname} + {\blx@err@confopt{max#1/min#1}{% + 'min#1' must be less than or equal to 'max#1'}} + {\csnumdef{blx@min#1}{#2}}}} \DeclareBibliographyOption{maxitems}{\blx@setmaxitems{#1}} +\DeclareBibliographyOption{minitems}{\blx@setminitems{#1}} + \def\blx@setmaxitems#1{% \ifnum#1<\@ne \blx@err@invopt{maxitems=#1} @@ -8429,7 +8692,6 @@ \fi \fi} -\DeclareBibliographyOption{minitems}{\blx@setminitems{#1}} \def\blx@setminitems#1{% \ifnum#1<\@ne \blx@err@invopt{minitems=#1} @@ -8506,6 +8768,12 @@ \def\blx@hook@endlang{\blx@postpunct}} \DeclareBibliographyOption{indexing}[true]{% + \blx@opt@index{#1}} +\DeclareTypeOption{indexing}[true]{% + \blx@opt@index{#1}} +\DeclareEntryOption{indexing}[true]{% + \blx@opt@index{#1}} +\def\blx@opt@index#1{% \ifcsdef{blx@opt@index@#1} {\csuse{blx@opt@index@#1}} {\blx@err@invopt{indexing=#1}{}}} @@ -9038,6 +9306,9 @@ \iftoggle{blx@natbib} {\blx@inputonce{blx-natbib.def}{natbib compatibility}{}{}{}{}} {} +\iftoggle{blx@mcite} + {\blx@inputonce{blx-mcite.def}{mcite-like commands}{}{}{}{}} + {} \RequireBibliographyStyle{\blx@bbxfile} \RequireCitationStyle{\blx@cbxfile} \blx@secinit @@ -9149,6 +9420,11 @@ \fi \blx@checkencoding} +\def\abx@mapinpenc#1#2{\csdef{blx@enc@#1}{#2}} +\abx@mapinpenc{utf8x}{utf8} +\abx@mapinpenc{lutf8}{utf8} +\abx@mapinpenc{x-ascii}{ascii} + \def\blx@checkencoding{% \ifundef\inputencodingname {\ifundef\XeTeXrevision @@ -9165,14 +9441,9 @@ \blx@info@noline{% XeTeX detected.\MessageBreak Assuming input encoding '\blx@inputencoding'}}} - {\let\blx@inputencoding\inputencodingname - \ifboolexpr{ - test {\ifdefstring\blx@inputencoding{utf8x}} - or - test {\ifdefstring\blx@inputencoding{lutf8}} - } - {\def\blx@inputencoding{utf8}} - {}% + {\ifcsdef{blx@enc@\inputencodingname} + {\letcs\blx@inputencoding{blx@enc@\inputencodingname}} + {\let\blx@inputencoding\inputencodingname}% \blx@info@noline{% Input encoding '\blx@inputencoding' detected}}% \ifdef\blx@bibencoding @@ -9187,7 +9458,7 @@ Automatic encoding selection.\MessageBreak Assuming data encoding '\blx@bibencoding'} \togglefalse{blx@reencode}} - {\ifdefequal\blx@bibencoding\blx@inputencoding + {\ifdefstrequal\blx@bibencoding\blx@inputencoding {\blx@info@noline{% Data encoding '\blx@bibencoding' specified.\MessageBreak No need to reencode data}% @@ -9235,29 +9506,32 @@ % Deferred last minute setup \AtBeginDocument{% + \blx@checkbackend{style}% \if@filesw \ifnum\blx@backend=\blx@backend@biber \blx@ifsigned{\jobname}{bcf} - {\immediate\openout\blx@auxout\jobname.bcf\relax - \blx@auxwrite\blx@auxout{}{\blx@bcf@start}% - \AfterEndDocument{% - \blx@auxwrite\blx@auxout{}{\blx@bcf@end}% - \immediate\closeout\blx@auxout}} - {}% + {\blx@ctrlwrite@biber} + {}% \else \blx@auxinit@bibtex\blx@bibfiles \blx@ifsigned{\blx@ctrlfile\blxauxsuffix}{bib} - {\immediate\openout\blx@auxout\blx@ctrlfile\blxauxsuffix.bib\relax - \blx@auxwrite\blx@auxout{}{\blx@ctrl@bibtex}% - \immediate\closeout\blx@auxout} - {}% + {\blx@ctrlwrite@bibtex} + {}% \fi - \blx@bblinput + \ifnumless\blx@reqbiber\thr@@ + {\blx@bblinput} + {}% \blx@maxsection\z@ \fi + \let\blx@reqbiber\z@ \csuse{abx@preamble}% + \blx@checkbackend{.bib file}% \blx@inf@refsec - \blx@inf@refseg} + \blx@inf@refseg + \numdef\blx@premaxnames{\c@maxnames}% + \numdef\blx@preminnames{\c@minnames}% + \c@maxnames\blx@maxcitenames\relax + \c@minnames\blx@mincitenames\relax} \AtEndOfPackage{% \AtBeginDocument{% |