diff options
author | Karl Berry <karl@freefriends.org> | 2010-03-20 23:32:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-03-20 23:32:55 +0000 |
commit | 1080eb42d3947b4414c2bda84c4d0c0b809c4e16 (patch) | |
tree | d5e2f1893ee3a1f85c1b0d195db8ba0a8c28ff60 /Master/texmf-dist/tex/latex/biblatex/biblatex.sty | |
parent | 6861935735f4cbecd9f2772a4123b3fb07d6ffc2 (diff) |
biblatex 0.9a (19mar10)
git-svn-id: svn://tug.org/texlive/trunk@17511 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 | 1006 |
1 files changed, 639 insertions, 367 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty index 62452d3e8c8..ce5dc41d4a4 100644 --- a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty +++ b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty @@ -1,4 +1,4 @@ -% $Id: biblatex.sty,v 0.9 2010/02/14 15:42:33 lehman beta $ +% $Id: biblatex.sty,v 0.9a 2010/03/19 19:52:15 lehman beta $ % Copyright (c) 2006-2010 Philipp Lehman. % @@ -21,7 +21,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{biblatex} -[\abx@rcsid $Id: biblatex.sty,v 0.9 2010/02/14 15:42:33 lehman beta $ +[\abx@rcsid $Id: biblatex.sty,v 0.9a 2010/03/19 19:52:15 lehman beta $ programmable bibliographies] \def\blx@version$#1: #2 ${#2} @@ -249,35 +249,6 @@ % trick showkeys into believing we're havard \let\HAR@checkdef\@empty -% koma-script -\newcommand{\ifkomabibtotoc}[2]{#2} -\newcommand{\ifkomabibtotocnumbered}[2]{#2} -\ifdef\ds@bibtotoc - {\DeclareOption{bibtotoc}{% - \let\ifkomabibtotoc\@firstoftwo} - \DeclareOption{bibtotocnumbered}{% - \let\ifkomabibtotoc\@firstoftwo - \let\ifkomabibtotocnumbered\@firstoftwo} - \DeclareOption{bibliography=nottotoc}{% - \let\ifkomabibtotoc\@secondoftwo - \let\ifkomabibtotocnumbered\@secondoftwo} - \DeclareOption{bibliography=totoc}{% - \let\ifkomabibtotoc\@firstoftwo} - \DeclareOption{bibliography=totocnumbered}{% - \let\ifkomabibtotoc\@firstoftwo - \let\ifkomabibtotocnumbered\@firstoftwo}} - {} - -% memoir -\@ifclassloaded{memoir} - {\newcommand*{\ifmemoirbibintoc}{% - \ifnobibintoc - \expandafter\@secondoftwo - \else - \expandafter\@firstoftwo - \fi}} - {\newcommand{\ifmemoirbibintoc}[2]{#2}} - %% Category codes \def\blx@docatcodes{% @@ -342,12 +313,18 @@ \def\thehighnamepenalty{\the\c@highnamepenalty} \newcounter{lownamepenalty} \def\thelownamepenalty{\the\c@lownamepenalty} +\newcounter{maxparens} +\def\themaxparens{\the\c@maxparens} +\newcounter{parenlevel} +\def\theparenlevel{\the\c@parenlevel} \newcount\blx@tempcnta \newcount\blx@tempcntb \newcount\blx@maxsection \newcount\blx@maxsegment \newcount\blx@notetype +\newcount\blx@parenlevel@text +\newcount\blx@parenlevel@foot \newlength{\labelnumberwidth} \newlength{\labelalphawidth} @@ -678,9 +655,9 @@ \PackageWarning{biblatex}{#1\@gobble}% \endgroup} \protected\def\blx@warning@entry#1{% - \ifundef\abx@field@entrykey - {\blx@warning{#1}} - {\blx@warning{#1\MessageBreak at entry '\abx@field@entrykey'}}} + \ifdef\abx@field@entrykey + {\blx@warning{#1\MessageBreak at entry '\abx@field@entrykey'}} + {\blx@warning{#1}}} \protected\def\blx@info#1{% \begingroup @@ -701,6 +678,9 @@ \def\blx@missing#1{% \mbox{\reset@font\bfseries#1}} +\protected\def\blx@errormark{% + \rule[0.25ex]{1.25ex}{1.25ex}} + \def\blx@err@patch#1{% \blx@error {Patching #1 failed} @@ -714,23 +694,35 @@ {Language '#1' not found} {The localization module for '#1' could not be found}} -\def\blx@err@invarg#1{% +\def\blx@err@invarg#1#2{% \blx@error {Argument '#1' invalid} - {The argument you have supplied is invalid.\MessageBreak - See the biblatex manual for details}} + {\ifblank{#2} + {The argument you have supplied is invalid.\MessageBreak + See the biblatex manual for details} + {#2}}} -\def\blx@err@invopt#1{% +\def\blx@err@invopt#1#2{% \blx@error {Option '#1' invalid} - {The option you have supplied is invalid.\MessageBreak - See the biblatex manual for valid option keys and - possible values}} + {\ifblank{#2} + {The option you have supplied is invalid.\MessageBreak + See the biblatex manual for valid option keys and + possible values} + {#2}}} -\def\blx@err@confopt#1{% +\def\blx@err@confopt#1#2{% + \blx@error + {Conflicting options\ifblank{#1}{}{ (#1)}} + {\ifblank{#2} + {The option you have supplied conflicts with another one.\MessageBreak + See the biblatex manual for valid option keys and possible values} + {#2}}} + +\def\blx@err@optdef#1{% \blx@error {Conflicting options} - {#1}} + {The option '#1' is already defined}} \def\blx@err@nodocdiv#1{% \blx@error @@ -779,6 +771,23 @@ If you continue, I will fall back to '\string#1'}% #1} +\def\blx@err@matchparen#1{% + \blx@error + {Unbalanced parentheses or brackets} + {\iftoggle{blx@footnote}{#1 in foot or endnote}{#1}.\MessageBreak + This error is triggered if \string\bibopenparen\space and + \string\bibcloseparen\MessageBreak or + \string\bibopenbracket\space and \string\bibclosebracket\space + are unbalanced\MessageBreak or mismatched}} + +\def\blx@err@nestparen#1{% + \blx@error + {Too deeply nested parentheses or brackets} + {#1 nested too deeply% + \iftoggle{blx@footnote}{\space in foot or endnote}{}.\MessageBreak + This error may also be triggered if \string\mkbibparens\MessageBreak + or \string\mkbibbrackets\space are nested too deeply}} + \def\blx@warn@nohyph#1{% \blx@warning{No hyphenation patterns for '#1'}} @@ -1150,12 +1159,12 @@ \expandafter\blx@defpunctpairs \expandafter{\the\csname blx@sf@\detokenize{#1}\endcsname}{#2}% \else - \blx@err@invarg{\detokenize{#1}}% + \blx@err@invarg{\detokenize{#1}{}}% \fi \else - \blx@err@invarg{\detokenize{#1}}% + \blx@err@invarg{\detokenize{#1}{}}% \fi} - {\blx@err@invarg{\detokenize{#1}}}} + {\blx@err@invarg{\detokenize{#1}{}}}} \def\blx@defpunctpairs#1#2{% \blx@undefpair{#1}{\the\blx@sf@dot}% @@ -1183,10 +1192,10 @@ \eappto\blx@tempb{% \cslet{blx@pp@\blx@tempa @\the\sfcode`#1}\noexpand\@empty}% \else - \blx@err@invarg{#1}% + \blx@err@invarg{#1}{}% \fi \else - \blx@err@invarg{#1}% + \blx@err@invarg{#1}{}% \fi \expandafter\blx@defpair \fi} @@ -1314,22 +1323,14 @@ \fi \csuse{blx@pq@#1}} -\newrobustcmd*{\unspace}{% - \ifhmode - \expandafter\blx@unspace - \fi} - -\def\blx@unspace{% - \ifdim\lastskip>\z@ - \unskip - \expandafter\blx@unspace - \else - \ifnum\lastpenalty>\z@ - \unpenalty - \expandafter\expandafter - \expandafter\blx@unspace - \fi - \fi} +\providerobustcmd*{\unspace}{% + \ifbool{hmode} + {\ifdimgreater\lastskip\z@ + {\unskip\unspace} + {\ifnumgreater\lastpenalty\z@ + {\unpenalty\unspace} + {}}} + {}} \newrobustcmd*{\bibsentence}{% \leavevmode\spacefactor\blx@sf@par @@ -1490,8 +1491,22 @@ {\ifblank{#2} {\define@key{blx@opt@pre}{#1}{#3}} {\define@key{blx@opt@pre}{#1}[#2]{#3}}} - {\blx@err@confopt{The package option '#1' already exists}}} - {\blx@err@confopt{The package option '#1' already exists}}} + {\blx@err@optdef{#1}}} + {\blx@err@optdef{#1}}} + +% {<key>}[<value>]{<code>} + +\newrobustcmd*{\DeclareTypeOption}[1]{% + \@ifnextchar[%] + {\blx@deftypeopt{#1}} + {\blx@deftypeopt{#1}[]}} + +\long\def\blx@deftypeopt#1[#2]#3{% + \ifcsundef{KV@blx@opt@typ@#1} + {\ifblank{#2} + {\define@key{blx@opt@typ}{#1}{#3}} + {\define@key{blx@opt@typ}{#1}[#2]{#3}}} + {\blx@err@optdef{#1}}} % {<key>}[<value>]{<code>} @@ -1501,11 +1516,11 @@ {\blx@defentryopt{#1}[]}} \long\def\blx@defentryopt#1[#2]#3{% - \ifcsundef{KV@blx@opt@bib@#1} + \ifcsundef{KV@blx@opt@ent@#1} {\ifblank{#2} - {\define@key{blx@opt@bib}{#1}{#3}} - {\define@key{blx@opt@bib}{#1}[#2]{#3}}} - {\blx@err@confopt{The entry option '#1' already exists}}} + {\define@key{blx@opt@ent}{#1}{#3}} + {\define@key{blx@opt@ent}{#1}[#2]{#3}}} + {\blx@err@optdef{#1}}} %% Auxiliary commands @@ -1562,6 +1577,9 @@ \newrobustcmd*{\renewbibmacro}{% \@star@or@long{\blx@defbibmacro\renew@command}} +\newrobustcmd*{\providebibmacro}{% + \@star@or@long{\blx@defbibmacro\provide@command}} + \def\blx@defbibmacro#1#2{% \expandafter#1\csname abx@macro@\detokenize{#2}\endcsname} @@ -1896,12 +1914,16 @@ % {<true>}{<false>} \protected\def\blx@ifciteseen@global{% - \expandafter\blx@ifseen@global - \expandafter{\abx@field@entrykey}} + \ifdef\abx@field@entrykey + {\expandafter\blx@ifseen@global + \expandafter{\abx@field@entrykey}} + {\@secondoftwo}} \protected\def\blx@ifciteseen@context{% - \expandafter\blx@ifseen@context - \expandafter{\abx@field@entrykey}} + \ifdef\abx@field@entrykey + {\expandafter\blx@ifseen@context + \expandafter{\abx@field@entrykey}} + {\@secondoftwo}} % {<entrykey>}{<true>}{<false>} @@ -2530,6 +2552,7 @@ \newblock \newunit \setunit \finentry} \appto\blx@blxinit{% + \def\ifnatbibmode{\iftoggle{blx@natbib}}% \def\ifcitation{\iftoggle{blx@citation}}% \def\ifbibliography{\iftoggle{blx@bibliography}}% \def\ifciteindex{\iftoggle{blx@citeindex}}% @@ -2921,15 +2944,20 @@ \c@liststart#1\relax \fi}% \ifblank{#2} - {\ifnum\c@listtotal>\c@maxnames - \c@liststop\c@minnames - \else - \c@liststop\c@listtotal + {\c@liststop\c@listtotal + \ifnum\c@listtotal>\c@maxnames + \ifnum\c@listtotal>\c@minnames + \c@liststop\c@minnames + \fi \fi} {\ifnum#2>\c@listtotal \c@liststop\c@listtotal \else - \c@liststop#2\relax + \ifnum#2<\@ne + \c@liststop\@ne + \else + \c@liststop#2\relax + \fi \fi}% \def\currentname{#3}% \letcs\blx@thedata{abx@name@#3}% @@ -3003,15 +3031,20 @@ \c@liststart#1\relax \fi}% \ifblank{#2} - {\ifnum\c@listtotal>\c@maxitems - \c@liststop\c@minitems - \else - \c@liststop\c@listtotal + {\c@liststop\c@listtotal + \ifnum\c@listtotal>\c@maxitems + \ifnum\c@listtotal>\c@minitems + \c@liststop\c@minitems + \fi \fi} {\ifnum#2>\c@listtotal \c@liststop\c@listtotal \else - \c@liststop#2\relax + \ifnum#2<\@ne + \c@liststop\@ne + \else + \c@liststop#2\relax + \fi \fi}% \def\currentlist{#3}% \letcs\blx@thedata{abx@list@#3}} @@ -3062,7 +3095,8 @@ \blx@resetdata \blx@getdata{#1}% \blx@entrysetcount - \blx@options + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry \addtocounter{instcount}\@ne \blx@execute \blx@beglang#2\blx@endlang @@ -3411,6 +3445,8 @@ \do{passim}% \do{see}% \do{seealso}% + \do{backrefpage}% + \do{backrefpages}% \do{thiscite}% \do{january}% \do{february}% @@ -3891,6 +3927,7 @@ \def\abx@dofields{% \do{entrykey}% + \do{childentrykey}% \do{entrytype}% \do{entrysubtype}% \do{entryset}% @@ -4057,9 +4094,9 @@ BibTeX \fi reported the following issues% - \ifundef\abx@field@entrykey - {} - {\MessageBreak with '\abx@field@entrykey'}% + \ifdef\abx@field@entrykey + {\MessageBreak with '\abx@field@entrykey'} + {}% :#1}% \blx@warning@noline{\blx@tempa}% \endgroup} @@ -4215,7 +4252,7 @@ \long\def\blx@bbl@options@i#1{\blx@bbl@options@ii#1==&} \long\def\blx@bbl@options@ii#1=#2=#3&{% - \ifcsundef{KV@blx@opt@bib@#1} + \ifcsundef{KV@blx@opt@ent@#1} {\blx@warning@noline{% Ignoring undefined option '#1'\MessageBreak at entry '\abx@field@entrykey'}} @@ -4270,26 +4307,38 @@ \ifcsdef{blx@setc@\the\c@refsection @#1} {\expandafter\expandafter\expandafter\blx@getdata \expandafter\expandafter\expandafter{% - \csname blx@setc@\the\c@refsection @#1\endcsname}} + \csname blx@setc@\the\c@refsection @#1\endcsname}% + \blx@ifdata{#1} + {\def\abx@field@childentrykey{#1}% + \begingroup + \blx@getdata{#1}% + \edef\blx@tempa{\endgroup + \def\noexpand\abx@field@childentrytype{\abx@field@entrytype}}% + \blx@tempa} + {}} {\blx@getdata{#1}}% \ifcsdef{blx@seti@\the\c@refsection @#1} {\letcs\abx@field@entrysetcount{blx@seti@\the\c@refsection @#1}} {}} -\def\blx@getdata@cite@i#1#2{% - \blx@getdata{#1}% - \def\abx@field@entrysetcount{#2}} - \def\blx@execute{% \blx@imc@thefield{execute}} -\def\blx@options{% +\def\blx@setoptions@entry{% \blx@imc@iffieldundef{options} {} {\begingroup - \def\blx@tempa{\endgroup\setkeys{blx@opt@bib}}% - \expandafter\blx@tempa - \expandafter{\abx@field@options}}} + \edef\blx@tempa{\endgroup + \noexpand\setkeys{blx@opt@ent}{\abx@field@options}}% + \blx@tempa}} + +\def\blx@setoptions@type#1{% + \ifcsdef{blx@opts@type@#1} + {\begingroup + \edef\blx@tempa{\endgroup + \noexpand\setkeys{blx@opt@typ}{\csuse{blx@opts@type@#1}}}% + \blx@tempa} + {}} \def\blx@entrysetcount{% \ifdef\abx@field@entrykey @@ -4299,12 +4348,14 @@ {}} {}} -% {<entrykey>}{<type>}{<options>} +% {<entrykey>}{<entrytype>}{<options>} \protected\def\blx@bbl@entry#1#2#3{% \begingroup \edef\abx@field@entrykey{\detokenize{#1}}% - \blx@bbl@options{#3}\blx@options + \blx@setoptions@type{#2}% + \blx@bbl@options{#3}% + \blx@setoptions@entry \edef\blx@bbl@data{blx@data@\the\c@refsection @\abx@field@entrykey}% \csuse\blx@bbl@data \cslet\blx@bbl@data\@empty @@ -4523,7 +4574,7 @@ \def\blx@bblstart{% \let\preamble\blx@bbl@preamble - \let\warn\blx@bbl@warn + \let\warn\blx@bbl@thewarn \let\entry\blx@bbl@entry \let\endentry\blx@bbl@endentry \let\lossort\blx@bbl@lossort @@ -4679,6 +4730,34 @@ %% Bibliography +% {<name>}{<start code>}[<end code>]{<item code>} + +\newrobustcmd*{\defbibenvironment}[4]{% + \long\csdef{blx@env@#1}{#2}% + \long\csdef{blx@endenv@#1}{#3}% + \long\csdef{blx@item@#1}{#4}} + +\defbibenvironment{bibliography} + {\list{}{% + \leftmargin\bibhang + \itemindent-\leftmargin + \itemsep\bibitemsep + \parsep\bibparsep}} + {\endlist} + {\item} + +\defbibenvironment{shorthands} + {\list{\thefield{shorthand}}{% + \labelwidth\shorthandwidth + \labelsep\biblabelsep + \leftmargin\labelwidth + \advance\leftmargin\labelsep + \itemsep\bibitemsep + \parsep\bibparsep + \def\makelabel##1{##1\hss}}} + {\endlist} + {\item} + % {<name>}[<default>]{<code>} \newrobustcmd*{\defbibheading}[1]{% @@ -4858,11 +4937,11 @@ \define@key{blx@bbc}{maxnames}{\blx@key@maxnames{#1}} \def\blx@key@maxnames#1{% \ifnum#1<\c@maxnames - \blx@error - {'maxnames=#1' invalid} - {The value may not be smaller than the global setting}% + \blx@err@confopt{maxnames}{% + The value may not be smaller than the + global 'maxnames' (=\the\c@maxnames)}% \else - \c@maxnames#1\relax + \blx@setmaxnames{#1}% \fi} \define@key{blx@bib}{minnames}{\blx@key@minnames{#1}} @@ -4872,25 +4951,26 @@ \define@key{blx@bbc}{minnames}{\blx@key@minnames{#1}} \def\blx@key@minnames#1{% \ifnum#1<\c@minnames - \blx@error - {'minnames=#1' invalid} - {The value may not be smaller than the global setting}% + \blx@err@confopt{minnames}{% + The value may not be smaller than the + global 'minnames' (=\the\c@minnames)}% \else - \c@minnames#1\relax + \blx@setminnames{#1}% \fi} -\define@key{blx@bib}{maxitems}{\c@maxitems#1\relax} -\define@key{blx@los}{maxitems}{\c@maxitems#1\relax} -\define@key{blx@bbs}{maxitems}{\c@maxitems#1\relax} -\define@key{blx@bbg}{maxitems}{\c@maxitems#1\relax} -\define@key{blx@bbc}{maxitems}{\c@maxitems#1\relax} +\define@key{blx@bib}{maxitems}{\blx@setmaxitems{#1}} +\define@key{blx@los}{maxitems}{\blx@setmaxitems{#1}} +\define@key{blx@bbs}{maxitems}{\blx@setmaxitems{#1}} +\define@key{blx@bbg}{maxitems}{\blx@setmaxitems{#1}} +\define@key{blx@bbc}{maxitems}{\blx@setmaxitems{#1}} -\define@key{blx@bib}{minitems}{\c@minitems#1\relax} -\define@key{blx@los}{minitems}{\c@minitems#1\relax} -\define@key{blx@bbs}{minitems}{\c@minitems#1\relax} -\define@key{blx@bbg}{minitems}{\c@minitems#1\relax} -\define@key{blx@bbc}{minitems}{\c@minitems#1\relax} +\define@key{blx@bib}{minitems}{\blx@setminitems{#1}} +\define@key{blx@los}{minitems}{\blx@setminitems{#1}} +\define@key{blx@bbs}{minitems}{\blx@setminitems{#1}} +\define@key{blx@bbg}{minitems}{\blx@setminitems{#1}} +\define@key{blx@bbc}{minitems}{\blx@setminitems{#1}} +\define@key{blx@bhd}{heading}{\blx@key@heading{#1}} \define@key{blx@bib}{heading}{\blx@key@heading{#1}} \define@key{blx@los}{heading}{\blx@key@heading{#1}} \define@key{blx@bbs}{heading}{\blx@key@heading{#1}} @@ -4900,11 +4980,23 @@ {\blx@error {Heading '#1' undefined} {Use \string\defbibheading\space to define it}} - {\def\blx@tempb{#1}}} + {\def\blx@theheading{#1}}} + +\define@key{blx@bib}{env}{\blx@key@env{#1}} +\define@key{blx@los}{env}{\blx@key@env{#1}} +\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 + {Environment '#1' undefined} + {Use \string\defbibenvironment\space to define it}} + {\def\blx@theenv{#1}}} -\define@key{blx@bib}{title}{\blx@key@title{#1}} -\define@key{blx@los}{title}{\blx@key@title{#1}} -\def\blx@key@title{\long\def\blx@tempe} +\define@key{blx@bhd}{title}{\long\def\blx@thetitle{#1}} +\define@key{blx@bib}{title}{\long\def\blx@thetitle{#1}} +\define@key{blx@los}{title}{\long\def\blx@thetitle{#1}} \define@key{blx@bib}{prenote}{\blx@key@prenote{#1}} \define@key{blx@los}{prenote}{\blx@key@prenote{#1}} @@ -4916,7 +5008,7 @@ {\blx@error {Note '#1' undefined} {Use \string\defbibnote\space to define it}} - {\def\blx@tempc{#1}}} + {\def\blx@theprenote{#1}}} \define@key{blx@bib}{postnote}{\blx@key@postnote{#1}} \define@key{blx@los}{postnote}{\blx@key@postnote{#1}} @@ -4928,7 +5020,28 @@ {\blx@error {Note '#1' undefined} {Use \string\defbibnote\space to define it}} - {\def\blx@tempd{#1}}} + {\def\blx@thepostnote{#1}}} + +% [<options>] + +\newrobustcmd*{\printbibheading}{% + \begingroup + \edef\on@line{\on@line}% + \@ifnextchar[%] + {\blx@printbibheading} + {\blx@printbibheading[]}} + +\def\blx@printbibheading[#1]{% + \def\blx@theheading{bibliography}% + \let\blx@thetitle\@empty + \blx@safe@actives + \setkeys{blx@bhd}{#1}% + \blx@rest@actives + \edef\blx@tempa{\endgroup + \noexpand\blx@bibheading + {\expandonce\blx@theheading} + {\expandonce\blx@thetitle}}% + \blx@tempa} % [<options>] @@ -4943,10 +5056,11 @@ \toggletrue{blx@tempa}% \toggletrue{blx@tempb}% \letcs\blx@tempa{blx@sbib@\the\c@refsection}% - \def\blx@tempb{bibliography}% - \let\blx@tempc\@empty - \let\blx@tempd\@empty - \let\blx@tempe\@empty + \def\blx@theheading{bibliography}% + \def\blx@theenv{bibliography}% + \let\blx@theprenote\@empty + \let\blx@thepostnote\@empty + \let\blx@thetitle\@empty \blx@safe@actives \setkeys{blx@bib}{#1}% \blx@rest@actives @@ -4967,10 +5081,11 @@ {\blx@bibbysection[]}} \def\blx@bibbysection[#1]{% - \def\blx@tempb{bibliography}% - \let\blx@tempc\@empty - \let\blx@tempd\@empty - \let\blx@tempe\@empty + \def\blx@theheading{bibliography}% + \def\blx@theenv{bibliography}% + \let\blx@theprenote\@empty + \let\blx@thepostnote\@empty + \let\blx@thetitle\@empty \c@refsection\@ne \blx@safe@actives \setkeys{blx@bbs}{#1}% @@ -5005,10 +5120,11 @@ {\blx@bibbysegment[]}} \def\blx@bibbysegment[#1]{% - \def\blx@tempb{bibliography}% - \let\blx@tempc\@empty - \let\blx@tempd\@empty - \let\blx@tempe\@empty + \def\blx@theheading{bibliography}% + \def\blx@theenv{bibliography}% + \let\blx@theprenote\@empty + \let\blx@thepostnote\@empty + \let\blx@thetitle\@empty \c@refsection\z@ \c@refsegment\@ne \blx@safe@actives @@ -5046,10 +5162,11 @@ {\blx@bibbycategory[]}} \def\blx@bibbycategory[#1]{% - \def\blx@tempb{bibliography}% - \let\blx@tempc\@empty - \let\blx@tempd\@empty - \let\blx@tempe\@empty + \def\blx@theheading{bibliography}% + \def\blx@theenv{bibliography}% + \let\blx@theprenote\@empty + \let\blx@thepostnote\@empty + \let\blx@thetitle\@empty \c@refsection\z@ \blx@safe@actives \setkeys{blx@bbc}{#1}% @@ -5076,8 +5193,8 @@ % {<entrykey>,...} \def\blx@bibliography{% - \blx@bibheading\blx@tempb\blx@tempe - \blx@bibnote\blx@tempc + \blx@bibheading\blx@theheading\blx@thetitle + \blx@bibnote\blx@theprenote \begingroup \blx@bibinit \let\@noitemerr\@empty @@ -5088,24 +5205,25 @@ \ifnum\bibnamesep=\z@ \let\blx@namesep\relax \fi - \thebibliography\relax + \csuse{blx@env@\blx@theenv}% \csuse{blx@hook@bibinit}% \let\blx@do\blx@bibitem \let\blx@done\blx@endbibliography \blx@listloop} \def\blx@endbibliography{% - \endthebibliography + \csuse{blx@endenv@\blx@theenv}% \par\nobreak \blx@noitem \endgroup - \blx@bibnote\blx@tempd + \blx@bibnote\blx@thepostnote \endgroup} \def\blx@bibheading#1#2{% \let\newrefsection\relax \let\newrefsegment\relax - \ifdefempty#2 + \expandafter\ifblank + \expandafter{#2} {\csuse{blx@head@#1}} {\csuse{blx@head@#1}[#2]}% \let\newrefsection\blx@newrefsection @@ -5139,10 +5257,11 @@ \begingroup \blx@getdata{#1}% \blx@ifdriver{\abx@field@entrytype} - {\blx@options + {\blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry \blx@thelabelnumber \addtocounter{instcount}\@ne - \thebibitem\relax + \csuse{blx@item@\blx@theenv}\relax \blx@initsep \blx@namesep \csuse{blx@hook@bibitem}% @@ -5178,15 +5297,6 @@ \fi \global\let\blx@prevhash\abx@field@fullhash} -\providecommand*{\thebibliography}{} -\renewenvironment*{thebibliography} - {\list{}{% - \leftmargin\bibhang - \itemindent-\leftmargin - \itemsep\bibitemsep - \parsep\bibparsep}} - {\endlist} -\newcommand*{\thebibitem}{\item} \newrobustcmd*{\AtBeginBibliography}{\gappto\blx@hook@bibinit} \newrobustcmd*{\AtEveryBibitem}{\gappto\blx@hook@bibitem} \@onlypreamble\AtBeginBibliography @@ -5266,10 +5376,11 @@ \toggletrue{blx@tempa}% \toggletrue{blx@tempb}% \letcs\blx@tempa{blx@losh@\the\c@refsection}% - \def\blx@tempb{shorthands}% - \let\blx@tempc\@empty - \let\blx@tempd\@empty - \let\blx@tempe\@empty + \def\blx@theheading{shorthands}% + \def\blx@theenv{shorthands}% + \let\blx@theprenote\@empty + \let\blx@thepostnote\@empty + \let\blx@thetitle\@empty \let\blx@printbibchecks\relax \blx@safe@actives \setkeys{blx@los}{#1}% @@ -5294,38 +5405,27 @@ \else \@restonecolfalse \fi - \blx@bibheading\blx@tempb\blx@tempe - \blx@bibnote\blx@tempc + \blx@bibheading\blx@theheading\blx@thetitle + \blx@bibnote\blx@theprenote \begingroup \blx@bibinit \let\@noitemerr\@empty \let\blx@noitem\blx@warn@losempty - \theshorthands\relax + \csuse{blx@env@\blx@theenv}% \csuse{blx@hook@losinit}% \let\blx@do\blx@lositem \let\blx@done\blx@endshorthands \blx@listloop} \def\blx@endshorthands{% - \endtheshorthands + \csuse{blx@endenv@\blx@theenv}% \par\nobreak \blx@noitem \endgroup - \blx@bibnote\blx@tempd + \blx@bibnote\blx@thepostnote \endgroup \if@restonecol\twocolumn\fi} -\newcommand*{\thelositem}{\item} -\newenvironment*{theshorthands} - {\list{\thefield{shorthand}}{% - \labelwidth\shorthandwidth - \labelsep\biblabelsep - \leftmargin\labelwidth - \advance\leftmargin\labelsep - \itemsep\bibitemsep - \parsep\bibparsep - \def\makelabel##1{##1\hss}}} - {\endlist} \newrobustcmd*{\AtBeginShorthands}{\gappto\blx@hook@losinit} \newrobustcmd*{\AtEveryLositem}{\gappto\blx@hook@lositem} \@onlypreamble\AtBeginShorthands @@ -5338,9 +5438,10 @@ {\let\blx@noitem\@empty \begingroup \blx@getdata{#1}% - \blx@options + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry \addtocounter{instcount}\@ne - \thelositem\relax + \csuse{blx@item@\blx@theenv}\relax \csuse{blx@hook@lositem}% \blx@execute \blx@initunit @@ -5499,7 +5600,7 @@ \AtEndDocument{\let\abx@aux@category\@gobbletwo} -%% Legacy commands +% Database \renewrobustcmd*{\bibliography}[1]{% \ifx\blx@bibfiles\@empty @@ -5509,21 +5610,6 @@ \fi} \let\blx@bibfiles\@empty -\AtBeginDocument{% - \protected\def\bibliography#1{% - \blx@error - {'\string\bibliography' invalid at this point} - {'\string\bibliography' must be given in the - preamble.\MessageBreak I'm ignoring the command}}} - -\renewrobustcmd*{\bibliographystyle}[1]{% - \blx@error - {'\string\bibliographystyle' invalid} - {'\string\bibliographystyle' is not supported. - Use the package\MessageBreak option 'style' or - the options 'bibstyle' and 'citestyle'.\MessageBreak - I'm ignoring the command}} - %% Citations \newrobustcmd*{\AtEveryCite}{\gappto\blx@hook@cite} @@ -5716,7 +5802,8 @@ \blx@getdata@cite{#1}% \fi \blx@entrysetcount - \blx@options + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry \blx@backref \blx@pagetracker \csuse{blx@hook@citekey}% @@ -6524,7 +6611,7 @@ \ifblank{#1} {\let\blx@thecheckpunct\blx@nocheckpunct} {\let\blx@thecheckpunct\blx@checkpunct - \edef\blx@autopunct{#1}}} + \edef\blx@autopunct{\detokenize{#1}}}} % [<prenote>][<postnote>]{<entrykey>,...}[<format>]{<namelist>}<punct> @@ -6674,6 +6761,7 @@ \def\iffieldnums#1{\blx@TE{\blx@imc@iffieldnums{#1}}}% \def\ifbibstring#1{\blx@TE{\blx@imc@ifbibstring{#1}}}% \def\iffieldbibstring#1{\blx@TE{\blx@imc@iffieldbibstring{#1}}}% + \def\ifnatbibmode{\blx@TE{\iftoggle{blx@natbib}}}% \def\ifcitation{\blx@TE{\iftoggle{blx@citation}}}% \def\ifbibliography{\blx@TE{\iftoggle{blx@bibliography}}}% \def\ifciteindex{\blx@TE{\iftoggle{blx@citeindex}}}% @@ -6804,38 +6892,125 @@ \newcommand*{\bibleftbracket}{\blx@postpunct[} \newcommand*{\bibrightbracket}{\blx@postpunct]\midsentence} -\newrobustcmd{\mkbibparens}[1]{% +\def\blx@parenlevel{% + \iftoggle{blx@footnote} + {\blx@parenlevel@foot} + {\blx@parenlevel@text}} + +\newrobustcmd*{\blx@bibopenparen}{% + \blx@opencheck\bibopenparen + \blx@postpunct + \ifnum\blx@parenlevel=\z@ + \global\blx@parenlevel\@ne + \global\c@parenlevel\@ne + \expandafter\bibleftparen + \else + \expandafter\blx@openparen + \fi} + +\newrobustcmd*{\blx@bibopenbracket}{% + \blx@opencheck\bibopenbracket \blx@postpunct + \ifnum\blx@parenlevel=\z@ + \global\blx@parenlevel1002 + \global\c@parenlevel\@ne + \expandafter\bibleftbracket + \else + \expandafter\blx@openparen + \fi} + +\newrobustcmd*{\blx@bibcloseparen}{% + \blx@closecheck\bibcloseparen + \blx@postpunct\blx@closeparen} + +\newrobustcmd*{\blx@bibclosebracket}{% + \blx@closecheck\bibclosebracket + \blx@postpunct\blx@closeparen} + +\def\blx@openparen{% + \ifodd\blx@parenlevel + \global\advance\blx@parenlevel\@ne + \global\advance\c@parenlevel\@ne + \expandafter\bibleftbracket + \else + \global\advance\blx@parenlevel\@ne + \global\advance\c@parenlevel\@ne + \expandafter\bibleftparen + \fi} + +\def\blx@closeparen{% + \ifodd\blx@parenlevel + \blx@closeparen@i + \expandafter\bibrightparen + \else + \blx@closeparen@i + \expandafter\bibrightbracket + \fi} + +\def\blx@closeparen@i{% + \ifnum\blx@parenlevel=1002 + \global\blx@parenlevel\z@ + \global\c@parenlevel\z@ + \else + \global\advance\blx@parenlevel\m@ne + \global\advance\c@parenlevel\m@ne + \fi} + +\def\blx@opencheck#1{% + \ifnum\numexpr\blx@parenlevel+\@ne + \ifnum\blx@parenlevel>\@m -1001\fi + >\c@maxparens + \blx@err@nestparen{\string#1}% + \blx@errormark + \fi} + +\def\blx@closecheck#1{% + \ifnum\numexpr\blx@parenlevel + \ifnum\blx@parenlevel>\@m -1001\fi + >\c@maxparens + \blx@err@nestparen{\string#1}% + \blx@errormark + \fi + \ifnum\blx@parenlevel<\@ne + \blx@err@matchparen{Unmatched \string#1}% + \blx@errormark + \fi} + +\AtEndDocument{% + \unless\ifnum\blx@parenlevel@text=\z@ + \blx@err@matchparen{% + Unbalanced parentheses or brackets in the document body}% + \fi + \unless\ifnum\blx@parenlevel@foot=\z@ + \blx@err@matchparen{% + Unbalanced parentheses or brackets in a foot or endnote}% + \fi} + +\newrobustcmd{\mkbibparens}[1]{% \begingroup - \let\mkbibparens\blx@noparens - \bibleftparen#1\blx@postpunct\bibrightparen + \blx@blxinit + \blx@setsfcodes + \bibopenparen#1\bibcloseparen \endgroup} -\long\def\blx@noparens#1{% - \blx@warning{Nested parentheses}% - \mkbibbrackets{#1}} - \newrobustcmd{\mkbibbrackets}[1]{% - \blx@postpunct \begingroup - \let\mkbibbrackets\blx@nobrackets - \bibleftbracket#1\blx@postpunct\bibrightbracket + \blx@blxinit + \blx@setsfcodes + \bibopenbracket#1\bibclosebracket \endgroup} -\long\def\blx@nobrackets#1{% - \blx@warning{Nested brackets}% - <#1\blx@postpunct>} +\newrobustcmd*{\parentext}{\mkbibparens} +\newrobustcmd*{\brackettext}{\mkbibbrackets} \newrobustcmd{\mkbibsuperscript}[1]{% \unspace\allowhyphens\textsuperscript{% \begingroup - \let\mkbibsuperscript\blx@nosuperscript + \protected\long\def\mkbibsuperscript##1{% + \blx@warning{Nested superscript}% + \mkbibbrackets{##1}}% #1\endgroup}} -\long\def\blx@nosuperscript#1{% - \blx@warning{Nested superscripts}% - \mkbibbrackets{#1}} - \newrobustcmd{\mkbibfootnote}{\blx@mkbibfootnote{}} \newrobustcmd{\mkbibfootnotetext}{\blx@mkbibfootnote{text}} \newrobustcmd{\blx@mkbibfootnote}[2]{% @@ -6950,9 +7125,17 @@ %% Package options -% {<options>} +% [<entrytype>]{<options>} -\newrobustcmd*{\ExecuteBibliographyOptions}{\setkeys{blx@opt@pre}} +\newrobustcmd*{\ExecuteBibliographyOptions}[2][]{% + \ifblank{#1} + {\setkeys{blx@opt@pre}{#2}} + {\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 % load-time only @@ -6978,7 +7161,7 @@ \DeclareBibliographyOption{backend}{% \ifcsdef{blx@backend@#1} {\letcs\blx@backend{blx@backend@#1}} - {\blx@err@invopt{backend=#1}}} + {\blx@err@invopt{backend=#1}{}}} \chardef\blx@backend@bibtex=0 \expandafter\chardef\csname blx@backend@bibtex8\endcsname=1 \chardef\blx@backend@biber=2 @@ -7011,7 +7194,7 @@ \DeclareBibliographyOption{sorting}{% \ifcsdef{blx@opt@sorting@#1} {\def\blx@sorting{#1}} - {\blx@err@invopt{sorting=#1}}} + {\blx@err@invopt{sorting=#1}{}}} \def\blx@opt@sorting@none{0} \def\blx@opt@sorting@nty{1} \def\blx@opt@sorting@nyt{2} @@ -7025,36 +7208,64 @@ \DeclareBibliographyOption{sortlos}{% \ifcsdef{blx@opt@sortlos@#1} {\letcs\blx@sortlos{blx@opt@sortlos@#1}} - {\blx@err@invopt{sortlos=#1}}} + {\blx@err@invopt{sortlos=#1}{}}} \def\blx@opt@sortlos@bib{0} \def\blx@opt@sortlos@los{1} -\DeclareBibliographyOption{maxnames}{% +\DeclareBibliographyOption{maxnames}{\blx@setmaxnames{#1}} +\def\blx@setmaxnames#1{% \ifnum#1<\@ne - \c@maxnames\@ne + \blx@err@invopt{maxnames=#1} + {'maxnames' must be greater than zero}% \else - \c@maxnames#1\relax + \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}{% +\DeclareBibliographyOption{minnames}{\blx@setminnames{#1}} +\def\blx@setminnames#1{% \ifnum#1<\@ne - \c@minnames\@ne + \blx@err@invopt{minnames=#1} + {'minnames' must be greater than zero}% \else - \c@minnames#1\relax + \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{maxitems}{% +\DeclareBibliographyOption{maxitems}{\blx@setmaxitems{#1}} +\def\blx@setmaxitems#1{% \ifnum#1<\@ne - \c@maxitems\@ne + \blx@err@invopt{maxitems=#1} + {'maxitems' must be greater than zero}% \else - \c@maxitems#1\relax + \ifnum#1<\c@minitems + \blx@err@confopt{maxitems/minitems} + {'maxitems' must be greater than or equal to 'minitems'}% + \else + \c@maxitems#1\relax + \fi \fi} -\DeclareBibliographyOption{minitems}{% +\DeclareBibliographyOption{minitems}{\blx@setminitems{#1}} +\def\blx@setminitems#1{% \ifnum#1<\@ne - \c@minitems\@ne + \blx@err@invopt{minitems=#1} + {'minitems' must be greater than zero}% \else - \c@minitems#1\relax + \ifnum#1>\c@maxitems + \blx@err@confopt{maxitems/minitems} + {'minitems' must be less than or equal to 'maxitems'}% + \else + \c@minitems#1\relax + \fi \fi} \DeclareBibliographyOption{maxline}{% @@ -7093,7 +7304,7 @@ \DeclareBibliographyOption{babel}{% \ifcsdef{blx@opt@babel@#1} {\csuse{blx@opt@babel@#1}} - {\blx@err@invopt{babel=#1}}} + {\blx@err@invopt{babel=#1}{}}} \def\blx@opt@babel@none{% \undef\blx@thelangenv \let\blx@hook@endlang\@empty} @@ -7110,7 +7321,7 @@ \DeclareBibliographyOption{indexing}[true]{% \ifcsdef{blx@opt@index@#1} {\csuse{blx@opt@index@#1}} - {\blx@err@invopt{indexing=#1}}} + {\blx@err@invopt{indexing=#1}{}}} \def\blx@opt@index@true{% \toggletrue{blx@citeindex}% \toggletrue{blx@bibindex}} @@ -7134,7 +7345,7 @@ \DeclareBibliographyOption{hyperref}[true]{% \ifcsdef{blx@opt@hyperref@#1} {\letcs\blx@hyperref{blx@opt@hyperref@#1}} - {\blx@err@invopt{hyperref=#1}}} + {\blx@err@invopt{hyperref=#1}{}}} \def\blx@opt@hyperref@false{0} \def\blx@opt@hyperref@true{1} \def\blx@opt@hyperref@auto{2} @@ -7163,7 +7374,7 @@ \DeclareBibliographyOption{block}{% \ifcsdef{blx@opt@block@#1} {\csuse{blx@opt@block@#1}} - {\blx@err@invopt{block=#1}}} + {\blx@err@invopt{block=#1}{}}} \def\blx@opt@block@none{% \let\blx@bibsetup\@empty \let\newblockpunct\@empty} @@ -7188,7 +7399,7 @@ \DeclareBibliographyOption{pagetracker}[true]{% \ifcsdef{blx@opt@pagetracker@#1} {\csuse{blx@opt@pagetracker@#1}} - {\blx@err@invopt{pagetracker=#1}}} + {\blx@err@invopt{pagetracker=#1}{}}} \def\blx@opt@pagetracker@true{% \if@twoside \blx@opt@pagetracker@spread @@ -7221,7 +7432,7 @@ \DeclareBibliographyOption{citetracker}[true]{% \ifcsdef{blx@opt@citetracker@#1} {\csuse{blx@opt@citetracker@#1}} - {\blx@err@invopt{citetracker=#1}}} + {\blx@err@invopt{citetracker=#1}{}}} \def\blx@opt@citetracker@true{% \let\blx@imc@ifciteseen\blx@ifciteseen@global \let\blx@imc@ifentryseen\blx@ifentryseen@global @@ -7252,7 +7463,7 @@ \DeclareBibliographyOption{ibidtracker}[true]{% \ifcsdef{blx@opt@ibidtracker@#1} {\csuse{blx@opt@ibidtracker@#1}} - {\blx@err@invopt{ibidtracker=#1}}} + {\blx@err@invopt{ibidtracker=#1}{}}} \def\blx@opt@ibidtracker@true{% \let\blx@imc@ifciteibid\blx@ifciteibid@global \let\blx@ibidtracker\blx@ibidtracker@gobal @@ -7281,7 +7492,7 @@ \DeclareBibliographyOption{idemtracker}[true]{% \ifcsdef{blx@opt@idemtracker@#1} {\csuse{blx@opt@idemtracker@#1}} - {\blx@err@invopt{idemtracker=#1}}} + {\blx@err@invopt{idemtracker=#1}{}}} \def\blx@opt@idemtracker@true{% \let\blx@imc@ifciteidem\blx@ifciteidem@global \let\blx@idemtracker\blx@idemtracker@gobal @@ -7310,7 +7521,7 @@ \DeclareBibliographyOption{opcittracker}[true]{% \ifcsdef{blx@opt@opcittracker@#1} {\csuse{blx@opt@opcittracker@#1}} - {\blx@err@invopt{opcittracker=#1}}} + {\blx@err@invopt{opcittracker=#1}{}}} \def\blx@opt@opcittracker@true{% \let\blx@imc@ifopcit\blx@ifopcit@global \let\blx@opcittracker\blx@opcittracker@gobal @@ -7339,7 +7550,7 @@ \DeclareBibliographyOption{loccittracker}[true]{% \ifcsdef{blx@opt@loccittracker@#1} {\csuse{blx@opt@loccittracker@#1}} - {\blx@err@invopt{loccittracker=#1}}} + {\blx@err@invopt{loccittracker=#1}{}}} \def\blx@opt@loccittracker@true{% \let\blx@imc@ifloccit\blx@ifloccit@global \let\blx@loccittracker\blx@loccittracker@gobal @@ -7365,25 +7576,41 @@ \let\blx@loccitreset\blx@loccitreset@context \booltrue{citetracker}} +\DeclareBibliographyOption{parentracker}[true]{% + \ifstrequal{#1}{true} + {\let\bibopenparen\blx@bibopenparen + \let\bibcloseparen\blx@bibcloseparen + \let\bibopenbracket\blx@bibopenbracket + \let\bibclosebracket\blx@bibclosebracket} + {\protected\def\bibopenparen{\bibleftparen}% + \protected\def\bibcloseparen{\bibrightparen}% + \protected\def\bibopenbracket{\bibleftbracket}% + \protected\def\bibclosebracket{\bibrightbracket}}} + +\DeclareBibliographyOption{maxparens}{% + \ifnumless{#1}{1} + {\blx@err@invopt{maxparens=#1}{}} + {\setcounter{maxparens}{#1}}} + \DeclareBibliographyOption{date}{% \ifcsundef{mkbibrange#1} - {\blx@err@invopt{date=#1}} + {\blx@err@invopt{date=#1}{}} {\protected\def\blx@imc@printdate{\csuse{mkbibrange#1}{}}% \protected\def\blx@imc@printdateextra{\csuse{mkbibrange#1extra}{}}}} \DeclareBibliographyOption{urldate}{% \ifcsundef{mkbibrange#1} - {\blx@err@invopt{urldate=#1}} + {\blx@err@invopt{urldate=#1}{}} {\protected\def\blx@imc@printurldate{\csuse{mkbibrange#1}{url}}}} \DeclareBibliographyOption{eventdate}{% \ifcsundef{mkbibrange#1} - {\blx@err@invopt{eventdate=#1}} + {\blx@err@invopt{eventdate=#1}{}} {\protected\def\blx@imc@printeventdate{\csuse{mkbibrange#1}{event}}}} \DeclareBibliographyOption{origdate}{% \ifcsundef{mkbibrange#1} - {\blx@err@invopt{origdate=#1}} + {\blx@err@invopt{origdate=#1}{}} {\protected\def\blx@imc@printorigdate{\csuse{mkbibrange#1}{orig}}}} \DeclareBibliographyOption{alldates}{% @@ -7406,7 +7633,7 @@ \DeclareBibliographyOption{notetype}{% \ifcsdef{blx@opt@notetype@#1} {\blx@notetype\csuse{blx@opt@notetype@#1}} - {\blx@err@invopt{notetype=#1}}} + {\blx@err@invopt{notetype=#1}{}}} \cslet{blx@opt@notetype@foot+end}\z@ \let\blx@opt@notetype@footonly\@ne \let\blx@opt@notetype@endonly\tw@ @@ -7426,23 +7653,35 @@ \iftoggle{blx@labelnumber} {} {\KV@blx@opt@pre@defernums{false}}} +\DeclareTypeOption{labelnumber}[true]{% FIXME: per-type check + \settoggle{blx@labelnumber}{#1}} \DeclareBibliographyOption{labelalpha}[true]{% \settoggle{blx@labelalpha}{#1}} +\DeclareTypeOption{labelalpha}[true]{% + \settoggle{blx@labelalpha}{#1}} \DeclareBibliographyOption{labelyear}[true]{% \settoggle{blx@labelyear}{#1}} +\DeclareTypeOption{labelyear}[true]{% + \settoggle{blx@labelyear}{#1}} \DeclareBibliographyOption{uniquename}[true]{% \ifcsdef{blx@opt@uniquename@#1} {\letcs\blx@uniquename{blx@opt@uniquename@#1}} - {\blx@err@invopt{uniquename=#1}}} + {\blx@err@invopt{uniquename=#1}{}}} +\DeclareTypeOption{uniquename}[true]{% + \ifcsdef{blx@opt@uniquename@#1} + {\letcs\blx@uniquename{blx@opt@uniquename@#1}} + {\blx@err@invopt{uniquename=#1}{}}} \def\blx@opt@uniquename@false{0} -\def\blx@opt@uniquename@true{1} -\def\blx@opt@uniquename@init{2} +\def\blx@opt@uniquename@init{1} +\def\blx@opt@uniquename@true{2} \DeclareBibliographyOption{singletitle}[true]{% \settoggle{blx@singletitle}{#1}} +\DeclareTypeOption{singletitle}[true]{% + \settoggle{blx@singletitle}{#1}} \DeclareBibliographyOption{defernums}[true]{% \settoggle{blx@defernums}{#1}% @@ -7456,7 +7695,7 @@ \DeclareBibliographyOption{refsection}{% \ifcsdef{blx@opt@refsection@#1} {\letcs\blx@refhook@section{blx@opt@refsection@#1}} - {\blx@err@invopt{refsection=#1}}} + {\blx@err@invopt{refsection=#1}{}}} \def\blx@opt@refsection@none{0} \def\blx@opt@refsection@part{1} \def\blx@opt@refsection@chapter{2} @@ -7466,7 +7705,7 @@ \DeclareBibliographyOption{refsegment}{% \ifcsdef{blx@opt@refsegment@#1} {\letcs\blx@refhook@segment{blx@opt@refsegment@#1}} - {\blx@err@invopt{refsegment=#1}}} + {\blx@err@invopt{refsegment=#1}{}}} \def\blx@opt@refsegment@none{0} \def\blx@opt@refsegment@part{1} \def\blx@opt@refsegment@chapter{2} @@ -7476,55 +7715,72 @@ \DeclareBibliographyOption{citereset}{% \ifcsdef{blx@opt@citereset@#1} {\letcs\blx@resethook{blx@opt@citereset@#1}} - {\blx@err@invopt{citereset=#1}}} + {\blx@err@invopt{citereset=#1}{}}} \def\blx@opt@citereset@none{0} \def\blx@opt@citereset@part{1} \def\blx@opt@citereset@chapter{2} \def\blx@opt@citereset@section{3} \def\blx@opt@citereset@subsection{4} +\DeclareBibliographyOption{bibwarn}[true]{% + \ifstrequal{#1}{true} + {\let\blx@bbl@thewarn\blx@bbl@warn} + {\let\blx@bbl@thewarn\@gobble}} + % Entry options \DeclareBibliographyOption{useprefix}[true]{% \settoggle{blx@useprefix}{#1}} +\DeclareTypeOption{useprefix}[true]{% + \settoggle{blx@useprefix}{#1}} \DeclareEntryOption{useprefix}[true]{% \settoggle{blx@useprefix}{#1}} \DeclareBibliographyOption{useauthor}[true]{% \settoggle{blx@useauthor}{#1}} +\DeclareTypeOption{useauthor}[true]{% + \settoggle{blx@useauthor}{#1}} \DeclareEntryOption{useauthor}[true]{% \settoggle{blx@useauthor}{#1}} \DeclareBibliographyOption{useeditor}[true]{% \settoggle{blx@useeditor}{#1}} +\DeclareTypeOption{useeditor}[true]{% + \settoggle{blx@useeditor}{#1}} \DeclareEntryOption{useeditor}[true]{% \settoggle{blx@useeditor}{#1}} \DeclareBibliographyOption{usetranslator}[true]{% \settoggle{blx@usetranslator}{#1}} +\DeclareTypeOption{usetranslator}[true]{% + \settoggle{blx@usetranslator}{#1}} \DeclareEntryOption{usetranslator}[true]{% \settoggle{blx@usetranslator}{#1}} +\DeclareTypeOption{skipbib}[true]{% + \settoggle{blx@skipbib}{#1}} \DeclareEntryOption{skipbib}[true]{% \settoggle{blx@skipbib}{#1}} + +\DeclareTypeOption{skiplos}[true]{% + \settoggle{blx@skiplos}{#1}} \DeclareEntryOption{skiplos}[true]{% \settoggle{blx@skiplos}{#1}} + +\DeclareTypeOption{skiplab}[true]{% + \settoggle{blx@skiplab}{#1}} \DeclareEntryOption{skiplab}[true]{% \settoggle{blx@skiplab}{#1}} + +\DeclareTypeOption{dataonly}[true]{% + \settoggle{blx@skipbib}{#1}% + \settoggle{blx@skiplos}{#1}% + \settoggle{blx@skiplab}{#1}} \DeclareEntryOption{dataonly}[true]{% \settoggle{blx@skipbib}{#1}% \settoggle{blx@skiplos}{#1}% \settoggle{blx@skiplab}{#1}} -% Legacy options - -\DeclareBibliographyOption{bibtex8}[true]{% - \ifstrequal{#1}{true} - {\letcs\blx@backend{blx@backend@bibtex8}} - {\letcs\blx@backend{blx@backend@bibtex}}} - -\DeclareOption{openbib}{\setkeys{blx@opt@pre}{block=par}} - % Option processor/scheduler \DeclareOption*{% @@ -7559,7 +7815,11 @@ language=auto,babel=none,date=comp,origdate=comp,eventdate=comp, urldate=short,autopunct=true,punctfont=false,defernums=false, refsection=none,refsegment=none,citereset=none,hyperref=auto, - maxline=79} + maxline=79,parentracker,maxparens=3,bibwarn} + +% Load compatibility code + +\input{blx-compat.def} % Process load-time options @@ -7577,7 +7837,7 @@ \input{biblatex.def} \iftoggle{blx@natbib} - {\blx@inputonce{bibnatex.def}{natbib compatibility}{}{}{}{}} + {\blx@inputonce{blx-natbib.def}{natbib compatibility}{}{}{}{}} {} \RequireBibliographyStyle{\blx@bbxfile} \RequireCitationStyle{\blx@cbxfile} @@ -7609,10 +7869,11 @@ \ifnum\blx@refhook@segment>\z@ \ifnum\blx@refhook@segment>\blx@refhook@section\relax \else - \blx@err@confopt{% - The 'refsegment' option must point to a - lower-level\MessageBreak document division - than 'refsection'}% + \blx@err@confopt + {refsegment/refsection} + {The 'refsegment' option must point to a + lower-level\MessageBreak document division + than 'refsection'}% \def\blx@refhook@segment{0}% \fi \fi @@ -7694,18 +7955,6 @@ {} {\blx@err@patch{\string\part}}}% \fi - \ifnum\c@minnames>\c@maxnames - \blx@err@confopt{% - The value of 'minnames' must be smaller than\MessageBreak - or equal to the value of 'maxnames'}% - \c@minnames\c@maxnames - \fi - \ifnum\c@minitems>\c@maxitems - \blx@err@confopt{% - The value of 'minitems' must be smaller than\MessageBreak - or equal to the value of 'maxitems'}% - \c@minitems\c@maxitems - \fi \@ifpackageloaded{inputenc} {\ifundef\inputencodingname % inputenc 2006/05/05 v1.1b {\begingroup @@ -7757,13 +8006,6 @@ ~~~~<bcf:option type="#1">\blx@nl #2% ~~~~</bcf:option>\blx@nl} -\xdef\blx@bcf@keyvalue#1#2{% - ~~~~~~<bcf:key>#1</bcf:key>\blx@nl - ~~~~~~<bcf:value>#2</bcf:value>\blx@nl -} -\xdef\blx@bcf@keymulti#1#2{% - ~~~~~~<bcf:key>#1</bcf:key>\blx@nl - #2} \xdef\blx@bcf@ordered#1#2{% ~~~~~~<bcf:value order="#1">#2</bcf:value>\blx@nl} \xdef\blx@bcf@sorting#1#2{% @@ -7776,17 +8018,106 @@ ~~~~</bcf:sort>\blx@nl} \xdef\blx@bcf@sortitem#1#2{% ~~~~~~<bcf:sortitem #1>#2</bcf:sortitem>\blx@nl} +\xdef\blx@bcf@svalue#1#2{% + \blx@bcf@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}{% + ~~~~~~<bcf:key>#1</bcf:key>\blx@nl + #2}% +} +\xdef\blx@bcf@toggle#1{% + \blx@bcf@svalue{#1}{\noexpand\iftoggle{blx@#1}{1}{0}}} \endgroup -\newrobustcmd*{\DeclareSortingScheme}[2]{% +\def\blx@bcf@options@global{% + \blx@bcf@comment{global}% + \blx@bcf@options{biblatex}{global}{% + \blx@bcf@svalue{alphaothers}{\detokenize\expandafter{\labelalphaothers}}% + \blx@bcf@toggle{labelalpha}% + \blx@bcf@mvalue{labelname}{\blx@bcf@labelname@global}% + \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}% + \blx@bcf@svalue{sortalphaothers}{\detokenize\expandafter{\labelalphaothers}}% + \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}% + }% +} + +\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}}} + {}% + \iftoggle{blx@labelyear} + {\ifcsdef{blx@bcf@labelyear@#1} + {\blx@bcf@mvalue{labelyear}{\csuse{blx@bcf@labelyear@#1}}} + {}} + {}% + \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}% + }% +} + +\AtEndPreamble{% + \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} + +% [<entrytype>]{<name>}{<spec>} + +\newrobustcmd*{\DeclareSortingScheme}[3][global]{% \begingroup \let\item\blx@sortdef@item \let\field\blx@sortdef@field \let\literal\blx@sortdef@literal \blx@tempcnta\z@ \let\blx@tempa\@empty - #2% - \csxdef{blx@bcf@scheme@#1}{\blx@bcf@sorting{global}{\blx@tempa}}% + #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}}% \endgroup} \@onlypreamble\DeclareSortingScheme @@ -7988,12 +8319,16 @@ \docsvlist{#2}% \endgroup} -\newrobustcmd*{\DeclareLabelname}{% - \blx@deflabel\blx@bcf@labelname@global} +% [<entrytype>] + +\newrobustcmd*{\DeclareLabelname}[1][global]{% + \expandafter\blx@deflabel\csname blx@bcf@labelname@#1\endcsname} \@onlypreamble\DeclareLabelname -\newrobustcmd*{\DeclareLabelyear}{% - \blx@deflabel\blx@bcf@labelyear@global} +% [<entrytype>] + +\newrobustcmd*{\DeclareLabelyear}[1][global]{% + \expandafter\blx@deflabel\csname blx@bcf@labelyear@#1\endcsname} \@onlypreamble\Declarelabelyear \DeclareLabelname{% @@ -8041,80 +8376,17 @@ \def\blx@ctrl@biber{% \blx@bcf@file{% - \blx@bcf@comment{options: biber}% + \blx@bcf@comment{BIBER OPTIONS}% \blx@bcf@options{biber}{global}{% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{bibencoding}{\ifdef\blx@bibencoding{\blx@bibencoding}{ascii}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{debug}{\iftoggle{blx@debug}{1}{0}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{inputenc}{\ifdef\blx@inputenc{\blx@inputenc}{ascii}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{mincrossrefs}{\blx@mincrossrefs}% - }% - }% - \blx@bcf@comment{options: biblatex}% - \blx@bcf@options{biblatex}{global}{% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{alphaothers}{\detokenize\expandafter{\labelalphaothers}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{labelalpha}{\iftoggle{blx@labelalpha}{1}{0}}% - }% - \blx@bcf@option{multivalued}{% - \blx@bcf@keymulti{labelname}{\blx@bcf@labelname@global}% - }% - \iftoggle{blx@labelyear} - {\blx@bcf@option{multivalued}{% - \blx@bcf@keymulti{labelyear}{\blx@bcf@labelyear@global}% - }% - } - {}% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{maxitems}{\the\c@maxitems}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{maxnames}{\the\c@maxnames}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{minitems}{\the\c@minitems}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{minnames}{\the\c@minnames}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{singletitle}{\iftoggle{blx@singletitle}{1}{0}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{sortalphaothers}{\detokenize\expandafter{\labelalphaothers}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{sortlos}{\blx@sortlos}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{terseinits}{\iftoggle{blx@terseinits}{1}{0}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{uniquename}{\blx@uniquename}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{useauthor}{\iftoggle{blx@useauthor}{1}{0}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{useeditor}{\iftoggle{blx@useeditor}{1}{0}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{useprefix}{\iftoggle{blx@useprefix}{1}{0}}% - }% - \blx@bcf@option{singlevalued}{% - \blx@bcf@keyvalue{usetranslator}{\iftoggle{blx@usetranslator}{1}{0}}% - }% + \blx@bcf@svalue{bibencoding}{\ifdef\blx@bibencoding{\blx@bibencoding}{ascii}}% + \blx@bcf@toggle{debug}% + \blx@bcf@svalue{inputenc}{\ifdef\blx@inputenc{\blx@inputenc}{ascii}}% + \blx@bcf@svalue{mincrossrefs}{\blx@mincrossrefs}% }% - \blx@bcf@comment{sorting}% - \csuse{blx@bcf@scheme@\blx@sorting}% + \blx@bcf@comment{BIBLATEX OPTIONS}% + \csuse{blx@biber@options}% + \blx@bcf@comment{SORTING SPEC}% + \csuse{blx@biber@sorting}% }% } |