% $Id: biblatex.def,v 0.7c 2008/02/03 16:50:00 lehman beta $

\ProvidesFile{biblatex.def}
[\blx@rcsid $Id: biblatex.def,v 0.7c 2008/02/03 16:50:00 lehman beta $
 biblatex generic definitions]

% ------------------------------------------------------------------
% FORMATTING COMMANDS
% ------------------------------------------------------------------

% Generic formatting commands and hooks
% ------------------------------------------------------------------

% Used in citations, bibliography, list of shorthands

\newcommand*{\bibleftparen}{(}
\newcommand*{\bibrightparen}{)\midsentence}
\newcommand*{\bibleftbracket}{[}
\newcommand*{\bibrightbracket}{]\midsentence}
\newcommand*{\bibellipsis}{[\textellipsis\unkern]\midsentence}
\newcommand*{\mkbibnamefirst}[1]{#1}
\newcommand*{\mkbibnamelast}[1]{#1}
\newcommand*{\mkbibnameprefix}[1]{#1}
\newcommand*{\mkbibnameaffix}[1]{#1}

% Delimiters used in citations, bibliography, list of shorthands

\newcommand*{\multinamedelim}{\addcomma\space}
\newcommand*{\finalnamedelim}{%
  \ifnum\value{liststop}>2 \finalandcomma\fi
  \addspace\bibstring{and}\space}
\newcommand*{\revsdnamedelim}{}
\newcommand*{\andothersdelim}{\addspace}

\newcommand*{\multilistdelim}{\addcomma\space}
\newcommand*{\finallistdelim}{%
  \ifnum\value{liststop}>2 \finalandcomma\fi
  \addspace\bibstring{and}\space}
\newcommand*{\andmoredelim}{\addspace}

% Used in citations

\newcommand*{\multicitedelim}{\addsemicolon\space}
\newcommand*{\compcitedelim}{\addcomma\space}
\newcommand*{\supercitedelim}{\addcomma}
\newcommand*{\prenotedelim}{\addspace\midsentence}
\newcommand*{\postnotedelim}{\addcomma\space}
\newcommand*{\nameyeardelim}{\addspace}

% Used in the bibliography and the list of shorthands

\newcommand*{\newunitpunct}{\addperiod\space}
\newcommand*{\finentrypunct}{\addperiod}
\newcommand*{\labelnamepunct}{\newunitpunct}
\newcommand*{\subtitlepunct}{\newunitpunct}
\newcommand*{\bibnamedash}{%
  \ifdim\leftmargin<0.75em
    \mbox{\textemdash\space}%
  \else
    \makebox[\leftmargin][l]{%
      \ifdim\leftmargin<1.25em
        \textendash
      \else
        \textemdash
      \fi}%
  \fi}

% \bibsetup is a generic hook controlling the (low-level) layout of
% the bibliography and the list of shorthands. The default
% definition should work fine in most cases.

\newcommand*{\bibsetup}{%
  \interlinepenalty=5000\relax
  \widowpenalty=10000\relax
  \clubpenalty=10000\relax
  \raggedbottom
  \frenchspacing
  \sloppy}

% The penalties above are not specific to biblatex. These are
% low-level TeX features. \interlinepenalty is the penalty assigned
% to page breaks within a paragraph (i.e., in this case, a
% bibliography entry); \clubpenalty is an additional penalty
% assigned to page breaks after the first line of a paragraph;
% \widowpenalty is an additional penalty assigned to page breaks
% before the last line of a paragraph. Note that the value 10000
% means `infinite' as far as TeX is concerned. Setting a penalty to
% 10000 will unconditionally suppress the respective breakpoint.
%
% The net effect of the above settings is as follows. Breaking a
% bibliography entry across pages is discouraged, but not suppressed
% altogether. If a bibliography entry spans less than four lines,
% TeX will always keep it on one page. If it spans four or more
% lines, it may be broken across pages, provided that there are at
% least two lines on the page before and after the break.
%
% These penalties should normally be used in conjunction with
% \raggedbottom. If you don't like that and remove \raggedbottom
% from the definition of \bibsetup, make sure to provide some
% stretchability between bibliography entries by setting \bibitemsep
% to a suitable value, e.g.:
%
% \setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
%
% Using \frenchspacing in the bibliography is recommended. If you
% want more visual separation, try the package option 'block=space'.
% This will yield better results than \nonfrenchspacing.

% \citesetup is a generic hook for citations.

\newcommand*{\citesetup}{%
  \frenchspacing}

% The default font of the bibliography and the list of shorthands.
% We simply reset the current font to the global defaults.

\newcommand*{\bibfont}{\normalfont\normalsize}

% Some length registers which may be used to fine-tune the
% (high-level) layout of the bibliography.

\setlength{\bibhang}{\parindent}
\setlength{\biblabelsep}{2\labelsep}
\setlength{\bibitemsep}{\itemsep}
\setlength{\bibitemextrasep}{0pt}
\setlength{\bibparsep}{0pt}

% Miscellaneous facilities
% ------------------------------------------------------------------

% The counter 'abbrvpenalty' holds the penalty used in short or
% abbreviated bibliography strings. For example, a linebreak in
% expressions such as "et al." or "ed. by" is unfortunate, but should
% still be possible to prevent overfull boxes. We use TeX's
% \hyphenpenalty (normally 50) as the default value. The idea is
% making TeX treat the whole expression as if it were a single,
% hyphenatable word as far as line-breaking is concerned. If you
% dislike such linebreaks, use a higher value. If you do not mind
% them at all, set this counter to zero. If you want to suppress them
% unconditionally, set it to 10000.
\setcounter{abbrvpenalty}{\hyphenpenalty}

% The counter 'lownamepenalty' holds a penalty which affects the
% line-breaking of names. This penalty is inserted between larger
% chunks of a name, for example between the chunk consisting of all
% first names and the last name. The default value is a quarter of
% TeX's \hyphenpenalty. If you dislike such linebreaks, use a higher
% value. If you do not mind them at all, set this counter to zero.
\setcounter{lownamepenalty}{\numexpr\hyphenpenalty/4\relax}

% The counter 'highnamepenalty' also holds a penalty affecting the
% line-breaking of names. This penalty is inserted between smaller
% chunks of a name, for example between the first and the middle
% name. The default value is half the \hyphenpenalty. If you dislike
% such linebreaks, use a higher value. If you do not mind them at
% all, set this counter to zero. If you prefer the traditional BibTeX
% behavior, set it to 10000.
\setcounter{highnamepenalty}{\numexpr\hyphenpenalty/2\relax}

% Note that default values assigned to the above counters are
% deliberately very low to prevent overfull boxes. This implies that
% you will hardly notice any effect on line-breaking if the text is
% set justified. If you set these counters to 10000 to suppress the
% respective breakpoints, you will notice their effect but you may
% also be confronted with overfull boxes. Keep in mind that
% line-breaking in the bibliography is often more difficult than in
% the body text and that you can not resort to rephrasing a sentence.
% In some cases it may be preferable to set the entire bibliography
% \raggedright (by modifying \bibsetup) to prevent unfortunate
% linebreaks. In this case, even the very low default penalties will
% make a visible difference.

% FIELD FORMATS (#1 is the value of the field)
% ------------------------------------------------------------------

% The fallback used by \printfield

\DeclareFieldFormat{default}{#1}

% The default used by \citefield

\DeclareFieldFormat{citefield}{#1}

% Used in citations

\DeclareFieldFormat{citetitle}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat[article]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[inbook]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[incollection]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[inproceedings]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[patent]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[thesis]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat[unpublished]{citetitle}{\mkbibquote{#1}}
\DeclareFieldFormat{labelyear}{\mkbibemph{#1}}% e.g., the 'a' in '1995a'
\DeclareFieldFormat{shorthand}{#1\isdot}
\DeclareFieldFormat{shorthandintro}{%
  \ifcapital{\MakeCapital{#1}}{#1}\isdot}
% citation commands
\DeclareFieldFormat{prenote}{#1\isdot}
\DeclareFieldFormat{postnote}{\mkpageprefix[pagination]{#1}}
% multicite commands
\DeclareFieldFormat{multiprenote}{#1\isdot}
\DeclareFieldFormat{multipostnote}{\mkpageprefix[pagination]{#1}}

% Used by \citeurl

\DeclareFieldFormat{citeurl}{\url{#1}}

% Used in the bibliography and the list of shorthands

\DeclareFieldFormat{booktitle}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{chapter}{\bibstring{chapter}~#1}
\DeclareFieldFormat{doi}{%
  DOI\addcolon\space
  \ifhyperref
    {\href{http://dx.doi.org/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}
\DeclareFieldFormat{edition}{\mkbibordinal{#1}~\bibstring{edition}}
\DeclareFieldFormat{file}{\url{#1}}
\DeclareFieldFormat{isbn}{ISBN\addcolon\space #1}
\DeclareFieldFormat{isrn}{ISRN\addcolon\space #1}
\DeclareFieldFormat{issn}{ISSN\addcolon\space #1}
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{issuetitle}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{maintitle}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat{month}{\mkbibmonth{#1}}
\DeclareFieldFormat{number}{#1}% number in a series
\DeclareFieldFormat[article]{number}{#1}% number of a journal
\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{#1}}
\DeclareFieldFormat{pagetotal}{\mkpagetotal[bookpagination]{#1}}
\DeclareFieldFormat{part}{.#1}% physical part of a logical volume
\DeclareFieldFormat{series}{#1}% publication series
\DeclareFieldFormat[article]{series}{% series of a journal
  \ifinteger{#1}
    {\mkbibordinal{#1}~\bibstring{jourser}}
    {\ifbibstring{#1}{\bibstring{#1}}{#1}}}
\DeclareFieldFormat{title}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat[article]{title}{\mkbibquote{#1}}
\DeclareFieldFormat[inbook]{title}{\mkbibquote{#1}}
\DeclareFieldFormat[incollection]{title}{\mkbibquote{#1}}
\DeclareFieldFormat[inproceedings]{title}{\mkbibquote{#1}}
\DeclareFieldFormat[patent]{title}{\mkbibquote{#1}}
\DeclareFieldFormat[thesis]{title}{\mkbibquote{#1}}
\DeclareFieldFormat[unpublished]{title}{\mkbibquote{#1}}
\DeclareFieldFormat{type}{\ifbibstring{#1}{\bibstring{#1}}{#1}}
\DeclareFieldFormat{url}{URL\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\space#1}}
\DeclareFieldFormat{version}{\bibstring{version}~#1}
\DeclareFieldFormat{volume}{\bibstring{volume}~#1}% volume of a book
\DeclareFieldFormat[article]{volume}{#1}% volume of a journal
\DeclareFieldFormat{volumes}{#1~\bibstring{volumes}}

\DeclareFieldAlias[periodical]{number}[article]{number}
\DeclareFieldAlias[periodical]{series}[article]{series}
\DeclareFieldAlias[periodical]{volume}[article]{volume}

% Generic formats for \printtext

\DeclareFieldFormat{parens}{\mkbibparens{#1}}
\DeclareFieldFormat{brackets}{\mkbibbrackets{#1}}
\DeclareFieldFormat{bibhyperref}{\bibhyperref{#1}}
\DeclareFieldFormat{bibhyperlink}{\bibhyperlink{\thefield{entrykey}}{#1}}
\DeclareFieldFormat{bibhypertarget}{\bibhypertarget{\thefield{entrykey}}{#1}}
\DeclareFieldFormat{noformat}{#1}

% ------------------------------------------------------------------
% LITERAL LIST FORMATS (#1 is the current item)
% ------------------------------------------------------------------

% Formatting directives for literal lists
% ------------------------------------------------------------------

% The fallback used by \printlist

\DeclareListFormat{default}{%
  \usebibmacro{list:delim}{#1}%
  #1\isdot
  \usebibmacro{list:andothers}}

% The default used by \citelist

\DeclareListAlias{citelist}{default}

% Used in the bibliography

\DeclareListFormat{publisher}{%
  \usebibmacro{list:delim}{#1}%
  #1\isdot
  \usebibmacro{list:andothers}}

\DeclareListFormat{language}{%
  \usebibmacro{list:delim}{%
    \ifbibstring{#1}
      {\bibxstring{#1}}
      {\ifbibstring{lang#1}
	 {\bibxstring{lang#1}}
	 {#1}}}%
  \ifbibstring{#1}
    {\bibstring{#1}}
    {\ifbibstring{lang#1}
       {\bibstring{lang#1}}
       {#1}}%
  \usebibmacro{list:andothers}}

\DeclareListFormat{location}{%
  \usebibmacro{list:delim}{#1}%
  #1\isdot
  \usebibmacro{list:andothers}}

\DeclareListFormat[patent]{location}{%
  \usebibmacro{list:plain}%
  \ifbibstring{#1}{\bibstring{#1}}{#1}%
  \usebibmacro{list:andothers}}

\DeclareListFormat{pageref}{%
  \ifnum\value{listcount}=1\relax
    \usebibmacro{pagerange:init}%
  \fi
  \usebibmacro{pagerange:comp}{#1}%
  \ifthenelse{\value{listcount}=\value{liststop}}
    {\usebibmacro{pagerange:dump}}
    {}}

\DeclareListAlias{origlocation}{location}
\DeclareListAlias{institution}{default}
\DeclareListAlias{organization}{default}

% Auxiliary macros for list formatting directives
% ------------------------------------------------------------------

\newbibmacro*{list:delim}[1]{%
  \ifthenelse{\value{listcount}>\value{liststart}}
    {\ifthenelse{\value{listcount}<\value{liststop}\OR
                 \ifmoreitems}
       {\multilistdelim}
       {\mkfinallistdelim{#1}}}
    {}}

\newbibmacro*{list:plain}{%
  \ifthenelse{\value{listcount}>\value{liststart}}
    {\multilistdelim}
    {}}

\newbibmacro*{list:andothers}{%
  \ifthenelse{\value{listcount}=\value{liststop}\AND
              \ifmoreitems}
    {\ifnum\value{liststop}>1 \finalandcomma\fi
     \andmoredelim\bibstring{andmore}}
    {}}

\newbibmacro*{pagerange:init}{%
  \@tempcnta\z@
  \@tempcntb-2\relax}

\newbibmacro*{pagerange:comp}[1]{%
  \advance\@tempcntb\@ne
  \ifinteger{#1}
    {\ifnum#1=\@tempcntb
       \def\pagerange@lastnumber{#1}%
       \advance\@tempcnta\@ne
     \else
       \usebibmacro{pagerange:dump}%
       \ifnum\@tempcntb>\m@ne\multilistdelim\fi
       \ifhyperref
         {\hyperlink{page.#1}{#1}}
         {#1}%
     \fi
     \@tempcntb#1\relax}
    {\usebibmacro{pagerange:dump}%
     \ifnum\@tempcntb>\m@ne\multilistdelim\fi
     \ifhyperref
       {\hyperlink{page.#1}{#1}}
       {#1}%
     \@tempcntb\m@ne}}

\newbibmacro*{pagerange:dump}{%
  \ifnum\@tempcnta>\z@
    \ifnum\@tempcnta>\@ne
      \bibrangedash
    \else
      \multilistdelim
    \fi
    \ifhyperref
      {\hyperlink{page.\pagerange@lastnumber}{\pagerange@lastnumber}}
      {\pagerange@lastnumber}%
    \@tempcnta\z@
  \fi}

% ------------------------------------------------------------------
% NAME LIST FORMATS
% ------------------------------------------------------------------

% Argments passed to formatting directives for name lists:
%
% #1 = last name
% #2 = last name (initials)
% #3 = first name
% #4 = first name (initials)
% #5 = name prefix, a.k.a. 'von part'
% #6 = name prefix (initials)
% #7 = name affix, a.k.a. 'junior part'
% #8 = name affix (initials)

% Formatting directives for name lists
% ------------------------------------------------------------------

% The fallback used by \printnames
\DeclareNameFormat{default}{%
  \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
  \usebibmacro{name:andothers}}

% The default used by \citename
\DeclareNameAlias{citename}{default}

% Used in all citations

\DeclareNameFormat{labelname}{%
  \ifcase\value{uniquename}%
    \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
  \or
    \ifuseprefix
      {\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
      {\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
  \or
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}}

% Used in the bibliography

\DeclareNameFormat{sortname}{%
  \ifnum\value{listcount}=1\relax
    \usebibmacro{name:last-first}{#1}{#3}{#5}{#7}%
    \ifblank{#3#5}
      {}
      {\usebibmacro{name:revsdelim}}%
  \else
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}}

% Not used by default

\DeclareNameFormat{initonly}{%
  \usebibmacro{name:first-last}{#2}{#4}{#6}{#8}%
  \usebibmacro{name:andothers}}

\DeclareNameAlias{author}{sortname}
\DeclareNameAlias{byauthor}{default}
% if editor replaces author, i.e. is given first ("Doe, John, ed.")
\DeclareNameAlias{editor}{sortname}
% if editor is printed in addition to author ("Edited by John Doe")
\DeclareNameAlias{byeditor}{default}
\DeclareNameAlias{bybookauthor}{default}
\DeclareNameAlias{bytranslator}{default}
\DeclareNameAlias{byredactor}{default}
\DeclareNameAlias{withcommentator}{default}
\DeclareNameAlias{withannotator}{default}
\DeclareNameAlias{withintroduction}{default}
\DeclareNameAlias{withforeword}{default}
\DeclareNameAlias{withafterword}{default}

% Auxiliary macros for name formatting directives
% ------------------------------------------------------------------

\newbibmacro*{name:last}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \ifblank{#3}
       {}
       {\ifcapital
          {\mkbibnameprefix{\MakeCapital{#3\isdot}}}
          {\mkbibnameprefix{#3\isdot}}%
        \ifpunctmark{'}{}{\addhighpenspace}}}
    {\usebibmacro{name:delim}{#1}}%
  \mkbibnamelast{#1}}%

\newbibmacro*{name:first-last}[4]{%
  \usebibmacro{name:delim}{#2#3#1}%
  \ifblank{#2}{}{\mkbibnamefirst{#2}\isdot\addlowpenspace}%
  \ifblank{#3}{}{%
    \mkbibnameprefix{#3}\isdot
    \ifpunctmark{'}
      {}
      {\ifuseprefix{\addhighpenspace}{\addlowpenspace}}}%
  \mkbibnamelast{#1}\isdot
  \ifblank{#4}{}{\addlowpenspace\mkbibnameaffix{#4}\isdot}}

\newbibmacro*{name:last-first}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \ifblank{#3}{}{%
       \mkbibnameprefix{\MakeCapital{#3}\isdot}%
       \ifpunctmark{'}{}{\addhighpenspace}}%
     \mkbibnamelast{#1\isdot}%
     \ifblank{#4}{}{\addlowpenspace\mkbibnameaffix{#4}\isdot}%
     \ifblank{#2}{}{\addcomma\addlowpenspace\mkbibnamefirst{#2}\isdot}}
    {\usebibmacro{name:delim}{#1}%
     \mkbibnamelast{#1}\isdot
     \ifblank{#4}{}{\addlowpenspace\mkbibnameaffix{#4}\isdot}%
     \ifblank{#2#3}{}{\addcomma}%
     \ifblank{#2}{}{\addlowpenspace\mkbibnamefirst{#2}\isdot}%
     \ifblank{#3}{}{\addlowpenspace\mkbibnameprefix{#3}\isdot}}}

\newbibmacro*{name:delim}[1]{%
  \ifthenelse{\value{listcount}>\value{liststart}}
    {\ifthenelse{\value{listcount}<\value{liststop}\OR
                 \ifmorenames}
       {\multinamedelim}
       {\mkfinalnamedelim{#1}}}
    {}}

\newbibmacro*{name:revsdelim}{%
  \ifthenelse{\(\value{liststop}=1\AND\ifmorenames\)\OR
        	\value{liststop}=2}
    {\revsdnamedelim}
    {}}

\newbibmacro*{name:andothers}{%
  \ifthenelse{\value{listcount}=\value{liststop}\AND
              \ifmorenames}
    {\ifnum\value{liststop}>1 \finalandcomma\fi
     \andothersdelim\bibstring{andothers}}
    {}}

% ------------------------------------------------------------------
% INDEX FORMATS FOR FIELDS (#1 is the value of the field)
% ------------------------------------------------------------------

% There is no need to test if a field to be indexed is empty because
% \indexfield performs this test implicitly.

% The fallback used by \indexfield

\DeclareIndexFieldFormat{default}{\index{#1}}

% Used in the bibliography and in citations

\DeclareIndexFieldFormat{indextitle}{%
  \usebibmacro{index:title}{\index}{#1}}

\newbibmacro*{index:title}[2]{%
  \usebibmacro{index:field}{#1}{\thefield{indexsorttitle}}{\emph{#2}}}

\newbibmacro*{index:field}[3]{%
  \begingroup
  \protected@edef\theindexentry{%
    \unexpanded{#1}{#2\actualoperator\unexpanded{#3}}}%
  \theindexentry
  \endgroup}

% ------------------------------------------------------------------
% INDEX FORMATS FOR LITERAL LISTS (#1 is the current item)
% ------------------------------------------------------------------

% The fallback used by \indexlist

\DeclareIndexListFormat{default}{\index{#1}}

% ------------------------------------------------------------------
% INDEX FORMATS FOR NAME LISTS
% ------------------------------------------------------------------

% Argments passed to indexing directives for name lists:
%
% #1 = last name
% #2 = last name (initials)
% #3 = first name
% #4 = first name (initials)
% #5 = name prefix, a.k.a 'von part'
% #6 = name prefix (initials)
% #7 = name affix, a.k.a 'junior part'
% #8 = name affix (initials)

% Indexing directives for name lists
% ------------------------------------------------------------------

% The fallback used by \indexnames

\DeclareIndexNameFormat{default}{%
  \usebibmacro{index:name}{\index}{#1}{#3}{#5}{#7}}

% Used in citations

\DeclareIndexNameAlias{labelname}{default}

% Used in the bibliography

\DeclareIndexNameAlias{author}{default}
\DeclareIndexNameAlias{editor}{default}
\DeclareIndexNameAlias{bookauthor}{default}

% Auxiliary macros for name indexing directives
% ------------------------------------------------------------------

% When generating an index entry, we need to test which parts of a
% name are actually available to prevent spurious punctuation and
% spaces. Since those parts which are not available yield an empty
% argument, we can use the \ifblank test from etoolbox.sty to analyze
% the name.
%
% Note that the standard LaTeX \index command simply writes its
% argument to the .idx file without preventing expansion. This means
% that all \ifblank tests are expanded on the way and will not end
% up in the index. The index package, however, prevents expansion.
% This would lead to \ifblank ending up in the .idx file. To avoid
% that, we preprocess the index entry inside an \edef. We use
% \unexpanded to protect the \index command and the actual data from
% expansion. This definition will work with both index.sty and the
% standard indexing facilities.
%
% We also use \ifuseprefix to ensure that the name prefix is handled
% properly. \actualoperator is the so-called actual operator, as
% defined by the `actual' specifier in the .ist file. The makeindex
% programm will use the part preceeding the \actualoperator
% delimiter for sorting. The part after the delimiter is used as the
% index is printed. Note that this is not specific to biblatex, see
% the makeindex documentation for details.

\newcommand*{\actualoperator}{@}

\newbibmacro*{index:name}[5]{%
  \begingroup
  \ifuseprefix
    {\edef\theindexentry{%
       \unexpanded{#1}{%
         \ifblank{#4}{}{\unexpanded{#4} }%
         \expandonce{\@firstofone #2}% remove spurious braces
         \ifblank{#5}{}{ \unexpanded{#5}}%
         \ifblank{#3}{}{, \unexpanded{#3}}%
         \actualoperator
         \ifblank{#4}{}{\unexpanded{\MakeCapital{#4}} }%
         \unexpanded{#2}%
         \ifblank{#5}{}{ \unexpanded{#5}}%
         \ifblank{#3}{}{, \unexpanded{#3}}}}}
    {\edef\theindexentry{%
       \unexpanded{#1}{%
         \expandonce{\@firstofone #2}% remove spurious braces
         \ifblank{#5}{}{ \unexpanded{#5}}%
         \ifblank{#3#4}{}{,}%
         \ifblank{#3}{}{ \unexpanded{#3}}%
         \ifblank{#4}{}{ \unexpanded{#4}}}}}%
  \theindexentry
  \endgroup}

% ------------------------------------------------------------------
% MISCELLANEOUS
% ------------------------------------------------------------------

\newcommand*{\mkfinalnamedelim}[1]{\finalnamedelim}
\newcommand*{\mkfinallistdelim}[1]{\finallistdelim}

\newcommand*{\fromlang}{%
  \iffieldundef{origlanguage}
    {\unspace}
    {\bibstring{from\thefield{origlanguage}}}}

\newcommand*{\bytypeauthor}{%
  \iffieldundef{authortype}
    {\bibstring{bytypeauthor}}
    {\bibstring{bytype\thefield{authortype}}}}

\newcommand*{\bytypeeditor}{%
  \iffieldundef{editortype}
    {\bibstring{bytypeeditor}}
    {\bibstring{bytype\thefield{editortype}}}}

\newcommand*{\bytypeeditora}{%
  \iffieldundef{editortype}
    {\bibstring{bytypeeditora}}
    {\bibstring{bytype\thefield{editortype}a}}}

\newcommand*{\bytypeeditorb}{%
  \iffieldundef{editortype}
    {\bibstring{bytypeeditorb}}
    {\bibstring{bytype\thefield{editortype}b}}}

\newcommand*{\typeeditor}{%
  \iffieldundef{editortype}
    {\bibstring{typeeditor}}
    {\bibstring{type\thefield{editortype}}}}

\newcommand*{\typeeditors}{%
  \iffieldundef{editortype}
    {\bibstring{typeeditors}}
    {\bibstring{type\thefield{editortype}s}}}

% ------------------------------------------------------------------
% PREDEFINED HEADINGS
% ------------------------------------------------------------------

\@ifclassloaded{article}
 {\@tempcnta 0 }
 {\@ifclassloaded{book}
   {\@tempcnta 1 }
   {\@ifclassloaded{report}
     {\@tempcnta 1 }
     {\@ifclassloaded{scrartcl}
        {\@tempcnta 2 }
        {\@ifclassloaded{scrbook}
           {\@tempcnta 3 }
           {\@ifclassloaded{scrreprt}
	      {\@tempcnta 3 }
	      {\@ifclassloaded{memoir}
		{\ifartopt
        	   \@tempcnta 4
        	 \else
        	   \@tempcnta 5
        	 \fi}
		{\ifundef\chapter
		   {\@tempcnta 0 }
		   {\@tempcnta 1 }}}}}}}}

\ifcase\@tempcnta % article
  \defbibheading{bibliography}{%
    \section*{\refname}%
    \@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}
  \defbibheading{shorthands}{%
    \section*{\losname}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibintoc}{%
    \section*{\refname}%
    \addcontentsline{toc}{section}{\refname}%
    \@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}
  \defbibheading{losintoc}{%
    \section*{\losname}%
    \addcontentsline{toc}{section}{\losname}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibnumbered}{%
    \section{\refname}%
    \if@twoside\markright{\MakeUppercase{\refname}}\fi}
  \defbibheading{losnumbered}{%
    \section{\losname}%
    \if@twoside\markright{\MakeUppercase{\losname}}\fi}
  \defbibheading{subbibliography}{%
    \subsection*{\refname}}
  \defbibheading{subbibintoc}{%
    \subsection*{\refname}%
    \addcontentsline{toc}{subsection}{\refname}}
  \defbibheading{subbibnumbered}{%
    \subsection{\refname}}

\or % book/report
  \defbibheading{bibliography}{%
    \chapter*{\bibname}%
    \@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}
  \defbibheading{shorthands}{%
    \chapter*{\losname}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibintoc}{%
    \chapter*{\bibname}%
    \addcontentsline{toc}{chapter}{\bibname}%
    \@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}
  \defbibheading{losintoc}{%
    \chapter*{\losname}%
    \addcontentsline{toc}{chapter}{\losname}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibnumbered}{%
    \chapter{\bibname}%
    \if@twoside\markright{\MakeUppercase{\bibname}}\fi}
  \defbibheading{losnumbered}{%
    \chapter{\losname}%
    \if@twoside\markright{\MakeUppercase{\losname}}\fi}
  \defbibheading{subbibliography}{%
    \section*{\bibname}%
    \if@twoside\markright{\MakeUppercase{\bibname}}\fi}
  \defbibheading{subbibintoc}{%
    \section*{\bibname}%
    \addcontentsline{toc}{section}{\bibname}%
    \if@twoside\markright{\MakeUppercase{\bibname}}\fi}
  \defbibheading{subbibnumbered}{%
    \section{\bibname}}

\or % scrartcl
  \defbibheading{bibliography}{%
    \ifkomabibtotocnumbered
      {\section{\refname}}
      {\ifkomabibtotoc
	 {\addsec{\refname}}
	 {\section*{\refname}}%
       \@mkboth{\refname}{\refname}}}
  \defbibheading{shorthands}{%
    \ifkomabibtotocnumbered
      {\section{\losname}}
      {\ifkomabibtotoc
	 {\addsec{\losname}}
	 {\section*{\losname}}%
       \@mkboth{\losname}{\losname}}}
  \defbibheading{bibintoc}{%
    \addsec{\refname}%
    \@mkboth{\refname}{\refname}}
  \defbibheading{losintoc}{%
    \addsec{\losname}%
    \@mkboth{\losname}{\losname}}
  \defbibheading{bibnumbered}{%
    \section{\refname}%
    \@mkboth{\sectionmarkformat\refname}{\sectionmarkformat\refname}}
  \defbibheading{losnumbered}{%
    \section{\losname}%
    \@mkboth{\sectionmarkformat\losname}{\sectionmarkformat\losname}}
  \defbibheading{subbibliography}{\subsection*{\refname}}
  \defbibheading{subbibintoc}{%
    \subsection*{\refname}%
    \addcontentsline{toc}{subsection}{\refname}}
  \defbibheading{subbibnumbered}{\subsection{\refname}}

\or % scrbook/scrreprt
  \defbibheading{bibliography}{%
    \ifkomabibtotocnumbered
      {\chapter{\bibname}}
      {\ifkomabibtotoc
	 {\addchap{\bibname}}
	 {\chapter*{\bibname}}%
       \@mkboth{\bibname}{\bibname}}}
  \defbibheading{shorthands}{%
    \ifkomabibtotocnumbered
      {\chapter{\losname}}
      {\ifkomabibtotoc
	 {\addchap{\losname}}
	 {\chapter*{\losname}}%
       \@mkboth{\losname}{\losname}}}
  \defbibheading{bibintoc}{%
    \addchap{\bibname}%
    \@mkboth{\bibname}{\bibname}}
  \defbibheading{losintoc}{%
    \addchap{\losname}%
    \@mkboth{\losname}{\losname}}
  \defbibheading{bibnumbered}{%
    \chapter{\bibname}%
    \@mkboth{\chaptermarkformat\bibname}{\chaptermarkformat\bibname}}
  \defbibheading{losnumbered}{%
    \chapter{\losname}%
    \@mkboth{\chaptermarkformat\losname}{\chaptermarkformat\losname}}
  \defbibheading{subbibliography}{%
    \section*{\bibname}%
    \if@twoside\markright{\sectionmarkformat\bibname}\fi}
  \defbibheading{subbibintoc}{%
    \addsec{\bibname}%
    \@mkboth{\bibname}{\bibname}}
  \defbibheading{subbibnumbered}{\section{\bibname}}

\or % memoir (article)
  \defbibheading{bibliography}{%
    \section*{\refname}%
    \ifmemoirbibintoc
      {\phantomsection
       \addcontentsline{toc}{section}{\refname}}
      {}%
    \@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}
  \defbibheading{shorthands}{%
    \section*{\losname}%
    \ifmemoirbibintoc
      {\phantomsection
       \addcontentsline{toc}{section}{\losname}}
      {}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibintoc}{%
    \section*{\refname}%
    \phantomsection
    \addcontentsline{toc}{section}{\refname}%
    \@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}
  \defbibheading{losintoc}{%
    \section*{\losname}%
    \phantomsection
    \addcontentsline{toc}{section}{\losname}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibnumbered}{\section{\refname}}
  \defbibheading{losnumbered}{\section{\losname}}
  \defbibheading{subbibliography}{%
    \subsection*{\refname}%
    \ifmemoirbibintoc
      {\phantomsection
       \addcontentsline{toc}{subsection}{\refname}}
      {}%
    \if@twoside\markright{\MakeUppercase{\refname}}\fi}
  \defbibheading{subbibintoc}{%
    \subsection*{\refname}%
    \phantomsection
    \addcontentsline{toc}{subsection}{\refname}%
    \if@twoside\markright{\MakeUppercase{\refname}}\fi}
  \defbibheading{subbibnumbered}{\subsection{\refname}}

\or % memoir (book)
  \defbibheading{bibliography}{%
    \chapter*{\bibname}%
    \ifmemoirbibintoc
      {\phantomsection
       \addcontentsline{toc}{chapter}{\bibname}}
      {}%
    \@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}
  \defbibheading{shorthands}{%
    \chapter*{\losname}%
    \ifmemoirbibintoc
      {\phantomsection
       \addcontentsline{toc}{chapter}{\losname}}
      {}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibintoc}{%
    \chapter*{\bibname}%
    \phantomsection
    \addcontentsline{toc}{chapter}{\bibname}%
    \@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}
  \defbibheading{losintoc}{%
    \chapter*{\losname}%
    \phantomsection
    \addcontentsline{toc}{chapter}{\losname}%
    \@mkboth{\MakeUppercase{\losname}}{\MakeUppercase{\losname}}}
  \defbibheading{bibnumbered}{%
    \chapter{\bibname}%
    \if@twoside\markright{\MakeUppercase{\bibname}}\fi}
  \defbibheading{losnumbered}{%
    \chapter{\losname}%
    \if@twoside\markright{\MakeUppercase{\losname}}\fi}
  \defbibheading{subbibliography}{%
    \section*{\bibname}%
    \ifmemoirbibintoc
      {\phantomsection
       \addcontentsline{toc}{section}{\bibname}}
      {}%
    \if@twoside\markright{\MakeUppercase{\bibname}}\fi}
  \defbibheading{subbibintoc}{%
    \section*{\bibname}%
    \phantomsection
    \addcontentsline{toc}{section}{\bibname}%
    \if@twoside\markright{\MakeUppercase{\bibname}}\fi}
  \defbibheading{subbibnumbered}{\section{\bibname}}

\fi

% ------------------------------------------------------------------
% GENERIC CITATION COMMANDS
% ------------------------------------------------------------------

\DeclareCiteCommand{\fullcite}
  {\usebibmacro{prenote}}
  {\usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\footfullcite}[\mkbibfootnote]
  {\bibsentence
   \usebibmacro{prenote}}
  {\usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeauthor}
  {\citetrackerfalse
   \pagetrackerfalse
   \usebibmacro{prenote}}
  {\indexnames{labelname}%
   \printnames{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citetitle}
  {\citetrackerfalse
   \pagetrackerfalse
   \usebibmacro{prenote}}
  {\indexfield{indextitle}%
   \printfield[citetitle]{labeltitle}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\citetitle}
  {\citetrackerfalse
   \pagetrackerfalse
   \usebibmacro{prenote}}
  {\indexfield{indextitle}%
   \printfield[citetitle]{title}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeyear}
  {\citetrackerfalse
   \pagetrackerfalse
   \usebibmacro{prenote}}
  {\printfield{year}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeurl}
  {\citetrackerfalse
   \pagetrackerfalse
   \usebibmacro{prenote}}
  {\printfield[citeurl]{url}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\newrobustcmd*{\Cite}{\bibsentence\cite}
\newrobustcmd*{\Textcite}{\bibsentence\textcite}
\newrobustcmd*{\Parencite}{\bibsentence\parencite}
\newrobustcmd*{\Footcite}{\bibsentence\footcite}
\newrobustcmd*{\Citeauthor}{\bibsentence\citeauthor}

\DeclareMultiCiteCommand{\cites}{\cite}{\multicitedelim}
\DeclareMultiCiteCommand{\parencites}[\mkbibparens]{\parencite}{\multicitedelim}
\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]{\footcite}{\multicitedelim}
\DeclareMultiCiteCommand{\supercites}[\mkbibsuperscript]{\supercite}{\supercitedelim}

\newrobustcmd*{\Cites}{\bibsentence\cites}
\newrobustcmd*{\Parencites}{\bibsentence\parencites}
\newrobustcmd*{\Footcites}{\bibsentence\footcites}

\DeclareAutoCiteCommand{plain}{\cite}{\cites}
\DeclareAutoCiteCommand{inline}{\parencite}{\parencites}
\DeclareAutoCiteCommand{footnote}[l]{\footcite}{\footcites}
\DeclareAutoCiteCommand{superscript}[l]{\supercite}{\supercites}

\newrobustcmd*{\Autocite}{\bibsentence\autocite}
\newrobustcmd*{\Autocites}{\bibsentence\autocites}

% ------------------------------------------------------------------
% GENERIC CITATION MACROS
% ------------------------------------------------------------------

\newbibmacro*{citeindex}{%
  \indexnames{labelname}%
  \indexfield{indextitle}}

\newbibmacro*{shorthandintro}{%
  \iffieldundef{shorthandintro}
    {\iffieldundef{shorthand}
       {}
       {\setunit{\addspace}%
        \printtext[parens]{%
	  \bibstring{citedas}\space
	  \printfield{shorthand}}}}
    {\setunit{\addspace}%
     \printtext[parens]{\printfield{shorthandintro}}}}

% citation commands

\newbibmacro*{prenote}{%
  \iffieldundef{prenote}
    {}
    {\printfield{prenote}%
     \prenotedelim}}

\newbibmacro*{postnote}{%
  \iffieldundef{postnote}
    {}
    {\postnotedelim
     \printfield{postnote}}}

% multicite commands

\newbibmacro*{multiprenote}{%
  \iffieldundef{multiprenote}
    {}
    {\printfield{multiprenote}%
     \prenotedelim}}

\newbibmacro*{multipostnote}{%
  \iffieldundef{multipostnote}
    {}
    {\postnotedelim
     \printfield{multipostnote}}}

% ------------------------------------------------------------------
% GENERIC BIBLIOGRAPHY MACROS
% ------------------------------------------------------------------

\newbibmacro*{finentry}{\finentry}

\newbibmacro*{bibindex}{%
  \indexnames{labelname}%
  \indexfield{indextitle}}

\newbibmacro*{author/editor}{%
  \ifthenelse{\ifuseauthor\AND\NOT\ifnameundef{author}}
    {\usebibmacro{author}}
    {\usebibmacro{editor}}}

\newbibmacro*{author}{%
  \ifuseauthor
    {\printnames{author}}
    {}}

\newbibmacro*{editor}{%
  \ifthenelse{\ifuseeditor\AND\NOT\ifnameundef{editor}}
    {\printnames{editor}\addcomma\space
     \usebibmacro{editorstrg}%
     \clearname{editor}}
    {}}

\newbibmacro*{editorstrg}{%
  \ifthenelse{\value{editor}>1\OR\ifandothers{editor}}
    {\bibstring{editors}}
    {\bibstring{editor}}}

\newbibmacro*{author+holder}{%
  \ifnameundef{author}
    {}
    {\printnames{author}%
     \ifthenelse{\ifnameundef{holder}\OR
                 \ifnamesequal{author}{holder}}
       {}
       {\setunit{\addspace}%
        \printtext[parens]{\printnames{holder}}}}}

\newbibmacro*{byauthor}{%
  \ifthenelse{\ifuseauthor\OR
	      \ifnameundef{author}}
    {}
    {\bibstring{byauthor}\addspace
     \printnames[byauthor]{author}}}

\newbibmacro*{bybookauthor}{%
  \ifnamesequal{author}{bookauthor}
    {}
    {\printnames{bookauthor}}}

\newbibmacro*{byeditor}{%
  \ifnameundef{editor}
    {}
    {\bibstring{byeditor}\addspace
     \printnames[byeditor]{editor}}}

\newbibmacro*{bytranslator}{%
  \ifnameundef{translator}
    {}
    {\bibstring{bytranslator}\addspace
     \printnames[bytranslator]{translator}}}

\newbibmacro*{byredactor}{%
  \ifnameundef{redactor}
    {}
    {\bibstring{byredactor}\addspace
     \printnames[byredactor]{redactor}}}

\newbibmacro*{withcommentator}{%
  \ifnameundef{commentator}
    {}
    {\bibstring{withcommentator}\addspace
     \printnames[withcommentator]{commentator}}}

\newbibmacro*{withannotator}{%
  \ifnameundef{annotator}
    {}
    {\bibstring{withannotator}\addspace
     \printnames[withannotator]{annotator}}}

\newbibmacro*{withintroduction}{%
  \ifnameundef{introduction}
    {}
    {\bibstring{withintroduction}\addspace
     \printnames[withintroduction]{introduction}}}

\newbibmacro*{withforeword}{%
  \ifnameundef{foreword}
    {}
    {\bibstring{withforeword}\addspace
     \printnames[withforeword]{foreword}}}

\newbibmacro*{withafterword}{%
  \ifnameundef{afterword}
    {}
    {\bibstring{withafterword}\addspace
     \printnames[withafterword]{afterword}}}

\newbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {\def\@tempa{byeditor}%
     \@tempswafalse
     \ifnamesequal{editor}{translator}
       {\edef\@tempa{\@tempa tr}%
        \@tempswatrue
        \clearname{translator}}
       {}%
     \ifnamesequal{editor}{commentator}
       {\edef\@tempa{\@tempa co}%
        \@tempswatrue
        \clearname{commentator}}
       {\ifnamesequal{editor}{annotator}
          {\edef\@tempa{\@tempa an}%
           \@tempswatrue
           \clearname{annotator}}
          {}}%
     \ifnamesequal{editor}{introduction}
       {\edef\@tempa{\@tempa in}%
        \@tempswatrue
	\clearname{introduction}}
       {\ifnamesequal{editor}{foreword}
          {\edef\@tempa{\@tempa fo}%
           \@tempswatrue
	   \clearname{foreword}}
          {\ifnamesequal{editor}{afterword}
             {\edef\@tempa{\@tempa af}%
              \@tempswatrue
	      \clearname{afterword}}
             {}}}%
     \if@tempswa
       \bibstring{\@tempa}\space
       \printnames[byeditor]{editor}%
     \else
       \usebibmacro{byeditor}%
     \fi
     \clearname{editor}%
     \newunit}%
  \usebibmacro{bytranslator+others}}

\newbibmacro*{bytranslator+others}{%
  \ifnameundef{translator}
    {}
    {\def\@tempa{bytranslator}%
     \@tempswafalse
     \ifnamesequal{translator}{commentator}
       {\edef\@tempa{\@tempa co}%
        \@tempswatrue
        \clearname{commentator}}
       {\ifnamesequal{translator}{annotator}
          {\edef\@tempa{\@tempa an}%
           \@tempswatrue
	   \clearname{annotator}}
          {}}%
     \ifnamesequal{translator}{introduction}
       {\edef\@tempa{\@tempa in}%
        \@tempswatrue
	\clearname{introduction}}
       {\ifnamesequal{translator}{foreword}
          {\edef\@tempa{\@tempa fo}%
           \@tempswatrue
	   \clearname{foreword}}
          {\ifnamesequal{translator}{afterword}
             {\edef\@tempa{\@tempa af}%
              \@tempswatrue
	      \clearname{afterword}}
             {}}}%
     \if@tempswa
       \bibstring{\@tempa}\space
       \printnames[bytranslator]{translator}%
     \else
       \usebibmacro{bytranslator}%
     \fi
     \clearname{translator}%
     \newunit}%
  \usebibmacro{byothers}}

\newbibmacro*{byothers}{%
  \usebibmacro{bytranslator}%
  \newunit
  \usebibmacro{byredactor}%
  \newunit
  \usebibmacro{withcommentator}%
  \newunit
  \usebibmacro{withannotator}%
  \newunit
  \usebibmacro{withintroduction}%
  \newunit
  \usebibmacro{withforeword}%
  \newunit
  \usebibmacro{withafterword}}

\newbibmacro*{title}{%
  \iffieldundef{title}
    {}
    {\printtext[title]{%
       \printfield[noformat]{title}%
       \setunit{\subtitlepunct}%
       \printfield[noformat]{subtitle}}%
     \newunit
     \printfield{titleaddon}}}

\newbibmacro*{booktitle}{%
  \iffieldundef{booktitle}
    {}
    {\printtext[booktitle]{%
       \printfield[noformat]{booktitle}%
       \setunit{\subtitlepunct}%
       \printfield[noformat]{booksubtitle}}%
     \newunit
     \printfield{booktitleaddon}}}

\newbibmacro*{maintitle}{%
  \iffieldundef{maintitle}
    {}
    {\printtext[maintitle]{%
       \printfield[noformat]{maintitle}%
       \setunit{\subtitlepunct}%
       \printfield[noformat]{mainsubtitle}}%
     \newunit
     \printfield{maintitleaddon}}}

\newbibmacro*{journal}{%
  \iffieldundef{journaltitle}
    {}
    {\printtext[journaltitle]{%
       \printfield[noformat]{journaltitle}%
       \setunit{\subtitlepunct}%
       \printfield[noformat]{journalsubtitle}}}}

\newbibmacro*{periodical}{%
  \iffieldundef{title}
    {}
    {\printtext[title]{%
       \printfield[noformat]{title}%
       \setunit{\subtitlepunct}%
       \printfield[noformat]{subtitle}}}}

\newbibmacro*{issue}{%
  \iffieldundef{issuetitle}
    {}
    {\printtext[issuetitle]{%
       \printfield[noformat]{issuetitle}%
       \setunit{\subtitlepunct}%
       \printfield[noformat]{issuesubtitle}}}}

\newbibmacro*{url+urldate}{%
  \printfield{url}%
  \iffieldundef{urlyear}
    {}
    {\setunit{\addspace}%
     \printtext[urldate]{\biburldate}}}

\newbibmacro*{date}{%
  \iffieldundef{year}
    {}
    {\iffieldundef{month}
       {\printfield{year}}
       {\iffieldundef{day}
          {\printfield{month}%
           \setunit{\addspace}%
           \printfield{year}}
          {\printtext{\bibdate}}}}}

\newbibmacro*{pageref}{%
  \iflistundef{pageref}
    {}
    {\ifnum\value{pageref}>1\relax
       \bibstring{pages}%
     \else
       \bibstring{page}%
     \fi
     \addcolon\space
     \printlist[pageref][-\value{listtotal}]{pageref}}}

\endinput
