From 255f0a58d9bae0f193b4bd7d07885325f2fe8585 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 14 Sep 2016 22:21:10 +0000
Subject: biblatex (14sep16)

git-svn-id: svn://tug.org/texlive/trunk@42063 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/biblatex/biblatex.def | 145 +++++++++-------------
 1 file changed, 58 insertions(+), 87 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/biblatex/biblatex.def')

diff --git a/Master/texmf-dist/tex/latex/biblatex/biblatex.def b/Master/texmf-dist/tex/latex/biblatex/biblatex.def
index 3016d22fef6..b9b58f756de 100644
--- a/Master/texmf-dist/tex/latex/biblatex/biblatex.def
+++ b/Master/texmf-dist/tex/latex/biblatex/biblatex.def
@@ -19,7 +19,7 @@
 \def\do#1{%
   \csdef{mkbibname#1}##1{##1}%
   \define@key{blx@opt@namepart}{#1}{\csdef{namepart#1}{##1}}%
-  \define@key{blx@opt@namepart}{#1_i}{\csdef{namepart#1i}{##1}}}
+  \define@key{blx@opt@namepart}{#1i}{\csdef{namepart#1i}{##1}}}
 \expandafter\docsvlist\expandafter{\blx@datamodel@constant@nameparts}
 
 % legacy aliases
@@ -29,7 +29,6 @@
 \let\mkbibnameaffix\@empty
 
 \AtEndPreamble{%
-
   \ifdefempty\mkbibnamelast
     {\let\@mkbibnamelastsaved\mkbibnamefamily}% not redefined by user
     {\blx@warning@noline{%
@@ -121,6 +120,8 @@
 \DeclareDelimFormat[textcite]{nonameyeardelim}{\addspace}
 \DeclareDelimFormat[bib]{nonameyeardelim}{\addspace}
 \DeclareDelimFormat[biblist]{nonameyeardelim}{\addspace}
+\DeclareDelimFormat{dateeradelim}{\addspace}
+\DeclareDelimFormat{datecircadelim}{\addspace}
 
 % This is a provisional definition for \iffinalcitedelim{<true>}{<false>}, a
 % test that should expand <true> if the next non-compact citation delimiter
@@ -334,6 +335,12 @@
     {#1}
     {\textsc{\MakeLowercase{#1}}}}
 
+% Convert HH to hh for time formatting
+\newcommand*{\mktimehh}[1]{%
+  \ifnumless{#1}{13}
+    {#1}
+    {\number\numexpr#1-12\relax}}
+
 % ------------------------------------------------------------------
 % ADDITIONAL PACKAGE OPTIONS
 % ------------------------------------------------------------------
@@ -389,13 +396,20 @@
   {citetitle}{#1}
 % labelyear can be a localisation string to allow for "no date" etc.
 \DeclareFieldFormat{labelyear}{% = the '1995' part in 'Jones 1995a'
-  \ifbibstring{#1}{\bibstring{#1}}{\stripzeros{#1}}}
-\DeclareFieldFormat{extrayear}{% = the 'a' in 'Jones 1995a'
-  \iffieldnums{labelyear}
-    {\mknumalph{#1}}
-    {\mkbibparens{\mknumalph{#1}}}}
-\DeclareFieldFormat{labelalpha}{#1}% = the 'Jon95' part of 'Jon95a'
-\DeclareFieldFormat{extraalpha}{\mknumalph{#1}}% = the 'a' in 'Jon95a'
+  \ifbibstring{#1}{\bibstring{#1}}{#1}}
+% If labeldatesource is a defined field, they 
+% Don't check labelyear directly as it is already processed into a range with markers
+% and so is never nums due to unexpandable parts of labelyear determination
+\DeclareFieldFormat{extrayear}{%
+  \iffieldundef{\thefield{labeldatesource}}
+    {\iffieldnums{\thefield{labeldatesource}year}
+      {\mknumalph{#1}}
+      {\mkbibparens{\mknumalph{#1}}}}
+    {\iffieldnums{\thefield{labeldatesource}}
+      {\mknumalph{#1}}
+      {\mkbibparens{\mknumalph{#1}}}}}%
+\DeclareFieldFormat{labelalpha}{#1}%
+\DeclareFieldFormat{extraalpha}{\mknumalph{#1}}%
 \DeclareFieldFormat{shorthand}{#1\isdot}
 \DeclareFieldFormat{shorthandintro}{%
   \ifcapital{\MakeCapital{#1}}{#1}\isdot}
@@ -809,15 +823,12 @@
   \usebibmacro{name:andothers}}
 
 % Fallback used by \printnames
-
 \DeclareNameAlias{default}{given-family}
 
 % Default used by \citename
-
 \DeclareNameAlias{citename}{default}
 
 % Used in some citations
-
 \DeclareNameFormat{labelname}{%
   \ifcase\value{uniquename}%
     \usebibmacro{name:family}
@@ -847,7 +858,6 @@
   \usebibmacro{name:andothers}}
 
 % Used in the bibliography
-
 \DeclareNameAlias{sortname}{family-given/given-family}
 
 \DeclareNameAlias{author}{default}
@@ -1180,66 +1190,6 @@
   }
 }
 
-\DeclareDriverSourcemap[datatype=ris]{
-  \map{
-    \step[typesource=ART,    typetarget=artwork]
-    \step[typesource=BILL,   typetarget=jurisdiction]
-    \step[typesource=BOOK,   typetarget=book]
-    \step[typesource=CHAP,   typetarget=inbook]
-    \step[typesource=COMP,   typetarget=software]
-    \step[typesource=CONF,   typetarget=proceedings]
-    \step[typesource=GEN,    typetarget=misc]
-    \step[typesource=JFULL,  typetarget=article]
-    \step[typesource=JOUR,   typetarget=article]
-    \step[typesource=MGZN,   typetarget=misc]
-    \step[typesource=MPCT,   typetarget=movie]
-    \step[typesource=NEWS,   typetarget=misc]
-    \step[typesource=PAMP,   typetarget=misc]
-    \step[typesource=PAT,    typetarget=patent]
-    \step[typesource=PCOMM,  typetarget=misc]
-    \step[typesource=RPRT,   typetarget=report]
-    \step[typesource=SER,    typetarget=misc]
-    \step[typesource=SLIDE,  typetarget=misc]
-    \step[typesource=SOUND,  typetarget=audio]
-    \step[typesource=STAT,   typetarget=legal]
-    \step[typesource=THES,   typetarget=thesis]
-    \step[typesource=UNBILL, typetarget=jurisdiction]
-    \step[typesource=UNPB,   typetarget=unpublished]
-  }
-  \map{
-    \step[fieldsource=Y1,       fieldtarget=date]
-    \step[fieldsource=PY,       fieldtarget=date]
-    \step[fieldsource=Y2,       fieldtarget=eventdate]
-    \step[fieldsource=A1,       fieldtarget=author]
-    \step[fieldsource=AU,       fieldtarget=author]
-    \step[fieldsource=A2,       fieldtarget=editor]
-    \step[fieldsource=A3,       fieldtarget=editor]
-    \step[fieldsource=ED,       fieldtarget=editor]
-    \step[fieldsource=SPEP,     fieldtarget=pages]
-    \step[fieldsource=N1,       fieldtarget=note]
-    \step[fieldsource=N2,       fieldtarget=abstract]
-    \step[fieldsource=AB,       fieldtarget=abstract]
-    \step[fieldsource=JO,       fieldtarget=journaltitle]
-    \step[fieldsource=JF,       fieldtarget=journaltitle]
-    \step[fieldsource=JA,       fieldtarget=shortjournal]
-    \step[fieldsource=VL,       fieldtarget=volume]
-    \step[fieldsource=IS,       fieldtarget=issue]
-    \step[fieldsource=CP,       fieldtarget=issue]
-    \step[fieldsource=CY,       fieldtarget=location]
-    \step[fieldsource=SN,       fieldtarget=isbn]
-    \step[fieldsource=PB,       fieldtarget=publisher]
-    \step[fieldsource=KW,       fieldtarget=keywords]
-    \step[fieldsource=TI,       fieldtarget=title]
-    \step[fieldsource=U1,       fieldtarget=usera]
-    \step[fieldsource=U2,       fieldtarget=userb]
-    \step[fieldsource=U3,       fieldtarget=userc]
-    \step[fieldsource=U4,       fieldtarget=userd]
-    \step[fieldsource=U5,       fieldtarget=usere]
-    \step[fieldsource=UR,       fieldtarget=url]
-    \step[fieldsource=L1,       fieldtarget=file]
-  }
-}
-
 % ------------------------------------------------------------------
 % META-FIELDS
 % ------------------------------------------------------------------
@@ -1254,6 +1204,7 @@
 
 \DeclareLabeldate{%
   \field{date}
+  \field{year}
   \field{eventdate}
   \field{origdate}
   \field{urldate}
@@ -1263,6 +1214,7 @@
 \DeclareLabeltitle{%
   \field{shorttitle}
   \field{title}
+  \field{maintitle}
 }
 
 % ------------------------------------------------------------------
@@ -1273,14 +1225,33 @@
   \labelelement{
     \field[final]{shorthand}
     \field{label}
-    \field[strwidth=3,strside=left,ifnames=1,pcompound=true]{labelname}
-    \field[strwidth=1,strside=left,pcompound=true]{labelname}
+    \field[strwidth=3,strside=left,ifnames=1]{labelname}
+    \field[strwidth=1,strside=left]{labelname}
   }
   \labelelement{
     \field[strwidth=2,strside=right]{year}    
   }
 }
 
+% ------------------------------------------------------------------
+% LABELALPHA NAME TEMPLATE
+% ------------------------------------------------------------------
+
+\DeclareLabelalphaNameTemplate{
+  \namepart[use=true, pre=true, strwidth=1, compound=true]{prefix}
+  \namepart{family}
+}
+
+% ------------------------------------------------------------------
+% UNIQUENAME TEMPLATE
+% ------------------------------------------------------------------
+
+\DeclareUniquenameTemplate{
+  \namepart[use=true, base=true]{prefix}
+  \namepart[base=true]{family}
+  \namepart{given}
+}
+
 % ------------------------------------------------------------------
 % SORTING
 % ------------------------------------------------------------------
@@ -1348,8 +1319,8 @@
     \field{year}
   }
   \sort{
-    \field[padside=left,padwidth=4,padchar=0]{volume}
-    \literal{0000}
+    \field{volume}
+    \literal{0}
   }
 }
 
@@ -1377,8 +1348,8 @@
     \field{title}
   }
   \sort{
-    \field[padside=left,padwidth=4,padchar=0]{volume}
-    \literal{0000}
+    \field{volume}
+    \literal{0}
   }
 }
 
@@ -1402,8 +1373,8 @@
     \field{year}
   }
   \sort{
-    \field[padside=left,padwidth=4,padchar=0]{volume}
-    \literal{0000}
+    \field{volume}
+    \literal{0}
   }
   \sort{
     \field{sorttitle}
@@ -1438,8 +1409,8 @@
     \field{title}
   }
   \sort{
-    \field[padside=left,padwidth=4,padchar=0]{volume}
-    \literal{0000}
+    \field{volume}
+    \literal{0}
   }
 }
 
@@ -1466,8 +1437,8 @@
     \field{year}
   }
   \sort{
-    \field[padside=left,padwidth=4,padchar=0]{volume}
-    \literal{0000}
+    \field{volume}
+    \literal{0}
   }
   \sort{
     \field{sorttitle}
@@ -1509,8 +1480,8 @@
     \field{sortkey}
   }
   \sort[direction=descending]{
-    \field[strside=left,strwidth=4]{sortyear}
-    \field[strside=left,strwidth=4]{year}
+    \field{sortyear}
+    \field{year}
     \literal{9999}
   }
   \sort{
-- 
cgit v1.2.3

