% $Id: blx-compat.def,v 0.9d 2010/09/03 20:11:58 lehman beta $

\ProvidesFile{blx-compat.def}
[\abx@rcsid $Id: blx-compat.def,v 0.9d 2010/09/03 20:11:58 lehman beta $
 biblatex generic compatibility]

% LaTeX

\AtBeginDocument{%
  \renewrobustcmd*{\bibliography}[1]{%
    \blx@error
      {'\string\bibliography' invalid at this point}
      {'\string\bibliography' must be given in the
       preamble.\MessageBreak I'm ignoring the command}}}

\renewrobustcmd*{\bibliographystyle}[1]{%
  \blx@error
    {'\string\bibliographystyle' invalid}
    {Use the package option 'style' instead.\MessageBreak
     I'm ignoring the command}}

% Standard classes

\DeclareOption{openbib}{\ExecuteBibliographyOptions{block=par}}

% biblatex <0.9b

\DeclareBibliographyOption{defernums}[true]{%
  \ExecuteBibliographyOptions{defernumbers=#1}}

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

% LaTeX, biblatex <0.9a

\providecommand*{\thebibliography}{}
\renewenvironment*{thebibliography}
  {\list{}{%
     \leftmargin\bibhang
     \itemindent-\leftmargin
     \itemsep\bibitemsep
     \parsep\bibparsep}}
  {\endlist}
\newcommand*{\thebibitem}{\item}

\defbibenvironment{bibliography}
  {\thebibliography}
  {\endthebibliography}
  {\thebibitem}

\newenvironment*{theshorthands}
  {\list{\thefield{shorthand}}{%
     \labelwidth\shorthandwidth
     \labelsep\biblabelsep
     \leftmargin\labelwidth
     \advance\leftmargin\labelsep
     \itemsep\bibitemsep
     \parsep\bibparsep
     \def\makelabel##1{##1\hss}}}
  {\endlist}
\newcommand*{\thelositem}{\item}

\defbibenvironment{shorthands}
  {\theshorthands}
  {\endtheshorthands}
  {\thelositem}

% Biblatex <0.8d

\DeclareBibliographyOption{bibtex8}[true]{%
  \ifstrequal{#1}{true}
    {\ExecuteBibliographyOptions{backend=bibtex8}}
    {\ExecuteBibliographyOptions{backend=bibtex}}}

% memoir

\ifdef\ifnobibintoc
  {\newcommand*{\ifmemoirbibintoc}{\notbool{nobibintoc}}}
  {\newcommand{\ifmemoirbibintoc}[2]{#2}}

% KOMA-Script

\newcommand{\ifkomabibtotoc}[2]{#2}
\newcommand{\ifkomabibtotocnumbered}[2]{#2}

\ifdef\ds@bibtotoc
  {% xkeyval breaks inheritance of key=value class options
   \ifdef\XKV@classoptionslist
     {\let\blx@classoptionslist\@classoptionslist
      \let\@classoptionslist\XKV@classoptionslist
      \AtEndOfPackage{\let\@classoptionslist\blx@classoptionslist}}
     {}%
   \DeclareOption{bibtotoc}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@secondoftwo}
   \DeclareOption{bibtotocnumbered}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@firstoftwo}%
   \DeclareOption{bibliography=totoc}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@secondoftwo}
   \DeclareOption{bibliography=nottotoc}{%
     \let\ifkomabibtotoc=\@secondoftwo
     \let\ifkomabibtotocnumbered=\@secondoftwo}
   \DeclareOption{bibliography=totocnumbered}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@firstoftwo}%
   \DeclareOption{bibliography=oldstyle}{%
     \ExecuteBibliographyOptions{block=space}}%
   \DeclareOption{bibliography=openstyle}{%
     \ExecuteBibliographyOptions{block=par}}%
   \DeclareOption{toc=bib}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@secondoftwo}%
   \DeclareOption{toc=bibliography}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@secondoftwo}%
   \DeclareOption{toc=bibnumbered}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@firstoftwo}%
   \DeclareOption{toc=numberedbib}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@firstoftwo}%
   \DeclareOption{toc=bibliographynumbered}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@firstoftwo}%
   \DeclareOption{toc=numberedbibliography}{%
     \let\ifkomabibtotoc=\@firstoftwo
     \let\ifkomabibtotocnumbered=\@firstoftwo}}
  {}

\endinput
