summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex/biblatex.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-06 22:29:57 +0000
committerKarl Berry <karl@freefriends.org>2010-09-06 22:29:57 +0000
commit240dbb5ee820f2e77e4106bf872f363540c413e2 (patch)
tree3921b3f18013915f30f418d31199a3770604a0db /Master/texmf-dist/tex/latex/biblatex/biblatex.sty
parent6892558c73756d9f24023e6269e025fa6f3cf15d (diff)
biblatex 0.9d (4sep10)
git-svn-id: svn://tug.org/texlive/trunk@19592 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.sty2953
1 files changed, 1848 insertions, 1105 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex/biblatex.sty b/Master/texmf-dist/tex/latex/biblatex/biblatex.sty
index ce5dc41d4a4..4af84cc06db 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.9a 2010/03/19 19:52:15 lehman beta $
+% $Id: biblatex.sty,v 0.9d 2010/09/03 20:11:58 lehman beta $
% Copyright (c) 2006-2010 Philipp Lehman.
%
@@ -19,26 +19,27 @@
\def\abx@cbxid$#1: #2 #3 #4 #5${#4 v#3 biblatex citation style}
\def\abx@lbxid$#1: #2 #3 #4 #5${#4 v#3 biblatex localization}
-\NeedsTeXFormat{LaTeX2e}
+\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{biblatex}
-[\abx@rcsid $Id: biblatex.sty,v 0.9a 2010/03/19 19:52:15 lehman beta $
+[\abx@rcsid $Id: biblatex.sty,v 0.9d 2010/09/03 20:11:58 lehman beta $
programmable bibliographies]
\def\blx@version$#1: #2 ${#2}
-\edef\blx@version{\blx@version$Revision: 0.9 $}
+\edef\blx@version{\blx@version$Revision: 0.9c $}
%% Compatibility and requirements
\RequirePackage{etoolbox}
\RequirePackage{keyval}
+\RequirePackage{logreq}
\RequirePackage{ifthen}
\RequirePackage{url}
-\@ifpackagelater{etoolbox}{2009/08/06}
+\@ifpackagelater{etoolbox}{2010/08/21}
{}
{\PackageError{biblatex}
{Outdated 'etoolbox' package}
- {Upgrade to etoolbox v1.8 (2009/08/06) or later.\MessageBreak
+ {Upgrade to etoolbox v2.0 (2010/08/21) or later.\MessageBreak
I found: '\csuse{ver@etoolbox.sty}'.\MessageBreak
This is a fatal error. I'm aborting now.}%
\endinput}
@@ -53,9 +54,9 @@
\docsvlist{%
amsrefs,apacite,babelbib,backref,bibtopic,bibunits,chapterbib,
cite,citeref,drftcite,footbib,inlinebib,jurabib,mcite,mciteplus,
- mlbib,multibbl,multibib,natbib,opcit,overcite,splitbib}%
+ mlbib,multibbl,multibib,natbib,opcit,overcite,splitbib,ucs}%
\@ifpackageloaded{babel}
- {\iftoggle{autolang}
+ {\iftoggle{blx@autolang}
{\blx@mkbabel}
{\blx@mknobabel}}
{\blx@mknobabel}%
@@ -100,13 +101,15 @@
\toggletrue{blx@tempa}%
\def\do#1{%
\patchcmd#1%
- {\color@begingroup}
- {\color@begingroup\toggletrue{blx@footnote}}
+ {\interlinepenalty\interfootnotelinepenalty}
+ {\toggletrue{blx@footnote}%
+ \interlinepenalty\interfootnotelinepenalty}
{\togglefalse{blx@tempa}\listbreak}
{}}%
\docsvlist{%
\@footnotetext,% latex
\H@@footnotetext,% hyperref
+ \V@@footnotetext,% fancyvrb
\scr@saved@footnotetext,% koma-script 3.x
\l@dold@footnotetext,% ledmac
\l@doldold@footnotetext,% ledmac
@@ -157,6 +160,22 @@
{}}
{}}
{}%
+ \apptocmd\@floatboxreset
+ {\boolfalse{citetracker}%
+ \boolfalse{pagetracker}}
+ {}
+ {\blx@err@patch{floats}}%
+ \ifdef\TX@endtabularx % tabularx/memoir
+ {\patchcmd\TX@endtabularx
+ {\edef\TX@ckpt{\cl@@ckpt}}
+ {\edef\TX@ckpt{\cl@@ckpt\abx@resttrackers}%
+ \abx@savetrackers}
+ {}
+ {\blx@err@patch{'tabularx'}}%
+ \apptocmd\TX@endtabularx{\abx@cleartrackers}
+ {}
+ {\blx@err@patch{'tabularx'}}}
+ {}%
\@ifpackageloaded{csquotes}
{\@ifpackagelater{csquotes}{2009/05/30}
{}
@@ -167,14 +186,20 @@
\@ifpackagelater{csquotes}{2009/08/27}
{\appto\@blockquote@prehook{\abx@savetrackers}%
\appto\@blockquote@posthook{\abx@resttrackers\abx@cleartrackers}}
- {\BlockquoteDisable{\let\blx@thecheckpunct\@gobble}}}
+ {\BlockquoteDisable{\let\blx@thecheckpunct\@gobble}}%
+ \@ifpackagelater{csquotes}{2010/06/09}
+ {}
+ {\newcommand*{\@quotereset}{}%
+ \newcount\@quotereset}}
{\@ifpackageloaded{babel}
{\blx@warning@noline{%
'babel' detected but 'csquotes' missing.\MessageBreak
- Loading 'csquotes' is strongly recommended}}
+ Loading 'csquotes' recommended}}
{}%
\newcommand*{\@quotelevel}{}%
\newcount\@quotelevel
+ \newcommand*{\@quotereset}{}%
+ \newcount\@quotereset
\newcommand*{\@setquotesfcodes}{}%
\let\@setquotesfcodes\relax
\newcommand*{\@ifquotemarker}{}%
@@ -203,22 +228,6 @@
\appto\blx@setsfcodes{%
\sfcode`\`=\z@
\sfcode`\'=\z@}}%
- \apptocmd\@floatboxreset
- {\boolfalse{citetracker}%
- \boolfalse{pagetracker}}
- {}
- {\blx@err@patch{floats}}%
- \ifdef\TX@endtabularx % tabularx/memoir
- {\patchcmd\TX@endtabularx
- {\edef\TX@ckpt{\cl@@ckpt}}
- {\edef\TX@ckpt{\cl@@ckpt\abx@resttrackers}%
- \abx@savetrackers}
- {}
- {\blx@err@patch{'tabularx'}}%
- \apptocmd\TX@endtabularx{\abx@cleartrackers}
- {}
- {\blx@err@patch{'tabularx'}}}
- {}%
\addtocontents{toc}{%
\string\boolfalse{citerequest}%
\string\boolfalse{citetracker}%
@@ -254,8 +263,9 @@
\def\blx@docatcodes{%
\do\=\do\<\do\>\do\-\do\"\do\'\do\`\do\.%
\do\,\do\;\do\:\do\!\do\?\do\/}
-\def\do#1{\noexpand\do\noexpand#1{\the\catcode`#1}}
+\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
@@ -271,6 +281,8 @@
%% Allocation
+\providecommand{\@gobblefive}[5]{}
+
\newcounter{listtotal}
\def\thelisttotal{\the\c@listtotal}
\newcounter{listcount}
@@ -345,13 +357,18 @@
\newtoggle{blx@tempa}
\newtoggle{blx@tempb}
+\newtoggle{blx@runltx}
+\newtoggle{blx@runbtx}
\newtoggle{blx@block}
\newtoggle{blx@unit}
\newtoggle{blx@insert}
\newtoggle{blx@lastins}
\newtoggle{blx@debug}
-\newtoggle{autolang}
-\newtoggle{blx@defernums}
+\newtoggle{blx@cssort}
+\newtoggle{blx@autolang}
+\newtoggle{blx@clearlang}
+\newtoggle{blx@defernumbers}
+\newtoggle{blx@omitnumbers}
\newtoggle{blx@footnote}
\newtoggle{blx@labelalpha}
\newtoggle{blx@labelnumber}
@@ -373,7 +390,7 @@
\newtoggle{blx@skiplab}
\newtoggle{blx@citation}
\newtoggle{blx@bibliography}
-\newtoggle{blx@recode}
+\newtoggle{blx@reencode}
\newtoggle{blx@citeindex}
\newtoggle{blx@bibindex}
@@ -396,8 +413,8 @@
\let\blx@blxinit\relax
\blx@initunit}
-\edef\blx@auxfile{\jobname}
-\let\blx@theauxout\@mainaux
+\edef\blx@auxfile@bibtex{\jobname}
+\let\blx@auxout@bibtex\@mainaux
\newcommand*{\labelalphaothers}{+}
\newcommand*{\blxauxsuffix}{-blx}
@@ -509,17 +526,19 @@
\unexpanded{\let#1\@empty\dolistloop}{#1}}%
#1\let\do\noexpand}
-% {<macro>}{<entrykey>,...} => <macro>{<entrykey>,...}
+% {<code>}{<string>} => <code>{<string>}
-\protected\def\blx@sanitizekeys#1#2{%
+\protected\def\blx@xsanitizeafter#1#2{%
\begingroup
+ \abx@hook@xsanitize
+ \def\blx@tempa{\endgroup#1}%
+ \edef\blx@tempb{#2}%
+ \expandafter\blx@tempa
+ \expandafter{\detokenize\expandafter{\blx@tempb}}}
+
+\def\abx@hook@xsanitize{%
\blx@safe@actives
- \let\protect\string
- \edef\blx@tempa{#2}%
- \edef\blx@tempa{%
- \endgroup\unexpanded{#1}{%
- \detokenize\expandafter{\blx@tempa}}}%
- \blx@tempa}
+ \let\protect\string}
% {<file>}{<message>}{<preload>}{<postload>}{<success>}{<failure>}
@@ -528,6 +547,7 @@
{\blx@info@noline{Trying to load #2..}%
\IfFileExists{#1}
{\blx@info@noline{... file '#1' found}%
+ \listxadd\blx@list@req@stat{#1}%
#3\@@input\@filef@und#4#5}
{\blx@info@noline{... file '#1' not found}#6}%
\global\csdef{blx@file@#1}{}%
@@ -536,34 +556,29 @@
% {<string>}
-\protected\def\blx@auxwrite#1#2{%
+\protected\def\blx@auxwrite#1#2#3{%
\if@filesw
\begingroup
\blx@safe@actives
\let\protect\string
- \immediate\write#1{#2}%
+ #2%
+ \immediate\write#1{#3}%
\endgroup
\fi}
-\def\blx@auxinit#1{%
- \blx@auxwrite\blx@theauxout{%
- \ifx\blx@theauxout\@mainaux
+\def\blx@auxinit@bibtex#1{%
+ \blx@auxwrite\blx@auxout@bibtex{}{%
+ \ifx\blx@auxout@bibtex\@mainaux
\else
\blx@msg@aux
\fi
- \ifnum\blx@backend=\blx@backend@biber
+ \string\bibstyle{biblatex}\blx@nl
+ \string\bibdata{%
+ \blx@ctrlfile\blxauxsuffix
\expandafter\ifblank\expandafter{#1}
- {}
- {\string\bibdata{#1}}%
- \else
- \string\bibstyle{biblatex}\blx@nl
- \string\bibdata{%
- \blx@ctrlfile\blxauxsuffix
- \expandafter\ifblank\expandafter{#1}
- {}
- {,#1}}\blx@nl
- \string\citation{biblatex-control}
- \fi}}
+ {}
+ {,#1}}\blx@nl
+ \string\citation{biblatex-control}}}
% {<file>}{<signature>}{<true>}{<false>}
@@ -587,7 +602,10 @@
\else
\blx@warning@noline{%
File '#1.#2' created\MessageBreak
- by wrong version of biblatex}%
+ by wrong version of
+ \ifnumequal\blx@backend\blx@backend@biber
+ {Biber}
+ {biblatex}}%
\fi
\else
\blx@error
@@ -618,7 +636,7 @@
\edef\blx@msg@aux{%
\blx@sig@aux\blx@nl
\blx@ver@aux\blx@nl
- \@percentchar\space Do not modify the above lines!\blx@nl
+ \@percentchar\space Do not modify this file!\blx@nl
\@percentchar\blx@nl
\@percentchar\space This is an auxiliary file
used by the 'biblatex' package.\blx@nl
@@ -629,13 +647,31 @@
\edef\blx@msg@bib{%
\blx@sig@bib\blx@nl
\blx@ver@bib\blx@nl
- Do not modify the above lines!\blx@nl\blx@nl
+ Do not modify this file!\blx@nl\blx@nl
This is an auxiliary file used
by the 'biblatex' package.\blx@nl
This file may safely be deleted.
It will be recreated as\blx@nl
required.\blx@nl\blx@nl}
+% {<true>}{<false>}
+
+\newrobustcmd*{\lbx@ifutfinput}{\ifboolexpr{%
+ test {\ifdefstring\inputencodingname{utf8}}
+ or
+ test {\ifdefstring\inputencodingname{utf8x}}
+ or
+ test {\ifdefstring\inputencodingname{lutf8}}
+ or
+ ( test {\ifundef\inputencodingname}
+ and
+ ( not test {\ifundef\XeTeXrevision}
+ or
+ not test {\ifundef\luatexversion}
+ )
+ )
+}}
+
%% User feedback
\protected\def\blx@error#1#2{%
@@ -675,12 +711,9 @@
\def\blx@imc@BibliographyWarning{\blx@warning@entry}
\blx@regimc\BibliographyWarning
-\def\blx@missing#1{%
+\protected\def\abx@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}
@@ -788,6 +821,12 @@
This error may also be triggered if \string\mkbibparens\MessageBreak
or \string\mkbibbrackets\space are nested too deeply}}
+\def\blx@err@filter{%
+ \blx@error
+ {Invalid filter expression}
+ {The filter expression you have supplied is invalid.\MessageBreak
+ See the biblatex manual for details}}
+
\def\blx@warn@nohyph#1{%
\blx@warning{No hyphenation patterns for '#1'}}
@@ -799,7 +838,7 @@
\protected\def\blx@warn@nostring#1{%
\blx@warning@entry{Bibliography string '#1' undefined}%
- \blx@missing{#1}}
+ \abx@missing{#1}}
\def\blx@warn@conflopt#1{%
\blx@warning{Conflicting options.\MessageBreak#1}}
@@ -828,104 +867,238 @@
\def\blx@msg@cundef#1{%
Citation '#1' undefined}
\def\blx@msg@cundefon#1{%
- Citation '#1' on page \thepage\space undefined}
-
-\let\blx@auxlist\@empty
-\def\blx@logreq#1{%
- \xifinlist{\blx@auxfile.aux}{\blx@auxlist}
+ Citation '#1' on page \the\c@page\space undefined}
+
+% \blx@list@active active aux files (basename)
+% [internal list]
+% \blx@list@inactive inactive aux files (basename)
+% [internal list]
+% \blx@list@bibfiles@<auxfile> aux file -> bib file mapping (refsections)
+% aux file (basename) -> bib files (full)
+% [internal list]
+
+\let\blx@list@active\@empty
+\let\blx@list@inactive\@empty
+\listeadd\blx@list@inactive{\jobname}
+
+\def\blx@regbibfile#1#2{%
+ \ifinlistcs{#2.bib}{blx@list@bibfiles@#1}
{}
- {\listxadd\blx@auxlist{\blx@auxfile.aux}%
- \blx@logreq@bibtex{\blx@auxfile}}%
- \ifblank{#1}
- {}
- {\@latex@warning{#1}}%
- \blx@reruntrue}
+ {\listcsxadd{blx@list@bibfiles@#1}{#2.bib}}}
-\def\blx@logreq@latex{\typeout{REQ:1:latex:REQ}}
-\def\blx@logreq@bibtex#1{%
- \begingroup
- \edef\blx@tempa{\endgroup
- \noexpand\typeout{REQ:2:bibtex:\blx@nl
- \ifcase\blx@backend
- binary=bibtex\blx@nl
- \or
- binary=bibtex8\blx@nl
- option=--mwizfuns 10000\blx@nl
- \or
- binary=biber\blx@nl
- \fi
- \ifundef\blx@mincrossrefs
- {}
- {\ifcase\blx@backend
- option=-min-crossrefs=\blx@mincrossrefs\blx@nl
- \or
- option=--min\string_crossrefs \blx@mincrossrefs\blx@nl
- \fi}%
- \ifdef\blx@bibencoding
- {\ifnum\blx@backend=\csuse{blx@backend@bibtex8}%
- option=--csfile \blx@bibencoding.csf\blx@nl
- \fi}
- {}%
- infile=#1\blx@nl:REQ}}%
- \blx@tempa}
+\def\blx@regbibfiles#1#2{%
+ \blx@xsanitizeafter{\forcsvlist{\blx@regbibfile{#1}}}{#2}}
-\def\blx@warn@rerun{%
- \blx@warning@noline{Please rerun LaTeX}}
-
-\def\blx@warn@auxlist{%
+\def\blx@check@logreq{%
\begingroup
- \edef\blx@tempa{%
- Please (re)run
- \ifnum\blx@backend=\blx@backend@biber
- Biber
- \else
- BibTeX
- \fi
- on the file(s):}%
- \def\do##1{\appto\blx@tempa{\MessageBreak##1}}%
- \dolistloop\blx@auxlist
- \blx@warning@noline{%
- \blx@tempa\MessageBreak
- and rerun LaTeX afterwards}%
+ \ifnum\blx@backend=\blx@backend@biber
+ \ltxrequest{biblatex}{{\iftoggle{blx@runltx}{1}{0}}}{%
+ \provides[type=dynamic]{
+ \file{\jobname.bcf}
+ }
+ \requires[type=dynamic]{
+ \file{\jobname.bbl}
+ }
+ \ifdef\blx@list@req@edit
+ {\requires[type=editable]{
+ \forlistloop\file\blx@list@req@edit
+ }}
+ {}
+ \ifdef\blx@list@req@stat
+ {\requires[type=static]{
+ \forlistloop\file\blx@list@req@stat
+ }}
+ {}
+ }%
+ \logrequest[package=biblatex,priority=5,active={{\iftoggle{blx@runbtx}{1}{0}}}]{%
+ \generic{biber}
+ \cmdline{
+ \binary{biber}
+ \infile{\jobname}
+ }
+ \input{
+ \file{\jobname.bcf}
+ }
+ \output{
+ \file{\jobname.bbl}
+ }
+ \provides[type=dynamic]{
+ \file{\jobname.bbl}
+ }
+ \requires[type=dynamic]{
+ \file{\jobname.bcf}
+ }
+ \ifcsdef{blx@list@bibfiles@\jobname}
+ {\requires[type=editable]{
+ \def\do{\file}
+ \dolistcsloop{blx@list@bibfiles@\jobname}
+ }}
+ {}
+ }%
+ \else
+ \ltxrequest{biblatex}{{\iftoggle{blx@runltx}{1}{0}}}{%
+ \provides[type=dynamic]{
+ \def\do##1{\file{##1.aux}}
+ \dolistloop\blx@list@inactive
+ \file{\blx@ctrlfile\blxauxsuffix.bib}
+ }
+ \requires[type=dynamic]{
+ \def\do##1{\file{##1.bbl}}
+ \dolistloop\blx@list@inactive
+ }
+ \ifdef\blx@list@req@edit
+ {\requires[type=editable]{
+ \forlistloop\file\blx@list@req@edit
+ }}
+ {}
+ \ifdef\blx@list@req@stat
+ {\requires[type=static]{
+ \forlistloop\file\blx@list@req@stat
+ }}
+ {}
+ }%
+ \def\do##1{%
+ \ifinlist{##1}{\blx@list@active}
+ {\blx@logreq@bibtex{1}{##1}}
+ {\blx@logreq@bibtex{0}{##1}}}%
+ \dolistloop\blx@list@inactive
+ \fi
\endgroup}
-\def\blx@reruntrue{%
- \G@refundefinedtrue
- \blx@logreq@latex
- \global\let\blx@reruntrue\relax}
+\def\blx@logreq@bibtex#1#2{%
+ \logrequest[package=biblatex,priority=5,active=#1]{%
+ \generic{bibtex}
+ \cmdline{%
+ \ifnum\blx@backend=\blx@backend@bibtex
+ \binary{bibtex}
+ \option{-min-crossrefs \blx@mincrossrefs}
+ \else
+ \binary{bibtex8}
+ \option{--wolfgang}
+ \option{--min\string_crossrefs \blx@mincrossrefs}
+ \ifdef\blx@csfencoding
+ {\option{--csfile \blx@csfencoding.csf}}
+ {}%
+ \fi
+ \infile{#2}
+ }
+ \input{
+ \file{#2.aux}
+ }
+ \output{
+ \file{#2.bbl}
+ }
+ \provides[type=dynamic]{
+ \file{#2.bbl}
+ }
+ \requires[type=dynamic]{
+ \file{#2.aux}
+ \file{\blx@ctrlfile\blxauxsuffix.bib}
+ }
+ \requires[type=editable]{
+ \ifcsdef{blx@list@bibfiles@#2}
+ {\def\do{\file}
+ \dolistcsloop{blx@list@bibfiles@#2}}
+ {}
+ }
+ \requires[type=static]{
+ \file{biblatex.bst}
+ \ifnum\blx@backend=\blx@backend@bibtexviii
+ \ifdef\blx@csfencoding
+ {\file{\blx@csfencoding.csf}}
+ {}%
+ \fi
+ }
+ }%
+}
-\protected\def\blx@checksum{%
- \blx@tempcnta\z@
- \ifx\blx@checksum@old\blx@checksum@new
- \else
- \advance\blx@tempcnta\@ne
- \blx@reruntrue
- \fi
- \ifx\blx@auxlist\@empty
+\def\blx@logreq@active#1{%
+ \ifnum\blx@backend=\blx@backend@biber
\else
- \advance\blx@tempcnta\tw@
- \blx@reruntrue
+ \xifinlist{\blx@auxfile@bibtex}{\blx@list@active}
+ {}
+ {\listxadd\blx@list@active{\blx@auxfile@bibtex}}%
\fi
- \csuse{blx@rerun}%
- \ifcase\blx@tempcnta
- \or
- \blx@warn@rerun
+ \ifblank{#1}
+ {}
+ {\@latex@warning{#1}}%
+ \blx@rerun@latex
+ \blx@rerun@bibtex}
+
+\def\blx@logreq@inactive{%
+ \ifnum\blx@backend=\blx@backend@biber
\else
- \blx@warn@auxlist
+ \xifinlist{\blx@auxfile@bibtex}{\blx@list@inactive}
+ {}
+ {\listxadd\blx@list@inactive{\blx@auxfile@bibtex}}%
\fi}
+\def\blx@rerun@latex{%
+ \G@refundefinedtrue
+ \global\toggletrue{blx@runltx}%
+ \global\let\blx@rerun@latex\relax}
+
+\def\blx@rerun@bibtex{%
+ \global\toggletrue{blx@runbtx}%
+ \global\let\blx@rerun@bibtex\relax}
+
\let\blx@checksum@old\@empty
\let\blx@checksum@new\@empty
\let\abx@aux@checksum\relax
-\def\blx@addchecksum#1{%
- \xdef\blx@checksum@old{\blx@checksum@old#1}}
+\def\blx@checksum#1#2#3{%
+ \begingroup
+ \blx@tempcnta\the\numexpr0#2*0#3\relax
+ \blx@tempcntb\blx@tempcnta
+ \divide\blx@tempcntb10
+ \multiply\blx@tempcntb10
+ \advance\blx@tempcnta-\blx@tempcntb
+ \xdef#1{#1\the\blx@tempcnta}%
+ \endgroup}
+\def\blx@addchecksum{\blx@checksum\blx@checksum@old}
\AtEndDocument{%
- \def\blx@addchecksum#1{%
- \xdef\blx@checksum@new{\blx@checksum@new#1}}}
+ \def\blx@addchecksum{\blx@checksum\blx@checksum@new}}
-\AfterEndDocument{\blx@checksum}
+\protected\def\blx@check@rerun{%
+ \blx@tempcnta\z@
+ \iftoggle{blx@runltx}
+ {\blx@tempcnta\@ne}
+ {\ifx\blx@checksum@old\blx@checksum@new
+ \else
+ \blx@tempcnta\@ne
+ \fi}%
+ \iftoggle{blx@runbtx}
+ {\advance\blx@tempcnta\tw@}
+ {}%
+ \ifcase\blx@tempcnta
+ \or
+ \blx@rerun@latex
+ \blx@warning@noline{Please rerun LaTeX}%
+ \else
+ \blx@rerun@latex
+ \blx@warn@auxlist
+ \fi}
+
+\def\blx@warn@auxlist{%
+ \begingroup
+ \ifnum\blx@backend=\blx@backend@biber
+ \edef\blx@tempa{%
+ Please (re)run Biber on the file:\MessageBreak
+ \jobname}%
+ \else
+ \edef\blx@tempa{Please (re)run BibTeX on the file(s):}%
+ \def\do##1{\appto\blx@tempa{\MessageBreak##1}}%
+ \dolistloop\blx@list@active
+ \fi
+ \blx@warning@noline{%
+ \blx@tempa\MessageBreak
+ and rerun LaTeX afterwards}%
+ \endgroup}
+
+\AfterEndDocument{%
+ \blx@check@rerun
+ \blx@check@logreq}
%% Punctuation and capitalization
@@ -1569,13 +1742,29 @@
\newrobustcmd*{\restorebibmacro}[1]{%
\blx@restore{abx@macro@\detokenize{#1}}}
-% {<name>}{<definition>}
+% {<name>}[<args>][<optarg>]{<definition>}
\newrobustcmd*{\newbibmacro}{%
- \@star@or@long{\blx@defbibmacro\new@command}}
+ \@star@or@long\blx@newbibmacro}
+
+\def\blx@newbibmacro#1{%
+ \ifcsundef{abx@macro@\detokenize{#1}}
+ {\blx@defbibmacro\new@command{#1}}
+ {\blx@warning{%
+ Bibliography macro '\detokenize{#1}' already defined.\MessageBreak
+ Using \string\renewbibmacro}
+ \blx@defbibmacro\renew@command{#1}}}
\newrobustcmd*{\renewbibmacro}{%
- \@star@or@long{\blx@defbibmacro\renew@command}}
+ \@star@or@long\blx@renewbibmacro}
+
+\def\blx@renewbibmacro#1{%
+ \ifcsundef{abx@macro@\detokenize{#1}}
+ {\blx@warning{%
+ Bibliography macro '\detokenize{#1}' undefined.\MessageBreak
+ Using \string\newbibmacro}
+ \blx@defbibmacro\new@command{#1}}
+ {\blx@defbibmacro\renew@command{#1}}}
\newrobustcmd*{\providebibmacro}{%
\@star@or@long{\blx@defbibmacro\provide@command}}
@@ -1928,10 +2117,10 @@
% {<entrykey>}{<true>}{<false>}
\protected\def\blx@ifentryseen@global{%
- \blx@sanitizekeys\blx@ifseen@global}
+ \blx@xsanitizeafter\blx@ifseen@global}
\protected\def\blx@ifentryseen@context{%
- \blx@sanitizekeys\blx@ifseen@context}
+ \blx@xsanitizeafter\blx@ifseen@context}
\def\blx@ifseen@global#1{%
\ifinlistcs{#1}{blx@bsee@\the\c@refsection}}
@@ -2147,7 +2336,7 @@
% {<field>}{<true>}{<false>}
\protected\def\blx@imc@iffieldint#1{%
- \iffieldundef{#1}
+ \blx@imc@iffieldundef{#1}
{\@secondoftwo}
{\expandafter\expandafter
\expandafter\ifinteger
@@ -2210,26 +2399,26 @@
% {<field>}{<true>}{<false>}
\protected\def\blx@imc@iffieldnum#1{%
- \iffieldundef{#1}
+ \blx@imc@iffieldundef{#1}
{\@secondoftwo}
{\expandafter\expandafter
- \expandafter\ifnumeral
+ \expandafter\blx@imc@ifnumeral
\expandafter\expandafter
\expandafter{\csname abx@field@#1\endcsname}}}
\protected\def\blx@imc@iffieldnums#1{%
- \iffieldundef{#1}
+ \blx@imc@iffieldundef{#1}
{\@secondoftwo}
{\expandafter\expandafter
- \expandafter\ifnumerals
+ \expandafter\blx@imc@ifnumerals
\expandafter\expandafter
\expandafter{\csname abx@field@#1\endcsname}}}
\protected\def\blx@imc@iffieldpages#1{%
- \iffieldundef{#1}
+ \blx@imc@iffieldundef{#1}
{\@secondoftwo}
{\expandafter\expandafter
- \expandafter\ifpages
+ \expandafter\blx@imc@ifpages
\expandafter\expandafter
\expandafter{\csname abx@field@#1\endcsname}}}
@@ -2529,7 +2718,8 @@
\protected\def\blx@finentry@usedrv{%
\unspace
- \blx@initunit}
+% \blx@initunit
+}
\protected\def\blx@finentry@inset{%
\blx@setunit\entrysetpunct
@@ -2577,57 +2767,73 @@
% {<text>}
-\newcommand{\MakeCapital}{}
-\begingroup
-\catcode`\"=\active
-\protected\long\gdef\MakeCapital#1{%
+\newrobustcmd{\MakeCapital}[1]{%
\begingroup
- \def\do##1{\def##1{\blx@mkcp@single##1}}%
- \abx@dosingleaccents
- \def\do##1{\def##1{\blx@mkcp@double##1}}%
- \abx@dodoubleaccents
- \def\IeC{\blx@mkcp@single\IeC}%
+ \blx@mkcp@init
+ \protected@edef\blx@tempa{#1}%
+ \expandafter\blx@mkcp@parse\blx@tempa\@empty\blx@mkcp@end}
+
+\def\blx@mkcp@init{%
+ \def\blx@mkcp@iec{\noexpand\blx@mkcp@iec\noexpand}%
+ \def\blx@mkcp@bbl{\noexpand\blx@mkcp@bbl\noexpand}%
+ \def\blx@mkcp@sgl{\noexpand\blx@mkcp@sgl\noexpand}%
+ \def\blx@mkcp@dbl{\noexpand\blx@mkcp@dbl\noexpand}%
+ \def\do##1{\def##1{\blx@mkcp@sgl##1}}\abx@dosingleaccents
+ \def\do##1{\def##1{\blx@mkcp@dbl##1}}\abx@dodoubleaccents
+ \def\IeC##1{\blx@mkcp@iec\IeC{##1}}%
\def\@tabacckludge##1{%
- \expandafter\blx@mkcp@single\csname\string##1\endcsname}%
+ \expandafter\blx@mkcp@sgl\csname\string##1\endcsname}}
+
+\begingroup
+\catcode`\"=\active
+\gappto\blx@mkcp@init{%
\ifnum\catcode`\"=\active
- \def"##1{\blx@mkcp@single"\noexpand##1}%
- \fi
- \def\blx@mkcp@single{\noexpand\blx@mkcp@single\noexpand}%
- \def\blx@mkcp@double{\noexpand\blx@mkcp@double\noexpand}%
- \protected@edef\blx@tempa{%
- \noexpand\ifblank{#1}
- {\endgroup\unexpanded{#1}}
- {\noexpand\blx@mkcp@parse#1}}%
- \blx@tempa}
+ \def"#1{\blx@mkcp@bbl"\noexpand#1}%
+ \fi}
\endgroup
-\long\def\blx@mkcp@parse#1{%
- \begingroup
- \expandafter\def\expandafter\blx@tempa\expandafter{#1}%
- \ifx\blx@tempa\IeC
- \aftergroup\blx@mkcp@iec
- \else\ifx\blx@tempa\blx@mkcp@single
- \aftergroup\blx@mkcp@two
- \else\ifx\blx@tempa\blx@mkcp@double
- \aftergroup\blx@mkcp@three
- \else
- \aftergroup\blx@mkcp@case
- \fi\fi\fi
- \endgroup{#1}}
+\def\blx@mkcp@parse{%
+ \futurelet\@let@token\blx@mkcp@eval}
+
+\long\def\blx@mkcp@eval{%
+ \ifx\@let@token\blx@mkcp@iec
+ \expandafter\blx@mkcp@getiec
+ \fi
+ \ifx\@let@token\blx@mkcp@bbl
+ \expandafter\blx@mkcp@gettwo
+ \fi
+ \ifx\@let@token\blx@mkcp@sgl
+ \expandafter\blx@mkcp@gettwo
+ \fi
+ \ifx\@let@token\blx@mkcp@dbl
+ \expandafter\blx@mkcp@getthree
+ \fi
+ \blx@mkcp@case}
+
+\def\blx@mkcp@getiec#1\blx@mkcp@case#2#3#4{%
+ \blx@mkcp@case{#2#3{#4}}}
+
+\def\blx@mkcp@gettwo#1\blx@mkcp@case#2#3#4{%
+ \blx@mkcp@case{#2#3#4}}
+
+\def\blx@mkcp@getthree#1\blx@mkcp@case#2#3#4#5{%
+ \blx@mkcp@case{#2#3#4#5}}
\long\def\blx@mkcp@case#1{%
+ \begingroup
\def\i{I}\def\j{J}%
\def\do##1##2{\let##1##2\do}%
\expandafter\do\@uclclist\relax{\relax\@gobble}%
- \uppercase{\protected@edef\blx@tempa{#1}}%
- \expandafter\endgroup\blx@tempa}
-
-\def\blx@mkcp@iec#1#2{\blx@mkcp@case{#1#2}}
-\def\blx@mkcp@two#1#2#3{\blx@mkcp@case{#2#3}}
-\def\blx@mkcp@three#1#2#3#4{\blx@mkcp@case{#2#3#4}}
+ \uppercase{\protected@edef\blx@tempa{\endgroup\blx@mkcp@end#1}}%
+ \blx@tempa}
-\let\blx@mkcp@single\@empty
-\let\blx@mkcp@double\@empty
+\protected\long\def\blx@mkcp@end#1\blx@mkcp@end{%
+ \let\blx@mkcp@iec\noexpand
+ \let\blx@mkcp@bbl\noexpand
+ \let\blx@mkcp@sgl\noexpand
+ \let\blx@mkcp@dbl\noexpand
+ \protected@edef\blx@tempa{\endgroup#1}%
+ \blx@tempa}
\def\abx@dosingleaccents{%
\do\"\do\'\do\`\do\^\do\~\do\=\do\.%
@@ -2649,64 +2855,111 @@
\long\def\blx@mksc@ii#1{%
\begingroup
- \def\blx@tempa{\endgroup}%
+ \let\blx@tempa\@empty
\let\blx@tempb\@empty
- \def\blx@tempc{\MakeCapital}%
- \@tempswatrue
- \blx@mksc@parse#1\blx@mksc@end}
+ \blx@mksc@init
+ \protected@edef\@tempa{#1}%
+ \expandafter\blx@mksc@parse\@tempa\blx@mksc@end}
+
+\def\blx@mksc@init{%
+ \blx@mkcp@init
+ \def\blx@mkcp@nil{\noexpand\blx@mkcp@nil\noexpand}%
+ \def\i{\blx@mkcp@nil\i}\def\j{\blx@mkcp@nil\j}%
+ \def\do##1{%
+ \ifx##1\relax
+ \else
+ \def##1{\blx@mkcp@nil##1}%
+ \expandafter\do
+ \fi}%
+ \expandafter\do\@uclclist\relax}
\def\blx@mksc@parse{%
\futurelet\@let@token\blx@mksc@eval}
\def\blx@mksc@eval{%
\ifx\@let@token\blx@mksc@end
- \blx@mksc@end
+ \expandafter\blx@mksc@end
\fi
\ifx\@let@token\bgroup
- \blx@mksc@group
+ \expandafter\blx@mksc@group
\fi
\ifx\@let@token\@sptoken
- \if@tempswa\blx@mksc@eject\fi
- \blx@mksc@space
+ \expandafter\blx@mksc@space
+ \fi
+ \ifx\@let@token\blx@mkcp@nil
+ \expandafter\blx@mksc@getone
\fi
- \if\relax\noexpand\@let@token
- \blx@mksc@cs
+ \ifx\@let@token\blx@mkcp@iec
+ \expandafter\blx@mksc@getiec
\fi
- \if-\noexpand\@let@token
- \if@tempswa\blx@mksc@eject\fi
+ \ifx\@let@token\blx@mkcp@bbl
+ \expandafter\blx@mksc@gettwo
+ \fi
+ \ifx\@let@token\blx@mkcp@sgl
+ \expandafter\blx@mksc@gettwo
+ \fi
+ \ifx\@let@token\blx@mkcp@dbl
+ \expandafter\blx@mksc@getthree
+ \fi
+ \if\noexpand\@let@token\relax
+ \expandafter\blx@mksc@cs
\fi
- \blx@mksc@other&}
+ \blx@mksc@other}
-\def\blx@mksc@end#1\blx@mksc@end{\fi
+\def\blx@mksc@end#1\blx@mksc@end{%
\blx@mksc@eject
+ \let\blx@mkcp@nil\noexpand
+ \let\blx@mkcp@iec\noexpand
+ \let\blx@mkcp@bbl\noexpand
+ \let\blx@mkcp@sgl\noexpand
+ \let\blx@mkcp@dbl\noexpand
+ \let\MakeUppercase\relax
+ \let\MakeLowercase\relax
+ \protected@edef\blx@tempa{\endgroup\blx@tempa}%
\blx@tempa}
-\long\def\blx@mksc@group#1&#2{\fi
+\long\def\blx@mksc@group#1\blx@mksc@other#2{%
\futurelet\@let@token\blx@mksc@ingroup#2&{#2}%
+ \blx@mksc@endhead
\blx@mksc@parse}
\long\def\blx@mksc@ingroup#1&#2{%
- \if\relax\noexpand\@let@token
+ \if\noexpand\@let@token\relax
\blx@mksc@locase{{#2}}%
\else
\blx@mksc@nocase{{#2}}%
\fi}
-\def\blx@mksc@space{\def\blx@mksc@space##1&}
-\@nameuse{blx@mksc@space} {\fi
+\def\blx@mksc@space{\def\blx@mksc@space##1\blx@mksc@other}
+\csuse{blx@mksc@space} {%
\blx@mksc@anycase{ }%
+ \blx@mksc@endhead
\blx@mksc@parse}
-\long\def\blx@mksc@cs#1&#2{\fi
+\long\def\blx@mksc@cs#1\blx@mksc@other#2{%
\ifcat\noexpand~\noexpand#2%
\blx@mksc@locase{#2}%
\else
\blx@mksc@nocase{#2}%
\fi
+ \blx@mksc@endhead
\blx@mksc@parse}
-\long\def\blx@mksc@other&#1{%
+\def\blx@mksc@getiec#1\blx@mksc@other#2#3#4{%
+ \blx@mksc@other{#2#3{#4}}}
+
+\def\blx@mksc@getone#1\blx@mksc@other#2#3{%
+ \blx@mksc@other{#2#3}}
+
+\def\blx@mksc@gettwo#1\blx@mksc@other#2#3#4{%
+ \blx@mksc@other{#2#3#4}}
+
+\def\blx@mksc@getthree#1\blx@mksc@other#2#3#4#5{%
+ \blx@mksc@other{#2#3#4#5}}
+
+\long\def\blx@mksc@other#1{%
\blx@mksc@locase{#1}%
+ \blx@mksc@endhead
\blx@mksc@parse}
\def\blx@mksc@locase{%
@@ -2728,15 +2981,18 @@
\def\blx@mksc@eject{%
\ifx\blx@tempb\@empty
\else
- \eappto\blx@tempa{%
- \expandonce\blx@tempc{\expandonce\blx@tempb}}%
+ \eappto\blx@tempa{\noexpand\MakeLowercase{\expandonce\blx@tempb}}%
\let\blx@tempb\@empty
- \fi
- \if@tempswa
- \def\blx@tempc{\MakeLowercase}%
- \@tempswafalse
\fi}
+\def\blx@mksc@endhead{%
+ \ifx\blx@tempb\@empty
+ \else
+ \eappto\blx@tempa{\noexpand\MakeCapital{\expandonce\blx@tempb}}%
+ \let\blx@tempb\@empty
+ \fi
+ \let\blx@mksc@endhead\relax}
+
% {<language,language,...>}
\newrobustcmd*{\DeclareCaseLangs}{%
@@ -2748,10 +3004,7 @@
\def\blx@defcaselangs#1{%
\ifblank{#1}
{}
- {\begingroup
- \def\do##1{\listgadd\blx@cmksc@lang{##1}}
- \docsvlist{#1}%
- \endgroup}}
+ {\forcsvlist{\listgadd\blx@cmksc@lang}{#1}}}
\DeclareCaseLangs{%
american,british,canadian,
@@ -2892,7 +3145,8 @@
\newrobustcmd*{\blx@imc@printfile}[2][]{%
\iftoggle{blx@loadfiles}
{\IfFileExists{#2}
- {\blx@imc@printtext[#1]{\input{#2}\unspace}}
+ {\listxadd\blx@list@req@edit{#2}%
+ \blx@imc@printtext[#1]{\input{#2}\unspace}}
{\blx@nounit}}
{\blx@nounit}}
@@ -3086,10 +3340,10 @@
% {<key>}{<code>}
-\protected\long\def\blx@imc@entrydata#1{%
- \blx@sanitizekeys\blx@imc@entrydata@i{#1}}
+\protected\def\blx@imc@entrydata{%
+ \blx@xsanitizeafter\blx@imc@entrydata@i}
-\protected\long\def\blx@imc@entrydata@i#1#2{%
+\long\def\blx@imc@entrydata@i#1#2{%
\blx@ifdata{#1}
{\begingroup
\blx@resetdata
@@ -3117,11 +3371,11 @@
\def\blx@entryset#1{%
\blx@ifdata{#1}
{\begingroup
- \begingroup
+% \begingroup
\blx@getdata{#1}%
- \edef\blx@tempa{\endgroup
- \def\noexpand\abx@field@entrytype{\abx@field@entrytype}}%
- \blx@tempa
+% \edef\blx@tempa{\endgroup
+% \def\noexpand\abx@field@entrytype{\abx@field@entrytype}}%
+% \blx@tempa
\def\abx@field@entrysetcount{1}%
\blx@set@precode
\blx@driver{\blx@imc@thefield{entrytype}}%
@@ -3145,69 +3399,122 @@
% [<wrapper>]{<string>}
\newrobustcmd*{\blx@imc@bibstring}[2][\@firstofone]{%
+ \blx@bibstring{#1}{\abx@str}{#2}}
+
+\newrobustcmd*{\blx@imc@biblstring}[2][\@firstofone]{%
+ \blx@bibstring{#1}{abx@lstr}{#2}}
+
+\newrobustcmd*{\blx@imc@bibsstring}[2][\@firstofone]{%
+ \blx@bibstring{#1}{abx@sstr}{#2}}
+
+\protected\def\blx@bibstring#1#2#3{%
\blx@begunit
\blx@hyphenreset
\let\bibstring\blx@imc@bibxstring
- \lowercase{\edef\blx@tempa{#2}}%
- \ifcsundef{abx@str@\blx@tempa}
- {\blx@warn@nostring{\blx@tempa}}
+ \let\biblstring\blx@imc@bibxlstring
+ \let\bibsstring\blx@imc@bibxsstring
+ \lowercase{\edef\blx@tempa{#3}}%
+ \ifcsundef{#2@\blx@tempa}
+ {\blx@warn@nostring\blx@tempa}
{\blx@imc@ifcapital
- {#1{\MakeCapital{\csuse{abx@str@\blx@tempa}}}}
- {#1{\csuse{abx@str@\blx@tempa}}}}%
+ {#1{\MakeCapital{\csuse{#2@\blx@tempa}}}}
+ {#1{\csuse{#2@\blx@tempa}}}}%
\blx@endunit}
% [<wrapper>]{<string>}
\newrobustcmd*{\blx@imc@bibcpstring}[2][\@firstofone]{%
+ \blx@bibcpstring{#1}{\abx@str}{#2}}
+
+\newrobustcmd*{\blx@imc@bibcplstring}[2][\@firstofone]{%
+ \blx@bibcpstring{#1}{abx@lstr}{#2}}
+
+\newrobustcmd*{\blx@imc@bibcpsstring}[2][\@firstofone]{%
+ \blx@bibcpstring{#1}{abx@sstr}{#2}}
+
+\protected\def\blx@bibcpstring#1#2#3{%
\blx@begunit
\blx@hyphenreset
\let\bibstring\blx@imc@bibxstring
- \lowercase{\edef\blx@tempa{#2}}%
- \ifcsundef{abx@str@\blx@tempa}
- {\blx@warn@nostring{\blx@tempa}}
- {#1{\MakeCapital{\csuse{abx@str@\blx@tempa}}}}%
+ \let\biblstring\blx@imc@bibxlstring
+ \let\bibsstring\blx@imc@bibxsstring
+ \lowercase{\edef\blx@tempa{#3}}%
+ \ifcsundef{#2@\blx@tempa}
+ {\blx@warn@nostring\blx@tempa}
+ {#1{\MakeCapital{\csuse{#2@\blx@tempa}}}}%
\blx@endunit}
% [<wrapper>]{<string>}
\newrobustcmd*{\blx@imc@biblcstring}[2][\@firstofone]{%
+ \blx@biblcstring{#1}{\abx@str}{#2}}
+
+\newrobustcmd*{\blx@imc@biblclstring}[2][\@firstofone]{%
+ \blx@biblcstring{#1}{abx@lstr}{#2}}
+
+\newrobustcmd*{\blx@imc@biblcsstring}[2][\@firstofone]{%
+ \blx@biblcstring{#1}{abx@sstr}{#2}}
+
+\protected\def\blx@biblcstring#1#2#3{%
\blx@begunit
\blx@hyphenreset
\let\bibstring\blx@imc@bibxstring
- \lowercase{\edef\blx@tempa{#2}}%
- \ifcsundef{abx@str@\blx@tempa}
- {\blx@warn@nostring{\blx@tempa}}
- {#1{\MakeLowercase{\csuse{abx@str@\blx@tempa}}}}%
+ \let\biblstring\blx@imc@bibxlstring
+ \let\bibsstring\blx@imc@bibxsstring
+ \lowercase{\edef\blx@tempa{#3}}%
+ \ifcsundef{#2@\blx@tempa}
+ {\blx@warn@nostring\blx@tempa}
+ {#1{\MakeLowercase{\csuse{#2@\blx@tempa}}}}%
\blx@endunit}
% [<wrapper>]{<string>}
\newrobustcmd*{\blx@imc@bibucstring}[2][\@firstofone]{%
+ \blx@bibucstring{#1}{\abx@str}{#2}}
+
+\newrobustcmd*{\blx@imc@bibuclstring}[2][\@firstofone]{%
+ \blx@bibucstring{#1}{abx@lstr}{#2}}
+
+\newrobustcmd*{\blx@imc@bibucsstring}[2][\@firstofone]{%
+ \blx@bibucstring{#1}{abx@sstr}{#2}}
+
+\protected\def\blx@bibucstring#1#2#3{%
\blx@begunit
\blx@hyphenreset
\let\bibstring\blx@imc@bibxstring
- \lowercase{\edef\blx@tempa{#2}}%
- \ifcsundef{abx@str@\blx@tempa}
- {\blx@warn@nostring{\blx@tempa}}
- {#1{\MakeUppercase{\csuse{abx@str@\blx@tempa}}}}%
+ \let\biblstring\blx@imc@bibxlstring
+ \let\bibsstring\blx@imc@bibxsstring
+ \lowercase{\edef\blx@tempa{#3}}%
+ \ifcsundef{#2@\blx@tempa}
+ {\blx@warn@nostring\blx@tempa}
+ {#1{\MakeUppercase{\csuse{#2@\blx@tempa}}}}%
\blx@endunit}
% {<string>}
\def\blx@imc@bibxstring#1{%
- \ifcsundef{abx@str@#1}
- {\protect\blx@warn@nostring{#1}}
- {\csuse{abx@str@#1}}}
+ \blx@bibxstring{\abx@str}{#1}}
+
+\def\blx@imc@bibxlstring#1{%
+ \blx@bibxstring{abx@lstr}{#1}}
+
+\def\blx@imc@bibxsstring#1{%
+ \blx@bibxstring{abx@sstr}{#1}}
+
+\def\blx@bibxstring#1#2{%
+ \ifcsundef{#1@#2}
+ {\protect\blx@warn@nostring{#2}}
+ {\csuse{#1@#2}}}
% {<string>}{<true>}{<false>}
\def\blx@imc@ifbibstring#1{%
- \ifcsundef{abx@str@\detokenize{#1}}
+ \ifcsundef{\abx@str @\detokenize{#1}}
{\@secondoftwo}
{\@firstoftwo}}
\def\blx@imc@ifbibxstring#1{%
- \ifcsundef{abx@str@#1}
+ \ifcsundef{\abx@str @#1}
{\@secondoftwo}
{\@firstoftwo}}
@@ -3216,22 +3523,55 @@
\def\blx@imc@iffieldbibstring#1{%
\blx@imc@iffieldundef{#1}
{\@secondoftwo}
- {\ifcsundef{abx@str@\detokenize\expandafter
+ {\ifcsundef{\abx@str @\detokenize\expandafter
\expandafter\expandafter{\csname abx@field@#1\endcsname}}
{\@secondoftwo}
{\@firstoftwo}}}
\blx@regimcs{%
- \bibstring \bibxstring \bibcpstring \biblcstring
- \bibucstring \ifbibstring \ifbibxstring \iffieldbibstring}
+ \bibstring \biblstring \bibsstring
+ \bibxstring \bibxlstring \bibxsstring
+ \bibcpstring \bibcplstring \bibcpsstring
+ \biblcstring \biblclstring \biblcsstring
+ \bibucstring \bibuclstring \bibucsstring
+ \ifbibstring \ifbibxstring \iffieldbibstring}
+
+\let\blx@hook@uc\relax
+\let\blx@hook@lc\relax
+
+\expandafter\patchcmd\csname MakeUppercase \endcsname
+ {\protected@edef}
+ {\blx@hook@uc\protected@edef}
+ {}
+ {\blx@err@patch{\string\MakeUppercase}}
+
+\expandafter\patchcmd\csname MakeLowercase \endcsname
+ {\protected@edef}
+ {\blx@hook@lc\protected@edef}
+ {}
+ {\blx@err@patch{\string\MakeLowercase}}
\appto\blx@blxinit{%
- \appto\@uclclist{%
- \bibstring\bibucstring
- \biblcstring\bibstring
- \bibcpstring\bibucstring
- \biblcstring\bibcpstring
- \biblcstring\bibucstring}}
+ \def\blx@hook@uc{%
+ \let\bibstring\blx@imc@bibucstring
+ \let\biblstring\blx@imc@bibuclstring
+ \let\bibsstring\blx@imc@bibucsstring
+ \let\biblcstring\blx@imc@bibucstring
+ \let\biblclstring\blx@imc@bibuclstring
+ \let\biblcsstring\blx@imc@bibucsstring
+ \let\bibcpstring\blx@imc@bibucstring
+ \let\bibcplstring\blx@imc@bibuclstring
+ \let\bibcpsstring\blx@imc@bibucsstring}%
+ \def\blx@hook@lc{%
+ \let\bibstring\blx@imc@biblcstring
+ \let\biblstring\blx@imc@biblclstring
+ \let\bibsstring\blx@imc@biblcsstring
+ \let\bibucstring\blx@imc@biblcstring
+ \let\bibuclstring\blx@imc@biblclstring
+ \let\bibucsstring\blx@imc@biblcsstring
+ \let\bibcpstring\blx@imc@biblcstring
+ \let\bibcplstring\blx@imc@biblclstring
+ \let\bibcpsstring\blx@imc@biblcsstring}}
\def\abx@dostrings{%
\do{bibliography}%
@@ -3329,14 +3669,14 @@
\do{translatoranaf}%
\do{translatorsanaf}%
\do{byauthor}%
- \do{byeditor}
- \do{byeditor}
+ \do{byeditor}%
+ \do{byeditor}%
\do{bycompiler}%
\do{byredactor}%
\do{byfounder}%
\do{bycontinuator}%
\do{bycollaborator}%
- \do{bytranslator}
+ \do{bytranslator}%
\do{bycommentator}%
\do{byannotator}%
\do{withcommentator}%
@@ -3344,40 +3684,40 @@
\do{withintroduction}%
\do{withforeword}%
\do{withafterword}%
- \do{byeditortr}
- \do{byeditorco}
- \do{byeditoran}
- \do{byeditorin}
- \do{byeditorfo}
- \do{byeditoraf}
- \do{byeditortrco}
- \do{byeditortran}
- \do{byeditortrin}
- \do{byeditortrfo}
- \do{byeditortraf}
- \do{byeditorcoin}
- \do{byeditorcofo}
- \do{byeditorcoaf}
- \do{byeditoranin}
- \do{byeditoranfo}
- \do{byeditoranaf}
- \do{byeditortrcoin}
- \do{byeditortrcofo}
- \do{byeditortrcoaf}
- \do{byeditortranin}
- \do{byeditortranfo}
- \do{byeditortranaf}
- \do{bytranslatorco}
- \do{bytranslatoran}
- \do{bytranslatorin}
- \do{bytranslatorfo}
- \do{bytranslatoraf}
- \do{bytranslatorcoin}
- \do{bytranslatorcofo}
- \do{bytranslatorcoaf}
- \do{bytranslatoranin}
- \do{bytranslatoranfo}
- \do{bytranslatoranaf}
+ \do{byeditortr}%
+ \do{byeditorco}%
+ \do{byeditoran}%
+ \do{byeditorin}%
+ \do{byeditorfo}%
+ \do{byeditoraf}%
+ \do{byeditortrco}%
+ \do{byeditortran}%
+ \do{byeditortrin}%
+ \do{byeditortrfo}%
+ \do{byeditortraf}%
+ \do{byeditorcoin}%
+ \do{byeditorcofo}%
+ \do{byeditorcoaf}%
+ \do{byeditoranin}%
+ \do{byeditoranfo}%
+ \do{byeditoranaf}%
+ \do{byeditortrcoin}%
+ \do{byeditortrcofo}%
+ \do{byeditortrcoaf}%
+ \do{byeditortranin}%
+ \do{byeditortranfo}%
+ \do{byeditortranaf}%
+ \do{bytranslatorco}%
+ \do{bytranslatoran}%
+ \do{bytranslatorin}%
+ \do{bytranslatorfo}%
+ \do{bytranslatoraf}%
+ \do{bytranslatorcoin}%
+ \do{bytranslatorcofo}%
+ \do{bytranslatorcoaf}%
+ \do{bytranslatoranin}%
+ \do{bytranslatoranfo}%
+ \do{bytranslatoranaf}%
\do{and}%
\do{andothers}%
\do{andmore}%
@@ -3509,10 +3849,7 @@
}
\newrobustcmd*{\NewBibliographyString}[1]{%
- \begingroup
- \let\do\blx@newstring
- \docsvlist{#1}%
- \endgroup}
+ \forcsvlist\blx@newstring{#1}}
\def\blx@newstring#1{%
\ifcsundef{KV@blx@lbx@#1}
@@ -3533,11 +3870,15 @@
\blx@lbxinput{#1}{}{\blx@err@nolang{#1}}%
\csuse{abx@strings@#1}}
-\def\blx@cfg@defstring#1{\csdef{abx@str@#1}}
+\def\blx@cfg@defstring#1#2{%
+ \csdef{abx@lstr@#1}{#2}%
+ \csdef{abx@sstr@#1}{#2}}
+
\def\blx@lbx@defstring#1#2{%
- \expandafter\blx@lbx@thedef\csname abx@str@#1\endcsname#2}
-\def\blx@lbx@longdef#1#2#3{\def#1{#2}}
-\def\blx@lbx@shortdef#1#2#3{\def#1{#3}}
+ \blx@lbx@defstring@i{#1}#2}
+\def\blx@lbx@defstring@i#1#2#3{%
+ \csdef{abx@lstr@#1}{#2}%
+ \csdef{abx@sstr@#1}{#3}}
% {<language>}
@@ -3588,23 +3929,32 @@
\@onlypreamble\DefineBibliographyStrings
\def\blx@defbibstrings#1#2{%
- \def\do##1{\csundef{abx@str@##1}}%
+ \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}%
\abx@dostrings
\csuse{abx@strings@#1}%
\setkeys{blx@lbx}{#2}%
- \global\cslet{abx@strings@#1}\@empty
- \def\do##1{%
- \ifcsundef{abx@str@##1}
- {\csxappto{abx@strings@#1}{%
- \undef\expandafter\noexpand\csname abx@str@##1\endcsname}}
- {\csxappto{abx@strings@#1}{%
- \def\expandafter\noexpand\csname abx@str@##1\endcsname{%
- \csexpandonce{abx@str@##1}}}}}%
- \abx@dostrings
+ \let\do\blx@defbibstrings@i
+ \csxdef{abx@strings@#1}{\abx@dostrings}%
\csgappto{abx@strings@#1}{%
- \let\bibname\abx@str@bibliography
- \let\refname\abx@str@references
- \let\losname\abx@str@shorthands}}
+ \ifcsdef{\abx@str @bibliography}
+ {\letcs\bibname{\abx@str @bibliography}}
+ {\let\bibname\@empty}%
+ \ifcsdef{\abx@str @references}
+ {\letcs\refname{\abx@str @references}}
+ {\let\refname\@empty}%
+ \ifcsdef{\abx@str @shorthands}
+ {\letcs\losname{\abx@str @shorthands}}
+ {\let\losname\@empty}}}
+
+\def\blx@defbibstrings@i#1{%
+ \ifcsdef{abx@lstr@#1}
+ {\def\expandafter\noexpand\csname abx@lstr@#1\endcsname{%
+ \csexpandonce{abx@lstr@#1}}}
+ {\undef\expandafter\noexpand\csname abx@lstr@#1\endcsname}%
+ \ifcsdef{abx@sstr@#1}
+ {\def\expandafter\noexpand\csname abx@sstr@#1\endcsname{%
+ \csexpandonce{abx@sstr@#1}}}
+ {\undef\expandafter\noexpand\csname abx@sstr@#1\endcsname}}
% {<language>}{<language>}
@@ -3652,7 +4002,7 @@
{\blx@lbxinput@ii{#2}{#1.lbx}{language '#2' -> '#1'}}
{\blx@warning@noline{%
File '#1.lbx' not found!\MessageBreak
- Ignoring mapping '#2' -> '#1'}
+ Ignoring mapping '#2' -> '#1'}%
\blx@lbxinput{#2}}}
% {<language>}{<lbxfile>}{<message>}
@@ -3737,58 +4087,89 @@
% {<short|long>}{<basename>}
\newrobustcmd*{\mkbibrangefull}[2]{%
- \printtext{%
- \csuse{mkbibdate#1}{#2year}{#2month}{#2day}%
- \iffieldundef{#2endyear}
- {}
- {\iffieldequalstr{#2endyear}{}
- {\mbox{\bibdatedash}}
- {\bibdatedash
- \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}
+ \iffieldundef{#2year}
+ {}
+ {\printtext{%
+ \csuse{mkbibdate#1}{#2year}{#2month}{#2day}%
+ \iffieldundef{#2endyear}
+ {}
+ {\iffieldequalstr{#2endyear}{}
+ {\mbox{\bibdatedash}}
+ {\bibdatedash
+ \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}}
\newrobustcmd*{\mkbibrangetrunc}[2]{%
- \printtext{%
- \iffieldsequal{#2year}{#2endyear}
- {\iffieldsequal{#2month}{#2endmonth}
- {\csuse{mkbibdate#1}{}{}{#2day}}
- {\csuse{mkbibdate#1}{}{#2month}{#2day}}}
- {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
- \iffieldundef{#2endyear}
- {}
- {\iffieldequalstr{#2endyear}{}
- {\mbox{\bibdatedash}}
- {\bibdatedash
- \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}
+ \iffieldundef{#2year}
+ {}
+ {\printtext{%
+ \iffieldsequal{#2year}{#2endyear}
+ {\iffieldsequal{#2month}{#2endmonth}
+ {\csuse{mkbibdate#1}{}{}{#2day}}
+ {\csuse{mkbibdate#1}{}{#2month}{#2day}}}
+ {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
+ \iffieldundef{#2endyear}
+ {}
+ {\iffieldequalstr{#2endyear}{}
+ {\mbox{\bibdatedash}}
+ {\bibdatedash
+ \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}}}}
\newrobustcmd*{\mkbibrangefullextra}[2]{%
- \printtext{%
- \csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
- \iffieldundef{#2endyear}
- {\printfield{extrayear}}
- {\iffieldequalstr{#2endyear}{}
- {\printfield{extrayear}%
- \printtext{\mbox{\bibdatedash}}}
- {\printtext{%
- \bibdatedash
- \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
- \printfield{extrayear}}}}}
+ \iffieldundef{#2year}
+ {}
+ {\printtext{%
+ \csuse{mkbibdate#1}{#2year}{#2month}{#2day}}%
+ \iffieldundef{#2endyear}
+ {\printfield{extrayear}}
+ {\iffieldequalstr{#2endyear}{}
+ {\printfield{extrayear}%
+ \printtext{\mbox{\bibdatedash}}}
+ {\printtext{%
+ \bibdatedash
+ \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
+ \printfield{extrayear}}}}}}
\newrobustcmd*{\mkbibrangetruncextra}[2]{%
- \printtext{%
- \iffieldsequal{#2year}{#2endyear}
- {\iffieldsequal{#2month}{#2endmonth}
- {\csuse{mkbibdate#1}{}{}{#2day}}
- {\csuse{mkbibdate#1}{}{#2month}{#2day}}}
- {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}}%
- \iffieldundef{#2endyear}
- {\printfield{extrayear}}
- {\iffieldequalstr{#2endyear}{}
- {\printfield{extrayear}%
- \printtext{\mbox{\bibdatedash}}}
- {\printtext{%
- \bibdatedash
- \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
- \printfield{extrayear}}}}}
+ \iffieldundef{#2year}
+ {}
+ {\printtext{%
+ \iffieldsequal{#2year}{#2endyear}
+ {\iffieldsequal{#2month}{#2endmonth}
+ {\csuse{mkbibdate#1}{}{}{#2day}}
+ {\csuse{mkbibdate#1}{}{#2month}{#2day}}}
+ {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}}}%
+ \iffieldundef{#2endyear}
+ {\printfield{extrayear}}
+ {\iffieldequalstr{#2endyear}{}
+ {\printfield{extrayear}%
+ \printtext{\mbox{\bibdatedash}}}
+ {\printtext{%
+ \bibdatedash
+ \csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
+ \printfield{extrayear}}}}}}
+
+\newrobustcmd*{\mkbibrangeiso}[1]{%
+ \iffieldundef{#1year}
+ {}
+ {\printtext{%
+ \blx@isodate{#1year}{#1month}{#1day}%
+ \iffieldundef{#1endyear}
+ {}
+ {\addslash\blx@isodate{#1endyear}{#1endmonth}{#1endday}}}}}
+
+\newrobustcmd*{\mkbibrangeisoextra}[1]{%
+ \iffieldundef{#1year}
+ {}
+ {\printtext{%
+ \blx@isodate[extrayear]{#1year}{#1month}{#1day}%
+ \iffieldundef{#1endyear}
+ {}
+ {\addslash\blx@isodate{#1endyear}{#1endmonth}{#1endday}}}}}
+
+\newrobustcmd*{\blx@isodate}[4][]{%
+ \thefield{#2}\ifblank{#1}{}{\printfield{#1}}%
+ \iffieldundef{#3}{}{\mbox{-}\thefield{#3}}%
+ \iffieldundef{#4}{}{\mbox{-}\thefield{#4}}}
\newrobustcmd*{\mkbibdatelong}[3]{}
\newrobustcmd*{\mkbibdateshort}[3]{}
@@ -3801,18 +4182,18 @@
\newrobustcmd*{\mkbibmonth}[1]{%
\ifcase0#1\relax
0\blx@warning@entry{Month out of range}%
- \or\bibstring{january}%
- \or\bibstring{february}%
- \or\bibstring{march}%
- \or\bibstring{april}%
- \or\bibstring{may}%
- \or\bibstring{june}%
- \or\bibstring{july}%
- \or\bibstring{august}%
- \or\bibstring{september}%
- \or\bibstring{october}%
- \or\bibstring{november}%
- \or\bibstring{december}%
+ \or\abx@bibmonth{january}%
+ \or\abx@bibmonth{february}%
+ \or\abx@bibmonth{march}%
+ \or\abx@bibmonth{april}%
+ \or\abx@bibmonth{may}%
+ \or\abx@bibmonth{june}%
+ \or\abx@bibmonth{july}%
+ \or\abx@bibmonth{august}%
+ \or\abx@bibmonth{september}%
+ \or\abx@bibmonth{october}%
+ \or\abx@bibmonth{november}%
+ \or\abx@bibmonth{december}%
\else
#1\blx@warning@entry{Month out of range}%
\fi}%
@@ -3833,20 +4214,20 @@
% {<language>}{<strings>}
\def\blx@maplang#1#2{%
- \csxappto{captions#1}{%
- \expandafter\noexpand\csname abx@strings@#2\endcsname}%
\csxappto{extras#1}{%
\noexpand\blx@resetpunct
- \expandafter\noexpand\csname abx@extras@#2\endcsname}%
+ \expandafter\noexpand\csname abx@extras@#2\endcsname
+ \expandafter\noexpand\csname abx@strings@#2\endcsname}%
\csxappto{noextras#1}{%
\noexpand\blx@resetpunct
\expandafter\noexpand\csname abx@noextras@#2\endcsname}}
%% Babel interface
-\let\blx@beglang\begingroup
-\let\blx@endlang\endgroup
+\def\blx@beglang{\blx@clearlang\begingroup}
+\def\blx@endlang{\endgroup}
\let\blx@hook@endlang\@empty
+\let\blx@hook@initlang\@empty
\def\blx@hyphenreset{%
\ifcsundef{l@\blx@languagename}
{}
@@ -3863,18 +4244,20 @@
\patchcmd\bbl@set@language
{\select@language}
{\blx@langsetup\languagename\select@language}%
- {\ifundef\blx@thelangenv
- {}
+ {\ifdef\blx@thelangenv
{\def\blx@beglang{%
- \begingroup
+ \blx@clearlang
+ \begingroup
\blx@imc@iffieldundef{hyphenation}
{}
- {\def\blx@endlang{%
+ {\blx@hook@initlang
+ \def\blx@endlang{%
\blx@hook@endlang
\csname end\blx@thelangenv\endcsname
\endgroup}%
\csname\blx@thelangenv\expandafter\endcsname
- \expandafter{\abx@field@hyphenation}}}}%
+ \expandafter{\abx@field@hyphenation}}}}
+ {}%
\blx@langsetup\bbl@main@language}
{\blx@err@patch{'babel' package}%
\blx@mknobabel}}
@@ -3884,6 +4267,40 @@
{}
{\blx@err@nolang{\blx@languagename}}}
+\newrobustcmd*{\DeclareRedundantLanguages}[2]{%
+ \begingroup
+ \ifblank{#2}
+ {\def\do##1{%
+ \global\csundef{blx@rlm@##1}%
+ \global\csundef{blx@rlm@lang##1}}}
+ {\def\do##1{%
+ \csxdef{blx@rlm@##1}{#2}%
+ \csxdef{blx@rlm@lang##1}{#2}}}%
+ \docsvlist{#1}%
+ \endgroup}
+
+\def\blx@clearlang{%
+ \iftoggle{blx@clearlang}
+ {\iflistundef{language}
+ {}
+ {\ifnumgreater{\value{language}}{1}
+ {}
+ {\expandafter\blx@clearlang@i\abx@list@language}}}
+ {}}
+
+\def\blx@clearlang@i#1{%
+ \ifcsdef{blx@rlm@#1}
+ {\expandafter\expandafter\expandafter\forcsvlist
+ \expandafter\expandafter\expandafter\blx@clearlang@ii
+ \expandafter\expandafter\expandafter{%
+ \csname blx@rlm@#1\endcsname}}
+ {}}
+
+\def\blx@clearlang@ii#1{%
+ \ifdefstring\languagename{#1}
+ {\clearlist{language}}
+ {}}
+
%% Bibtex data interface
\def\abx@donames{%
@@ -3954,6 +4371,7 @@
\do{eid}%
\do{eprint}%
\do{eprinttype}%
+ \do{eprintclass}%
\do{file}%
\do{gender}%
\do{howpublished}%
@@ -3979,6 +4397,7 @@
\do{extrayear}%
\do{library}%
\do{localnumber}%
+ \do{prefixnumber}%
\do{mainsubtitle}%
\do{maintitle}%
\do{maintitleaddon}%
@@ -4101,21 +4520,66 @@
\blx@warning@noline{\blx@tempa}%
\endgroup}
+% {<field>}{<code>}
+
+\newrobustcmd{\DeclareFieldInputHandler}[2]{%
+ \ifblank{#2}
+ {\csundef{blx@fih@#1}}
+ {\long\csdef{blx@fih@#1}##1{#2}}}
+\@onlypreamble\DeclareFieldInputHandler
+
+% {<list>}{<code>}
+
+\newrobustcmd*{\DeclareListInputHandler}[2]{%
+ \ifblank{#2}
+ {\csundef{blx@lih@#1}}
+ {\csdef{blx@lih@#1}##1{#2}}}
+\@onlypreamble\DeclareListInputHandler
+
+% {<name>}{<code>}
+
+\newrobustcmd*{\DeclareNameInputHandler}[2]{%
+ \ifblank{#2}
+ {\csundef{blx@nih@#1}}
+ {\csdef{blx@nih@#1}##1{#2}}}
+\@onlypreamble\DeclareNameInputHandler
+
+% {<entrykey>}{<refsection>}{<field>}{<value>}
+
+\long\def\blx@bbl@addentryfield#1#2#3#4{%
+ \csxappto{blx@data@#2@\detokenize{#1}}{%
+ \def\expandafter\noexpand\csname abx@field@#3\endcsname{#4}}}
+
% {<field>}{<value>}
-\protected\long\def\blx@bbl@fielddef#1#2{%
+\long\def\blx@bbl@addfield#1#2{%
\csxappto\blx@bbl@data{%
- \def\expandonce{\csname abx@field@#1\endcsname}%
- {\unexpanded{#2}}}}
+ \def\expandafter\noexpand\csname abx@field@#1\endcsname{#2}}}
+
+\protected\long\def\blx@bbl@fielddef#1#2{%
+ \def\NewValue{#2}%
+ \ifcsdef{blx@fih@#1}
+ {\csname blx@fih@#1\endcsname{#2}%
+ \ifdefvoid\NewValue}
+ {\@secondoftwo}
+ {}
+ {\blx@bbl@addfield{#1}{\expandonce\NewValue}}}
\protected\long\def\blx@bbl@fieldedef#1#2{%
- \csxappto\blx@bbl@data{%
- \def\expandonce{\csname abx@field@#1\endcsname}{#2}}}
+ \edef\NewValue{#2}%
+ \ifcsdef{blx@fih@#1}
+ {\csname blx@fih@#1\expandafter
+ \endcsname\expandafter{\NewValue}%
+ \ifdefvoid\NewValue}
+ {\@secondoftwo}
+ {}
+ {\blx@bbl@addfield{#1}{\NewValue}}}
\protected\long\def\blx@bbl@stringdef#1#2{%
- \csxappto\blx@bbl@data{%
- \def\expandonce{\csname abx@field@#1\endcsname}%
- {\detokenize{#2}}}}
+ \begingroup
+ \edef\blx@tempa{\endgroup
+ \blx@bbl@fielddef{#1}{\detokenize{#2}}}%
+ \blx@tempa}
% {<field>}
@@ -4123,12 +4587,16 @@
\begingroup
\let\verb\blx@bbl@verbadd
\def\blx@tempa{#1}%
- \let\blx@tempb\@empty}
+ \let\NewValue\@empty}
\protected\def\blx@bbl@verbend{%
- \csxappto\blx@bbl@data{%
- \def\expandonce{\csname abx@field@\blx@tempa\endcsname}%
- {\blx@tempb}}%
+ \ifcsdef{blx@fih@\blx@tempa}
+ {\csname blx@fih@\blx@tempa\expandafter
+ \endcsname\expandafter{\NewValue}%
+ \ifdefvoid\NewValue}
+ {\@secondoftwo}
+ {}
+ {\blx@bbl@addfield{\blx@tempa}{\NewValue}}%
\endgroup}
\protected\def\blx@bbl@verbadd{%
@@ -4145,7 +4613,7 @@
\uccode`\>=\endlinechar
\uppercase{\gdef\blx@bbl@verbadd@i<#1>}{%
\endgroup
- \edef\blx@tempb{\blx@tempb\detokenize{#1}}}
+ \edef\NewValue{\NewValue\detokenize{#1}}}
\endgroup
% {<counter>}{<value>}
@@ -4167,18 +4635,33 @@
% {<list}{<itemcount>}{<value>}
\protected\def\blx@bbl@listdef#1#2#3{%
- \csxappto\blx@bbl@data{%
- \csname c@#1\endcsname#2\relax
- \def\expandonce{\csname abx@list@#1\endcsname}%
- {\unexpanded{#3}}}}
+ \def\NewCount{#2}%
+ \def\NewValue{#3}%
+ \ifcsdef{blx@lih@#1}
+ {\csname blx@lih@#1\endcsname{#3}%
+ \ifdefvoid\NewValue}
+ {\@secondoftwo}
+ {}
+ {\csxappto\blx@bbl@data{%
+ \csname c@#1\endcsname\NewCount\relax
+ \def\expandafter\noexpand\csname abx@list@#1\endcsname
+ {\expandonce\NewValue}}}}
+
% {<name>}{<itemcount>}{<value>}
\protected\def\blx@bbl@namedef#1#2#3{%
- \csxappto\blx@bbl@data{%
- \csname c@#1\endcsname#2\relax
- \def\expandonce{\csname abx@name@#1\endcsname}%
- {\unexpanded{#3}}}}
+ \def\NewCount{#2}%
+ \def\NewValue{#3}%
+ \ifcsdef{blx@nih@#1}
+ {\csname blx@nih@#1\endcsname{#3}%
+ \ifdefvoid\NewValue}
+ {\@secondoftwo}
+ {}
+ {\csxappto\blx@bbl@data{%
+ \csname c@#1\endcsname\NewCount\relax
+ \def\expandafter\noexpand\csname abx@name@#1\endcsname
+ {\expandonce\NewValue}}}}
% {<entrykey>,...}
@@ -4187,8 +4670,9 @@
\csxdef{blx@setp@\the\c@refsection @\abx@field@entrykey}{\detokenize{#1}}%
\begingroup
\blx@tempcnta\z@
- \let\do\blx@bbl@set@i
- \expandafter\docsvlist\expandafter{\detokenize{#1}}%
+ \expandafter\forcsvlist
+ \expandafter\blx@bbl@set@i
+ \expandafter{\detokenize{#1}}%
\endgroup}
\def\blx@bbl@set@i#1{%
@@ -4205,11 +4689,11 @@
% {<entrykey>}
\protected\def\blx@bbl@xref#1{%
- \ifcsdef{blx@refp@\the\c@refsection @#1}
+ \ifcsdef{blx@refp@\the\c@refsection @\detokenize{#1}}
{}
- {\listcsgadd{blx@refs@\the\c@refsection}{#1}}%
- \listcsxadd{blx@refp@\the\c@refsection @#1}{\abx@field@entrykey}%
- \csxdef{blx@refc@\the\c@refsection @\abx@field@entrykey}{#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{%
\blx@ifdata{#1}
@@ -4227,8 +4711,7 @@
\protected\def\blx@bbl@keyw#1{%
\iftoggle{blx@skipbib}
{}
- {\def\do{\blx@addkeyword{\abx@field@entrykey}}%
- \docsvlist{#1}%
+ {\forcsvlist{\blx@addkeyword{\abx@field@entrykey}}{#1}%
\blx@bbl@fielddef{keywords}{#1}}}
\def\blx@addkeyword#1#2{%
@@ -4239,8 +4722,7 @@
\protected\long\def\blx@bbl@options#1{%
\begingroup
\let\blx@tempa\@empty
- \let\do\blx@bbl@options@i
- \docsvlist{#1}%
+ \forcsvlist\blx@bbl@options@i{#1}%
\edef\blx@tempa{%
\endgroup
\ifx\blx@tempa\@empty
@@ -4348,6 +4830,17 @@
{}}
{}}
+% {<section>}
+
+\def\blx@bbl@refsection#1{%
+ \begingroup
+ \c@refsection#1\relax}
+
+\def\blx@bbl@endrefsection{%
+ \endgroup
+ \csnumgdef{blx@labelnumber@\the\c@refsection}{0}%
+ \iftoggle{blx@reencode}{\blx@reencode}{}}
+
% {<entrykey>}{<entrytype>}{<options>}
\protected\def\blx@bbl@entry#1#2#3{%
@@ -4359,8 +4852,8 @@
\edef\blx@bbl@data{blx@data@\the\c@refsection @\abx@field@entrykey}%
\csuse\blx@bbl@data
\cslet\blx@bbl@data\@empty
- \blx@bbl@fieldedef{entrykey}{\abx@field@entrykey}%
- \blx@bbl@fielddef{entrytype}{#2}%
+ \blx@bbl@addfield{entrykey}{\abx@field@entrykey}%
+ \blx@bbl@addfield{entrytype}{#2}%
\blx@imc@iffieldundef{options}
{}
{\blx@bbl@fieldedef{options}{\expandonce\abx@field@options}}}
@@ -4406,19 +4899,16 @@
\begingroup
\letcs\blx@tempa{blx@sort@\the\c@refsection}%
\global\cslet{blx@sort@\the\c@refsection}\@empty
- \let\do\blx@addset@i
- \dolistloop\blx@tempa
+ \forlistloop\blx@addset@i\blx@tempa
\endgroup}
\def\blx@addset@i#1{%
\listcsgadd{blx@sort@\the\c@refsection}{#1}%
\ifcsdef{blx@setp@\the\c@refsection @#1}
- {\begingroup
- \let\do\blx@addset@ii
- \expandafter\expandafter\expandafter\docsvlist
+ {\expandafter\expandafter\expandafter\forcsvlist
+ \expandafter\expandafter\expandafter\blx@addset@ii
\expandafter\expandafter\expandafter{%
- \csname blx@setp@\the\c@refsection @#1\endcsname}%
- \endgroup}
+ \csname blx@setp@\the\c@refsection @#1\endcsname}}
{}}
\def\blx@addset@ii#1{%
@@ -4431,24 +4921,32 @@
\csuse{abx@ffd@*@shorthandwidth}{\abx@field@shorthand}}}}
\def\blx@bbl@labelnumber{%
- \ifundef\abx@field@shorthand
- {\ifundef\abx@field@localnumber
- {\csnumgdef{blx@labelnumber@\the\c@refsection}{%
- \csuse{blx@labelnumber@\the\c@refsection}+1}%
- \edef\abx@field@localnumber{%
- \csuse{blx@labelnumber@\the\c@refsection}}}
- {}%
- \blx@bbl@fieldedef{labelnumber}{\abx@field@localnumber}%
- \iftoggle{blx@skipbib}
- {}
- {\blx@setlabwidth{\labelnumberwidth}{%
- \csuse{abx@ffd@*@labelnumberwidth}{\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}}}}}
+ \ifdefempty\abx@field@localnumber
+ {}
+ {\ifundef\abx@field@shorthand
+ {\ifdef\abx@field@localnumber
+ {}
+ {\csnumgdef{blx@labelnumber@\the\c@refsection}{%
+ \csuse{blx@labelnumber@\the\c@refsection}+1}%
+ \edef\abx@field@localnumber{%
+ \csuse{blx@labelnumber@\the\c@refsection}}}%
+ \blx@bbl@fieldedef{labelnumber}{\abx@field@localnumber}%
+ \iftoggle{blx@skipbib}
+ {}
+ {\blx@setlabwidth{\labelnumberwidth}{%
+ \csuse{abx@ffd@*@labelnumberwidth}{%
+ \ifdef\abx@field@prefixnumber
+ {\abx@field@prefixnumber\abx@field@localnumber}
+ {\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}}}}}%
+ \ifdef\abx@field@prefixnumber
+ {\blx@bbl@fieldedef{prefixnumber}{\abx@field@prefixnumber}}
+ {}}
\def\blx@bbl@labelalpha{%
\ifundef\abx@field@shorthand
@@ -4575,6 +5073,8 @@
\def\blx@bblstart{%
\let\preamble\blx@bbl@preamble
\let\warn\blx@bbl@thewarn
+ \let\refsection\blx@bbl@refsection
+ \let\endrefsection\blx@bbl@endrefsection
\let\entry\blx@bbl@entry
\let\endentry\blx@bbl@endentry
\let\lossort\blx@bbl@lossort
@@ -4609,30 +5109,43 @@
% {<instcount>}{<entrykey>}{<refsection>}{<labelnumber>}
\protected\def\blx@aux@number#1#2#3#4{%
- \begingroup
- \edef\blx@bbl@data{blx@data@#3@\detokenize{#2}}%
- \blx@bbl@fielddef{localnumber}{#4}%
- \csgdef{blx@labelnumber@\the\c@refsection}{#4}%
- \blx@addchecksum{\the\numexpr#1+#4}%
- \endgroup}
+ \blx@bbl@addentryfield{#2}{#3}{localnumber}{#4}%
+ \ifblank{#4}
+ {}
+ {\csgdef{blx@labelnumber@#3}{#4}%
+ \blx@addchecksum{#1}{#4}}}
\AtEndDocument{%
- \def\abx@aux@number#1#2#3#4{\blx@addchecksum{\the\numexpr#1+#4}}}
+ \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{#1}{#2}{prefixnumber}{#3}}
\def\blx@addlabelnumber{%
\iftoggle{blx@skiplab}
{}
{\begingroup
- \ifundef\abx@field@shorthand
- {\ifundef\abx@field@localnumber
- {\csnumgdef{blx@labelnumber@\the\c@refsection}{%
- \csuse{blx@labelnumber@\the\c@refsection}+1}%
- \blx@auxwrite\@mainaux{%
- \string\abx@aux@number{\the\c@instcount}{\abx@field@entrykey}%
- {\the\c@refsection}{\csuse{blx@labelnumber@\the\c@refsection}}}%
- \edef\blx@bbl@data{blx@data@\the\c@refsection @\abx@field@entrykey}%
- \blx@bbl@fieldedef{localnumber}{\csuse{blx@labelnumber@\the\c@refsection}}}
- {}}
+ \edef\blx@bbl@data{blx@data@\the\c@refsection @\abx@field@entrykey}%
+ \iftoggle{blx@omitnumbers}
+ {\blx@auxwrite\@mainaux{}{%
+ \string\abx@aux@number{\the\c@instcount}{\abx@field@entrykey}{\the\c@refsection}{}}}
+ {\ifundef\abx@field@shorthand
+ {\ifundef\abx@field@localnumber
+ {\csnumgdef{blx@labelnumber@\the\c@refsection}{%
+ \csuse{blx@labelnumber@\the\c@refsection}+1}%
+ \blx@auxwrite\@mainaux{}{%
+ \string\abx@aux@number{\the\c@instcount}{\abx@field@entrykey}%
+ {\the\c@refsection}{\csuse{blx@labelnumber@\the\c@refsection}}}}
+ {}}
+ {}}%
+ \ifdef\blx@prefixnumbers
+ {\ifundef\abx@field@shorthand
+ {\blx@auxwrite\@mainaux{}{%
+ \string\blx@aux@numprefix{\abx@field@entrykey}%
+ {\the\c@refsection}{\expandonce\blx@prefixnumbers}}}
+ {}}
{}%
\endgroup}}
@@ -4657,8 +5170,8 @@
\def\blx@bblinput{%
\begingroup
- \iftoggle{blx@recode}
- {\ifdef\inpenc@prehook % inputenc 2006/05/05 v1.1b
+ \iftoggle{blx@reencode}
+ {\ifdef\inpenc@prehook
{\inpenc@prehook{}%
\inpenc@posthook{}}
{}%
@@ -4666,46 +5179,62 @@
{}%
\blx@info@noline{Trying to load bibliographic data..}%
\blx@blxinit
- \blx@bblfile
- \blx@bblsecs
+ \ifnumequal\blx@backend\blx@backend@biber
+ {\blx@bblfile@biber}
+ {\blx@bblfile@bibtex
+ \blx@bblsecs@bibtex}%
\endgroup
- \iftoggle{blx@recode}
+ \iftoggle{blx@reencode}
{\ifdef\@enablequotes
{\@enablequotes}
{}}
{}}
-\def\blx@bblfile{%
+\def\blx@bblfile@biber{%
+ \blx@secinit
+ \begingroup
+ \blx@bblstart
+ \blx@ifsigned{\jobname}{bbl}
+ {\InputIfFileExists{\jobname.bbl}
+ {\blx@info@noline{... file '\jobname.bbl' found}}
+ {\blx@info@noline{... file '\jobname.bbl' not found}%
+ \typeout{No file \jobname.bbl.}}}
+ {}%
+ \blx@bblend
+ \endgroup
+ \csnumgdef{blx@labelnumber@\the\c@refsection}{0}}
+
+\def\blx@bblfile@bibtex{%
\blx@secinit
\begingroup
\blx@bblstart
\ifnum\c@refsection>\z@
- \edef\blx@auxfile{\jobname\the\c@refsection\blxauxsuffix}%
+ \edef\blx@auxfile@bibtex{\jobname\the\c@refsection\blxauxsuffix}%
\else
- \edef\blx@auxfile{\jobname}%
+ \edef\blx@auxfile@bibtex{\jobname}%
\fi
- \blx@ifsigned{\blx@auxfile}{bbl}
- {\InputIfFileExists{\blx@auxfile.bbl}
- {\blx@info@noline{... file '\blx@auxfile.bbl' found}}
- {\blx@info@noline{... file '\blx@auxfile.bbl' not found}%
- \typeout{No file \blx@auxfile.bbl.}}}
+ \blx@ifsigned{\blx@auxfile@bibtex}{bbl}
+ {\InputIfFileExists{\blx@auxfile@bibtex.bbl}
+ {\blx@info@noline{... file '\blx@auxfile@bibtex.bbl' found}}
+ {\blx@info@noline{... file '\blx@auxfile@bibtex.bbl' not found}%
+ \typeout{No file \blx@auxfile@bibtex.bbl.}}}
{}%
\blx@bblend
\endgroup
\csnumgdef{blx@labelnumber@\the\c@refsection}{0}%
- \iftoggle{blx@recode}{\blx@recode}{}}
+ \iftoggle{blx@reencode}{\blx@reencode}{}}
-\def\blx@bblsecs{%
+\def\blx@bblsecs@bibtex{%
\advance\c@refsection\@ne
\ifnum\c@refsection>\blx@maxsection
\else
- \blx@bblfile
- \expandafter\blx@bblsecs
+ \blx@bblfile@bibtex
+ \expandafter\blx@bblsecs@bibtex
\fi}
-\def\blx@recode{%
+\def\blx@reencode{%
\begingroup
- \abx@hook@recode
+ \abx@hook@reencode
\let\protect\@unexpandable@protect
\def\do##1{\cslet{abx@name@##1}\relax}%
\abx@donames
@@ -4722,7 +5251,7 @@
\dolistcsloop{blx@sort@\the\c@refsection}%
\endgroup}
-\def\abx@hook@recode{%
+\def\abx@hook@reencode{%
\ifdef\@enablequotes{\@enablequotes}{}%
\def\IeC##1{\unexpanded{\IeC{##1}}}%
\let~\relax
@@ -4777,11 +5306,60 @@
% {<name>}{<code>}
\newrobustcmd*{\defbibfilter}[2]{%
+ \begingroup
+ \def\blx@flt@error{\csname blx@flt@errortrue\endcsname}%
+ \let\not\blx@flt@not \let\NOT\not
+ \let\and\blx@flt@and \let\AND\and
+ \let\or\blx@flt@or \let\OR\or
+ \letcs\({blx@flt@(} \letcs\){blx@flt@)}%
+ \def\section##1{\blx@flt@error}%
+ \def\segment##1{segment=##1}%
+ \def\type##1{type=##1}%
+ \def\subtype##1{subtype=##1}%
+ \def\keyword##1{keyword={##1}}%
+ \def\category##1{category={##1}}%
+ \edef\blx@tempa{\noexpand\blx@defbibfilter{#2}}%
+ \ifdef\blx@flt@errortrue
+ {\blx@err@filter}
+ {\let\the\relax
+ \let\blx@flt@item\relax
+ \edef\blx@tempa{\blx@tempa}%
+ \ifdef\blx@flt@errortrue
+ {\blx@err@filter}
+ {\csxdef{blx@filter@#1}{\blx@tempa}}}%
+ \endgroup}
+
+\def\blx@defbibfilter#1{%
+ \blx@defbibfilter@i#1 &}
+\def\blx@defbibfilter@i#1 #2&{%
+ \blx@defbibfilter@ii#1==&%
+ \ifblank{#2}{}{\blx@defbibfilter@i#2 &}}
+\def\blx@defbibfilter@ii#1=#2=#3&{%
\ifblank{#2}
- {\blx@error
- {Invalid filter}
- {The specified filter code is invalid}}
- {\long\csdef{blx@filter@#1}{#2}}}
+ {\ifblank{#1}
+ {}
+ {\ifcsdef{blx@flt@#1}
+ {\csname blx@flt@#1\endcsname}
+ {\blx@flt@error}}}
+ {\ifcsdef{blx@flt@#1}
+ {\csname blx@flt@#1\endcsname{\detokenize{#2}}}
+ {\blx@flt@error}}}
+
+\def\blx@flt@and{ and }
+\def\blx@flt@or{ or }
+\def\blx@flt@not{ not }
+\csdef{blx@flt@(}{ ( }
+\csdef{blx@flt@)}{ ) }
+\def\blx@flt@segment#1{%
+ test {\xifinlistcs\blx@flt@item{blx@segm@\the\c@refsection @#1}}}
+\def\blx@flt@type#1{%
+ test {\xifinlistcs\blx@flt@item{blx@type@\the\c@refsection @#1}}}
+\def\blx@flt@subtype#1{%
+ test {\xifinlistcs\blx@flt@item{blx@subt@\the\c@refsection @#1}}}
+\def\blx@flt@keyword#1{%
+ test {\xifinlistcs\blx@flt@item{blx@keyw@\the\c@refsection @#1}}}
+\def\blx@flt@category#1{%
+ test {\xifinlistcs\blx@flt@item{blx@catg@#1}}}
% options
@@ -4923,12 +5501,12 @@
\define@key{blx@los}{filter}{\blx@key@filter{#1}}
\def\blx@key@filter#1{%
- \ifcsundef{blx@filter@#1}
+ \ifcsdef{blx@filter@#1}
+ {\blx@printbibchecks
+ \blx@bibfilter\blx@tempa{blx@filter@#1}}
{\blx@warning{%
Custom filter '#1' not found.\MessageBreak
- Skipping this custom filter}}
- {\blx@printbibchecks
- \blx@bibfilter\blx@tempa{blx@filter@#1}}}
+ Skipping this custom filter}}}
\define@key{blx@bib}{maxnames}{\blx@key@maxnames{#1}}
\define@key{blx@los}{maxnames}{\blx@key@maxnames{#1}}
@@ -5022,6 +5600,32 @@
{Use \string\defbibnote\space to define it}}
{\def\blx@thepostnote{#1}}}
+\define@key{blx@bib}{resetnumbers}[true]{%
+ \ifstrequal{#1}{true}
+ {\iftoggle{blx@defernumbers}
+ {\csnumdef{blx@labelnumber@0}{0}}
+ {\blx@warning{%
+ Option 'resetnumbers' requires 'defernumbers=true'.\MessageBreak
+ Ignoring 'resetnumbers=true'}}}
+ {}}
+
+\define@key{blx@bib}{omitnumbers}[true]{%
+ \ifstrequal{#1}{true}
+ {\iftoggle{blx@defernumbers}
+ {\toggletrue{blx@omitnumbers}}
+ {\blx@warning{%
+ Option 'omitnumbers' requires 'defernumbers=true'.\MessageBreak
+ Ignoring 'omitnumbers=true'}}}
+ {}}
+
+\define@key{blx@bib}{prefixnumbers}{%
+ \iftoggle{blx@defernumbers}
+ {\csnumdef{blx@labelnumber@0}{0}%
+ \def\blx@prefixnumbers{#1}}
+ {\blx@warning{%
+ Option 'prefixnumbers' requires 'defernumbers=true'.\MessageBreak
+ Ignoring 'prefixnumbers=\detokenize{#1}'}}}
+
% [<options>]
\newrobustcmd*{\printbibheading}{%
@@ -5172,8 +5776,7 @@
\setkeys{blx@bbc}{#1}%
\blx@rest@actives
\togglefalse{blx@tempa}%
- \let\do\blx@bibcategory
- \dolistloop\blx@categories
+ \forlistloop\blx@bibcategory\blx@categories
\blx@endbibcategory}
\def\blx@bibcategory#1{%
@@ -5213,7 +5816,6 @@
\def\blx@endbibliography{%
\csuse{blx@endenv@\blx@theenv}%
- \par\nobreak
\blx@noitem
\endgroup
\blx@bibnote\blx@thepostnote
@@ -5230,7 +5832,7 @@
\let\newrefsegment\blx@newrefsegment}
\def\blx@bibnote#1{%
- \ifdefempty{#1}
+ \ifdefempty#1
{}
{\begingroup
\let\newrefsection\relax
@@ -5244,6 +5846,7 @@
{}
{\toggletrue{blx@bibliography}}%
\blx@blxinit
+ \blx@resetdata
\csuse{blx@hook@bbxinit}%
\bibsetup\bibfont
\blx@setsfcodes
@@ -5320,29 +5923,29 @@
\protected\def\blx@aux@page#1#2{%
\csgdef{blx@page@#1}{#2}%
- \blx@addchecksum{\the\numexpr#1+0#2}}
+ \blx@addchecksum{#1}{#2}}
\protected\def\blx@aux@spread#1#2{%
\ifodd#2\relax
\csxdef{blx@page@#1}{\number\numexpr#2-1}%
\else
\csgdef{blx@page@#1}{#2}%
\fi
- \blx@addchecksum{\the\numexpr#1+0#2}}
+ \blx@addchecksum{#1}{#2}}
\protected\def\blx@aux@fnpage#1#2{%
\csgdef{blx@fnpage@#1}{#2}%
- \blx@addchecksum{\the\numexpr#1+0#2}}
+ \blx@addchecksum{#1}{#2}}
\protected\def\blx@aux@fnspread#1#2{%
\ifodd#2\relax
\csxdef{blx@fnpage@#1}{\number\numexpr#2-1}%
\else
\csgdef{blx@fnpage@#1}{#2}%
\fi
- \blx@addchecksum{\the\numexpr#1+0#2}}
+ \blx@addchecksum{#1}{#2}}
\AtEndDocument{%
- \def\abx@aux@page#1#2{\blx@addchecksum{\the\numexpr#1+0#2}}%
- \def\abx@aux@fnpage#1#2{\blx@addchecksum{\the\numexpr#1+0#2}}}
+ \def\abx@aux@page#1#2{\blx@addchecksum{#1}{#2}}%
+ \def\abx@aux@fnpage#1#2{\blx@addchecksum{#1}{#2}}}
% hyperref interface
@@ -5391,10 +5994,10 @@
\def\blx@printbibchecks{%
\togglefalse{blx@tempa}%
- \iftoggle{blx@defernums}
+ \iftoggle{blx@defernumbers}
{\global\let\blx@printbibchecks\relax}
{\iftoggle{blx@labelnumber}
- {\blx@warning{Setting 'defernums=true' recommended}}
+ {\blx@warning@noline{Setting 'defernumbers=true' recommended}}
{\global\let\blx@printbibchecks\relax}}}
% {<entrykey>,...}
@@ -5419,7 +6022,6 @@
\def\blx@endshorthands{%
\csuse{blx@endenv@\blx@theenv}%
- \par\nobreak
\blx@noitem
\endgroup
\blx@bibnote\blx@thepostnote
@@ -5489,43 +6091,76 @@
\blx@inf@refsec
\blx@secinit
\if@filesw
- \blx@auxwrite\@mainaux{%
- \string\abx@aux@refsection{\the\c@refsection}}%
- \xdef\blx@auxfile{\jobname\the\c@refsection\blxauxsuffix}%
- \blx@ifsigned{\blx@auxfile}{aux}
- {\immediate\openout\blx@auxout \blx@auxfile.aux\relax
- \global\let\blx@theauxout\blx@auxout
- \blx@auxinit{#1}}
- {}%
+ \blx@auxwrite\@mainaux{}{%
+ \string\abx@aux@refsection{\the\c@refsection}{\the\c@page}}%
+ \ifnum\blx@backend=\blx@backend@biber
+ \blx@xsanitizeafter\blx@refsection@biber{#1}%
+ \else
+ \blx@xsanitizeafter\blx@refsection@bibtex{#1}%
+ \fi
\fi
\blx@info{Setting label 'refsection:\the\c@refsection'}%
\label{refsection:\the\c@refsection}%
\endgroup}
+\def\blx@refsection@biber#1{%
+ \blx@regbibfiles{\jobname}{#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\blx@refsection@bibtex#1{%
+ \xdef\blx@auxfile@bibtex{\jobname\the\c@refsection\blxauxsuffix}%
+ \blx@regbibfiles{\blx@auxfile@bibtex}{#1}%
+ \blx@logreq@inactive
+ \blx@ifsigned{\blx@auxfile@bibtex}{aux}
+ {\immediate\openout\blx@auxout\blx@auxfile@bibtex.aux\relax
+ \global\let\blx@auxout@bibtex\blx@auxout
+ \blx@auxinit@bibtex{#1}}
+ {}}
+
\protected\def\endrefsection{%
\blx@endrefsection
\blx@inf@refsec}
\def\blx@endrefsection{%
\blx@endrefsegment
- \ifx\blx@theauxout\blx@auxout
- \immediate\closeout\blx@auxout
+ \ifnum\blx@backend=\blx@backend@biber
+ \blx@endrefsection@biber
+ \else
+ \blx@endrefsection@bibtex
\fi
- \global\let\blx@theauxout\@mainaux
- \xdef\blx@auxfile{\jobname}%
+ \global\c@refsection\z@}
+
+\def\blx@endrefsection@biber{%
\ifnum\c@refsection>\z@
- \global\c@refsection\z@
+ \blx@auxwrite\blx@auxout{}{%
+ \blx@bcf@endsection\blx@nl
+ \blx@bcf@comment{section 0 (cont.)}%
+ \blx@bcf@section{0}}%
+ \fi}
+
+\def\blx@endrefsection@bibtex{%
+ \ifx\blx@auxout@bibtex\blx@auxout
+ \immediate\closeout\blx@auxout
+ \global\let\blx@auxout@bibtex\@mainaux
+ \xdef\blx@auxfile@bibtex{\jobname}%
\fi}
\AtEndDocument{%
\blx@endrefsection
- \def\abx@aux@refsection#1{\blx@addchecksum{[#1]}}}
+ \def\abx@aux@refsection#1#2{\blx@addchecksum{#1}{#2}}}
-\protected\def\abx@aux@refsection#1{%
+\protected\def\abx@aux@refsection#1#2{%
\ifnum#1>\blx@maxsection
\global\blx@maxsection#1\relax
\fi
- \blx@addchecksum{[#1]}}
+ \blx@addchecksum{#1}{#2}}
% Reference segments
@@ -5581,14 +6216,12 @@
{Category '#1' not declared}
{Use \string\DeclareBibliographyCategory\space to declare}}
{\AfterPreamble{%
- \def\do{\blx@addtocategory{#1}}%
- \blx@sanitizekeys\docsvlist{#2}%
- \let\do\noexpand}}}
+ \blx@xsanitizeafter{\forcsvlist{\blx@addtocategory{#1}}}{#2}}}}
% {<category>}{<entrykey>,...}
\def\blx@addtocategory#1#2{%
- \blx@auxwrite\@mainaux{\string\abx@aux@category{#1}{#2}}%
+ \blx@auxwrite\@mainaux{}{\string\abx@aux@category{#1}{#2}}%
\abx@aux@category{#1}{#2}}
% {<category>}{<entrykey>,...}
@@ -5603,11 +6236,14 @@
% Database
\renewrobustcmd*{\bibliography}[1]{%
- \ifx\blx@bibfiles\@empty
- \gdef\blx@bibfiles{#1}%
- \else
- \gappto\blx@bibfiles{,#1}%
- \fi}
+ \blx@xsanitizeafter{\forcsvlist\blx@addbibfile}{#1}}
+
+\def\blx@addbibfile#1{%
+ \ifdefempty\blx@bibfiles
+ {\gdef\blx@bibfiles{#1}}
+ {\gappto\blx@bibfiles{,#1}}%
+ \blx@regbibfile{\jobname}{#1}}
+
\let\blx@bibfiles\@empty
%% Citations
@@ -5676,7 +6312,7 @@
{\listcsgadd{blx@segm@\the\c@refsection @\the\c@refsegment}{#1}}%
\blx@ifdata{#1}
{}
- {\blx@logreq{#2{#1}}}}
+ {\blx@logreq@active{#2{#1}}}}
\def\blx@citation@set#1#2{%
\blx@citation@entry{#1}{#2}%
@@ -5725,12 +6361,16 @@
{blx@segm@\the\c@refsection @\the\c@refsegment}
{blx@sbib@\the\c@refsection}%
\ifcsvoid{blx@sort@\the\c@refsection}
- {\blx@logreq{}}
+ {\blx@logreq@active{}}
{}}
{}}
\def\blx@bibreq#1{%
- \blx@auxwrite\blx@theauxout{\string\citation{#1}}}
+ \ifnum\blx@backend=\blx@backend@biber
+ \blx@auxwrite\blx@auxout{}{\blx@bcf@citekey{#1}}%
+ \else
+ \blx@auxwrite\blx@auxout@bibtex{}{\string\citation{#1}}%
+ \fi}
% {<entrykey>,...}
@@ -5739,8 +6379,7 @@
\blx@tempcnta\z@
\blx@tempcntb\z@
\let\blx@tempa\@empty
- \let\do\blx@citeadd
- \docsvlist{#1}%
+ \forcsvlist\blx@citeadd{#1}%
\blx@thenotecheck
\ifnum\blx@tempcnta>\z@
\ifnum\blx@tempcntb>\z@
@@ -5752,7 +6391,7 @@
\edef\blx@tempa{\endgroup
\c@citecount\z@
\c@citetotal\the\blx@tempcnta\relax
- \unexpanded{\let\do\blx@citeprint\dolistloop}{\blx@tempb}}%
+ \unexpanded{\forlistloop\blx@citeprint}{\blx@tempb}}%
\blx@tempa}
\def\blx@notecheck{%
@@ -5780,7 +6419,7 @@
{\advance\blx@tempcnta\@ne
\listadd\blx@tempa{#1}}
{\ifnum\blx@tempcntb>\z@\multicitedelim\fi
- \blx@missing{#1}%
+ \abx@missing{#1}%
\advance\blx@tempcntb\@ne}}
% {<entrykey>}
@@ -6155,12 +6794,12 @@
\if@filesw
\protected@write\@mainaux{}{\string\abx@aux@backref
{\the\c@instcount}{\abx@field@entrykey}%
- {\the\c@refsection}{\thepage}}%
+ {\the\c@refsection}{\thepage}{\noexpand\the\c@page}}%
\fi}
-% {<instcount>}{<entrykey>}{<refsection>}{<page>}
+% {<instcount>}{<entrykey>}{<refsection>}{<page>}{<page int>}
-\protected\def\blx@aux@backref#1#2#3#4{%
+\protected\def\blx@aux@backref#1#2#3#4#5{%
\ifcsundef{blx@pref@#3@\detokenize{#2}}
{\global\cslet{blx@pref@#3@\detokenize{#2}}\@empty
\expandafter\blx@onlypreamble
@@ -6169,10 +6808,10 @@
\ifinlistcs{#4}{blx@pref@#3@\detokenize{#2}}
{}
{\listcsgadd{blx@pref@#3@\detokenize{#2}}{#4}}%
- \blx@addchecksum{\the\numexpr#1+0#4}}
+ \blx@addchecksum{#1}{#5}}
\AtEndDocument{%
- \def\abx@aux@backref#1#2#3#4{\blx@addchecksum{\the\numexpr#1+0#4}}}
+ \def\abx@aux@backref#1#2#3#4#5{\blx@addchecksum{#1}{#5}}}
% {<true>}{<false>}
@@ -6192,19 +6831,37 @@
{\blx@bibhyperref[\abx@field@entrykey]}}%
\ifundef\hyper@natanchorstart
{\long\def\blx@bibhyperref[#1]#2{%
- \hyperlink{cite.\the\c@refsection @#1}{#2}}%
+ \blx@sfsave\hyperlink{cite.\the\c@refsection @#1}{\blx@sfrest
+ #2%
+ \blx@sfsave}\blx@sfrest}%
\protected\long\def\blx@imc@bibhyperlink#1#2{%
- \hyperlink{cite.\the\c@refsection:#1}{#2}}%
+ \blx@sfsave\hyperlink{cite.\the\c@refsection:#1}{\blx@sfrest
+ #2%
+ \blx@sfsave}\blx@sfrest}%
\protected\long\def\blx@imc@bibhypertarget#1#2{%
- \hypertarget{cite.\the\c@refsection:#1}{#2}}}%
+ \blx@sfsave\hypertarget{cite.\the\c@refsection:#1}{\blx@sfrest
+ #2%
+ \blx@sfsave}\blx@sfrest}}%
{\long\def\blx@bibhyperref[#1]#2{%
- \hyper@natlinkstart{\the\c@refsection @#1}#2\hyper@natlinkend}%
+ \blx@sfsave\hyper@natlinkstart{\the\c@refsection @#1}\blx@sfrest
+ #2%
+ \blx@sfsave\hyper@natlinkend\blx@sfrest}%
\protected\long\def\blx@imc@bibhyperlink#1#2{%
- \hyper@natlinkstart{\the\c@refsection:#1}#2\hyper@natlinkend}%
+ \blx@sfsave\hyper@natlinkstart{\the\c@refsection:#1}\blx@sfrest
+ #2%
+ \blx@sfsave\hyper@natlinkend\blx@sfrest}%
\protected\long\def\blx@imc@bibhypertarget#1#2{%
- \@bsphack\hyper@natanchorstart{\the\c@refsection:#1}\@esphack
- #2\hyper@natanchorend}}
- \let\blx@imc@ifhyperref\@firstoftwo}
+ \blx@sfsave\hyper@natanchorstart{\the\c@refsection:#1}\blx@sfrest
+ #2%
+ \blx@sfsave\hyper@natanchorend\blx@sfrest}}
+ \let\blx@imc@ifhyperref\@firstoftwo
+ \def\blx@sf{\spacefactor}%
+ \def\blx@sfsave{%
+ \blx@leavevmode
+ \numgdef\blx@sf{\spacefactor}}%
+ \def\blx@sfrest{%
+ \ifhmode\spacefactor\blx@sf\relax\fi
+ \gdef\blx@sf{\spacefactor}}}
\appto\blx@mknohyperref{%
\protected\def\blx@imc@bibhyperref{\@ifnextchar[\blx@nohyperref\@firstofone}%
@@ -6227,10 +6884,7 @@
{}
{\ifstrequal{*}{#1}
{\blx@citation@all}
- {\begingroup
- \let\do\blx@nocite@do
- \blx@sanitizekeys\docsvlist{#1}%
- \endgroup}}}%
+ {\blx@xsanitizeafter{\forcsvlist\blx@nocite@do}{#1}}}}%
\@esphack}
\def\blx@nocite@do#1{\blx@citation{#1}\blx@msg@cundef}
@@ -6249,7 +6903,7 @@
\long\def\blx@citeargs@ii#1[#2]{%
\blx@citeargs@iii{#1{#2}}}
\long\def\blx@citeargs@iii#1#2{%
- \blx@sanitizekeys{#1}{#2}}
+ \blx@xsanitizeafter{#1}{#2}}
% {<macro>}(<arg1>)(<arg2>)
% => <macro>{<arg1>}{<arg2>}
@@ -6296,7 +6950,7 @@
\ifx#1&%
\expandafter\blx@checkpunct@iii
\fi
- \if\noexpand#1\noexpand\blx@tempb
+ \ifx#1\blx@tempb
\expandafter\blx@checkpunct@iv
\fi
\blx@checkpunct@ii}
@@ -6611,7 +7265,16 @@
\ifblank{#1}
{\let\blx@thecheckpunct\blx@nocheckpunct}
{\let\blx@thecheckpunct\blx@checkpunct
- \edef\blx@autopunct{\detokenize{#1}}}}
+ \def\blx@autopunct{#1}}}
+
+\AfterEndPreamble{% babel
+ \begingroup
+ \makeatletter
+ \scantokens\expandafter{%
+ \expandafter\gdef
+ \expandafter\blx@autopunct
+ \expandafter{\blx@autopunct}}%
+ \endgroup}
% [<prenote>][<postnote>]{<entrykey>,...}[<format>]{<namelist>}<punct>
@@ -6630,7 +7293,7 @@
\def\blx@loopcode{%
\ifnameundef{#5}
{\blx@warning@entry{'#5' undefined or not a name list}%
- \blx@missing{#5}}
+ \abx@missing{#5}}
{\printnames[#4]{#5}}}%
\def\blx@dlimcode{\multicitedelim}%
\ifblank{#2}
@@ -6656,9 +7319,9 @@
{\def\abx@field@postnote{#2}}%
\def\blx@precode{\usebibmacro{prenote}}%
\def\blx@loopcode{%
- \blx@imc@iflistundef{#5}
+ \iflistundef{#5}
{\blx@warning@entry{'#5' undefined or not a literal list}%
- \blx@missing{#5}}
+ \abx@missing{#5}}
{\printlist[#4]{#5}}}%
\def\blx@dlimcode{\multicitedelim}%
\ifblank{#2}
@@ -6686,7 +7349,7 @@
\def\blx@loopcode{%
\iffieldundef{#5}
{\blx@warning@entry{'#5' undefined or not a field}%
- \blx@missing{#5}}
+ \abx@missing{#5}}
{\printfield[#4]{#5}}}%
\def\blx@dlimcode{\multicitedelim}%
\ifblank{#2}
@@ -6759,6 +7422,7 @@
\def\ifpages#1{\blx@TE{\blx@imc@ifpages{#1}}}%
\def\iffieldnum#1{\blx@TE{\blx@imc@iffieldnum{#1}}}%
\def\iffieldnums#1{\blx@TE{\blx@imc@iffieldnums{#1}}}%
+ \def\iffieldpages#1{\blx@TE{\blx@imc@iffieldpages{#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}}}%
@@ -6778,40 +7442,20 @@
% {<listmacro>}{<filtercsname>} => matches in <listmacro>
\protected\def\blx@bibfilter#1#2{%
- \let\blx@@TE@hook\blx@TE@hook
- \appto\blx@TE@hook\blx@fltinit
+ \begingroup
\edef\blx@do##1{%
- \def\noexpand\blx@fltitem{##1}%
- \noexpand\ifthenelse{\csexpandonce{#2}}%
- {\listadd\noexpand#1{##1}}%
+ \def\noexpand\blx@flt@item{##1}%
+ \ifboolexpr{\csexpandonce{#2}}%
+ {\listadd\noexpand\blx@tempa{##1}}%
{}}%
- \def\blx@done{\let\blx@TE@hook\blx@@TE@hook}%
- \begingroup\edef#1{\endgroup
- \unexpanded{\let#1\@empty}%
+ \let\blx@done\relax
+ \edef\blx@tempa{%
+ \let\noexpand\blx@tempa\noexpand\@empty
\blx@listloop{#1}}%
- #1}
-
-\appto\blx@fltinit{%
- \def\segment#1{\blx@xTE{%
- \ifinlist
- {\blx@fltitem}
- {\csuse{blx@segm@\the\c@refsection @#1}}}}%
- \def\type#1{\blx@xTE{%
- \ifinlist
- {\blx@fltitem}
- {\csuse{blx@type@\the\c@refsection @#1}}}}%
- \def\subtype#1{\blx@xTE{%
- \ifinlist
- {\blx@fltitem}
- {\csuse{blx@subt@\the\c@refsection @#1}}}}%
- \def\keyword#1{\blx@xTE{%
- \ifinlist
- {\blx@fltitem}
- {\csuse{blx@keyw@\the\c@refsection @\detokenize{#1}}}}}%
- \def\category#1{\blx@xTE{%
- \ifinlist
- {\blx@fltitem}
- {\csuse{blx@catg@#1}}}}}
+ \blx@tempa
+ \edef\blx@tempa{\endgroup
+ \def\noexpand#1{\blx@tempa}}%
+ \blx@tempa}
%% Auxiliary macros
@@ -6882,10 +7526,13 @@
\newrobustcmd*{\mkbibemph}{\emph}
\protected\long\def\blx@imc@mkbibemph#1{%
- \emph{#1}\relax
- \blx@imc@setpunctfont\emph}
+ \emph{#1}\blx@imc@setpunctfont\emph}
-\blx@regimcs{\mkbibquote \mkbibemph}
+\newrobustcmd*{\mkbibbold}{\textbf}
+\protected\long\def\blx@imc@mkbibbold#1{%
+ \textbf{#1}\blx@imc@setpunctfont\textbf}
+
+\blx@regimcs{\mkbibquote \mkbibemph \mkbibbold}
\newcommand*{\bibleftparen}{\blx@postpunct(}
\newcommand*{\bibrightparen}{\blx@postpunct)\midsentence}
@@ -6976,6 +7623,9 @@
\blx@errormark
\fi}
+\protected\def\blx@errormark{%
+ \rule[0.25ex]{1.25ex}{1.25ex}}
+
\AtEndDocument{%
\unless\ifnum\blx@parenlevel@text=\z@
\blx@err@matchparen{%
@@ -7123,6 +7773,448 @@
\let\blx@volcite@vol\@gobble
\let\blx@volcite@page\@firstofone}
+%% Control file writers
+
+\begingroup
+\let~\space
+\@makeother\<
+\@makeother\>
+\@makeother\.
+\@makeother\:
+\@makeother\?
+\@makeother\"
+\@makeother\-
+\@makeother\=
+\@makeother\/
+\xdef\blx@bcf@file{%
+ \blx@sig@bcf\blx@nl
+ \blx@ver@bcf\blx@nl}
+\xdef\blx@bcf@endfile{%
+ \blx@nl</bcf:controlfile>}
+\xdef\blx@bcf@comment#1{%
+ ~~<!-- #1 -->\blx@nl}
+\xdef\blx@bcf@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{%
+ ~~~~<bcf:option type="#1">\blx@nl
+ #2%
+ ~~~~</bcf:option>\blx@nl}
+\xdef\blx@bcf@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%
+ ~~</bcf:sorting>\blx@nl}
+\xdef\blx@bcf@sort#1#2{%
+ ~~~~<bcf:sort #1>\blx@nl
+ #2%
+ ~~~~</bcf:sort>\blx@nl}
+\xdef\blx@bcf@sortitem#1#2{%
+ ~~~~~~<bcf:sortitem #1>#2</bcf:sortitem>\blx@nl}
+\xdef\blx@bcf@section#1{%
+ ~~<bcf:section number="#1">}
+\xdef\blx@bcf@endsection{%
+ ~~</bcf:section>}
+\xdef\blx@bcf@bibdata#1#2{%
+ ~~<bcf:bibdata section="#1">\blx@nl
+ #2%
+ ~~</bcf:bibdata>\blx@nl}
+\xdef\blx@bcf@datasource#1#2{%
+ ~~~~<bcf:datasource type="#1">#2</bcf:datasource>\blx@nl}
+\xdef\blx@bcf@citekey#1{%
+ ~~~~<bcf:citekey>#1</bcf:citekey>}
+\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
+
+\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
+ #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
+
+\def\blx@sortdef@item#1{%
+ \advance\blx@tempcnta\@ne
+ \blx@tempcntb\z@
+ \let\blx@tempb\@empty
+ \let\do\@firstofone
+ #1%
+ \eappto\blx@tempa{%
+ \blx@bcf@sort{order="\the\blx@tempcnta"}{\blx@tempb}}}
+
+\newcommand*{\blx@sortdef@field}[2][]{%
+ \advance\blx@tempcntb\@ne
+ \edef\blx@tempc{order="\the\blx@tempcntb"}%
+ \ifblank{#1}
+ {}
+ {\setkeys{blx@sortdef@field}{#1}}%
+ \eappto\blx@tempb{%
+ \blx@bcf@sortitem{\blx@tempc}{#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"}}
+\define@key{blx@sortdef@field}{padwidth}{% integer
+ \appto\blx@tempc{ pad_width="#1"}}
+\define@key{blx@sortdef@field}{padchar}{% character
+ \appto\blx@tempc{ pad_char="#1"}}
+
+\def\blx@sortdef@literal#1{%
+ \advance\blx@tempcntb\@ne
+ \eappto\blx@tempb{%
+ \blx@bcf@sortitem{order="\the\blx@tempcntb"}{#1}}}
+
+\DeclareSortingScheme{none}{%
+ \item{\field{citeorder}}
+}
+
+\DeclareSortingScheme{debug}{%
+ \item{\field{entrykey}}
+}
+
+\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}}
+}
+
+\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}}
+}
+
+\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}}
+}
+
+\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}}
+}
+
+\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}}
+}
+
+\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}}
+}
+
+\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}}
+}
+
+\def\blx@deflabel#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}}}%
+ \docsvlist{#2}%
+ \endgroup}
+
+% [<entrytype>]
+
+\newrobustcmd*{\DeclareLabelname}[1][global]{%
+ \expandafter\blx@deflabel\csname blx@bcf@labelname@#1\endcsname}
+\@onlypreamble\DeclareLabelname
+
+% [<entrytype>]
+
+\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@version:%
+ \noexpand\iftoggle{blx@debug}{1}{0}:%
+ \noexpand\ifnum\noexpand\blx@backend=\noexpand\blx@backend@bibtexviii
+ 1:%
+ \noexpand\else
+ 0:%
+ \noexpand\fi
+ \noexpand\iftoggle{blx@cssort}{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@opt@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{bibencoding}{\blx@bibencoding}%
+ \blx@bcf@toggle{cssort}%
+ \blx@bcf@toggle{debug}%
+ \blx@bcf@svalue{inputenc}{\blx@inputenc}%
+ \blx@bcf@svalue{mincrossrefs}{\blx@mincrossrefs}%
+ }%
+ \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>}
@@ -7163,15 +8255,16 @@
{\letcs\blx@backend{blx@backend@#1}}
{\blx@err@invopt{backend=#1}{}}}
\chardef\blx@backend@bibtex=0
-\expandafter\chardef\csname blx@backend@bibtex8\endcsname=1
+\chardef\blx@backend@bibtexviii=1
\chardef\blx@backend@biber=2
+\cslet{blx@backend@bibtex8}\blx@backend@bibtexviii
\DeclareBibliographyOption{loadfiles}[true]{%
\settoggle{blx@loadfiles}{#1}}
\DeclareBibliographyOption{mincrossrefs}{%
\ifnum#1<\z@
- \undef\blx@mincrossrefs
+ \def\blx@mincrossrefs{1}%
\def\blx@minxrefs{1}%
\else
\def\blx@mincrossrefs{#1}%
@@ -7180,16 +8273,7 @@
\def\blx@minxrefs{2}
\DeclareBibliographyOption{bibencoding}{%
- \ifstrequal{#1}{ascii}
- {\undef\blx@bibencoding
- \togglefalse{blx@recode}}
- {\def\blx@bibencoding{#1}%
- \ifstrequal{#1}{inputenc}
- {\togglefalse{blx@recode}}
- {\toggletrue{blx@recode}}%
- \ifnum\blx@backend<\csuse{blx@backend@bibtex8}%
- \letcs\blx@backend{blx@backend@bibtex8}%
- \fi}}
+ \def\blx@bibencoding{#1}}
\DeclareBibliographyOption{sorting}{%
\ifcsdef{blx@opt@sorting@#1}
@@ -7205,6 +8289,9 @@
\def\blx@opt@sorting@ydnt{22}
\def\blx@opt@sorting@debug{99}
+\DeclareBibliographyOption{sortcase}[true]{%
+ \settoggle{blx@cssort}{#1}}
+
\DeclareBibliographyOption{sortlos}{%
\ifcsdef{blx@opt@sortlos@#1}
{\letcs\blx@sortlos{blx@opt@sortlos@#1}}
@@ -7287,35 +8374,47 @@
\DeclareBibliographyOption{abbreviate}[true]{%
\ifstrequal{#1}{true}
- {\let\blx@lbx@thedef\blx@lbx@shortdef}
- {\let\blx@lbx@thedef\blx@lbx@longdef}}
+ {\def\abx@str{abx@sstr}}
+ {\def\abx@str{abx@lstr}}}
+
+\DeclareBibliographyOption{dateabbrev}[true]{%
+ \ifstrequal{#1}{true}
+ {\let\abx@bibmonth\blx@imc@bibsstring}
+ {\let\abx@bibmonth\blx@imc@biblstring}}
\DeclareBibliographyOption{language}{%
\ifstrequal{#1}{auto}
- {\toggletrue{autolang}%
+ {\toggletrue{blx@autolang}%
\def\blx@languagename{english}}
{\IfFileExists{#1.lbx}
- {\togglefalse{autolang}%
+ {\togglefalse{blx@autolang}%
\edef\blx@languagename{#1}}
{\blx@error
{Language '#1' not supported}
{Failed to find a matching '#1.lbx' file}}}}
+\DeclareBibliographyOption{clearlang}[true]{%
+ \settoggle{blx@clearlang}{#1}}
+
\DeclareBibliographyOption{babel}{%
\ifcsdef{blx@opt@babel@#1}
{\csuse{blx@opt@babel@#1}}
{\blx@err@invopt{babel=#1}{}}}
\def\blx@opt@babel@none{%
\undef\blx@thelangenv
+ \let\blx@hook@initlang\@empty
\let\blx@hook@endlang\@empty}
\def\blx@opt@babel@hyphen{%
\def\blx@thelangenv{hyphenrules}%
+ \let\blx@hook@initlang\@empty
\let\blx@hook@endlang\@empty}
\csdef{blx@opt@babel@other*}{%
\def\blx@thelangenv{otherlanguage*}%
+ \def\blx@hook@initlang{\@quotereset\@ne}%
\def\blx@hook@endlang{\blx@postpunct}}
\def\blx@opt@babel@other{%
\def\blx@thelangenv{otherlanguage}%
+ \def\blx@hook@initlang{\@quotereset\@ne}%
\def\blx@hook@endlang{\blx@postpunct}}
\DeclareBibliographyOption{indexing}[true]{%
@@ -7355,7 +8454,7 @@
{\let\blx@backref\blx@backref@global
\let\abx@aux@backref\blx@aux@backref}
{\let\blx@backref\relax
- \let\abx@aux@backref\@gobblefour}}
+ \let\abx@aux@backref\@gobblefive}}
\appto\blx@mkhyperref{%
\ifHy@plainpages
@@ -7593,25 +8692,25 @@
{\setcounter{maxparens}{#1}}}
\DeclareBibliographyOption{date}{%
- \ifcsundef{mkbibrange#1}
- {\blx@err@invopt{date=#1}{}}
+ \ifcsdef{mkbibrange#1}
{\protected\def\blx@imc@printdate{\csuse{mkbibrange#1}{}}%
- \protected\def\blx@imc@printdateextra{\csuse{mkbibrange#1extra}{}}}}
+ \protected\def\blx@imc@printdateextra{\csuse{mkbibrange#1extra}{}}}
+ {\blx@err@invopt{date=#1}{}}}
\DeclareBibliographyOption{urldate}{%
- \ifcsundef{mkbibrange#1}
- {\blx@err@invopt{urldate=#1}{}}
- {\protected\def\blx@imc@printurldate{\csuse{mkbibrange#1}{url}}}}
+ \ifcsdef{mkbibrange#1}
+ {\protected\def\blx@imc@printurldate{\csuse{mkbibrange#1}{url}}}
+ {\blx@err@invopt{urldate=#1}{}}}
\DeclareBibliographyOption{eventdate}{%
- \ifcsundef{mkbibrange#1}
- {\blx@err@invopt{eventdate=#1}{}}
- {\protected\def\blx@imc@printeventdate{\csuse{mkbibrange#1}{event}}}}
+ \ifcsdef{mkbibrange#1}
+ {\protected\def\blx@imc@printeventdate{\csuse{mkbibrange#1}{event}}}
+ {\blx@err@invopt{eventdate=#1}{}}}
\DeclareBibliographyOption{origdate}{%
- \ifcsundef{mkbibrange#1}
- {\blx@err@invopt{origdate=#1}{}}
- {\protected\def\blx@imc@printorigdate{\csuse{mkbibrange#1}{orig}}}}
+ \ifcsdef{mkbibrange#1}
+ {\protected\def\blx@imc@printorigdate{\csuse{mkbibrange#1}{orig}}}
+ {\blx@err@invopt{origdate=#1}{}}}
\DeclareBibliographyOption{alldates}{%
\ExecuteBibliographyOptions{date=#1,urldate=#1,eventdate=#1,origdate=#1}}
@@ -7652,7 +8751,7 @@
\settoggle{blx@labelnumber}{#1}%
\iftoggle{blx@labelnumber}
{}
- {\KV@blx@opt@pre@defernums{false}}}
+ {\KV@blx@opt@pre@defernumbers{false}}}
\DeclareTypeOption{labelnumber}[true]{% FIXME: per-type check
\settoggle{blx@labelnumber}{#1}}
@@ -7683,9 +8782,9 @@
\DeclareTypeOption{singletitle}[true]{%
\settoggle{blx@singletitle}{#1}}
-\DeclareBibliographyOption{defernums}[true]{%
- \settoggle{blx@defernums}{#1}%
- \iftoggle{blx@defernums}
+\DeclareBibliographyOption{defernumbers}[true]{%
+ \settoggle{blx@defernumbers}{#1}%
+ \iftoggle{blx@defernumbers}
{\KV@blx@opt@pre@labelnumber{true}%
\let\blx@thelabelnumber\blx@addlabelnumber
\let\abx@aux@number\blx@aux@number}
@@ -7803,39 +8902,38 @@
\noexpand\setkeys{blx@opt@pre}{\blx@theoptions}}%
\blx@tempa}}
+%% Initial setup
+
% Set defaults
\setkeys{blx@opt@ldt}{style=numeric}
\setkeys{blx@opt@pre}{%
- sorting=nty,sortlos=los,sortcites=false,maxnames=3,minnames=1,
+ sorting=nty,sortlos=los,sortcase,sortcites=false,maxnames=3,minnames=1,
maxitems=3,minitems=1,mincrossrefs=2,useauthor=true,useeditor=true,
- usetranslator=false,indexing=false,backref=false,abbreviate=true,
- pagetracker=false,ibidtracker=false,idemtracker=false,
+ usetranslator=false,indexing=false,abbreviate=true,dateabbrev=true,
+ backref=false,pagetracker=false,ibidtracker=false,idemtracker=false,
opcittracker=false,loccittracker=false,citetracker=false,block=none,
- 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,parentracker,maxparens=3,bibwarn}
+ language=auto,clearlang=true,babel=none,date=comp,origdate=comp,
+ eventdate=comp,urldate=short,autopunct=true,punctfont=false,
+ defernumbers=false,refsection=none,refsegment=none,citereset=none,
+ hyperref=auto,maxline=79,parentracker,maxparens=3,bibwarn}
% Load compatibility code
-\input{blx-compat.def}
-
-% Process load-time options
-
-\ProcessOptions*
-
-%% Initial setup
+\blx@inputonce{blx-compat.def}{compatibility code}{}{}{}{}
% Restore catcodes
-\def\do#1#2{\catcode`#1=#2\relax}\blx@catcodes
+\blx@catcodes
\undef\blx@catcodes
-\let\do\noexpand
+
+% Process load-time options
+
+\ProcessOptions*
% Load citation and bibliography styles, configuration file
-\input{biblatex.def}
+\blx@inputonce{biblatex.def}{generic definitions}{}{}{}{}
\iftoggle{blx@natbib}
{\blx@inputonce{blx-natbib.def}{natbib compatibility}{}{}{}{}}
{}
@@ -7849,13 +8947,7 @@
\blx@processoptions
-% Deferred last minute setup
-
-\csdef{blx@opt@refsection@none}{0}
-\csdef{blx@opt@refsection@part}{1}
-\csdef{blx@opt@refsection@chapter}{2}
-\csdef{blx@opt@refsection@section}{3}
-\csdef{blx@opt@refsection@subsection}{4}
+% Deferred setup at end of preamble
\AtEndPreamble{%
\iftoggle{blx@firstinits}
@@ -7866,17 +8958,16 @@
Setting 'uniquename=init'}%
\fi}
{}%
- \ifnum\blx@refhook@segment>\z@
- \ifnum\blx@refhook@segment>\blx@refhook@section\relax
- \else
- \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
+ \ifnumgreater\blx@refhook@segment\z@
+ {\ifnumgreater\blx@refhook@segment\blx@refhook@section
+ {}
+ {\blx@err@confopt
+ {refsegment/refsection}
+ {The 'refsegment' option must point to a
+ lower-level\MessageBreak document division
+ than 'refsection'}%
+ \def\blx@refhook@segment{0}}}
+ {}%
\ifcase\blx@refhook@segment
\or % 1
\ifundef\part
@@ -7955,454 +9046,106 @@
{}
{\blx@err@patch{\string\part}}}%
\fi
- \@ifpackageloaded{inputenc}
- {\ifundef\inputencodingname % inputenc 2006/05/05 v1.1b
- {\begingroup
- \def\@inpenc@undefined@#1{\gdef\blx@inputenc{#1}}%
- \@inpenc@undefined
- \endgroup}
- {\let\blx@inputenc\inputencodingname}%
- \ifdef\blx@bibencoding
- {\iftoggle{blx@recode}
- {\blx@info@noline{%
- Input encoding '\blx@bibencoding' specified}}
- {\blx@info@noline{%
- Input encoding '\blx@inputenc' detected}%
- \let\blx@bibencoding\blx@inputenc}}
- {}}
- {\ifdef\blx@bibencoding
- {\blx@error
- {Package 'inputenc' not loaded}
- {The 'bibencoding' option depends on 'inputenc'}%
- \undef\blx@bibencoding
- \togglefalse{blx@recode}}
- {}}}
-
-\begingroup
-\let~\space
-\@makeother\<
-\@makeother\>
-\@makeother\.
-\@makeother\:
-\@makeother\?
-\@makeother\"
-\@makeother\-
-\@makeother\/
-\xdef\blx@bcf@file#1{%
- \blx@sig@bcf\blx@nl
- \blx@ver@bcf\blx@nl
- #1%
- </bcf:controlfile>}
-\xdef\blx@bcf@comment#1{%
- ~~<!-- #1 -->\blx@nl}
-\xdef\blx@bcf@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{%
- ~~~~<bcf:option type="#1">\blx@nl
- #2%
- ~~~~</bcf:option>\blx@nl}
-\xdef\blx@bcf@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%
- ~~</bcf:sorting>\blx@nl}
-\xdef\blx@bcf@sort#1#2{%
- ~~~~<bcf:sort #1>\blx@nl
- #2%
- ~~~~</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
-
-\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
- #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
-
-\def\blx@sortdef@item#1{%
- \advance\blx@tempcnta\@ne
- \blx@tempcntb\z@
- \let\blx@tempb\@empty
- \let\do\@firstofone
- #1%
- \eappto\blx@tempa{%
- \blx@bcf@sort{order="\the\blx@tempcnta"}{\blx@tempb}}}
-
-\newcommand*{\blx@sortdef@field}[2][]{%
- \advance\blx@tempcntb\@ne
- \edef\blx@tempc{order="\the\blx@tempcntb"}%
- \ifblank{#1}
+ \blx@checkencoding}
+
+\def\blx@checkencoding{%
+ \ifundef\inputencodingname
+ {\ifundef\XeTeXrevision
+ {\ifundef\luatexversion
+ {\def\blx@inputenc{ascii}%
+ \blx@info@noline{%
+ No input encoding detected.\MessageBreak
+ Assuming '\blx@inputenc'}}
+ {\def\blx@inputenc{utf8}%
+ \blx@info@noline{%
+ LuaTeX detected.\MessageBreak
+ Assuming input encoding '\blx@inputenc'}}}
+ {\def\blx@inputenc{utf8}%
+ \blx@info@noline{%
+ XeTeX detected.\MessageBreak
+ Assuming input encoding '\blx@inputenc'}}}
+ {\let\blx@inputenc\inputencodingname
+ \ifboolexpr{
+ test {\ifdefstring\blx@inputenc{utf8x}}
+ or
+ test {\ifdefstring\blx@inputenc{lutf8}}
+ }
+ {\def\blx@inputenc{utf8}}
+ {}%
+ \blx@info@noline{%
+ Input encoding '\blx@inputenc' detected}}%
+ \ifdef\blx@bibencoding
+ {\ifdefstring\blx@bibencoding{ascii}
+ {\blx@info@noline{%
+ Data encoding '\blx@bibencoding' specified.\MessageBreak
+ No need to reencode data}%
+ \togglefalse{blx@reencode}}
+ {\ifdefstring\blx@bibencoding{inputenc}
+ {\let\blx@bibencoding\blx@inputenc
+ \blx@info@noline{%
+ Data encoding '\blx@bibencoding' specified.\MessageBreak
+ No need to reencode data}
+ \togglefalse{blx@reencode}}
+ {\ifdefequal\blx@bibencoding\blx@inputenc
+ {\blx@info@noline{%
+ Data encoding '\blx@bibencoding' specified.\MessageBreak
+ No need to reencode data}%
+ \togglefalse{blx@reencode}}
+ {\ifnumequal\blx@backend\blx@backend@biber
+ {\blx@info@noline{%
+ Data encoding '\blx@bibencoding' specified.\MessageBreak
+ Backend will reencode on the fly}%
+ \togglefalse{blx@reencode}}
+ {\blx@info@noline{%
+ Data encoding '\blx@bibencoding' specified.\MessageBreak
+ Reencoding not supported by backend.\MessageBreak
+ Falling back to reencoding with inputenc}%
+ \@ifpackageloaded{inputenc}
+ {\toggletrue{blx@reencode}}
+ {\@ifpackageloaded{inputenx}
+ {\toggletrue{blx@reencode}}
+ {\blx@warning@noline{%
+ On-the-fly data reencoding not supported by\MessageBreak
+ this setup. Load the 'inputenc/inputenx'\MessageBreak
+ package or use backend=biber. 'luainputenc'\MessageBreak
+ is not supported (use backend=biber instead)}%
+ \togglefalse{blx@reencode}}}}}}}}
+ {\def\blx@bibencoding{ascii}%
+ \blx@info@noline{%
+ Data encoding not specified.\MessageBreak
+ Assuming '\blx@bibencoding'}%
+ \togglefalse{blx@reencode}}%
+ \ifdefstring\blx@bibencoding{ascii}
{}
- {\setkeys{blx@sortdef@field}{#1}}%
- \eappto\blx@tempb{%
- \blx@bcf@sortitem{\blx@tempc}{#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"}}
-\define@key{blx@sortdef@field}{padwidth}{% integer
- \appto\blx@tempc{ pad_width="#1"}}
-\define@key{blx@sortdef@field}{padchar}{% character
- \appto\blx@tempc{ pad_char="#1"}}
-
-\def\blx@sortdef@literal#1{%
- \advance\blx@tempcntb\@ne
- \eappto\blx@tempb{%
- \blx@bcf@sortitem{order="\the\blx@tempcntb"}{#1}}}
-
-\DeclareSortingScheme{none}{%
- \item{\field{citeorder}}
-}
-
-\DeclareSortingScheme{debug}{%
- \item{\field{entrykey}}
-}
-
-\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}}
-}
-
-\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}}
-}
-
-\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}}
-}
-
-\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}}
-}
-
-\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}}
-}
+ {\ifdefstring\blx@bibencoding{utf8}
+ {\ifnumequal\blx@backend\blx@backend@biber
+ {}
+ {\blx@warning@noline{%
+ Data encoding is '\blx@bibencoding'.\MessageBreak
+ Use backend=biber}}}
+ {\ifnumless\blx@backend\blx@backend@bibtexviii
+ {\blx@warning@noline{%
+ Data encoding is '\blx@bibencoding'.\MessageBreak
+ Use backend=bibtex8 or backend=biber}}}
+ {\let\blx@csfencoding\blx@bibencoding}}}
-\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}}
-}
-
-\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}}
-}
-
-\def\blx@deflabel#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}}}%
- \docsvlist{#2}%
- \endgroup}
-
-% [<entrytype>]
-
-\newrobustcmd*{\DeclareLabelname}[1][global]{%
- \expandafter\blx@deflabel\csname blx@bcf@labelname@#1\endcsname}
-\@onlypreamble\DeclareLabelname
-
-% [<entrytype>]
-
-\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@version:%
- \noexpand\iftoggle{blx@debug}{1}{0}:%
- \noexpand\ifnum\noexpand\blx@backend=\csuse{blx@backend@bibtex8}%
- 1:%
- \noexpand\else
- 0:%
- \noexpand\fi
- \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@opt@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@ctrl@biber{%
- \blx@bcf@file{%
- \blx@bcf@comment{BIBER OPTIONS}%
- \blx@bcf@options{biber}{global}{%
- \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{BIBLATEX OPTIONS}%
- \csuse{blx@biber@options}%
- \blx@bcf@comment{SORTING SPEC}%
- \csuse{blx@biber@sorting}%
- }%
-}
+% Deferred last minute setup
\AtBeginDocument{%
\if@filesw
- \blx@auxinit{\blx@bibfiles}%
\ifnum\blx@backend=\blx@backend@biber
\blx@ifsigned{\jobname}{bcf}
{\immediate\openout\blx@auxout\jobname.bcf\relax
- \immediate\write\blx@auxout{\blx@ctrl@biber}%
- \immediate\closeout\blx@auxout}
+ \blx@auxwrite\blx@auxout{}{\blx@bcf@start}%
+ \AfterEndDocument{%
+ \blx@auxwrite\blx@auxout{}{\blx@bcf@end}%
+ \immediate\closeout\blx@auxout}}
{}%
\else
+ \blx@auxinit@bibtex\blx@bibfiles
\blx@ifsigned{\blx@ctrlfile\blxauxsuffix}{bib}
{\immediate\openout\blx@auxout\blx@ctrlfile\blxauxsuffix.bib\relax
- \immediate\write\blx@auxout{\blx@ctrl@bibtex}%
+ \blx@auxwrite\blx@auxout{}{\blx@ctrl@bibtex}%
\immediate\closeout\blx@auxout}
{}%
\fi