% \iffalse meta comment
% File: babelbib.dtx Copyright (C) 2003--2009 Harald Harders
% \fi
%
% \iffalse
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
%\usepackage{url}
\usepackage{array}
\usepackage{amsmath}
\usepackage{hyperref}
\IfFileExists{booktabs.sty}%
  {\usepackage{booktabs}}%
  {\let\toprule\hline
    \let\midrule\hline
    \let\bottomrule\hline}
\IfFileExists{babelbib.sty}{\usepackage{babelbib}
  \let\babelbibSTYfound\active}{\GenericWarning{babelbib.dtx}{Package
    file babelbib.sty not found (Documentation will be messed up!^^J^^A
    Generate babelbib.sty by LaTeXing babelbib.ins, process
    babelbib.dtx again)^^J}\stop}
\GetFileInfo{babelbib.sty}
\title{Multilingual bibliographies: The \texttt{babelbib} package}
\author{Harald Harders\\\texttt{h.harders@tu-bs.de}}
\date{Version \fileversion, \filedate, printed \today}
\newlength{\tempdima}%
\makeatletter
\renewenvironment{table}[1][]{%
  \@float{table}[#1]%
  \centering%
  \setlength{\tempdima}{\abovecaptionskip}%
  \setlength{\abovecaptionskip}{\belowcaptionskip}%
  \setlength{\belowcaptionskip}{\tempdima}%
  }{%
\end@float
}
\makeatother
\EnableCrossrefs
\CodelineIndex
\DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter}
\DoNotIndex{\setcounter,\space,\",\@empty,\begin,\end,\iffalse,\fi,\extras}
\DoNotIndex{\bibs,\ifx,\else,\fi,\ ,\ae,\emph,\input}
\CodelineNumbered
\RecordChanges
\CheckSum{12203}
\hyphenation{bib-lio-gra-phy}
\begin{document}
 \DocInput{babelbib.dtx}
\end{document}
%</driver>
% \fi
%
% \changes{0.1}{2003/04/11}{Total new version}%
% \changes{0.2}{2003/04/20}{Rewritten in main parts}%
% \changes{0.42}{2003/11/09}{Use unique version strings for all files
%   of the bundle}%
% \changes{0.42}{2003/11/09}{Reorganise docstrip code}%
% \changes{0.43}{2004/01/06}{Document the problem using
%   \texttt{frenchle.sty} when using \texttt{french} language with
%   some babel versions}%
% \changes{0.44}{2004/01/06}{Improved spacings in documentation}%
% \changes{0.44a}{2004/02/12}{Adapted Makefile for \TeX Live}%
% \changes{0.46}{2004/06/28}{Enable to switch off printout of language
%   name with \texttt{babamspl} style}%
% \changes{1.00}{2005/02/16}{Rewritten warning about \texttt{frenchle.sty}
%   package}%
% \changes{1.00}{2005/02/16}{Shorten version string}%
% \changes{1.00}{2005/02/16}{Added \texttt{urldate} to all \BibTeX\
%   styles}%
% \changes{1.01}{2005/04/11}{Added space after the \cs{btx}\ldots\
%   commands in the \texttt{bst} files to avoid line-breaking problem}%
% \changes{1.02}{2005/04/15}{Language Portuguese completed}%
% \changes{1.10}{2005/05/24}{Allow different ordering of forenames and
%   lastnames}%
% \changes{1.10}{2005/05/24}{Protect the \cs{foreignlanguage} calls
%   (avoids problems with natbib)}%
% \changes{1.11}{2005/06/12}{Avoid some additional line breaks in
%   author and editor names}%
% \changes{1.11}{2005/06/12}{Switch ISBN and ISSN in bibliographies on
%   and off (does not work for \protect\AmS\ style)}%
% \changes{1.11}{2005/06/12}{Remove space after \cs{btxurlfont}
%   because a linebreak between \cs{url} and the argument breaks
%   \texttt{hyperref.sty} (which is a pity because this can lead to
%   line-break problems with long arguments)}%
% \changes{1.12}{2005/06/19}{Correct \cs{btxlanguagenameenglish},
%   \cs{btxmastthesis}, and \cs{btxmonaugshort} in
%   \texttt{french.bdf}}%
% \changes{1.13}{2005/06/27}{Apply corrections to and complete Italian
%   language}%
% \changes{1.14}{2005/07/11}{Complete and correct catalan}%
% \changes{1.20}{2005/11/13}{Add Greek language}%
% \changes{1.20}{2005/11/13}{Change method to write \texttt{urldate}
%   to enable to write it in brackets}%
% \changes{1.20}{2005/11/13}{Bugfix in names writing of abbreviated
%   styles}%
% \changes{1.20}{2005/11/13}{Ensure to write URL's in latin font}%
% \changes{1.20}{2005/11/13}{Numerals for French and Spanish}%
% \changes{1.20}{2005/11/13}{Add the fields \texttt{ANNOTE} and
%   \texttt{ANNOTELANGUAGE} to all bib\TeX\ styles and introduce the
%   command \cs{btxannotation} which prints the annotations on
%   request.}%
% \changes{1.20}{2005/11/13}{Add the package options \texttt{isbn},
%   \texttt{noisbn}, \texttt{issn}, \texttt{noissn},
%   \texttt{varlanguage}, \texttt{nolanguagenames}, \texttt{annote}, and
%   \texttt{noannote}}%
% \changes{1.20}{2005/11/13}{Add new font \texttt{jtitle} for titles
%   of journal articles}%
% \changes{1.20}{2005/11/13}{Fix a bug with additional spaces after
%   names}%
% \changes{1.21}{2005/11/20}{Fix problem when the first bibliography entry
%   is in an unknown language}%
% \changes{1.22}{2006/01/02}{Remove space after \cs{btxurlfont} again
%   because a linebreak between \cs{url} and the argument breaks
%   \texttt{hyperref.sty}}%
% \changes{1.23}{2006/08/18}{Fix bug in typesetting title of articles for
%   \texttt{babamspl.bst}}%
% \changes{1.24}{2008/02/17}{Put \cs{btxISSN} and \cs{btxISBN} into an
%   \cs{mbox} to prevent them from being hyphenated}%
% \changes{1.25}{2008/09/24}{Add font command for publisher}%
% \changes{1.25}{2008/09/24}{Remove change of language in
%   alpha-numerical bib items because of occasional exceeded TeX memory}%
% \changes{1.26}{2009/06/17}{Correct journal article title font in
%   \texttt{babamspl.bst}}%
% \changes{1.26}{2009/06/17}{Linebreak added between url and urldate}%
% \changes{1.26}{2009/06/17}{Added Galician and Bahasa languages}%
% \changes{1.26}{2009/06/17}{Added French and Portuguese numerals}%
% \changes{1.26}{2009/06/17}{Corrected Spanish numerals}%
% \changes{1.26}{2009/06/17}{Removed comma before `and' in long lists
%   of authors in Portuguese and Swedish}%
% \changes{1.27}{2009/06/19}{Capitalised month names in Poruguese but
%   not in Brazilian}%
% \changes{1.27}{2009/06/19}{Fixed publisherfont in babamspl.bst}%
% \changes{1.27}{2009/06/19}{Added Russian language}%
%
% \maketitle
% \begin{abstract}
% \noindent
% This package enables to generate multilingual bibliographies in
% cooperation with |babel|.
% Two approaches are possible:
% Each citation may be written in another language, or the whole
% bibliography can be typeset in a language chosen by the user.
% 
% In addition, the package supports commands to change the typography
% of the bibliographies.
% 
% The current version supports Afrikaans, Bahasa, Catalan, Danish, Dutch,
% English, Esperanto, Finnish, French,\footnote{Babelbib does not work
%   with \texttt{frenchle} prior V5,987. Please update the frenchle
%   package or use the native babel support for French, instead.}
% Galician, German, Greek, Italian, Norwegian, Portuguese, Russian,
% Spanish, and Swedish.
% Please help me to add more languages.
% 
% Many of the standard and extended bibliography styles are available.
% Please read section~\ref{sec:styles}.
%
% \textbf{If you have used version 0.1 of this package:
% The mechanism to change fonts have changed, please read
% section~\ref{sec:typography}.}
%
% Have a look to \texttt{tugboat-babelbib.pdf} which includes detailed
% descriptions how to use and extend the babelbib bundle.
% \end{abstract}
%
% \tableofcontents
%
% \section*{Copyright}
% Copyright 2003--2008 Harald Harders.
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% \section{Introduction}
%
% This package is a replacement for |bibgerm.sty| \cite{germbib} with the
% aim to be extendable to other languages more easily.
% In addition, |babelbib| provides a more flexible typography of
% bibliographies without the need to change |bst| files.
% But there are two shortcomings: This package needs
% |babel.sty|~\cite{babel} (thus, it does not work with |german.sty|
% or |ngerman.sty|), and it is written for \LaTeXe\ and does not work
% with plain \TeX.
%
% The current version supports Afrikaans, Bahasa, Catalan, Danish, Dutch,
% English, Esperanto, Finnish, French,\footnote{Babelbib does not work
%   with \texttt{frenchle} prior V5,987. Please update the frenchle
%   package or use the native babel support for French, instead.}
% Galician, German, Greek, Italian, Norwegian, Portuguese, Russian,
% Spanish, and Swedish.
%
% If you have used version 0.1 of this package:
% The mechanism to change fonts have changed, please read
% section~\ref{sec:typography}.
%
% \section{Usage}%
% \label{sec:usage}%
%
% To use this package place
% \begin{verbatim}
%\usepackage{babelbib}\end{verbatim}
% into the preamble of your document.
% The package loads all necessary language definitions for all files
% it knows that are loaded by |babel|.
% 
% By default, the language of the bibliographic keywords (``editor'',
% ``page'', etc.) switches for each item to the language of the cited
% document.\footnote{This is equivalent to using the package option
%   \texttt{varlanguage}.}
% If all citations shall be written in the same language, add the
% option\index{fixlanguage=\texttt{fixlanguage}|usage} |fixlanguage|
% to the package call.
% Then, all bibliographies are typeset in the document's main
% language.
% To change the bibliography's language, use
% \DescribeMacro{\selectbiblanguage}
% |\selectbiblanguage{|$\langle$language$\rangle$|}|.
% This command only has an effect, if |fixlanguage| is set. 
%
% |babelbib| supports the \BibTeX\ styles |babplain|, |babplai3|,
% |babalpha|, |babunsrt|, |bababbrv|, and |bababbr3| that correspond
% to the standard |bst| files, but include international support as
% well as flexible typography.\footnote{The versions with the
%   \texttt{3} in the filenames replace the second and later authors by
%   \emph{et al.}, if more than three authors are given.}
% As usual, you select the style using
% \DescribeMacro{\bibliographystyle}
% |\bibliographystyle{|$\langle$filename$\rangle$|}|.
% In addition, the package supports the \BibTeX\ style |babamspl|
% which corresponds to |amsplain| by the \AmS. 
% \changes{0.2}{2003/04/20}{Added option \texttt{languagenames} to
%   define commands for language names}%
% \index{languagenames=\texttt{languagenames}|usage}%
% If you want to use this style, you have to add the option
% |languagenames| to the call of the package.
% Default is |nolanguagenames|.
%
% \DescribeMacro{\declarebtxcommands}%
% If you don't like some of the keywords provided by |babelbib|, or if
% you want to use new ones, you are able to get these using the
% command \cs{declarebtxcommands}.
% It takes two arguments, where the first is the language for which
% you want to add or change keywords, and the second is the list of
% command definitions.
% It seems to be best to show that for an example. 
% You may want to change the definitions for Ph.D.\ theses for English
% and German with new orthography (the defaults are ``PhD thesis'' resp.\
% \foreignlanguage{ngerman}{"`Dissertation"'}).
% You can reach a change by the following code:
% \begin{verbatim}
%\declarebtxcommands{english}{%
%  \def\btxphdthesis#1{\protect\foreignlanguage{english}{Ph.D.\ thesis}}%
%}
%\declarebtxcommands{ngerman}{%
%  \def\btxphdthesis#1{\protect\foreignlanguage{ngerman}{Doktorarbeit}}%
%}\end{verbatim}
% You may change more than one command in one |\setbtxcommand|
% command.
% You just have to add more of the |\def|\ldots\ lines.
% But please don't forget the percent sign at the end of the lines in
% order to avoid unwanted spaces in the output.
% The \AmS\ \BibTeX\ style |amsplain| uses ``Ph.D.\ thesis'' instead
% of the default ``PhD thesis'' for |babamspl|.
% If you want the same keyword as in the \AmS\ original, you can use
% the \cs{declarebtxcommands} line shown above.
%
%
% \section{Preparing the \texttt{bib} files}
%
% In order to use the feature of multilingual bibliographies, add the
% field |language| to every entry in your |bib| files.
% This field gives the language of the cited document, e.\,g.
% \begin{verbatim}
%@InBook{dieter1997a,
%  editor =       {Dieter, George~E. and others},
%  title =        {Materials Selection and Design},
%  chapter =      {Effects of Composition, Processing, and Structure on 
%                  Properties of Engineering Plastics},
%  publisher =    {ASM International},
%  year =         1997,
%  volume =       20,
%  series =       {ASM Handbook},
%  pages =        {434--456},
%  language =     {english},
%  isbn =         {0-87170-386-6}
%}\end{verbatim}
% Then, the output of the document data (title, authors, series, etc.)
% is typeset with correct hyphenation patterns.
% Wheather also the keywords (``edition'', ``pages'', etc.) are
% switched to the citation language, depends on wheather |fixlanguage|
% has been used.
% All languages that appear in the bibliography have to be loaded by
% |babel|.
%
% \DescribeMacro{\setbtxfallbacklanguage}
% If the field |language| is missing, the citation is typeset using a
% fall-back language.
% By default, the document's main language (that one that is active at
% \cs{begin\{document\}}) is used.
% You can change the fall-back language by using
% \cs{setbtxfallbacklanguage\marg{language}}, e.\,g.,
% \begin{verbatim}
%\setbtxfallbacklanguage{ngerman}\end{verbatim}
%
% |babelbib| supports a couple of additional fields:
% |ISBN|, |ISSN|, |URL|, |URLDATE|, and |ANNOTE|.
% |ISBN| and |ISSN| take the ISBN or ISSN respectively.
% |URL| is the address of a WWW page while |URLDATE| is the date when
% the WWW page has been visited.
% The field |URL| is typeset using the command |\url| if available,
% e.\,g., if the user has loaded |url.sty|.
% Otherwise, |babelbib| defines a |\url| command which just calls
% |\texttt|.
% |ANNOTE| typesets annotations after each entry in the bibliography.
% By default, a |quotation| environment (starting with \cs{noindent})
% is used.
% If the field |ANNOTELANGUAGE| is also given, the language is
% switched to the specified language.
% Otherwise the language of the keywords is used.
%
% You can change the behaviour by redefining
% \cs{btxannotation}\marg{annotations}.
% The annotations are only printed when the package option |annote| is
% used.
%
% \DescribeMacro{\biblanguage}%
% If you want to use language-dependent commands as \cs{alsoname} in a
% bibliography that was produced with |fixlanguage| you will be
% surprised that the commands change the output depending on the
% language of the citation.
% If you want to write a field with the keyword language, you can use
% the command \cs{biblanguage}, e.g.,
% \begin{verbatim}
%@Article{abinger1988a,
%  author =      {Abinger, R. and Hammer, F. and Leopold, J. and others},
%  title =       {Gro"sschaden an einem 300"=MW"=Dampfturbosatz},
%  journal =     {Der Maschinenschaden},
%  year =        1988,
%  volume =      61,
%  number =      2,
%  pages =       {58--60},
%  language =    {ngerman},
%  note =        {\biblanguage{\alsoname~\cite{abinger1990a}}}
%}\end{verbatim}
% This will give the note ``\alsoname~[\ldots]'' instead of
% ``{\selectlanguage{ngerman}\alsoname~[\ldots]}'' when the
% bibliography uses English keywords.
%
%
% \section{Available bibliography styles}%
% \label{sec:styles}%
%
% The |babelbib| bundle contains adapted versions of the standard
% bibliography styles |plain|, |unsrt|, |abbrv|, and |alpha|.
% They are called |babplain|, |babunsrt|, |bababbrv|, and |babalpha|,
% respectively.
% All variants write names in a special manner when more than one
% author is given.
% The first author ist written ``Lastname, Forename'' while all other
% authors are written ``Forename Lastname''.
% This is done to emphesize the ordering by the lastname.
%
% If you don't want this behaviour you can use additional variants
% that use the same notation for all names.
% By appending |-fl| to the style name, e.\,g., |babalpha-fl|, all names
% are written ``Forename Lastname''.
% By appending |-lf|, e.\,g., |babalpha-lf|, all names are written
% ``Lastname, Forename''.
%
% The style |babamspl| is the |babelbib| equivalent to |amsplain|.
%
%
% \section{Customisation of the bibliography's typography}
% \label{sec:typography}%
%
% In constrast to the standard and |germbib| |bst| files, the
% appearance of the different data types is not fixed for |bab*.bst|.
% There are commands for some data fields that determine the used
% font.
%
% \DescribeMacro{\setbibliographyfont}%
% You can change some font specifications in the bibliography using
% the command
% \cs{setbibliographyfont\{\textrm{\meta{element}}\}\{\textrm{\meta{font command}}\}},
% where \meta{element} is a typographic element, listed in
% table~\ref{tab:elements}.
% \begin{table}[tp]
%   \centering
%   \caption{Default values for the fonts in bibliographies.
%     If no value is given, the standard font (normally upright roman)
%     is used.}
%   \label{tab:elements}
%   \begin{tabular}{llll}
%     \toprule
%     Element& Data types& \multicolumn{2}{c}{Default value for
%     \BibTeX\ style} \\
%     && |bababbrv|, |babalpha|& |babamspl| \\
%     && |babplain|, |babunsrt|& \\
%     \midrule
%     name& Authors, editors& & \\
%     lastname& Lastnames of Authors, editors& & \\
%     title& All kinds of titles& \cs{emph}& \cs{emph}\\
%     jtitle& Title of journal articles& \cs{emph}& \cs{emph}\\
%     etal& ``\emph{et al.}''& \cs{emph}& \\
%     journal& Journal name& & \\
%     publisher& Publisher name& & \\
%     volume& Volume (journal)& & \cs{textbf} \\
%     ISBN& ISBN& \cs{MakeUppercase}& \cs{MakeUppercase} \\
%     ISSN& ISSN& \cs{MakeUppercase}& \cs{MakeUppercase} \\
%     url& URL& \cs{url}& \cs{url} \\
%     urldate& visiting date of URL& & \\
%     ordinal& ordinal numbers in edition& & \\
%     \bottomrule
%   \end{tabular}
% \end{table}
% \meta{font command} is a command that takes one argument, e.\,g.\
% |\textbf|, |\emph|, or |\textsc|.
% If no suitable command is available, you have to define one, first.
% For example, you can get a bold italic font as follows:
% \begin{verbatim}
%\newcommand\textitbf[1]{{\bfseries\itshape #1\/}}%
%\setbibliographyfont{title}{\textitbf}%\end{verbatim}
% As it can be seen in this example, the argument of the used font
% command mustn't be specified in |\setbibliographyfont|.
%
%
% \subsection{Names}
%
% The \meta{element} |name| changes the whole name of the author,
% including forename and lastname.
% If |lastname| is also specified, it changes the lastname within the
% font for the name.
% For example,
% \begin{verbatim}
%\setbibliographyfont{name}{\emph}
%\setbibliographyfont{lastname}{\MakeUppercase}\end{verbatim}
% leads to |\emph{Harald \MakeUppercase{Harders}}| resp.\
% ``\emph{Harald \MakeUppercase{Harders}}''.
%
%
% By default, a colon is printed after the author names.
% If you want another sign, just redefine the command
% \cs{btxauthorcolon}:
% \begin{verbatim}
%\renewcommand\btxauthorcolon{,}\end{verbatim}
% Unfortunately, it cannot detect if the name ends on a fullstop.
% Thus, things like ``Harders, H.. \emph{Title of document}'' may
% appear.
%
%
% \subsection{URL's}
%
% The font definition for |urldate| can also be used not to change the
% font but to provide a command that writes the date in the correct
% language, e.\,g., using the |isodate| package:
% \begin{verbatim}
%\usepackage[short]{isodate}
%\setbibliographyfont{urldate}{\printdate}\end{verbatim}
%
% When using |urldate|, normally a string is printed between the url
% itself and the the date, e.g., in English
% ``\url{http://www.dante.de}, visited on 2005-11-11''.
% The string is ``|, visited on |''.
% This is reached by the definition of the internal command
% \cs{btxurldatecomment}, e.g., for English
% \begin{verbatim}
%\def\btxurldatecomment#1{%
%  \protect\foreignlanguage{english}{, visited on #1}%
%}\end{verbatim}
% You can change this command, for example, to typeset the date in
% brackets:
% \begin{verbatim}
%\declarebtxcommands{english}{%
%  \def\btxurldatecomment#1{ [#1]}%
%}\end{verbatim}
% Be sure not to forget the leading space.
% It is necessary to be able to begin with a comma which does not have
% a space before it.
%
%
% \subsection{ISBN and ISSN}
%
% \DescribeMacro{\btxISBN}%
% \DescribeMacro{\btxISSN}%
% There are two additional commands, \cs{btxISBN} and \cs{btxISSN}.
% They generate the strings ``ISBN'' and ``ISSN'' in bibliographies. 
% By default, they do it without a change of the font. 
% For example, if using oldstyle digits, it could be worth to change
% them e.\,g.\ to
% \begin{verbatim}
%\renewcommand\btxISBN{\textsc{isbn}}
%\renewcommand\btxISSN{\textsc{issn}}\end{verbatim}
%
% \DescribeMacro{\btxprintISBN}%
% \DescribeMacro{\btxprintISSN}%
% By default, the ISBN resp.\ ISSN is printed if present in the data
% base.
% You can switch this behaviour off by using \cs{btxprintISBN\{false\}}
% resp.\ \cs{btxprintISSN\{false\}}.
% Similarly, printing is switched on by \cs{btxprintISBN\{true\}}
% resp.\ \cs{btxprintISSN\{true\}}.
% Alternatively, you can switch on or off the ISBN and ISSN when
% loading the package by using the package options |isbn|, |noisbn|,
% |issn|, or |noissn|.
%
% This, however, only works for the ``standard'' styles, i.\,e., not for
% the \AmS\ style |babamspl|.
%
% If you are using |babamspl|, the language names of the citations are
% printed by default, as the original \AmS\ style does it.
% You can avoid this by adding following line to your preamble:
% \begin{verbatim}
%\newcommand\btxprintamslanguage[1]{}\end{verbatim}
%
%
% \subsection{Spaces between forenames}
%
% \DescribeMacro{\btxfnamespaceshort}%
% \DescribeMacro{\btxfnamespacelong}%
% The spaces between multiple forenames are written by
% \cs{btxfnamespacelong} and \cs{btxfnamespaceshort} for full and
% abbreviated forenames, respectively.
% By default, a normal space is used between full forenames, and a
% thin space (\cs{,}) is used between abbreviated forenames (with the
% exception English where no space is printed).
% These defaults can be changed language-dependent:
% \begin{verbatim}
%\declarebtxcommands{english}{%
%  \def\btxfnamespaceshort{\,}%
%  \def\btxfnamespacelong{~}%
%}\end{verbatim}
%
%
% \subsection{Edition numbers}
%
% Ordinal numbers for editions are handled by \LaTeX\ when typesetting
% the bibliography.
% You just have to give the number itself in the |bib| file and it is
% typeset correctly in the bibliography, e.g.,
% \begin{verbatim}
%edition = 3\end{verbatim}
% is typeset as "`3."' in German and ``3rd'' in English.
% Unfortunately, I do not know about other languages than these two
% how to write ordinal numbers.
% Thus, in all other languages, a warning is produced and the given
% number is printed without a change (``3'' in the example).
% If not a pure number is given, it also is typeset without a change.
% You can add or change the output of edition numbers on a language
% basis, e.g.,
% \begin{verbatim}
%\declarebtxcommands{english}{%
%  \def\btxnumeralshort#1{%
%    \btxnumeralenglish{english}{#1}}%
%  \def\btxnumerallong#1{%
%    \ifnumber{#1}{%
%      \ifcase#1 0th\or first\or second\or third\or forth\or fifth\or
%        sixth\or seventh\or eighth\or nineth\or tenth\else
%        \btxnumeralenglish{english}{#1}%
%      \fi}{#1}}%
%}\end{verbatim}
% This example typesets the ordinals between 1st and 10th as words and
% switches to the short form for larger numbers in English language
% for the long version and uses the default function for the short
% version.
%
% Three output formats are predefined:
% \cs{btxnumeraldot} prints the number with a dot followed, as
% it is common in German.
% \cs{btxnumeralenglish} adds ``st'', ``nd'', ``rd'', or
% ``th'', depending on the number.
% And \cs{btxnumeralfallback} generates a warning and prints
% the number as given.
%
% If you, for instance, want to switch the Danish behaviour to be as
% the German is, use these commands:
% \begin{verbatim}
%\declarebtxcommands{danish}{%
%  \def\btxnumeralshort#1{\btxnumeraldot{danish}{#1}}%
%  \def\btxnumerallong#1{\btxnumeraldot{danish}{#1}}%
%}\end{verbatim}
%
% For the English variant, a font |numeral| is predefined that
% typesets the appended characters. 
% If you, for example, want to print the superscripted, use
% \begin{verbatim}
%\setbibliographyfont{numeral}{\textsuperscript}\end{verbatim}
% 
% If you know how numerals are handled in a language, please send me
% an eMail.
%
%
%
% \section{How to add new languages}
%
% The language definitions are placed in special files with the
% extension |.bdf|.
% If you want to add a new language to the |babelbib| system, you
% should copy one of the existing |bdf| files and change the new
% file.
% 
% Since |babelbib.sty| contains a list of known languages, it will not
% find the new language definition file, automatically. 
% Then, you can give the name of the new file without extension as an
% option when loading |babelbib|. 
% For example, to load |mylang.bdf|, you have to load the package as
% follows:
% \begin{verbatim}
%\usepackage[mylang]{babelbib}\end{verbatim}
%
% If you have developed a new |bdf| file, please send it to
% |h.harders@tu-bs.de|.
% Then, I will add it to the |babelbib| system.
%
% \section{Problems and Incompatibilities}
%
% \begin{itemize}
% \item
%   Babelbib does not work together with old versions of the
%   |frenchle| package prior V5,987.
%   Please update the frenchle package or use the native babel support
%   for the French language, instead.
% \item
%   If babelbib is used together with one of the classes of the
%   KOMA-Script bundle, some additional spaces are added when
%   numerical edition numbers are used. 
%   This is a KOMA-Script bug and will be fixed in the next
%   KOMA-Script release.
% \end{itemize}
%
% \section{To Do}
%
% \begin{itemize}
% \item Add more languages.
% \item Complete Dutch.
% \item Add the possibility to switch off ISBN and ISSN to |babasmpl|.
% \end{itemize}
%
%
% \section*{Acknowledgements}
%
% Danie Els, \url{dnjels@sun.ac.za} (Afrikaans);
% Taneli Huuskonen, \url{huuskone@cc.helsinki.fi} (Esperanto, Finnish);
% V\'\i ctor Lua\~na, \url{victor@fluor.quimica.uniovi.es} (Spanish);
% Hans Fredrik Nordhaug, \url{hansfn@mi.uib.no} (Norwegian, Swedish);
% Robert Fuster, \url{rfuster@imm.upv.es} (Catalan);
% Markus Kohm, \url{komascript@gmx.info} (Different schemes for writing names);
% Matthias D. Eisner, \url{matthias.eisner@ethz.ch} (protect
% \cs{foreignlanguage} calls);
% Daniel Winkelmann, \url{daniel.winkelmann@club-internet.fr}
% (idea for different formatting of forenames and lastnames);
% Jan Steffan, \url{me@jansteffan.de} (\cs{setbtxfallbacklanguage});
% Philip Ratcliffe, \url{philip.ratcliffe@email.it} (corrections for
% Italian); Angel Tsankov, \url{bigman@abv.bg} (bugfix with
% \cs{bbbb\meta{\cs{CurrentOption}}loaded});
% Prokopis Prokopidis, \url{prokopis@ilsp.gr} (Greek);
% Daniel Flipo, \url{daniel.flipo@univ-lille1.fr} (French numerals);
% Ignacio Fern\'andez Galv\'an, \url{jellby@yahoo.com} (Spanish
% numerals);
% Peter Bartke, \url{bartke@inf.fu-berlin.de} (idea of annote field);
% Yanti Yulianti, \url{y_yanti@students.itb.ac.id} (Bahasa);
% Miguel Rodr{\'\i}guez Penabad \url{penabad@udc.es} (Galician);
% Jos\'e Carlos Santos \url{jcsantos@fc.up.pt} (Portuguese).
%
% Furthermore, I thank the person who provided Russian. 
% Unfortunately, I cannot find the name anymore.
%
%\begin{thebibliography}{1}
%  \providebibliographyfont{name}{}%
%  \providebibliographyfont{title}{\emph}%
%  \providebibliographyfont{etal}{\emph}%
%  \providebibliographyfont{volume}{}%
%  \providebibliographyfont{ISBN}{\MakeUppercase}%
%  \providebibliographyfont{ISSN}{\MakeUppercase}%
%  \providebibliographyfont{url}{\url}%
%
%\selectlanguage{\english}
%\bibitem{babel}
%\btxnamefont{Braams, Johannes}: \btxtitlefont{Babel, a multilingual package
%  for use with \LaTeX's standard document classes}, 2002.
%\newblock \btxurlfont{CTAN:macros/latex/required/babel/}.
%
%\selectlanguage{\english}
%\bibitem{germbib}
%\btxnamefont{Wallmeier, M.}, A.~Scherer\btxandcomma{} \btxandlong{}\
%  \btxnamefont{H.~Harders}: \btxtitlefont{Macros for german {\BibTeX}ing},
%  2000.
%\newblock \btxurlfont{CTAN:biblio/bibtex/contrib/germbib/}.
%
%\end{thebibliography}
%
% \StopEventually{\PrintChanges \PrintIndex}
%
%
% \section{The implementation}
%
% Source lines that look like \texttt{$\langle$*...$\rangle$} or
% \texttt{$\langle$/...$\rangle$} where \texttt{...} is arbitrary text
% are not written into the output files.
% If a source line starts with \texttt{$\langle$...$\rangle$}, this
% part of the line is omitted.
%
% \subsection{Headings of the files}
%
% Heading of the package and the other files:
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[1998/06/01]
\ProvidesPackage{babelbib}
%</package>
%    \end{macrocode}
% File heads of the |bdf| files:
%    \begin{macrocode}
%<afrikaans>%% Language definitions for Afrikaans by
%<afrikaans>%%   Danie Els <dnjels@sun.ac.za>
%<afrikaans>\ProvidesFile{afrikaans.bdf}
%<bahasa>%% Language definitions for Bahasa by
%<bahasa>%%   Yanti Yulianti <y_yanti@students.itb.ac.id>
%<bahasa>\ProvidesFile{bahasa.bdf}
%<catalan>%% Language definitions for Catalan by
%<catalan>%%   Robert Fuster <rfuster@imm.upv.es>
%<catalan>\ProvidesFile{catalan.bdf}
%<danish>\ProvidesFile{danish.bdf}
%<dutch>\ProvidesFile{dutch.bdf}
%<english>\ProvidesFile{english.bdf}
%<esperanto>%% Language definitions for Esperanto by
%<esperanto>%%   Taneli Huuskonen <huuskone@cc.helsinki.fi>
%<esperanto>\ProvidesFile{esperanto.bdf}
%<finnish>%% Language definitions for Finnish by
%<finnish>%%   Taneli Huuskonen <huuskone@cc.helsinki.fi>
%<finnish>\ProvidesFile{finnish.bdf}
%<french>\ProvidesFile{french.bdf}
%<galician>%% Language definitions for Galician by
%<galician>%%   Miguel Rodr{\'\i}guez Penabad <penabad@udc.es>
%<galician>\ProvidesFile{galician.bdf}
%<german>\ProvidesFile{german.bdf}
%<greek>\ProvidesFile{greek.bdf}
%<greek>%% Language definitions for Greek by
%<greek>%%   Prokopis Prokopidis <prokopis@ilsp.gr>
%<italian>\ProvidesFile{italian.bdf}
%<norsk>%% Language definitions for Norwegian by
%<norsk>%%   Hans Fredrik Nordhaug <hansfn@mi.uib.no>
%<norsk>\ProvidesFile{norsk.bdf}
%<portuguese>%% Language definitions for Portuguese by
%<portuguese>%%   Jos\'e Carlos Santos <jcsantos@fc.up.pt>
%<portuguese>\ProvidesFile{portuguese.bdf}
%<russian>%% Language definitions for Russian by
%<russian>%%   ... (can't find the information. If it was you please tell me!)
%<russian>\ProvidesFile{russian.bdf}
%<spanish>%% Language definitions for Spanish by
%<spanish>%%   V{\'\i}ctor Lua{\~n}a <victor@fluor.quimica.uniovi.es>
%<spanish>\ProvidesFile{spanish.bdf}
%<swedish>%% Language definitions for Swedish by
%<swedish>%%   Hans Fredrik Nordhaug <hansfn@mi.uib.no>
%<swedish>\ProvidesFile{swedish.bdf}
%    \end{macrocode}
% Version information unique for all generated files:
%    \begin{macrocode}
%<latex>  [2009/06/18 v1.27  babelbib: multilingual bibliographies (HH)]
%<bst>%% 2009/06/18 v1.27  babelbib: multilingual bibliographies (HH)
%    \end{macrocode}
%
% \subsection{The package itself}
%
% \index{fixlanguage=\texttt{fixlanguage}|main}%
% Define an option which fixes the language in the bibliography to the
% main language of the document.
%    \begin{macrocode}
%<*package>
\newif\ifbbbbfixlanguage
\DeclareOption{fixlanguage}{\bbbbfixlanguagetrue}
\DeclareOption{varlanguage}{\bbbbfixlanguagefalse}
%    \end{macrocode}
% \changes{0.2}{2003/04/20}{Added option \texttt{languagenames} to
%   define commands for language names}%
% \index{languagenames=\texttt{languagenames}|main}%
% If this option is used, generate the commands
% \cs{btxlanguagename}\meta{language} that save how languages are
% called in other languages, e.\,g. in German, French is called
% \foreignlanguage{ngerman}{"`franz�sisch"'}.
%    \begin{macrocode}
\newif\ifbbbblanguagenames
\DeclareOption{nolanguagenames}{\bbbblanguagenamesfalse}
\DeclareOption{languagenames}{\bbbblanguagenamestrue}
%    \end{macrocode}
%    \begin{macrocode}
\newif\ifbbbbannotations
\DeclareOption{annote}{\bbbbannotationstrue}
\DeclareOption{noannote}{\bbbbannotationsfalse}
%    \end{macrocode}
% \begin{macro}{\ifbtx@printISBN}
% \begin{macro}{\ifbtx@printISSN}
% The booleans that store the necessary information if ISBN and ISSN
% shall be printed.
%    \begin{macrocode}
\newif\ifbtx@printISBN
\newif\ifbtx@printISSN
\DeclareOption{isbn}{\btx@printISBNtrue}
\DeclareOption{noisbn}{\btx@printISBNfalse}
\DeclareOption{issn}{\btx@printISSNtrue}
\DeclareOption{noissn}{\btx@printISSNfalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% If additional options are given, try to load these as
% languages. This is implemented in order to be able to use a new
% language that is not yet supported by the official |babelbib|.
% \changes{1.15}{2005/09/01}{Small bug fix in loading language files}%
%    \begin{macrocode}
\DeclareOption*{%
  \InputIfFileExists{\CurrentOption.bdf}{%
    \expandafter\def\csname bbbb\CurrentOption loaded\endcsname{\@empty}%
  }{%
    \PackageError{babelbib}{%
      Language definition file \CurrentOption.bdf not found}{%
      Maybe you misspelled the language option?}%
  }%
}
%    \end{macrocode}
% Default options.
%    \begin{macrocode}
\ExecuteOptions{varlanguage,nolanguagenames,noannote,isbn,issn}
%    \end{macrocode}
% Process the given options.
%    \begin{macrocode}
\ProcessOptions*
%    \end{macrocode}
% \begin{macro}{\bbbbifundefined}
% Define a replacement for \cs{@ifundefined} that does not define the
% command it is tested for as side effect.
% This command has been taken from a news posting by Markus Kohm
% (|markus.kohm@gmx.de|).
%    \begin{macrocode}
\newcommand*{\bbbbifundefined}[1]{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname #1\endcsname\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\bbbbaddto}
% Adds the command named |\bibs#2| to the command |\extras#1|, if this
% command is defined before, where |#1| and |#2| are the arguments of
% |\bbbbaddto|. For internal use only.
% \changes{0.32}{2003/05/06}{Changed \cs{bbbbaddto} in order to allow
%   different commands to be added to \cs{extras}\meta{language}}%
%    \begin{macrocode}
\newcommand\bbbbaddto[2]{%
%    \end{macrocode}
% Test wheather  |\extras#1| is defined.
%    \begin{macrocode}
  \expandafter\bbbbifundefined{extras#1}{}{%
%    \end{macrocode}
% Call |babel|'s command to append |\bibs#1| to |\extras#1|.
%    \begin{macrocode}
    \expandafter\addto\expandafter{\csname extras#1\endcsname}{%
      \csname #2\endcsname}%
    \typeout{babelbib extension \@backslashchar #2 added to
      \string\extras #1}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\inputbdf}
% Input the file |#2.bdf| if babel has loaded the language |#1|. 
% For internal use only.
%    \begin{macrocode}
\newcommand\inputbdf[2]{%
%    \end{macrocode}
% \changes{0.43}{2004/01/05}{Test on \cs{date}\meta{language} instead on
%   \cs{l@}\meta{language} (caused problems with \TeX Live)}%
% Test wheather |\date#1| is defined which is the case if the language
% |#1| has been loaded.
%    \begin{macrocode}
  \bbbbifundefined{date#1}{}{%
%    \end{macrocode}
% Input |#2.bdf|.
%    \begin{macrocode}
    \@ifundefined{bbbb#2loaded}{%
      \expandafter\def\csname bbbb#2loaded\endcsname{\@empty}%
      \input{#2.bdf}%
    }{}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\selectbiblanguage}
% \changes{0.3}{2003/04/21}{Handling of usage before or after
%   \texttt{begin\{document\}} added}%
% Define |\selectbiblanguage| which explicitly selects the language
% for the bibliography. This is only useful when the option
% |fixlanguage| is used.
% Otherwise the command produces a warning and does nothing else.
%
% Since all the language dependent macros are not know before
% |\begin{document}|, the command |\selectbiblanguage| has to wait
% until there, before doing any action. 
% Because after |\begin{document}|, it can do the action immediately,
% |\selectbiblanguge| has to be redefined there.
%    \begin{macrocode}
\ifbbbbfixlanguage
%    \end{macrocode}
% Define the |\selectlanguage| command for usage before
% |\begin{document}|.
%    \begin{macrocode}
  \newcommand\selectbiblanguage[1]{%
    \AtBeginDocument{\@selectbiblanguage{#1}}%
  }
%    \end{macrocode}
% Redefine it at |\begin{document}|.
%    \begin{macrocode}
  \AtBeginDocument{%
    \renewcommand\selectbiblanguage[1]{\@selectbiblanguage{#1}}%
  }
%    \end{macrocode}
% Define the ``real'' command that does the action.
% It tests wheather |\bibs#1| and |\extras#1| are known and produces
% error messages if not.
% If everything is okay, change the bibliography language.
%    \begin{macrocode}
  \newcommand\@selectbiblanguage[1]{%
    \bbbbifundefined{bibs#1}{%
      \bbbbifundefined{date#1}{%
        \PackageError{babelbib}{Language #1 in bibliography not loaded
          by babel}{%
          The language #1 hasn't been loaded by babel.
          Add it to the\MessageBreak
          options of the \string\usepackage{babel} command or to the
          global options.}%
      }{%
        \PackageError{babelbib}{Language #1 in bibliography unknown by
          babelbib}{%
          There are no definitions for #1 available in the
          current\MessageBreak
          version of babelbib. Please contact h.harders@tu-bs.de.}%
      }%
    }{%
      \typeout{babelbib: Set language for keywords in the bibliography fixed to #1}%
      \csname bibs#1\endcsname
    }%
  }
\else
  \newcommand\selectbiblanguage[1]{%
    \PackageWarning{babelbib}{Command \string\selectbiblanguage\space
      used without package\MessageBreak
      option fixlanguage. Ignored}%
  }
  \AtBeginDocument{%
    \typeout{babelbib: Use citation-dependent languages in bibliography}%
  }
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxselectlanguage}
% \changes{0.2}{2003/04/20}{Added}%
% Define |\selectbiblanguage| which selects a language and complains
% if babelbib does not know about this language.
% For internal use, only.
%    \begin{macrocode}
\newcommand\btxselectlanguage[1]{%
  \bbbbifundefined{bibs#1}{%
    \bbbbifundefined{date#1}{%
      \PackageError{babelbib}{Language #1 in bibliography not loaded
        by babel}{%
        The language #1 hasn't been loaded by babel.
        Add it to the\MessageBreak
        options of the \string\usepackage{babel} command or to the
        global options.}%
    }{%
      \ifbbbbfixlanguage
        \PackageWarning{babelbib}{Language #1 in bibliography
          unknown\MessageBreak 
          by babelbib. Hyphenation will be\MessageBreak
          incorrect}%
      \else
        \PackageError{babelbib}{Language #1 in bibliography unknown by
          babelbib}{%
          There are no definitions for #1 available in the
          current\MessageBreak
          version of babelbib. Please contact h.harders@tu-bs.de.}%
      \fi
    }%
  }{%
    \csname extras#1\endcsname
    \selectlanguage{#1}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\biblanguage}
% \changes{1.15}{2005/09/01}{Add \cs{biblanguage} that switches to the
%   keyword language within a field}%
% Define \cs{biblanguage} which switches to the keyword language
% within a field.
%    \begin{macrocode}
\newcommand\biblanguage[1]{{%
    \expandafter\selectlanguage\expandafter{\biblanguagename}#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxlanguagename}
% \changes{0.2}{2003/04/20}{Added}%
% Define |\btxlanguagename| which typesets the name of the language
% given in the argument, spoken in the current active language.
%    \begin{macrocode}
\newcommand\btxlanguagename[1]{%
  \bbbbifundefined{btxlanguagename#1}{%
    \PackageError{babelbib}{Languagename for #1 not
      defined\MessageBreak
      in \languagename\space language}{%
      Either you have forgotten to specify the option `languagenames'
      when loading\MessageBreak
      babelbib, or the command \string\bibs\languagename\space does
      not contain a definition\MessageBreak
      for the command \string\btxlanguagename#1.
      In the latter case, please\MessageBreak 
      contact h.harders@tu-bs.de.}%
    #1%
  }{%
    \@nameuse{btxlanguagename#1}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\setbtxfallbacklanguage}
% \changes{1.12}{2005/06/19}{Add the command \cs{setbtxfallbacklanguage}
%   to force a fall-back language}%
%    \begin{macrocode}
\newcommand*\setbtxfallbacklanguage[1]{%
  \edef\btxfallbacklanguage{#1}%
  \typeout{babelbib: Set bibliography fall-back language to
    \btxfallbacklanguage}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxfallbacklanguage}
% \changes{0.40}{2003/09/26}{Add the command \cs{btxfallbacklanguage}
%   for items without given language}%
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifundefined{btxfallbacklanguage}{%
    \edef\btxfallbacklanguage{\languagename}%
  \typeout{babelbib: Set bibliography fall-back language to
    \btxfallbacklanguage}%
  }{%
    \typeout{babelbib: Bibliography fall-back language unchanged
      (\btxfallbacklanguage)}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\declarebtxcommands}
% \changes{0.3}{2003/04/21}{Added}%
% Declare |\declarebtxcommands| which adds or replaces one or more of the
% |\Btx| or |\btx| commands defined in a \cs{bibs}\meta{language}
% command.
% The first argument gives the language for which the commands shall
% be added or changed.
% The second argument includes the definitions of the commands.
% For an example, see section~\ref{sec:usage}.
%    \begin{macrocode}
\newcommand*\declarebtxcommands[2]{%
  \AtBeginDocument{%
    \typeout{babelbib: Add a command to \string\bibs#1}%
    \expandafter\g@addto@macro\csname bibs#1\endcsname{#2}%
    \ifbbbbfixlanguage
      \selectbiblanguage{\biblanguagename}%
    \fi
  }%
}
%    \end{macrocode}
% This command may only be used in the preamble.
%    \begin{macrocode}
\@onlypreamble\declarebtxcommands
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxifchangecaseon}
% \begin{macro}{\btxifchangecaseoff}
% \changes{0.32}{2003/05/06}{Move change of case from bst to sty}%
% The bst files write titles twice, first with changed case and second
% with preserved case.
% The macros \cs{btxifchangecaseon} and \cs{btxifchangecaseoff}
% typeset one of these versions.
% The languages append one of these commands to the
% \cs{extras}\meta{language} commands.
%    \begin{macrocode}
\newcommand*\btxifchangecaseon{%
  \def\btxifchangecase{\@firstoftwo}%
}%
\newcommand*\btxifchangecaseoff{%
  \def\btxifchangecase{\@secondoftwo}%
}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\setbibliographyfont}
% \changes{0.2}{2003/04/20}{Don't change the font commands directly
%   but use this command}%
% Define |\setbibliographyfont| and |\setbibliographyfont*| that set
% the font declared by the first argument |#1| to the second argument
% |#2|.
% The second argument has to be a macro with one argument, like
% |\textbf|, |\emph|, |\textsc|, etc.
% The normal version generates an error, if the internal command
% |\btx#1font| is not defined. 
% The star version doesn't.
% error.
%    \begin{macrocode}
\newcommand\setbibliographyfont{%
  \@ifnextchar*{\@@setbibliographyfont}{\@setbibliographyfont}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@setbibliographyfont}
%    \begin{macrocode}
\newcommand\@setbibliographyfont[2]{%
  \bbbbifundefined{btx#1font}{%
    \PackageError{babelbib}{Bibliography font `#1' can't be set}{%
      You have tried to define a font for the bibliographic element
      \MessageBreak
      `#1', which is unknown to babelbib}%
  }{%
    \expandafter\renewcommand\csname btx#1font\endcsname{#2}%
    \typeout{babelbib: Bibliography font for `#1' changed.}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@setbibliographyfont}
% The first argument is the |*| and ignored.
%    \begin{macrocode}
\newcommand\@@setbibliographyfont[3]{%
  \bbbbifundefined{btx#2font}{%
    \expandafter\newcommand\csname btx#2font\endcsname{#3}%
    \typeout{babelbib: Bibliography font for `#2' newly defined.}%
  }{%
    \expandafter\renewcommand\csname btx#2font\endcsname{#3}%
    \typeout{babelbib: Bibliography font for `#2' changed.}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\providebibliographyfont}
% \changes{0.2}{2003/04/20}{Added}%
% Define |\providebibliographyfont| and |\providebibliographyfont*|
% that do the same as |\setbibliographyfont| and
% |\setbibliographyfont*|, but only, if |\setbibliographyfont| has not
% been used for |#1|, before.
% It is similar to |\providecommmand| which only defines that command
% if it is undefined, before.
% This command is intended to be used by the \BibTeX\ style, but can
% also be used by the user.
%    \begin{macrocode}
\newcommand\providebibliographyfont{%
  \@ifnextchar*{\@@providebibliographyfont}{\@providebibliographyfont}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@providebibliographyfont}
%    \begin{macrocode}
\newcommand\@providebibliographyfont[2]{%
  \bbbbifundefined{btx#1font}{%
    \PackageError{babelbib}{Bibliography font `#1' can't be set}{%
      You have tried to define a font for the bibliographic element
      \MessageBreak
      `#1', which is unknown to babelbib}%
  }{%
    \expandafter\ifx\csname btx#1font\endcsname\@empty
      \expandafter\renewcommand\csname btx#1font\endcsname{#2}%
      \typeout{babelbib: Using the BibTeX style's default font for `#1'.}%
    \else
      \typeout{babelbib: Using user changed font for `#1'.}%
    \fi
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@setbibliographyfont}
% The first argument is the |*| and ignored.
%    \begin{macrocode}
\newcommand\@@providebibliographyfont[3]{%
  \bbbbifundefined{btx#2font}{%
    \expandafter\newcommand\csname btx#2font\endcsname{#3}%
    \typeout{babelbib: Using the BibTeX style's default font for `#2'.}%
  }{%
    \expandafter\ifx\csname btx#2font\endcsname\@empty
      \expandafter\renewcommand\csname btx#2font\endcsname{#3}%
      \typeout{babelbib: Using the BibTeX style's default font for `#2'.}%
    \else
      \typeout{babelbib: Using user changed font for `#2'.}%
    \fi
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxnamefont}
% \changes{0.32}{2003/05/06}{Add new font for journal names}%
% \changes{1.12}{2005/06/19}{Add new font \cs{btxlastname} for last
%   names}%
% Define the dummy commands for available fonts
%    \begin{macrocode}
\newcommand*\btxnamefont{}
\let\btxnamefont=\@empty
\newcommand*\btxlastnamefont{}
\let\btxlastnamefont=\@empty
\newcommand\btxtitlefont{}
\let\btxtitlefont=\@empty
\newcommand\btxjtitlefont{}
\let\btxjtitlefont=\@empty
\newcommand\btxetalfont{}
\let\btxetalfont=\@empty
\newcommand\btxjournalfont{}
\let\btxjournalfont=\@empty
\newcommand\btxpublisherfont{}
\let\btxpublisherfont=\@empty
\newcommand\btxvolumefont{}
\let\btxvolumefont=\@empty
\newcommand\btxISBNfont{}
\let\btxISBNfont=\@empty
\newcommand\btxISSNfont{}
\let\btxISSNfont=\@empty
\newcommand\btxurlfont{}
\let\btxurlfont=\@empty
\newcommand\btxurldatefont{}
\let\btxurldatefont=\@empty
\newcommand\btxnumeralfont{}
\let\btxnumeralfont=\@empty
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxauthorcolon}
% \changes{0.2}{2003/04/20}{Added}%
% Define |\btxauthorcolon| which defines the characters typeset after 
% the authors, if they are written before the title.
% By default, it is a ``:''. 
%    \begin{macrocode}
\newcommand\btxauthorcolon{:}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxISBN}
% Define |\btxISBN| which outputs "`ISBN"' in a bibliography. 
% For example, it could be defined to |\textsc{isbn}| when old style
% digits are used.
%    \begin{macrocode}
\newcommand\btxISBN{ISBN}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxISSN}
% Define |\btxISSN| which outputs "`ISSN"' in a bibliography. 
% For example, it could be defined to |\textsc{issn}| when old style
% digits are used.
%    \begin{macrocode}
\newcommand\btxISSN{ISSN}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ifbtxprintISBN}
% \begin{macro}{\ifbtxprintISSN}
% These commands are used by the bibliography styles to typeset the
% ISBN or ISSN only if wanted.
%    \begin{macrocode}
\DeclareRobustCommand\ifbtxprintISBN[1]{\ifbtx@printISBN #1\fi}
\DeclareRobustCommand\ifbtxprintISSN[1]{\ifbtx@printISSN #1\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\btxprintISBN}
% \begin{macro}{\btxprintISSN}
% These macros are used to switch on or off printing of ISBN resp.\
% ISSN.
% Valid arguments are |true| and |false|.
%    \begin{macrocode}
\newcommand*\btxprintISBN[1]{\csname btx@printISBN#1\endcsname}
\newcommand*\btxprintISSN[1]{\csname btx@printISSN#1\endcsname}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\btxannotation}
% A command that typesets annotations.
%    \begin{macrocode}
\ifbbbbannotations
  \DeclareRobustCommand\btxannotation[1]{%
    \begin{quotation}%
      \noindent
      #1%
    \end{quotation}%
  }
\else
  \DeclareRobustCommand\btxannotation[1]{}%
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btx@ifnumerical}
% Test wheather argument 1 is a number (from KOMA script)
%    \begin{macrocode}
\providecommand\ifnumber[3]{%
 \begingroup\@tempswafalse\let\scr@next\test@number
 \expandafter\scr@next#1\scr@next
 \if@tempswa\endgroup#2\else\endgroup#3\fi
}
\providecommand*\test@number[1]{%
 \ifx \scr@next#1%
  \let\scr@next\relax
 \else
  \@tempcnta=\expandafter\expandafter\expandafter\number
  \expandafter`#1\relax
  \ifnum \@tempcnta>47\relax
   \ifnum \@tempcnta<58\relax
    \@tempswatrue
   \else\@tempswafalse\fi
  \else\@tempswafalse\fi
  \if@tempswa\else\let\scr@next\gobble@till@next\fi\fi
 \scr@next
}
\def\gobble@till@next#1\scr@next{}
%    \end{macrocode}
% \end{macro}
% \changes{1.17}{2005/11/05}{Handle numerical edition numbers}%
% \begin{macro}{\btx@parsenum}
% Parses the number given by \cs{btx@parsenum}\meta{number}\cs{@empty}
% prints it and returns the last two digits in \cs{btx@digita} and
% \cs{btx@digitb}.
%    \begin{macrocode}
\def\btx@parsenum#1#2#3\@empty{%
  #1%
  \edef\btx@digitb{#3}%
  \ifx\@empty\btx@digitb
    #2%
    \edef\btx@digita{#1}%
    \edef\btx@digitb{#2}%
  \else
    \expandafter\btx@parsenum#2#3\@empty
  \fi
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxnumeralfallback}
%    \begin{macrocode}
\DeclareRobustCommand\btxnumeralfallback[2]{%
  \foreignlanguage{#1}{%
    \ifnumber{#2}{%
      \PackageWarning{babelbib}{Handling of numerical editions not
        handled\MessageBreak by language #1 for edition `#2'}%
    }{}%
    #2%
  }%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxnumeraldot}
%    \begin{macrocode}
\DeclareRobustCommand\btxnumeraldot[2]{%
  \foreignlanguage{#1}{\ifnumber{#2}{#2.}{#2}}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\btxnumeralenglish}
%    \begin{macrocode}
\DeclareRobustCommand\btxnumeralenglish[2]{%
  \foreignlanguage{#1}{%
    \ifnumber{#2}{%
      \expandafter\btx@parsenum#2\@empty\@empty\@empty
      \btxnumeralfont{%
        \ifx\btx@digitb\@empty
          \ifcase\btx@digita th\or st\or nd\or rd\else th\fi
        \else
          \ifnum\btx@digita=1
            th%
          \else
            \ifcase\btx@digitb th\or st\or nd\or rd\else th\fi
          \fi
        \fi
        }%
    }{#2}%
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\url}
% \changes{0.40}{2003/09/26}{If no \cs{url} command is defined,
%   produce an error}%
% \changes{0.2}{2003/04/20}{Added, if not available by another
%   package}%
% Define |\url| which, by default, is used for URLs. Only necessary if
% not provided by another package, e.\,g.\ |url.sty|.
%    \begin{macrocode}
\AtBeginDocument{%
  \providecommand\url[1]{%
    \PackageError{babelbib}{No \string\url\space command defined but
      field URL used\MessageBreak
      in bibliography}{%
      Please define a \string\url\space command for printing URLs
      before \string\begin{document}, e.\,g.\MessageBreak
        by loading the package `url.sty'.}%
    \texttt{#1}%
    }%
}
%    \end{macrocode}
% \end{macro}
% Perform the following commands at |\begin{document}| in order to be
% sure to do that after loading |babel|.
%    \begin{macrocode}
\AtBeginDocument{%
%    \end{macrocode}
% Load |babel| if that has not been done, yet.
%    \begin{macrocode}
  \RequirePackage{babel}
%    \end{macrocode}
% Input all know languages that babel has also loaded, before.
% \changes{0.2}{2003/04/20}{Removed Italian from the list of
%   automatically found languages, since it is not complete, yet}%
% \changes{0.31}{2003/05/01}{Added Italian to the list of automatically
%   found languages, again}%
% \changes{0.34}{2003/07/28}{Added Afrikaans}%
% \changes{0.41}{2003/11/03}{Added Norwegian (by Hans Fredrik Nordhaug)}%
% \changes{1.00}{2005/02/16}{Renamed franceis to francais}%
%    \begin{macrocode}
  \inputbdf{afrikaans}{afrikaans}
  \inputbdf{american}{english}
  \inputbdf{austrian}{german}
  \inputbdf{bahasa}{bahasa}
  \inputbdf{brazil}{portuguese}
  \inputbdf{brazilian}{portuguese}
  \inputbdf{british}{english}
  \inputbdf{canadian}{english}
  \inputbdf{canadien}{french}
  \inputbdf{catalan}{catalan}
  \inputbdf{danish}{danish}
  \inputbdf{dutch}{dutch}
  \inputbdf{english}{english}
  \inputbdf{esperanto}{esperanto}
  \inputbdf{finnish}{finnish}
  \inputbdf{francais}{french}
  \inputbdf{french}{french}
  \inputbdf{frenchb}{french}
  \inputbdf{galician}{galician}
  \inputbdf{german}{german}
  \inputbdf{germanb}{german}
  \inputbdf{greek}{greek}
  \inputbdf{italian}{italian}
  \inputbdf{norsk}{norsk}
  \inputbdf{mexican}{spanish}
  \inputbdf{naustrian}{german}
  \inputbdf{ngerman}{german}
  \inputbdf{portuges}{portuguese}
  \inputbdf{portuguese}{portuguese}
  \inputbdf{russian}{russian}
  \inputbdf{russianb}{russian}
  \inputbdf{spanish}{spanish}
  \inputbdf{swedish}{swedish}
  \inputbdf{UKenglish}{english}
  \inputbdf{USenglish}{english}
%    \end{macrocode}
% Call |\bibs#1|, where |#1| stands for the main language of the
% document, to activate the additional bibliographic commands.
%    \begin{macrocode}
  \ifbbbbfixlanguage
    \typeout{babelbib: Load BibTeX extensions
      \string\bibs\bbl@main@language\space for \bbl@main@language}%
    \selectbiblanguage{\bbl@main@language}%
  \else
    \expandafter\selectlanguage\expandafter{\bbl@main@language}%
  \fi
}
%</package>
%    \end{macrocode}
%
% \subsection{The language definitions}
%
% \subsubsection{German}
%    \begin{macrocode}
%<*german>
%    \end{macrocode}
%
% \begin{macro}{\bibsgerman}
% Define |\bibsgerman| which itself defines all necessary expressions
% used in bibliographies that differ in different languages.
% This command is used for all German dialects.
%
% Since the language of the keywords may differ from the language of
% the bibliography item, the keyword language is set for each keyword.
% Because this command is also used for dialects, it has an optional
% argument which is set to the dialect.
%    \begin{macrocode}
\newcommand\bibsgerman[1][german]{%
%    \end{macrocode}
% Define the command |\biblanguagename| that always returns the name
% of the current language for bibliographies.
%    \begin{macrocode}
  \def\biblanguagename{#1}%
%    \end{macrocode}
% First, define all commands for usage within a sentence (which
% normally start with a lowercase letter, if they aren't a noun).
% These commands start with a lowercase letter.
%
% Many commands have an argument. This may be used by the bib\TeX\
% styles to append a dot after abbreviations, e.\,g.\
% |\btxetalshort{.}|.
%    \begin{macrocode}
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}% 
  \def\btxandshort##1{\protect\foreignlanguage{#1}{und}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{und}}%
%    \end{macrocode}
% The command |\btxandcomma| contains a ``,'' if a comma is added
% before the ``and'' in a list of more than two items.
% For German, this is not the case.
%    \begin{macrocode}
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{in:}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{in:}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{d.\ Reihe}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{der Reihe}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{Hrsg##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{Herausgeber}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{Hrsg##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{Herausgeber}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{Bd##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{Band}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{Nr##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{Nummer}}%
%    \end{macrocode}
% Avoid the ligature in
% \foreignlanguage{ngerman}{"`Auf"|lage"'} in the same way, |babel|
% does it.
% This is a change in the behaviour to the |germbib| package.
% In \foreignlanguage{ngerman}{"`Aufl"'} the ligature is still
% used since this is done in abbreviations.
%    \begin{macrocode}
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{Aufl##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{%
      Auf\penalty10000\discretionary{-}{}{\kern.03em}%
    \allowhyphens lage}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{Kap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{Kapitel}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{S##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{Seite}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{S##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{Seiten}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Diplomarbeit}}%
%    \end{macrocode}
% Use \foreignlanguage{ngerman}{"`Dissertation"'} instead of 
% \foreignlanguage{ngerman}{"`Doktorarbeit"'} for PhD theses.
% This is a change in the behaviour to the |germbib| package.
%    \begin{macrocode}
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{Dissertation}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Techn.\ Ber##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Technischer Bericht}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januar}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februar}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{M\"arz}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Mai}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Juni}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Juli}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{August}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktober}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Dezember}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{M\"arz}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Mai}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Juni}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Juli}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dez##1{}}}%
%    \end{macrocode}
% Then, define all commands for usage at the begin of a sentence
% (which start with an uppercase letter).
% These commands start with an uppercase letter.
% Since, in German, many nouns are the same in the middle and at the
% start of a sentence, the |\Btx| variants just call the |\btx|
% variant.
%    \begin{macrocode}
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{In:}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{In:}}%
  \def\Btxeditorshort{\btxeditorshort}%
  \def\Btxeditorlong{\btxeditorlong}%
  \def\Btxeditorsshort{\btxeditorsshort}%
  \def\Btxeditorslong{\btxeditorslong}%
  \def\Btxvolumeshort{\btxvolumeshort}%
  \def\Btxvolumelong{\btxvolumelong}%
  \def\Btxnumbershort{\btxnumbershort}%
  \def\Btxnumberlong{\btxnumberlong}%
  \def\Btxeditionshort{\btxeditionshort}%
  \def\Btxeditionlong{\btxeditionlong}%
  \def\Btxchaptershort{\btxchaptershort}%
  \def\Btxchapterlong{\btxchapterlong}%
  \def\Btxpageshort{\btxpageshort}%
  \def\Btxpagelong{\btxpagelong}%
  \def\Btxpagesshort{\btxpagesshort}%
  \def\Btxpageslong{\btxpageslong}%
  \def\Btxtechrepshort{\btxtechrepshort}%
  \def\Btxtechreplong{\btxtechreplong}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, besucht: ##1}}%
%    \end{macrocode}
% \changes{1.16}{2005/10/31}{Allow to alter space between two
%   forenames}%
% The command \cs{btxfnamespaceshort} and \cs{btxfnamespacelong}
% contain the space between two abbreviated resp.\ full forenames.
%    \begin{macrocode}
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
%    \end{macrocode}
% \changes{1.17}{2005/11/05}{Handle numerical edition numbers}%
% Handle numerical edition numbers.
%    \begin{macrocode}
  \def\btxnumeralshort##1{\btxnumeraldot{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeraldot{#1}{##1}}%
%    \end{macrocode}
% A command that just puts some user defined text in the language of
% the keywords.
%    \begin{macrocode}
%  \def\btxkeywordlanguage##1{\protect\foreignlanguage{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
%    \end{macrocode}
% \changes{0.2}{2003/04/20}{Added language names}%
% Names of all known languages in the current language.
% For example, used by |babamspl.bst|.
%    \begin{macrocode}
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{englisch}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{deutsch}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugiesisch}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugiesisch}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{englisch}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgarisch}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{englisch}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{franz\"osisch}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalanisch}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroatisch}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tschechisch}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{d\"anisch}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{niederl\"andisch}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{englisch}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finnisch}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{franz\"osisch}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{franz\"osisch}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{franz\"osisch}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{deutsch}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{deutsch}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{griechisch}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebr\"aisch}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{ungarisch}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{isl\"andisch}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irisch}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italienisch}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{lateinisch}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{deutsch}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{deutsch}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norwegisch}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{neunorwegisch}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polnisch}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugiesisch}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugiesisch}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russisch}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{schottisch}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbisch}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spanisch}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{schwedisch}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{t\"urkisch}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{englisch}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{englisch}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\bibsgermanb}
% Do the same for the language ``germanb''. Since there is no
% difference, just call |\bibsgerman|.
%    \begin{macrocode}
\newcommand\bibsgermanb{\bibsgerman}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\bibsngerman}
% Do the same for German with new ortography. Call |\bibsgerman| with
% new hyphenation patterns.
%    \begin{macrocode}
\newcommand\bibsngerman[1][ngerman]{\bibsgerman[#1]}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\bibsaustrian}
% Once again. Austrians use \foreignlanguage{ngerman}{"`J\"anner"'}
% instead of \foreignlanguage{ngerman}{"`Januar"'}. Thus, redefine the
% corresponding command.
%    \begin{macrocode}
\newcommand\bibsaustrian[1][austrian]{%
  \bibsgerman[#1]%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{J\"anner}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{J\"an##1{}}}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\bibsnaustrian}
% New Austrian is the same as Austrian.
%    \begin{macrocode}
\newcommand\bibsnaustrian[1][naustrian]{%
  \bibsngerman[#1]%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{J\"anner}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{J\"an##1{}}}%
}
%    \end{macrocode}
% \end{macro}
% The rest has to be executed after loading |babel.sty|, because the
% |\extra...| commands have to be defined for all used languages.
%    \begin{macrocode}
\AtBeginDocument{%
%    \end{macrocode}
% If the language is fixed, do nothing.
%    \begin{macrocode}
  \ifbbbbfixlanguage    
  \else
%    \end{macrocode}
% Append the corresponding |\#2| command to each used language,
% namely |\extras#1|.
%    \begin{macrocode}
    \bbbbaddto{austrian}{bibsaustrian}
    \bbbbaddto{german}{bibsgerman}
    \bbbbaddto{germanb}{bibsgermanb}
    \bbbbaddto{naustrian}{bibsnaustrian}
    \bbbbaddto{ngerman}{bibsngerman}
  \fi
%    \end{macrocode}
% \changes{0.32}{2003/05/06}{Move change of case from bst to sty}%
% Switch off the change of case in titles for all German dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{austrian}{btxifchangecaseoff}
  \bbbbaddto{german}{btxifchangecaseoff}
  \bbbbaddto{germanb}{btxifchangecaseoff}
  \bbbbaddto{naustrian}{btxifchangecaseoff}
  \bbbbaddto{ngerman}{btxifchangecaseoff}
}
%</german>
%    \end{macrocode}
%
% \subsubsection{Galician}
% \changes{1.26}{2009/06/17}{Added Galician language}%
%    \begin{macrocode}
%<*galician>
%    \end{macrocode}
%
% The language definition for Galician was provided by Miguel
% Rodr{\'\i}guez Penabad.
%
% \begin{macro}{\bibsgalician}
% Bibliographic commands for Galician.
%    \begin{macrocode}
\newcommand\bibsgalician[1][galician]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{e~cols##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{e~colaboradores}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{e}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{e}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{editor}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{eds##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{editores}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volume}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{%
      n\textsuperscript{\underline{o}}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{n\'umero}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{edici\'{o}n}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{cap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{cap{\'\i}tulo}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p\'ax##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{p\'axina}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{p\'axs##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{p\'axinas}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Tese de Licenciatura}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{Tese de Doutoramento}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Informe t\'ecnico##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Informe t\'ecnico}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Xaneiro}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Febreiro}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Marzo}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{Abril}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Maio}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Xu\~no}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Xullo}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{Agosto}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{Setembro}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Outubro}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{Novembro}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Decembro}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Xan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Abr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Mai}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Xu\~n}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Xul}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Ago##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Set##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Out##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{En}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{En}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Editor}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Editores}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{%
      N\textsuperscript{\underline{o}}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{N\'umero}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Edici\'on}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Cap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Cap\'\itulo}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P\'ax##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{P\'axina}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{P\'axs##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{P\'axinas}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Informe t\'ecnico}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Informe t\'ecnico}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, visitado o ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\protect\foreignlanguage{#1}{%
      \ifnumber{##1}{##1\textsuperscript{a}}{##1}}}%
  \def\btxnumerallong##1{\btxnumeralshort{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{b\'ulgaro}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catal\'an}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croata}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{checo}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{dan\'es}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{holand\'es}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finland\'es}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{grego}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebreo}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{h\'ungaro}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{island\'es}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irland\'es}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italiano}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{lat\'\i n}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{noruego}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{noruego}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polaco}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{ruso}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{escoc\'es}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbio}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{espa\~nol}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{sueco}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turco}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{ingl\'es}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{galician}{bibsgalician}
  \fi
  \bbbbaddto{galician}{btxifchangecaseoff}
}
%</galician>
%    \end{macrocode}
%
% \subsubsection{English}
%    \begin{macrocode}
%<*english>
%    \end{macrocode}
%
% The language definition for English is mostly the same as the German
% one. Therefore, it is not described in detail, again.
%
% \begin{macro}{\bibsenglish}
% \changes{1.00}{2005/02/16}{Handle package \texttt{frenchpro}}%
% |french.sty| already defines \cs{bibsenglish}. 
% In this case it has to be redefined, otherwise newly defined.
%    \begin{macrocode}
\makeatletter
\@ifpackageloaded{french}{}{\newcommand\bibsenglish{}}
\makeatother
%    \end{macrocode}
% \changes{0.2}{2003/04/20}{Changed some abbreviations}%
% Bibliographic commands for English.
%    \begin{macrocode}
\renewcommand\bibsenglish[1][english]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}% 
  \def\btxandshort##1{\protect\foreignlanguage{#1}{and}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{and}}%
  \def\btxandcomma##1{,}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{of}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{of}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{editor}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{eds##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{editors}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volume}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{no##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{number}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{edition}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{ch##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{chapter}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{page}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{pp##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{pages}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Master's thesis}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{PhD thesis}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Techn.\ rep##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Technical report}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{January}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{February}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{March}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{May}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{June}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{July}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{August}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{October}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{December}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{May}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{June}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{July}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sept##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Oct##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Editor}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Eds##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Editors}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{No##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Number}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Edition}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Ch##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Chapter}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Page}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Pp##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Pages}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tech.\ Rep##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Technical Report}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, visited on ##1}}%
  \def\btxfnamespaceshort{}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralenglish{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralenglish{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
%    \end{macrocode}
% \changes{0.2}{2003/04/20}{Added language names}%
% Names of all known languages in the current language.
%    \begin{macrocode}
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{english}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{german}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portuguese}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portuguese}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{english}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgarian}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{english}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{french}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catalan}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croatian}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{czech}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{danish}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{dutch}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{english}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finnish}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{french}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{french}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{french}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{german}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{german}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{greek}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebrew}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{hungarian}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{icelandic}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irish}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italian}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latin}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{german}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{german}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norwegian}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{new-norwegian}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polish}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portuguese}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portuguese}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russian}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{scottish}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbian}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spanish}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{swedish}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turkish}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{english}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{english}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Copy the commands to the other languages.
%    \begin{macrocode}
\newcommand\bibsamerican{\bibsenglish[american]}
\newcommand\bibsbritish{\bibsenglish[british]}
\newcommand\bibscanadian{\bibsenglish[canadian]}
\newcommand\bibsUKenglish{\bibsenglish[UKenglish]}
\newcommand\bibsUSenglish{\bibsenglish[USenglish]}
%    \end{macrocode}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage    
  \else
    \bbbbaddto{american}{bibsamerican}
    \bbbbaddto{british}{bibsbritish}
    \bbbbaddto{canadian}{bibscanadian}
    \bbbbaddto{english}{bibsenglish}
    \bbbbaddto{UKenglish}{bibsUKenglish}
    \bbbbaddto{USenglish}{bibsUSenglish}
  \fi
%    \end{macrocode}
% \changes{0.32}{2003/05/06}{Move change of case from bst to sty}%
% Switch on the change of case in titles for all English dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{american}{btxifchangecaseon}
  \bbbbaddto{british}{btxifchangecaseon}
  \bbbbaddto{canadian}{btxifchangecaseon}
  \bbbbaddto{english}{btxifchangecaseon}
  \bbbbaddto{UKenglish}{btxifchangecaseon}
  \bbbbaddto{USenglish}{btxifchangecaseon}
}
%</english>
%    \end{macrocode}
%
% \subsubsection{Italian}
%    \begin{macrocode}
%<*italian>
%    \end{macrocode}
%
% \begin{macro}{\bibsitalian}
% Bibliographic commands for Italian.
% \changes{0.33}{2003/05/22}{Changed some Italian keywords according
%   to the custom-bib file italian.mbs}%
%    \begin{macrocode}
\newcommand\bibsitalian[1][italian]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}% 
  \def\btxandshort##1{\protect\foreignlanguage{#1}{e}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{e}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{della serie}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{nella serie}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{della serie}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{nella serie}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{cur##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{curatore}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{cur##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{curatori}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volume}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{no##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{numero}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{edizione}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{cap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{capitolo}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{pagina}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{pp##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{pagine}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{tesi di laurea}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{tesi di dottorato}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Rapp.\ Tecnico}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Rapporto Tecnico}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{gennaio}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{febbraio}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{marzo}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{aprile}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{maggio}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{giugno}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{luglio}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{agosto}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{settembre}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{ottobre}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{novembre}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{dicembre}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{gen##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{mag##1{}}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{giu##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{lug##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{ago##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{set##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{ott##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{dic##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{Nel}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{Nel}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Cur##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Curatore}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Cur##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Curatori}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{No##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Numero}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Edizione}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Cap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Capitolo}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Pagina}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Pp##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Pagine}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Rap.\ Tecnico}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Rapporto Tecnico}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, accesso a ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
%    \end{macrocode}
% \changes{0.2}{2003/04/20}{Added placeholders for language names}%
% \changes{0.31}{2003/05/01}{Added some language names for Italian}%
% Names of all known languages in the current language.
%    \begin{macrocode}
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{inglese}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{tedesco}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portoghese}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portoghese}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{inglese}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgaro}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{inglese}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{francese}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catalano}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croato}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{ceco}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{danese}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{olandese}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{inglese}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finlandese}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{francese}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{francese}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{francese}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{tedesco}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{tedesco}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{greco}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{ebreo}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{ungherese}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islandese}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irlandese}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italiano}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latino}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{tedesco}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{tedesco}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norvegese}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{nuovo norvegese}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polacco}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portoghese}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portoghese}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russo}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{scozzese}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbo}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spagnolo}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{svedese}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turco}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{inglese}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{inglese}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage    
  \else
    \bbbbaddto{italian}{bibsitalian}
  \fi
%    \end{macrocode}
% \changes{0.32}{2003/05/06}{Move change of case from bst to sty}%
% Switch off the change of case in titles for Italian by
% appending \cs{btxifchangecaseoff} to \cs{extrasitalian}.
%    \begin{macrocode}
  \bbbbaddto{italian}{btxifchangecaseoff}
}
%</italian>
%    \end{macrocode}
%
% \subsubsection{Greek}
%    \begin{macrocode}
%<*greek>
%    \end{macrocode}
%
% The language definition for Greek was provided by Prokopis
% Prokopidis.
%
% \begin{macro}{\bibsgreek}
% Bibliographic commands for Greek.
%    \begin{macrocode}
\newcommand\bibsgreek[1][greek]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{k.'a##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{kai 'alloi}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{kai}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{kai}}%
  \def\btxandcomma##1{,}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{sto}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{sto}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{tou}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{sto}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{tou}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{sto}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{epim##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{epimelht'hc}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{epim##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{epimelht'ec}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{t'om##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{t'omoc}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{ar##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{arijm'oc}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{'ekd##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{'ekdosh}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{kef##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{kef'alaio}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{sel##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{sel'ida}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{sel##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{sel'idec}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Metaptuqiak'h ergas'ia}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{Didaktorik'h diatrib'h}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Teqn.\ anaf##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Teqnik'h anafor'a}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Ianou'arioc}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Febrou'arioc}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{M'artioc}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{Apr'ilioc}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{M'aioc}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Io'unioc}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Io'ulioc}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{A'ugoustoc}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{Sept'embrioc}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Okt'wbrioc}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{No'embrioc}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Dek'embrioc}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Ian##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{M'ar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{M'ai}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Io'un##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Io'ul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{A'ug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sept##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{No'e##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dek##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{Sto}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{Sto}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Epim##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Epimelht'hc}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Epim##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Epimelht'ec}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{T'om##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{T'omoc}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{Ar##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Arijm'oc}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{'Ekd##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{'Ekdosh}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Kef##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Kef'alaio}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{Sel##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Sel'ida}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Sel##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Sel'idec}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Teqn.\ Anaf##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Teqnik'h Anafor'a}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, ep'iskeyh thn ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\protect\foreignlanguage{#1}{%
      \ifnumber{##1}{##1h}{##1}}}%
  \def\btxnumerallong##1{\protect\foreignlanguage{#1}{\ifnumber{##1}{%
        \ifcase##1 ##1h\or pr'wth\or de'uterh\or tr'ith\or t'etarth%
          \or p'empth\or 'ekth\or 'ebdomh\or 'ogdoh\or 'enath\else ##1h\fi
      }{##1}}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
%    \end{macrocode}
% Names of all known languages in the current language.
%    \begin{macrocode}
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{agglik'a}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{germanik'a}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portogalik'a}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portogalik'a}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{agglik'a}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{boulgarik'a}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{agglik'a}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{gallik'a}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalanik'a}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroatik'a}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tseqik'a}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{danik'a}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{ollandik'a}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{agglik'a}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finlandik'a}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{gallik'a}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{gallik'a}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{gallik'a}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{germanik'a}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{germanik'a}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{ellhnik'a}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{ebra"ik'a}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{ouggrik'a}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islandik'a}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irlandik'a}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italik'a}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latinik'a}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{germanik'a}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{germanik'a}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norbhgik'a}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{n'ea norbhgik'a}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polwnik'a}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portogalik'a}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portogalik'a}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{rwsik'a}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{skwts'ezika}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbik'a}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{ispanik'a}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{souhdik'a}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{tourkik'a}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{agglik'a}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{agglik'a}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{greek}{bibsgreek}
  \fi
  \bbbbaddto{greek}{btxifchangecaseoff}
}
%</greek>
%    \end{macrocode}
%
%
% \subsubsection{Norwegian}
%    \begin{macrocode}
%<*norsk>
%    \end{macrocode}
%
% The language definition for Norwegian was provided by Hans Fredrik
% Nordhaug.
%
% \begin{macro}{\bibsnorsk}
% Bibliographic commands for Norsk.
%    \begin{macrocode}
\newcommand\bibsnorsk[1][norsk]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{og}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{og}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{av}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{av}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{redakt\o r}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{redakt\o rer}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{bd##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{bind}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{nr##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{nummer}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{utg##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{utgave}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{kap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{kapittel}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{s##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{side}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{s##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{sider}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Masteroppgave}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{PhD-avhandling}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{tekn.\ rap##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{teknisk rapport}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januar}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februar}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Mars}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Mai}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Juni}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Juli}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{August}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktober}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Desember}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Mai}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Des##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{I}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{I}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Redakt\o r}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Redakt\o rer}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Bd##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Bind}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{Nr##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Nummer}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Utg##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Utgave}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Kap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Kapittel}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{S##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Side}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{S##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Sider}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tekn.\ rap##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Teknisk rapport}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, sjekket: ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
%    \end{macrocode}
% Names of all known languages in the current language.
%    \begin{macrocode}
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgarsk}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalansk}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroatisk}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tsjekkisk}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{dansk}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{nederlandsk}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finsk}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{gr\ae sk}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebraisk}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{ungarsk}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islandsk}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irsk}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italiensk}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latinsk}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norsk}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{nynorsk}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polsk}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russisk}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{skotsk}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbisk}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spansk}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{svensk}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{tyrkisk}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{engelsk}}%
  \fi
}
\newcommand\bibsnorwegian{\bibsnorsk}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage    
  \else
    \bbbbaddto{norsk}{bibsnorsk}
  \fi
%    \end{macrocode}
% Switch off the change of case in titles for Norsk by
% appending \cs{btxifchangecaseoff} to \cs{extrasnorsk}.
%    \begin{macrocode}
  \bbbbaddto{norsk}{btxifchangecaseoff}
}
%</norsk>
%    \end{macrocode}
%
% \subsubsection{French}
% \changes{0.32}{2003/05/06}{Added French language}%
%    \begin{macrocode}
%<*french>
%    \end{macrocode}
%
% \begin{macro}{\bibsfrench}
% \changes{1.00}{2005/02/16}{Handle package \texttt{frenchpro}}%
% |french.sty| already defines \cs{bibsfrench}. 
% In this case it has to be redefined, otherwise newly defined.
%    \begin{macrocode}
\makeatletter
\@ifpackageloaded{french}{}{\newcommand\bibsfrench{}}
\makeatother
%    \end{macrocode}
% Bibliographic commands for French.
%    \begin{macrocode}
\renewcommand\bibsfrench[1][french]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}% 
  \def\btxandshort##1{\protect\foreignlanguage{#1}{et}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{et}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{dans}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{dans}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{dans}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{dans}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{r\'ed##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{r\'edacteur}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{r\'eds##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{r\'edacteurs}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{t##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{tome}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{%
      n\textsuperscript{o}\kern.2em\relax{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{num\'ero}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{\'ed##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{\'edition}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{chap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{chapitre}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{page}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{pages}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{M\'emoire de ma\^itrise}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{Th\`ese de doctorat}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{rap.\ tech##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{rapport technique}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{janvier}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{f\'evrier}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{mars}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{avril}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{mai}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{juin}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{juillet}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{ao\^ut}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{septembre}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{octobre}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{novembre}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{d\'ecembre}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{f\'ev##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{avr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{mai}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{juin}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{juil##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{ao\^ut}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{sept##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{oct##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{d\'ec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{Dans}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{Dans}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{R\'ed##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{R\'edacteur}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{R\'eds##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{R\'edacteurs}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{T##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Tome}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{%
      N\textsuperscript{o}\kern.2em\relax}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Num\'ero}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{\'Ed##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{\'Edition}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Chap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Chapitre}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Page}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Pages}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Rap. tech##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Rapport technique}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, visit\'e le ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfrench{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfrench{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
%    \end{macrocode}
% Names of all known languages in the current language.
%    \begin{macrocode}
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{anglais}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{allemand}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugais}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugais}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{anglais}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgare}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{anglais}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{fran\c{c}ais}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catalan}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croate}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tch\`eque}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{danois}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{n\'eerlandais}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{anglais}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finnois}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{fran\c{c}ais}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{fran\c{c}ais}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{fran\c{c}ais}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{allemand}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{allemand}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{grec}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{h\'ebreu}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{hongrois}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islandais}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irlandais}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italien}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latin}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{allemand}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{allemand}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norv\'egien}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{nouveau
        norv\'egien}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polonais}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugais}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugais}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russe}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{\'ecossais}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbe}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{espagnol}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{su\'edois}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turc}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{anglais}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{anglais}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Copy the commands to the other languages.
%    \begin{macrocode}
\newcommand\bibsfrancais{\bibsfrench[francais]}
\newcommand\bibsfrenchb{\bibsfrench[frenchb]}
\newcommand\bibscanadien{\bibsfrench[canadien]}
%    \end{macrocode}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage    
  \else
    \bbbbaddto{francais}{bibsfrancais}
    \bbbbaddto{french}{bibsfrench}
    \bbbbaddto{frenchb}{bibsfrenchb}
    \bbbbaddto{canadien}{bibscanadien}
  \fi
%    \end{macrocode}
% Switch on the change of case in titles for all French dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{francais}{btxifchangecaseoff}
  \bbbbaddto{french}{btxifchangecaseoff}
  \bbbbaddto{frenchb}{btxifchangecaseoff}
  \bbbbaddto{canadien}{btxifchangecaseoff}
}
%    \end{macrocode}
% \begin{macro}{\btxnumeralfrench}
%    \begin{macrocode}
\makeatletter
\DeclareRobustCommand\btxnumeralfrench[2]{%
  \foreignlanguage{#1}{%
    \ifnumber{#2}{%
      \expandafter\btx@parsenum#2\@empty\@empty\@empty
      \btxnumeralfont{%
        \ifx\btx@digitb\@empty
          \ifcase\btx@digita \ieme\or \iere\else \ieme\fi
        \else
          \ifnum\btx@digita=1
            th%
          \else
            \ifcase\btx@digitb \ieme\or \iere\else \ieme\fi
          \fi
        \fi
        }%
    }{#2}%
  }%
}
\makeatother
%    \end{macrocode}
% \end{macro}
% \changes{0.43}{2004/01/06}{Warn if using \texttt{french} language}%
% \changes{0.44}{2004/01/06}{Only warn if babel version is too old}%
% \changes{1.00}{2005/02/16}{Remove warning for old babel package with
%   \texttt{french} language}%
%    \begin{macrocode}
%</french>
%    \end{macrocode}
%
% \subsubsection{Russian}
%    \begin{macrocode}
%<*russian>
%    \end{macrocode}
%
% \begin{macro}{\bibsrussian}
% Bibliographic commands for Russian.
%    \begin{macrocode}
\newcommand\bibsrussian[1][russian]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{\IeC {\cyri }~\IeC
      {\cyrd }\IeC {\cyrr }.##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{\IeC {\cyri }~\IeC
      {\cyrd }\IeC {\cyrr }\IeC {\cyru }\IeC {\cyrg }\IeC {\cyri }\IeC
      {\cyre }}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{\IeC {\cyri }}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{\IeC {\cyri }}}%
  \def\btxandcomma##1{,}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrv }}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrv }}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{\IeC {\cyri
      }\IeC {\cyrz }}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrv }}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{\IeC {\cyri
      }\IeC {\cyrz }}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{\IeC {\cyrv }}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrr
      }\IeC {\cyre }\IeC {\cyrd }.##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrr }\IeC
      {\cyre }\IeC {\cyrd }\IeC {\cyra }\IeC {\cyrk }\IeC {\cyrt }\IeC
      {\cyro }\IeC {\cyrr }}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrr
      }\IeC {\cyre }\IeC {\cyrd }.##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{\IeC {\cyrr
      }\IeC {\cyre }\IeC {\cyrd }\IeC {\cyra }\IeC {\cyrk }\IeC {\cyrt
      }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrery }}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrt }.##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{\IeC {\cyrt }\IeC
      {\cyro }\IeC {\cyrm }}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{%
      n\textsuperscript{\underline{o}}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrn }\IeC
      {\cyro }\IeC {\cyrm }\IeC {\cyre }\IeC {\cyrr }}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrr
      }\IeC {\cyre }\IeC {\cyrd }.##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrr
      }\IeC {\cyre }\IeC {\cyrd }\IeC {\cyra }\IeC {\cyrk }\IeC {\cyrc
      }\IeC {\cyri }\IeC {\cyrya }}}% 
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{\IeC {\cyrg
      }\IeC {\cyrl }.##1{}}}% 
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrg
      }\IeC {\cyrl }\IeC {\cyra }\IeC {\cyrv }\IeC {\cyra }}}% 
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrs }\IeC
      {\cyrt }\IeC {\cyrr }.##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{\IeC {\cyrs }\IeC
      {\cyrt }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyri }\IeC
      {\cyrc }\IeC {\cyra }}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrs }\IeC
      {\cyrt }\IeC {\cyrr }.##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{\IeC {\cyrs }\IeC
      {\cyrt }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyri }\IeC
      {\cyrc }\IeC {\cyrery }}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{\IeC {\CYRD }\IeC
      {\cyri }\IeC {\cyrp }\IeC {\cyrl }\IeC {\cyro }\IeC {\cyrm }
      \IeC {\cyrm }\IeC {\cyra }\IeC {\cyrg }\IeC {\cyri }\IeC {\cyrs
      }\IeC {\cyrt }\IeC {\cyrr }\IeC {\cyra }}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{\IeC {\CYRK }\IeC
      {\cyra }\IeC {\cyrn }\IeC {\cyrd }\IeC {\cyri }\IeC {\cyrd }\IeC
      {\cyra }\IeC {\cyrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyra }\IeC
      {\cyrya } \IeC {\cyrd }\IeC {\cyri }\IeC {\cyrs }\IeC {\cyrs
      }\IeC {\cyre }\IeC {\cyrr }\IeC {\cyrt }\IeC {\cyra }\IeC {\cyrc
      }\IeC {\cyri }\IeC {\cyrya }}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrt
      }\IeC {\cyre }\IeC {\cyrh }.\ \IeC {\cyro }\IeC {\cyrt }\IeC
      {\cyrch }\IeC {\cyre }\IeC {\cyrt }##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{\IeC {\cyrt
      }\IeC {\cyre }\IeC {\cyrh }\IeC {\cyrn }\IeC {\cyri }\IeC
      {\cyrch }\IeC {\cyre }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri
      }\IeC {\cyrishrt } \IeC {\cyro }\IeC {\cyrt }\IeC {\cyrch }\IeC
      {\cyre }\IeC {\cyrt }}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrya
      }\IeC {\cyrn }\IeC {\cyrv }\IeC {\cyra }\IeC {\cyrr }\IeC
      {\cyrsftsn }}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{\IeC {\cyrf }\IeC
      {\cyre }\IeC {\cyrv }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrl }\IeC
      {\cyrsftsn }}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrm }\IeC
      {\cyra }\IeC {\cyrr }\IeC {\cyrt }}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{\IeC {\cyra }\IeC
      {\cyrp }\IeC {\cyrr }\IeC {\cyre }\IeC {\cyrl }\IeC {\cyrsftsn
      }}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{\IeC {\cyrm }\IeC
      {\cyra }\IeC {\cyrishrt }}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{\IeC {\cyri }\IeC
      {\cyryu }\IeC {\cyrn }\IeC {\cyrsftsn }}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{\IeC {\cyri }\IeC
      {\cyryu }\IeC {\cyrl }\IeC {\cyrsftsn }}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{\IeC {\cyra }\IeC
      {\cyrv }\IeC {\cyrg }\IeC {\cyru }\IeC {\cyrs }\IeC {\cyrt }}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{\IeC {\cyrs }\IeC
      {\cyre }\IeC {\cyrn }\IeC {\cyrt }\IeC {\cyrya }\IeC {\cyrb
      }\IeC {\cyrr }\IeC {\cyrsftsn }}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{\IeC {\cyro }\IeC
      {\cyrk }\IeC {\cyrt }\IeC {\cyrya }\IeC {\cyrb }\IeC {\cyrr
      }\IeC {\cyrsftsn }}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{\IeC {\cyrn }\IeC
      {\cyro }\IeC {\cyrya }\IeC {\cyrb }\IeC {\cyrr }\IeC {\cyrsftsn
      }}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{\IeC {\cyrd }\IeC
      {\cyre }\IeC {\cyrk }\IeC {\cyra }\IeC {\cyrb }\IeC {\cyrr }\IeC
      {\cyrsftsn }}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrya
      }\IeC {\cyrn }\IeC {\cyrv }.##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrf
      }\IeC {\cyre }\IeC {\cyrv }.##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrm
      }\IeC {\cyra }\IeC {\cyrr }.##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{\IeC {\cyra
      }\IeC {\cyrp }\IeC {\cyrr }.##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrm
      }\IeC {\cyra }\IeC {\cyrishrt }}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{\IeC {\cyri
      }\IeC {\cyryu }\IeC {\cyrn }\IeC {\cyrsftsn }##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{\IeC {\cyri
      }\IeC {\cyryu }\IeC {\cyrl }\IeC {\cyrsftsn }##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{\IeC {\cyra
      }\IeC {\cyrv }\IeC {\cyrg }.##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrs
      }\IeC {\cyre }\IeC {\cyrn }.##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{\IeC {\cyro
      }\IeC {\cyrk }\IeC {\cyrt }.##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrn
      }\IeC {\cyro }\IeC {\cyrya }.##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{\IeC {\cyrd
      }\IeC {\cyre }\IeC {\cyrk }.##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{\IeC {\CYRV }}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRV }}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRR
      }\IeC {\cyre }\IeC {\cyrd }.##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{\IeC {\CYRR }\IeC
      {\cyre }\IeC {\cyrd }\IeC {\cyra }\IeC {\cyrk }\IeC {\cyrt }\IeC
      {\cyro }\IeC {\cyrr }}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRR
      }\IeC {\cyre }\IeC {\cyrd }.##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{\IeC {\CYRR
      }\IeC {\cyre }\IeC {\cyrd }\IeC {\cyra }\IeC {\cyrk }\IeC {\cyrt
      }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrery }}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRT }.##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{\IeC {\CYRT }\IeC
      {\cyro }\IeC {\cyrm }}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{%
      N\textsuperscript{\underline{o}}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{\IeC {\CYRN }\IeC
      {\cyro }\IeC {\cyrm }\IeC {\cyre }\IeC {\cyrr }}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRR
      }\IeC {\cyre }\IeC {\cyrd }.##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{\IeC {\CYRR
      }\IeC {\cyre }\IeC {\cyrd }\IeC {\cyra }\IeC {\cyrk }\IeC {\cyrc
      }\IeC {\cyri }\IeC {\cyrya }}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{\IeC {\CYRG
      }\IeC {\cyrl }.##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{\IeC {\CYRG
      }\IeC {\cyrl }\IeC {\cyra }\IeC {\cyrv }\IeC {\cyra }}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRS }\IeC
      {\cyrt }\IeC {\cyrr }.##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{\IeC {\CYRS }\IeC
      {\cyrt }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyri }\IeC
      {\cyrc }\IeC {\cyra }}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRS }\IeC
      {\cyrt }\IeC {\cyrr }.##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{\IeC {\CYRS }\IeC
      {\cyrt }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyri }\IeC
      {\cyrc }\IeC {\cyrery }}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{\IeC {\CYRT
      }\IeC {\cyre }\IeC {\cyrh }.\ \IeC {\cyro }\IeC {\cyrt }\IeC
      {\cyrch }\IeC {\cyre }\IeC {\cyrt }##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{\IeC {\CYRT
      }\IeC {\cyre }\IeC {\cyrh }\IeC {\cyrn }\IeC {\cyri }\IeC
      {\cyrch }\IeC {\cyre }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri
      }\IeC {\cyrishrt } \IeC {\cyro }\IeC {\cyrt }\IeC {\cyrch }\IeC
      {\cyre }\IeC {\cyrt }}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, \IeC {\cyrp
      }\IeC {\cyro }\IeC {\cyrs }\IeC {\cyre }\IeC {\cyrshch }\IeC
      {\cyre }\IeC {\cyrn }\IeC {\cyro } ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{\IeC
        {\cyra }\IeC {\cyrn }\IeC {\cyrg }\IeC {\cyrl }\IeC {\cyri
        }\IeC {\cyrishrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{\IeC
        {\cyra }\IeC {\cyrv }\IeC {\cyrs }\IeC {\cyrt }\IeC {\cyrr
        }\IeC {\cyri }\IeC {\cyrishrt }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{\IeC
        {\cyrp }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrt }\IeC {\cyru
        }\IeC {\cyrg }\IeC {\cyra }\IeC {\cyrl }\IeC {\cyrsftsn }\IeC
        {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{\IeC
        {\cyrp }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrt }\IeC {\cyru
        }\IeC {\cyrg }\IeC {\cyra }\IeC {\cyrl }\IeC {\cyrsftsn }\IeC
        {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{\IeC
        {\cyra }\IeC {\cyrn }\IeC {\cyrg }\IeC {\cyrl }\IeC {\cyri
        }\IeC {\cyrishrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{\IeC
        {\cyrb }\IeC {\cyro }\IeC {\cyrl }\IeC {\cyrg }\IeC {\cyra
        }\IeC {\cyrr }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{\IeC
        {\cyra }\IeC {\cyrn }\IeC {\cyrg }\IeC {\cyrl }\IeC {\cyri
        }\IeC {\cyrishrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{\IeC
        {\cyrf }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyrc
        }\IeC {\cyru }\IeC {\cyrz }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{\IeC
        {\cyrk }\IeC {\cyra }\IeC {\cyrt }\IeC {\cyra }\IeC {\cyrl
        }\IeC {\cyro }\IeC {\cyrn }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{\IeC
        {\cyrh }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrv }\IeC {\cyra
        }\IeC {\cyrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{\IeC
        {\cyrch }\IeC {\cyre }\IeC {\cyrsh }\IeC {\cyrs }\IeC {\cyrk
        }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{\IeC
        {\cyrd }\IeC {\cyra }\IeC {\cyrt }\IeC {\cyrs }\IeC {\cyrk
        }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{\IeC {\cyrg
        }\IeC {\cyro }\IeC {\cyrl }\IeC {\cyrl }\IeC {\cyra }\IeC
        {\cyrn }\IeC {\cyrd }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri
        }\IeC {\cyrishrt }}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{\IeC
        {\cyra }\IeC {\cyrn }\IeC {\cyrg }\IeC {\cyrl }\IeC {\cyri
        }\IeC {\cyrishrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{\IeC
        {\cyrerev }\IeC {\cyrs }\IeC {\cyrp }\IeC {\cyre }\IeC {\cyrr
        }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyrt }\IeC {\cyro }}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{\IeC
        {\cyrf }\IeC {\cyri }\IeC {\cyrn }\IeC {\cyrs }\IeC {\cyrk
        }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamefranceis{\protect\foreignlanguage{#1}{\IeC
        {\cyrf }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyrc
        }\IeC {\cyru }\IeC {\cyrz }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{\IeC
        {\cyrf }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyrc
        }\IeC {\cyru }\IeC {\cyrz }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{\IeC
        {\cyrf }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyrn }\IeC {\cyrc
        }\IeC {\cyru }\IeC {\cyrz }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{\IeC
        {\cyrn }\IeC {\cyre }\IeC {\cyrm }\IeC {\cyre }\IeC {\cyrc
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{\IeC
        {\cyrn }\IeC {\cyre }\IeC {\cyrm }\IeC {\cyre }\IeC {\cyrc
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{\IeC {\cyrg
        }\IeC {\cyrr }\IeC {\cyre }\IeC {\cyrch }\IeC {\cyre }\IeC
        {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{\IeC
        {\cyre }\IeC {\cyrv }\IeC {\cyrr }\IeC {\cyre }\IeC {\cyrishrt
        }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{\IeC
        {\cyrv }\IeC {\cyre }\IeC {\cyrn }\IeC {\cyrg }\IeC {\cyre
        }\IeC {\cyrr }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{\IeC
        {\cyri }\IeC {\cyrs }\IeC {\cyrl }\IeC {\cyra }\IeC {\cyrn
        }\IeC {\cyrd }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{\IeC {\cyri
        }\IeC {\cyrr }\IeC {\cyrl }\IeC {\cyra }\IeC {\cyrn }\IeC
        {\cyrd }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt
        }}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{\IeC
        {\cyri }\IeC {\cyrt }\IeC {\cyra }\IeC {\cyrl }\IeC {\cyrsftsn
        }\IeC {\cyrya }\IeC {\cyrn }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{\IeC {\cyrl
        }\IeC {\cyra }\IeC {\cyrt }\IeC {\cyri }\IeC {\cyrn }\IeC
        {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{\IeC
        {\cyrn }\IeC {\cyre }\IeC {\cyrm }\IeC {\cyre }\IeC {\cyrc
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{\IeC
        {\cyrn }\IeC {\cyre }\IeC {\cyrm }\IeC {\cyre }\IeC {\cyrc
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{\IeC {\cyrn
        }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrv }\IeC {\cyre }\IeC
        {\cyrzh }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{\IeC
        {\cyrn }\IeC {\cyro }\IeC {\cyrv }\IeC {\cyro }\IeC {\cyrn
        }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrv }\IeC {\cyre }\IeC
        {\cyrzh }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{\IeC
        {\cyrp }\IeC {\cyro }\IeC {\cyrl }\IeC {\cyrsftsn }\IeC {\cyrs
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{\IeC
        {\cyrp }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrt }\IeC {\cyru
        }\IeC {\cyrg }\IeC {\cyra }\IeC {\cyrl }\IeC {\cyrsftsn }\IeC
        {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{\IeC
        {\cyrp }\IeC {\cyro }\IeC {\cyrr }\IeC {\cyrt }\IeC {\cyru
        }\IeC {\cyrg }\IeC {\cyra }\IeC {\cyrl }\IeC {\cyrsftsn }\IeC
        {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{\IeC
        {\cyrr }\IeC {\cyru }\IeC {\cyrs }\IeC {\cyrs }\IeC {\cyrk
        }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{\IeC
        {\cyrsh }\IeC {\cyro }\IeC {\cyrt }\IeC {\cyrl }\IeC {\cyra
        }\IeC {\cyrn }\IeC {\cyrd }\IeC {\cyrs }\IeC {\cyrk }\IeC
        {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{\IeC
        {\cyrs }\IeC {\cyre }\IeC {\cyrr }\IeC {\cyrb }\IeC {\cyrs
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{\IeC
        {\cyri }\IeC {\cyrs }\IeC {\cyrp }\IeC {\cyra }\IeC {\cyrn
        }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{\IeC
        {\cyrsh }\IeC {\cyrv }\IeC {\cyre }\IeC {\cyrd }\IeC {\cyrs
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{\IeC
        {\cyrt }\IeC {\cyru }\IeC {\cyrr }\IeC {\cyre }\IeC {\cyrc
        }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrishrt }}}%
    \def\btxlanguagenameukrainian{\protect\foreignlanguage{#1}{\IeC
        {\cyru }\IeC {\cyrk }\IeC {\cyrr }\IeC {\cyra }\IeC {\cyri
        }\IeC {\cyrn }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{\IeC
        {\cyra }\IeC {\cyrn }\IeC {\cyrg }\IeC {\cyrl }\IeC {\cyri
        }\IeC {\cyrishrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{\IeC
        {\cyra }\IeC {\cyrn }\IeC {\cyrg }\IeC {\cyrl }\IeC {\cyri
        }\IeC {\cyrishrt }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC
        {\cyrishrt }}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Copy the commands to the other languages.
%    \begin{macrocode}
\newcommand\bibsrussianb{\bibsrussian[russianb]}
%    \end{macrocode}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage    
  \else
    \bbbbaddto{russianb}{bibrussianb}
    \bbbbaddto{russian}{bibsrussian}
  \fi
%    \end{macrocode}
% Switch off the change of case in titles for all Russian dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{russianb}{btxifchangecaseoff}
  \bbbbaddto{russian}{btxifchangecaseoff}
}
%</russian>
%    \end{macrocode}
%
% \subsubsection{Spanish}
% \changes{0.33}{2003/05/22}{Added Spanish language}%
%    \begin{macrocode}
%<*spanish>
%    \end{macrocode}
%
% The language definition for Spanish was provided by V{\'\i}ctor
% Lua{\~n}a and slightly changed by me according to |spanish.mbs|
% (custom-bib package).
%
% \begin{macro}{\bibsspanish}
% Bibliographic commands for Spanish.
%    \begin{macrocode}
\newcommand\bibsspanish[1][spanish]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{y~cols##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{y~colaboradores}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{y}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{y}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{editor}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{eds##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{editores}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volumen}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{%
      n\textsuperscript{\underline{o}}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{n\'umero}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{edici{\'o}n}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{cap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{cap{\'\i}tulo}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p\'ag##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{p\'agina}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{p\'ags##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{p\'aginas}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Tesis de Licenciatura}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{Tesis de Doctorado}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Informe t\'ecnico##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Informe t\'ecnico}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Enero}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Febrero}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Marzo}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{Abril}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Mayo}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Junio}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Julio}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{Agosto}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{Septiembre}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Octubre}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{Noviembre}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Deciembre}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Ene##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Abr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{May}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Ago##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Oct##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dic##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{En}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{En}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Editor}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Editores}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volumen}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{%
      N\textsuperscript{\underline{o}}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{N\'umero}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Edici\'on}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Cap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Cap\'\itulo}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P\'ag##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{P\'agina}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{P\'ags##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{P\'aginas}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Informe t\'ecnico}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Informe t\'ecnico}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, visitado el ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\protect\foreignlanguage{#1}{%
      \ifnumber{##1}{##1\textsuperscript{\underline a}}{##1}}}%
%  \def\btxnumeralshort##1{\ifnumber{##1}{\protect\foreignlanguage{#1}{%
%        ##1\ifcase##1 \ieme\or \iere\else \ieme\fi}}{##1}}%
  \def\btxnumerallong##1{\btxnumeralshort{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{b\'ulgaro}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catalan}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croata}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{checo}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{dan\'es}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{holand\'es}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finland\'es}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{franc\'es}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{griego}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebreo}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{h\'ungaro}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{island\'es}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irland\'es}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italiano}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{lat\'\i n}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{alem\'an}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{noruego}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{noruego}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polaco}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugu\'es}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{ruso}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{escoc\'es}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbio}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{espa\~nol}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{sueco}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turco}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{ingl\'es}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{ingl\'es}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Copy the commands to the other languages.
%    \begin{macrocode}
\newcommand\bibsmexican[1][mexican]{%
  \bibsspanish[mexican]%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Tesis de Maestr{\'\i}a}}%
}
%    \end{macrocode}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{spanish}{bibsspanish}
    \bbbbaddto{mexican}{bibsmexican}
  \fi
  \bbbbaddto{spanish}{btxifchangecaseoff}
  \bbbbaddto{mexican}{btxifchangecaseoff}
}
%</spanish>
%    \end{macrocode}
%
% \subsubsection{Danish}
% \changes{0.33}{2003/05/22}{Added Danish language}%
%    \begin{macrocode}
%<*danish>
%    \end{macrocode}
%
% \begin{macro}{\bibsdanish}
% Bibliographic commands for Danish.
%    \begin{macrocode}
\newcommand\bibsdanish[1][danish]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{og}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{og}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{af}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{af}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{redakt\o r}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{redakt\o rer}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{bd##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{bind}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{nr##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{nummer}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{udg##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{udgave}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{kap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{kapitel}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{s##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{side}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{pp##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{sider}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Speciale}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{ph.d.-afhandling}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Tekn.\ rap##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Teknisk rapport}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januar}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februar}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Marts}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Maj}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Juni}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Juli}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{August}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktober}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{December}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Maj}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{I}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{I}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Redakt\o r}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Redakt\o rer}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Bd##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Bind}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{Nr##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Nummer}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Udg##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Udgave}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Kap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Kapitel}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{S##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Side}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Pp##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Sider}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tekn.\ rap##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Teknisk rapport}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, bes\o gt den ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgarsk}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalansk}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroatisk}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tjekkisk}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{dansk}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{nederlandsk}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finsk}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{fransk}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{gr\ae sk}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebraisk}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{ungarsk}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islandsk}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irsk}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italiensk}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latinsk}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{tysk}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norsk}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{nynorsk}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polsk}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugisisk}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russisk}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{skotsk}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbisk}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spansk}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{svensk}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{tyrkisk}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{engelsk}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{engelsk}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{danish}{bibsdanish}
  \fi
  \bbbbaddto{danish}{btxifchangecaseoff}
}
%</danish>
%    \end{macrocode}
%
% \subsubsection{Finnish}
% \changes{0.45}{2004/04/21}{Added Finnish language}%
%    \begin{macrocode}
%<*finnish>
%    \end{macrocode}
%
% \begin{macro}{\bibsfinnish}
% Bibliographic commands for Finnish.
%    \begin{macrocode}
\newcommand\bibsfinnish[1][finnish]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{ja}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{ja}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{teoksessa}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{teoksessa}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{sarjassa}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{sarjassa}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{sarjassa}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{sarjassa}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{toim##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{toimittaja}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{toim##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{toimittajat}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{nide}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{nide}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{nro##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{numero}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{painos}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{l##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{luku}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{s##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{sivu}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{ss##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{sivut}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Pro Gradu -ty\"o}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{v\"ait\"oskirja}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{tekn.\ rap##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{tekninen raportti}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{tammikuu}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{helmikuu}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{maaliskuu}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{huhtikuu}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{toukokuu}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{kes\"akuu}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{hein\"akuu}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{elokuu}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{syyskuu}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{lokakuu}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{marraskuu}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{joulukuu}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{tam##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{hel##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{maa##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{huh##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{tou##1{}}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{kes##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{hei##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{elo##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{syy##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{lok##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{mar##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{jou##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{Teoksessa}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{Teoksessa}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Toim##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Toimittaja}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Toim##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Toimittajat}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Nide##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Nide}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{Nro##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Numero}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Painos}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{L##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Luku}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{S##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Sivu}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Ss##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Sivut}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tekn.\ rap##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Tekninen raportti}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, vierailtu ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{englanti}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{saksa}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugali}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugali}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{englanti}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgaria}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{englanti}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{ranska}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalaani}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroaati}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tsekki}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{tanska}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{hollanti}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{englanti}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{suomi}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{ranska}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{ranska}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{ranska}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{saksa}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{saksa}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{kreikka}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{heprea}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{unkari}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islanti}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{iiri}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italia}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latina}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{saksa}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{saksa}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norja}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{uusnorja}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{puola}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugali}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugali}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{ven\"j\"a}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{skotti}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbi}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{espanja}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{ruotsi}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turkki}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{englanti}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{englanti}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{finnish}{bibsfinnish}
  \fi
%    \end{macrocode}
% Switch off the change of case in titles by appending
% \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{finnish}{btxifchangecaseoff}
}
%</finnish>
%    \end{macrocode}
%
% \subsubsection{Esperanto}
% \changes{0.45}{2004/04/21}{Added Esperanto language}%
%    \begin{macrocode}
%<*esperanto>
%    \end{macrocode}
%
% \begin{macro}{\bibsesperanto}
% Bibliographic commands for Esperanto.
%    \begin{macrocode}
\newcommand\bibsesperanto[1][esperanto]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{k~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{kaj~aliaj}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{k}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{kaj}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{redaktoro}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{red-oj##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{redaktoroj}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volumo}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{no##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{nombro}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{redakcio}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{\^c##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{\^capitro}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{pa\^go}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{pp##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{pa\^goj}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{magistra disertacio}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{doktora disertacio}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Tekn.\ rap##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Teknika raporto}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januaro}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februaro}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Marco}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{Aprilo}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Majo}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Junio}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Julio}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{A\u{u}gusto}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{Septembro}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktobro}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{Novembro}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Decembro}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Maj##1{}}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sept##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{En}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{En}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Redaktoro}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Redaktoroj}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volumo}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{No##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Nombro}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Redakcio}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{\^C##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{\^Capitro}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Pa\^go}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Pp##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Pa\^goj}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tekn.\ Rap##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Teknika Raporto}}%
%  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, ?? ##1}}%
  \def\btxurldatecomment##1{\PackageError{babelbib}{Comment for
      urldate in Esperanto undefined. Please send the translation for 
      'visited on' to harald.harders@tu-bs.de}{} [##1]}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{angla}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{germana}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugala}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugala}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{angla}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgara}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{angla}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{franca}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalana}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroata}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{\^ce\^ha}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{dana}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{nederlanda}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{angla}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finna}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{franca}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{franca}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{franca}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{germana}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{germana}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{greka}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebrea}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{hungara}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islanda}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irlanda}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{itala}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latino}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{germana}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{germana}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norvega}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{nov-norvega}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{pola}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugala}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugala}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{rusa}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{skota}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serba}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{hispana}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{sveda}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turka}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{angla}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{angla}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{esperanto}{bibsesperanto}
  \fi
%    \end{macrocode}
% Switch off the change of case in titles by appending
% \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{esperanto}{btxifchangecaseoff}
}
%</esperanto>
%    \end{macrocode}
%
% \subsubsection{Portuguese}
% \changes{0.33}{2003/05/22}{Added Portuguese language}%
% \changes{1.02}{2005/04/15}{Language Portuguese completed}%
% \changes{1.10}{2005/04/24}{Bug in Portuguese removed}%
%    \begin{macrocode}
%<*portuguese>
%    \end{macrocode}
%
% \begin{macro}{\bibsportuguese}
% Bibliographic commands for Portuguese.
%    \begin{macrocode}
\newcommand\bibsportuguese[1][portuguese]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}% 
  \def\btxandshort##1{\protect\foreignlanguage{#1}{e}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{e}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{de}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{editor}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{eds##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{editores}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volume}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{%
      n\textsuperscript{\underline{o}}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{n\'umero}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{edi\c c\~ao}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{cap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{cap\'\i tulo}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p\'ag##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{p\'agina}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{p\'ags##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{p\'aginas}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Tese de Mestrado}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{Tese de Doutoramento}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Rel.\ T\'ec##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Relat\'orio T\'ecnico}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Janeiro}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Fevereiro}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Mar\c co}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{Abril}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Maio}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Junho}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Julho}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{Agosto}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{Setembro}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Outubro}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{Novembro}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Dezembro}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Fev##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Maio}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Ago##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Set##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Out##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dez##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Editor}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Eds##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Editores}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{%
      N\textsuperscript{\underline{o}}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{N\'umero}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Edi\c c\~ao}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Cap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Cap\'{\i}tulo}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P\'ag##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{P\'agina}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{P\'ags##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{P\'aginas}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Rel.\ T\'ec##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Relat\'orio T\'ecnico}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, acedido em ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\protect\foreignlanguage{#1}{%
      \ifnumber{##1}{##1\textsuperscript{\underline a}}{##1}}}%
  \def\btxnumerallong##1{\btxnumeralshort{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{ingl\^es}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{alem\~ao}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugu\^es}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugu\^es}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{ingl\^es}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{b\'ulgaro}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{ingl\^es}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{franc\^es}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catal\~ao}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croata}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{checo}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{dinamarqu\^es}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{holand\^es}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{ingl\^es}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finland\^es}}%
    \def\btxlanguagenamefranceis{\protect\foreignlanguage{#1}{franc\^es}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{franc\^es}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{franc\^es}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{\alem\~ao}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{\alem\~ao}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{grego}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebreu}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{h\'ungaro}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{island\^es}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irland\^es}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italiano}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latim}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{\alem\~ao}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{\alem\~ao}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{noruegu\^es}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{neo-noruegu\^es}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polaco}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugu\^es}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugu\^es}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russio}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{escoc\^es}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{s\'ervio}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{espanhol}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{sueco}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turco}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{ingl\^es}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{ingl\^es}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Copy the commands to the other languages.
%    \begin{macrocode}
\newcommand\bibsportuges[1][portuges]{\bibsportuguese[#1]}
\newcommand\bibsbrazil[1][brazil]{\bibsbrazilian[#1]}
\newcommand\bibsbrazilian[1][brazilian]{%
  \bibsportuguese[#1]%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{janeiro}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{fevereiro}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{mar\c co}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{abril}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{maio}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{junho}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{julho}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{agosto}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{setembro}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{outubro}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{novembro}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{dezembro}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{fev##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{mar##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{maio}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{ago##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{set##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{out##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{dez##1{}}}%
}
%    \end{macrocode}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage    
  \else
    \bbbbaddto{brazil}{bibsbrazil}
    \bbbbaddto{brazilian}{bibsbrazilian}
    \bbbbaddto{portuges}{bibsportuges}
    \bbbbaddto{portuguese}{bibsportuguese}
  \fi
%    \end{macrocode}
% Switch off the change of case in titles for all Portuguese dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{brazil}{btxifchangecaseoff}
  \bbbbaddto{brazilian}{btxifchangecaseoff}
  \bbbbaddto{portuges}{btxifchangecaseoff}
  \bbbbaddto{portuguese}{btxifchangecaseoff}
}
%</portuguese>
%    \end{macrocode}
%
% \subsubsection{Dutch}
% \changes{0.33}{2003/05/22}{Added Dutch language}%
%    \begin{macrocode}
%<*dutch>
%    \end{macrocode}
%
% \begin{macro}{\bibsdutch}
% Bibliographic commands for Dutch.
%    \begin{macrocode}
\newcommand\bibsdutch[1][dutch]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{en anderen}}% 
  \def\btxandshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxandcomma##1{,}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{van}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{van}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{redactie}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{redactie}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volume}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{nr##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{nummer}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{druk}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{uitgave}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{hfdst##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{hoofdstuk}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{pag##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{pagina}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{pag##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{pagina's}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{scriptie}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{proefschrift}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Tech.\ Rapp##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Technisch Rapport}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januari}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februari}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Maart}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Mei}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Juni}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Juli}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{Augustus}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktober}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{December}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mrt}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Mei}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Redactie}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Redactie}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{Nr##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Nummer}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Druk}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Uitgave}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Hfdst##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Hoofdstuk}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{Pag##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Pagina}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Pags##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Pagina's}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tech.\ Rapp##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Technisch Rapport}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, bezocht op ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{engels}}%
 %   \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{german}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugees}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugees}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{engels}}%
 %   \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgarian}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{engels}}%
 %   \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{french}}%
 %   \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catalan}}%
 %   \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croatian}}%
 %   \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{czech}}%
 %   \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{d\"anisch}}%
 %   \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{dutch}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{engels}}%
 %   \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
 %   \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finnish}}%
 %   \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{french}}%
 %   \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{french}}%
 %   \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{french}}%
 %   \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{german}}%
 %   \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{german}}%
 %   \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{greek}}%
 %   \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebrew}}%
 %   \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{hungarian}}%
 %   \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{icelandic}}%
 %   \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irish}}%
 %   \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italian}}%
 %   \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latin}}%
 %   \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{german}}%
 %   \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{german}}%
 %   \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norwegian}}%
 %   \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{new-norwegian}}%
 %   \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polish}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugees}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugees}}%
 %   \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russian}}%
 %   \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{scottish}}%
 %   \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbian}}%
 %   \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spanish}}%
 %   \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{swedish}}%
 %   \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turkish}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{engels}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{engels}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage    
  \else
    \bbbbaddto{dutch}{bibsdutch}
  \fi
%    \end{macrocode}
% Switch on the change of case in titles for all Dutch dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{dutch}{btxifchangecaseoff}
}
%</dutch>
%    \end{macrocode}
%
% \subsubsection{Swedish}
% \changes{0.33}{2003/05/22}{Added Swedish language}%
% \changes{0.41}{2003/11/03}{Corrected swedish (by Hans Fredrik Nordhaug)}%
%    \begin{macrocode}
%<*swedish>
%    \end{macrocode}
%
% The language definition for Swedish was provided by Hans Fredrik
% Nordhaug.
%
% \begin{macro}{\bibsswedish}
% Bibliographic commands for Swedish.
%    \begin{macrocode}
\newcommand\bibsswedish[1][swedish]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{och}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{och}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{av}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{av}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{redakt\"or}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{redakt\"orer}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volym}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{nr##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{nummer}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{utg}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{utg\aa va}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{kap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{kapitel}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{s##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{sida}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{s##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{sidor}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{scriptie}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{proefschrift}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Tech.\ Rapp##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Technisch Rapport}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januari}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februari}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Mars}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Maj}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Juni}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Juli}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{Augusti}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktober}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{December}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mar}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Maj}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Dec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{I}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{I}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Redactie}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Redactie}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{Nr##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Nummer}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Druk}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Utgave}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Hfdst##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Hoofdstuk}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{Pag##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Pagina}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Pags##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Pagina's}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tech.\ Rapp##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Technisch Rapport}}%
%  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, ?? ##1}}%
  \def\btxurldatecomment##1{\PackageError{babelbib}{Comment for
      urldate in Swedish undefined. Please send the translation for 
      'visited on' to harald.harders@tu-bs.de}{} [##1]}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{engelska}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{tyska}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugisiska}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugisiska}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{engelska}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgariska}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{engelska}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{franska}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalanska}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroatiska}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tjeckiska}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{danska}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{nederl\"andska}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{engelska}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finska}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{franska}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{franska}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{franska}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{tyska}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{tyska}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{grekiska}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebreiska}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{ungerska}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{isl\"andska}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{iriska}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italienska}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latin}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{tyska}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{tyska}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norska}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{nynorska}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polska}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugisiska}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugisiska}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{ryska}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{skotsks}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbiska}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spanska}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{svenska}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turkiska}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{engelska}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{engelska}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{swedish}{bibsswedish}
  \fi
%    \end{macrocode}
% Switch on the change of case in titles for all Swedish dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{swedish}{btxifchangecaseoff}
}
%</swedish>
%    \end{macrocode}
%
% \subsubsection{Afrikaans}
% \changes{0.34}{2003/07/28}{Added Afrikaans language}%
%    \begin{macrocode}
%<*afrikaans>
%    \end{macrocode}
%
% The language definition for Afrikaans was provided by Danie Els.
%
% \begin{macro}{\bibsafrikaans}
% Bibliographic commands for Afrikaans.
%    \begin{macrocode}
\newcommand\bibsafrikaans[1][afrikaans]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{et~alii}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{en}}%
  \def\btxandcomma##1{\protect\foreignlanguage{#1}{}}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{van}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{van}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{in}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{redakteur}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{reds##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{redakteurs}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volume}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{no##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{nommer}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{uitg##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{uitgawe}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{hfst##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{hoofstuk}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{bladsy}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{pp##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{bladsye}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Meesters tesis}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{PhD verhandeling}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Tegn.\ versl##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Tegniese verslag}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januarie}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februarie}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Maart}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Mei}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Junie}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Julie}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{Augustus}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktober}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Desember}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mrt##1{}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Mei##1}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Des##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{In}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Redakteur}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Reds##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Redakteurs}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{No##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Nommer}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Uitg##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Uitgawe}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Hfst##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Hoofstuk}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Bladsy}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Pp##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Bladsye}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Tegn.\ Verslag}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Tegniese Verslag}}%
%  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, ?? ##1}}%
  \def\btxurldatecomment##1{\PackageError{babelbib}{Comment for
      urldate in Afrikaans undefined. Please send the translation for 
      'visited on' to harald.harders@tu-bs.de}{} [##1]}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameafrikaans{\protect\foreignlanguage{#1}{afrikaans}}%
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{engels}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{duits}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugees}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugees}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{engels}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgaars}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{engels}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{frans}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{katalaans}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroaties}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{tsjeggies}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{deens}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{nederlands}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{engels}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{fins}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{frans}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{frans}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{frans}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{duits}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{duits}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{grieks}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebreeus}}%
    \def\btxlanguagenamenhungarian{\protect\foreignlanguage{#1}{hongaars}}%
    \def\btxlanguagenamenicelandic{\protect\foreignlanguage{#1}{yslands}}%
    \def\btxlanguagenamenirish{\protect\foreignlanguage{#1}{iers}}%
    \def\btxlanguagenamenitalian{\protect\foreignlanguage{#1}{italiaans}}%
    \def\btxlanguagenamenlatin{\protect\foreignlanguage{#1}{latyn}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{duits}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{duits}}%
    \def\btxlanguagenamennorsk{\protect\foreignlanguage{#1}{noors}}%
    \def\btxlanguagenamennynorsk{\protect\foreignlanguage{#1}{neo-noors}}%
    \def\btxlanguagenamenpolish{\protect\foreignlanguage{#1}{pools}}%
    \def\btxlanguagenamenportuges{\protect\foreignlanguage{#1}{portugees}}%
    \def\btxlanguagenamenportuguese{\protect\foreignlanguage{#1}{portugees}}%
    \def\btxlanguagenamenrussian{\protect\foreignlanguage{#1}{russies}}%
    \def\btxlanguagenamenscottish{\protect\foreignlanguage{#1}{skots}}%
    \def\btxlanguagenamenserbian{\protect\foreignlanguage{#1}{serwies}}%
    \def\btxlanguagenamenspanish{\protect\foreignlanguage{#1}{spaans}}%
    \def\btxlanguagenamenswedish{\protect\foreignlanguage{#1}{sweeds}}%
    \def\btxlanguagenamenturkish{\protect\foreignlanguage{#1}{turks}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{engels}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{engels}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{afrikaans}{bibsafrikaans}
  \fi
%    \end{macrocode}
% Switch on the change of case in titles for all Afrikaans dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{afrikaans}{btxifchangecaseoff}
}
%</afrikaans>
%    \end{macrocode}
%
% \subsubsection{Bahasa}
%    \begin{macrocode}
%<*bahasa>
%    \end{macrocode}
%
% The language definition for Bahasa was provided by Yanti Yulianti.
%
% \begin{macro}{\bibsbahasa}
% Bibliographic commands for Bahasa.
%    \begin{macrocode}
%%
%% This is file `bahasa.bdf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% babelbib.dtx  (with options: `latex,bahasa')
%% 
%%   babelbib package
%% 
%%   Copyright  2003--2005 Harald Harders
%% 
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1 of the License, or any later version.
%% 
%%   h.harders@tu-bs.de
%% 
\newcommand\bibsbahasa[1][bahasa]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{et~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{en~alii }}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{dan}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{dan}}%
  \def\btxandcomma##1{,}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{dalam}}%
  \def\btxinshort##1{\protect\foreignlanguage{#1}{dalam}}%
  \def\btxofseriesshort##1{\protect\foreignlanguage{#1}{dari}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{dalam}}%
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{dari}}%
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{dalam}}%
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{redaktur}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{red##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{redaktur}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volume}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{nr##1{}}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{nomor}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{edisi}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{edisi}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{bab##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{bab}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{hal##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{halaman}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{hal##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{halaman}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{tesis Master}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{disertasi Dokotor}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Lap.\ Rapp##1{}}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Laporan}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{Januari}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{Februari}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{Maret}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{April}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{Mei}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{Juni}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{Juli}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{Augustus}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{September}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{Oktober}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{November}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{Desember}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{Jan##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{Feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{Mrt}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{Apr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{Mei}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{Jun##1{}}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{Jul##1{}}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{Aug##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{Sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{Okt##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{Nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{Des##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{Dalam}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{Dalam}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Redaktur}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Red##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Redaktur}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volume}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{Nr##1{}}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{Nomor}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Ed}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Edisi}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Bab##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Bab}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{Hal##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{Halaman}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{Hal##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{Halaman}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Lap.\ Rapp##1{}}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Laporan}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, diambil tanggal ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{inggris}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{jerman}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugis}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugis}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{inggris}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{bulgaria}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{inggris}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{prancis}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catalanya}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{kroasia}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{ceko}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{denmark}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{belanda}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{inggris}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{spanyol}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finlandia}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{prancis}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{prancis}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{prancis}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{jerman}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{jerman}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{yunani}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{yahudi}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{hungaria}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{islandia}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irlandia}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{italia}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{latin}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{jerman}}%
 %   \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{jerman}}%
 %   \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{norwegia}}%
 %   \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{norwegia baru}}%
 %   \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polish}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugis}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugis}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{russia}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{skotlandia}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbia}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{spanyol}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{swedia}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turki}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{inggris}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{inggris}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{bahasa}{bibsbahasa}
  \fi
  \bbbbaddto{bahasa}{btxifchangecaseoff}
}
%</bahasa>
%    \end{macrocode}
%
% \subsubsection{Catalan}
% \changes{1.00}{2005/02/16}{Added Catalan language}%
%    \begin{macrocode}
%<*catalan>
%    \end{macrocode}
%
% The language definition for Catalan was provided by
% Robert Fuster, rfuster@imm.upv.es.
%
% \begin{macro}{\bibsafrikaans}
%    \begin{macrocode}
\newcommand\bibscatalan[1][catalan]{%
  \def\biblanguagename{#1}%
  \def\btxetalshort##1{\protect\foreignlanguage{#1}{i~al##1{}}}%
  \def\btxetallong##1{\protect\foreignlanguage{#1}{i~altres}}%
  \def\btxandshort##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxandlong##1{\protect\foreignlanguage{#1}{i}}%
  \def\btxandcomma##1{}%
  \def\btxinlong##1{\protect\foreignlanguage{#1}{dins}}% 
  \def\btxinshort##1{\protect\foreignlanguage{#1}{dins}}%
  \def\btxinseriesshort##1{\protect\foreignlanguage{#1}{dins}}% 
  \def\btxofserieslong##1{\protect\foreignlanguage{#1}{de}}% 
  \def\btxinserieslong##1{\protect\foreignlanguage{#1}{dins}}% 
  \def\btxeditorshort##1{\protect\foreignlanguage{#1}{ed##1{}}}% 
  \def\btxeditorlong##1{\protect\foreignlanguage{#1}{editor}}%
  \def\btxeditorsshort##1{\protect\foreignlanguage{#1}{eds##1{}}}%
  \def\btxeditorslong##1{\protect\foreignlanguage{#1}{editors}}%
  \def\btxvolumeshort##1{\protect\foreignlanguage{#1}{vol##1{}}}%
  \def\btxvolumelong##1{\protect\foreignlanguage{#1}{volum}}%
  \def\btxnumbershort##1{\protect\foreignlanguage{#1}{n}}%
  \def\btxnumberlong##1{\protect\foreignlanguage{#1}{n\'umero}}%
  \def\btxeditionshort##1{\protect\foreignlanguage{#1}{ed##1{}}}%
  \def\btxeditionlong##1{\protect\foreignlanguage{#1}{edici{\'o}}}%
  \def\btxchaptershort##1{\protect\foreignlanguage{#1}{cap##1{}}}%
  \def\btxchapterlong##1{\protect\foreignlanguage{#1}{cap{\'\i}tol}}%
  \def\btxpageshort##1{\protect\foreignlanguage{#1}{p##1{}}}%
  \def\btxpagelong##1{\protect\foreignlanguage{#1}{p\`agina}}%
  \def\btxpagesshort##1{\protect\foreignlanguage{#1}{ps##1{}}}%
  \def\btxpageslong##1{\protect\foreignlanguage{#1}{p\`agines}}%
  \def\btxmastthesis##1{\protect\foreignlanguage{#1}{Tesina de Llicenciatura}}%
  \def\btxphdthesis##1{\protect\foreignlanguage{#1}{Tesi de Doctorat}}%
  \def\btxtechrepshort##1{\protect\foreignlanguage{#1}{Rep. t\`ecnic}}%
  \def\btxtechreplong##1{\protect\foreignlanguage{#1}{Report t\`ecnic}}%
  \def\btxmonjanlong##1{\protect\foreignlanguage{#1}{gener}}%
  \def\btxmonfeblong##1{\protect\foreignlanguage{#1}{febrer}}%
  \def\btxmonmarlong##1{\protect\foreignlanguage{#1}{mar\c{c}}}%
  \def\btxmonaprlong##1{\protect\foreignlanguage{#1}{abril}}%
  \def\btxmonmaylong##1{\protect\foreignlanguage{#1}{maig}}%
  \def\btxmonjunlong##1{\protect\foreignlanguage{#1}{juny}}%
  \def\btxmonjullong##1{\protect\foreignlanguage{#1}{juliol}}%
  \def\btxmonauglong##1{\protect\foreignlanguage{#1}{agost}}%
  \def\btxmonseplong##1{\protect\foreignlanguage{#1}{setembre}}%
  \def\btxmonoctlong##1{\protect\foreignlanguage{#1}{octubre}}%
  \def\btxmonnovlong##1{\protect\foreignlanguage{#1}{novembre}}%
  \def\btxmondeclong##1{\protect\foreignlanguage{#1}{desembre}}%
  \def\btxmonjanshort##1{\protect\foreignlanguage{#1}{gen##1{}}}%
  \def\btxmonfebshort##1{\protect\foreignlanguage{#1}{feb##1{}}}%
  \def\btxmonmarshort##1{\protect\foreignlanguage{#1}{mar\c{c}}}%
  \def\btxmonaprshort##1{\protect\foreignlanguage{#1}{abr##1{}}}%
  \def\btxmonmayshort##1{\protect\foreignlanguage{#1}{maig}}%
  \def\btxmonjunshort##1{\protect\foreignlanguage{#1}{juny}}%
  \def\btxmonjulshort##1{\protect\foreignlanguage{#1}{jul}}%
  \def\btxmonaugshort##1{\protect\foreignlanguage{#1}{ago##1{}}}%
  \def\btxmonsepshort##1{\protect\foreignlanguage{#1}{sep##1{}}}%
  \def\btxmonoctshort##1{\protect\foreignlanguage{#1}{oct##1{}}}%
  \def\btxmonnovshort##1{\protect\foreignlanguage{#1}{nov##1{}}}%
  \def\btxmondecshort##1{\protect\foreignlanguage{#1}{dec##1{}}}%
  \def\Btxinlong##1{\protect\foreignlanguage{#1}{Dins}}%
  \def\Btxinshort##1{\protect\foreignlanguage{#1}{Dins}}%
  \def\Btxeditorshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorlong##1{\protect\foreignlanguage{#1}{Editor}}%
  \def\Btxeditorsshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditorslong##1{\protect\foreignlanguage{#1}{Editors}}%
  \def\Btxvolumeshort##1{\protect\foreignlanguage{#1}{Vol##1{}}}%
  \def\Btxvolumelong##1{\protect\foreignlanguage{#1}{Volum}}%
  \def\Btxnumbershort##1{\protect\foreignlanguage{#1}{N\'um}}%
  \def\Btxnumberlong##1{\protect\foreignlanguage{#1}{N\'umero}}%
  \def\Btxeditionshort##1{\protect\foreignlanguage{#1}{Ed##1{}}}%
  \def\Btxeditionlong##1{\protect\foreignlanguage{#1}{Edici\'o}}%
  \def\Btxchaptershort##1{\protect\foreignlanguage{#1}{Cap##1{}}}%
  \def\Btxchapterlong##1{\protect\foreignlanguage{#1}{Cap\'\itol}}%
  \def\Btxpageshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpagelong##1{\protect\foreignlanguage{#1}{P\`agina}}%
  \def\Btxpagesshort##1{\protect\foreignlanguage{#1}{P##1{}}}%
  \def\Btxpageslong##1{\protect\foreignlanguage{#1}{P\`agines}}%
  \def\Btxtechrepshort##1{\protect\foreignlanguage{#1}{Rep. t\`ecnic}}%
  \def\Btxtechreplong##1{\protect\foreignlanguage{#1}{Report t\`ecnic}}%
  \def\btxurldatecomment##1{\protect\foreignlanguage{#1}{, visitada el ##1}}%
  \def\btxfnamespaceshort{\,}%
  \def\btxfnamespacelong{ }%
  \def\btxnumeralshort##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxnumerallong##1{\btxnumeralfallback{#1}{##1}}%
  \def\btxkeywordlanguage##1{{\protect\selectlanguage{#1}##1}}%
  \ifbbbblanguagenames
    \def\btxlanguagenameamerican{\protect\foreignlanguage{#1}{angl\`es}}%
    \def\btxlanguagenameaustrian{\protect\foreignlanguage{#1}{alem\`any}}%
    \def\btxlanguagenamebrazil{\protect\foreignlanguage{#1}{portugu\`es}}%
    \def\btxlanguagenamebrazilian{\protect\foreignlanguage{#1}{portugu\`es}}%
    \def\btxlanguagenamebritish{\protect\foreignlanguage{#1}{angl\'es}}%
    \def\btxlanguagenamebulgarian{\protect\foreignlanguage{#1}{b\'ulgar}}%
    \def\btxlanguagenamecanadian{\protect\foreignlanguage{#1}{angl\`es}}%
    \def\btxlanguagenamecanadien{\protect\foreignlanguage{#1}{franc\`es}}%
    \def\btxlanguagenamecatalan{\protect\foreignlanguage{#1}{catal\`a}}%
    \def\btxlanguagenamecroatian{\protect\foreignlanguage{#1}{croat}}%
    \def\btxlanguagenameczech{\protect\foreignlanguage{#1}{txec}}%
    \def\btxlanguagenamedanish{\protect\foreignlanguage{#1}{dan\`es}}%
    \def\btxlanguagenamedutch{\protect\foreignlanguage{#1}{neerland\`es}}%
    \def\btxlanguagenameenglish{\protect\foreignlanguage{#1}{angl\`es}}%
    \def\btxlanguagenameesperanto{\protect\foreignlanguage{#1}{esperanto}}%
    \def\btxlanguagenamefinnish{\protect\foreignlanguage{#1}{finland\`es}}%
    \def\btxlanguagenamefrancais{\protect\foreignlanguage{#1}{franc\`es}}%
    \def\btxlanguagenamefrench{\protect\foreignlanguage{#1}{franc\`es}}%
    \def\btxlanguagenamefrenchb{\protect\foreignlanguage{#1}{franc\`es}}%
    \def\btxlanguagenamegerman{\protect\foreignlanguage{#1}{alem\`any}}%
    \def\btxlanguagenamegermanb{\protect\foreignlanguage{#1}{alem\`any}}%
    \def\btxlanguagenamegreek{\protect\foreignlanguage{#1}{grec}}%
    \def\btxlanguagenamehebrew{\protect\foreignlanguage{#1}{hebreu}}%
    \def\btxlanguagenamehungarian{\protect\foreignlanguage{#1}{hongar\`es}}%
    \def\btxlanguagenameicelandic{\protect\foreignlanguage{#1}{island\`es}}%
    \def\btxlanguagenameirish{\protect\foreignlanguage{#1}{irland\`es}}%
    \def\btxlanguagenameitalian{\protect\foreignlanguage{#1}{itali\`a}}%
    \def\btxlanguagenamelatin{\protect\foreignlanguage{#1}{llat\'\i}}%
    \def\btxlanguagenamenaustrian{\protect\foreignlanguage{#1}{alem\`any}}%
    \def\btxlanguagenamengerman{\protect\foreignlanguage{#1}{alem\`any}}%
    \def\btxlanguagenamenorsk{\protect\foreignlanguage{#1}{noruec}}%
    \def\btxlanguagenamenynorsk{\protect\foreignlanguage{#1}{noruec}}%
    \def\btxlanguagenamepolish{\protect\foreignlanguage{#1}{polon\`es}}%
    \def\btxlanguagenameportuges{\protect\foreignlanguage{#1}{portugu\`es}}%
    \def\btxlanguagenameportuguese{\protect\foreignlanguage{#1}{portugu\`es}}%
    \def\btxlanguagenamerussian{\protect\foreignlanguage{#1}{rus}}%
    \def\btxlanguagenamescottish{\protect\foreignlanguage{#1}{escoc\`es}}%
    \def\btxlanguagenameserbian{\protect\foreignlanguage{#1}{serbi}}%
    \def\btxlanguagenamespanish{\protect\foreignlanguage{#1}{espa\~nol}}%
    \def\btxlanguagenameswedish{\protect\foreignlanguage{#1}{suec}}%
    \def\btxlanguagenameturkish{\protect\foreignlanguage{#1}{turc}}%
    \def\btxlanguagenameUKenglish{\protect\foreignlanguage{#1}{angl\`es}}%
    \def\btxlanguagenameUSenglish{\protect\foreignlanguage{#1}{angl\`es}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% Append the definitions to the language-calling commands.
%    \begin{macrocode}
\AtBeginDocument{%
  \ifbbbbfixlanguage
  \else
    \bbbbaddto{catalan}{bibscatalan}
  \fi
%    \end{macrocode}
% Switch on the change of case in titles for all Afrikaans dialects by
% appending \cs{btxifchangecaseoff} to \cs{extras}\meta{language}.
%    \begin{macrocode}
  \bbbbaddto{catalan}{btxifchangecaseoff}
}
%</catalan>
%    \end{macrocode}
%
% \section{\BibTeX\ style files}
% \changes{0.40}{2003/09/26}{Moved the \texttt{bst} files into the
%   global \texttt{dtx} file}%
%
% \subsection{``Normal'' \BibTeX\ style files}
%
% \subsubsection{Generic code}
%
% Because most parts of the \BibTeX\ style files are equal for all
% styles, they are generated from the same source code.
%    \begin{macrocode}
%<*bststd>
%    \end{macrocode}
% Declare the data fields that are handled by the \BibTeX\ styles.
%    \begin{macrocode}
ENTRY
  { address
    annote
    annotelanguage
    author
    booktitle
    chapter
    edition
    editor
    howpublished
    institution
    isbn
    issn
    journal
    key
    language
    month
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    type
    url
    urldate
    volume
    year
  }
  {}
%</bststd>
%<bststd&!bstalpha>  { label }
%<bststd&bstalpha>  { label extra.label sort.label }
%<*bststd>

%    \end{macrocode}
% Declare integer variables.
%    \begin{macrocode}
INTEGERS
  { output.state
    before.all
    mid.sentence
    after.sentence
    after.block
    before.title
  }

%    \end{macrocode}
% Declare string variables.
%    \begin{macrocode}
STRINGS
  { s
    t
    language.state
    change.temp
    isbn.command
  }

%    \end{macrocode}
% Declare the constants that define at which position within a
% citation we are when processing it.
%    \begin{macrocode}
FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
  #4 'before.title :=
  "nostate" 'language.state :=
}

%    \end{macrocode}
% Logical function |not|.
%
% Syntax: \meta{int1} |not| $\longrightarrow$ \meta{int2}.
%
% Returns |1| if \meta{arg1} != |0|, |0| otherwise.
%    \begin{macrocode}
FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

%    \end{macrocode}
% Logical function |and|.
% Syntax: \meta{arg1} \meta{arg1} |and|.
% Returns |1| if \meta{arg1} == |true| and \meta{arg2} == |true|, |0|
% otherwise.
%    \begin{macrocode}
FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

%    \end{macrocode}
% Logical function |or|.
% Syntax: \meta{arg1} \meta{arg1} |or|.
% Returns |1| if \meta{arg1} == |true| or \meta{arg2} == |true|, |0|
% otherwise.
%    \begin{macrocode}
FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

%    \end{macrocode}
% Function |language.change.case|.
% Syntax: \meta{string1} \meta{string2} |language.change.case|
% $\longrightarrow$ \meta{string3}
% This function has the same syntax as |change.case$| but writes
% \meta{string1} twice into \meta{string3}, first with changed case,
% second with original case.
%    \begin{macrocode}
FUNCTION {language.change.case}
{ 
  'change.temp :=
  't :=
  "\btxifchangecase {"
  t change.temp change.case$ *
  "}{" *
  t *
  "}" *
}

%    \end{macrocode}
% Generates output for the string \meta{string1}.
% Syntax: \meta{string1} |output.nonnull| $\longrightarrow$ \meta{string2}
%    \begin{macrocode}
FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { ", " * write$ }
    { output.state after.block =
        { add.period$ write$
          newline$
          "\newblock " write$
        }
        { output.state before.all =
            'write$
            {
              output.state before.title =
                { "\btxauthorcolon\ " * write$ }
                { add.period$ " " * write$ }
              if$
            }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
  if$
  s
}

%    \end{macrocode}
% Generates output if the given string \meta{string1} is not empty.
% Syntax: \meta{string1} |output.nonnull| $\longrightarrow$ \meta{string2}
%    \begin{macrocode}
FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

%    \end{macrocode}
% Outputs a bibliography item.
% \changes{1.17}{2005/11/05}{Change the language in alpha-numerical
%   bib items}%
%    \begin{macrocode}
FUNCTION {output.bibitem}
{ newline$
%    \end{macrocode}
% \changes{0.40}{2003/09/26}{Switch to a fall-back language when
%   \texttt{language} field is missing}%
% If no language is given, fall back to the language that has been
% active at \cs{begin\{document\}} or to the given fall-back
% language.
% For \BibTeX, this language gets the name \texttt{nolanguage}.
%    \begin{macrocode}
  language empty$
    {
      language.state "nolanguage" =
        'skip$
        {
          "empty language in " cite$ * warning$
          "\expandafter\btxselectlanguage\expandafter {"
          "\btxfallbacklanguage}" *
          write$ newline$
        }
      if$
      "nolanguage" 'language.state :=
    }
    {
      language.state language =
        'skip$
        {
          "\btxselectlanguage {" language * "}" *
          write$ newline$
        }
      if$
      language 'language.state :=
    }
  if$
%</bststd>
%<bststd&!bstalpha>  "\bibitem {" write$
%<bststd&bstalpha>  "\bibitem [{" label * "}]{" * write$
%<*bststd>
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

%    \end{macrocode}
% Output an ISBN or ISSN.
%
% Syntax: \meta{string1} \meta{string2} |output.isbn|
%
% Prints the ISBN or ISSN given by \meta{string1} and uses the \TeX\
% macro given by \meta{string2} to determine if the text is printed or
% not.
% \meta{string2} normally is \cs{ifbtxprintISSN} or
% \cs{ifbtxprintISSN}. 
%    \begin{macrocode}
FUNCTION {output.isbn}
{
  'isbn.command :=
  duplicate$
  empty$
    'pop$
    {
      's :=
      output.state mid.sentence =
        {
          isbn.command * " {, " * write$
          s "}" *
        }
        { output.state after.block =
            {
              add.period$
              write$
              newline$
              "\newblock " write$
              isbn.command " {" * s * ".}" *
            }
            { output.state before.all =
                {
                  write$
                  isbn.command " {" * write$
                  s "}" *
                }
                {
                  output.state before.title =
                    {
                      "\btxauthorcolon\ " * write$
                      isbn.command " {" * write$
                      s "}" *
                    }
                    {
                      add.period$ " " * write$
                      isbn.command " {" * write$
                      s ".}" *
                    }
                  if$
                }
              if$
            }
          if$
          mid.sentence 'output.state :=
        }
      if$
    }
  if$
}

%    \end{macrocode}
% Completes an entry.
%    \begin{macrocode}
FUNCTION {fin.entry}
{ add.period$
  write$
  newline$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
        'skip$
        { after.sentence 'output.state := }
      if$
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {after.authors}
{ output.state before.all =
    'skip$
    { before.title 'output.state := }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {new.block.checka}
{ empty$
    'skip$
    'new.block
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {new.block.checkc}
{ empty$
  swap$ empty$
  and
    'skip$
    'after.authors
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {new.sentence.checka}
{ empty$
    'skip$
    'new.sentence
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {new.sentence.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.sentence
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

%    \end{macrocode}
% \changes{1.00}{2005/02/16}{Remove \texttt{emphasize} and
%   \texttt{smallcaps} from \BibTeX\ styles}%
%    \begin{macrocode}
FUNCTION {namefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxnamefont {" swap$ * "}" * }
  if$
}

%    \end{macrocode}
% \changes{1.12}{2005/06/19}{Add extra formatting of lastnames to
%   \BibTeX\ styles}%
%    \begin{macrocode}
FUNCTION {lastnamefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxlastnamefont {" swap$ * "}" * }
  if$
}
%    \end{macrocode}
% Set font for titles:
%    \begin{macrocode}
FUNCTION {titlefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxtitlefont {" swap$ * "}" * }
  if$
}
%    \end{macrocode}
% Set font for titles of articles in journals:
%    \begin{macrocode}
FUNCTION {jtitlefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxjtitlefont {" swap$ * "}" * }
  if$
}
%    \end{macrocode}
% Set font for the journal name:
%    \begin{macrocode}
FUNCTION {journalfont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxjournalfont {" swap$ * "}" * }
  if$
}
%    \end{macrocode}
% Set font for the publisher name:
%    \begin{macrocode}
FUNCTION {publisherfont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxpublisherfont {" swap$ * "}" * }
  if$
}
%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {volumefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxvolumefont {" swap$ * "}" * }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {etalfont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxetalfont {" swap$ * "}" * }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
INTEGERS { nameptr namesleft numnames }

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
      {
%</bststd>
%<*bststd&!bstshort&!namevarb>
        s nameptr "{ff{\btxfnamespacelong } }{vv~}" format.name$
        s nameptr "{ll}" format.name$ lastnamefont * 
        s nameptr "{, jj}" format.name$ *
        't :=
%</bststd&!bstshort&!namevarb>
%<*bststd&bstshort&!namevarb>
        s nameptr 
        "{f{.\btxfnamespaceshort }.~}{vv~}" format.name$
        s nameptr "{ll}" format.name$ lastnamefont * 
        s nameptr "{,~jj}" format.name$ *
        't :=
%</bststd&bstshort&!namevarb>
%<*bststd&!bstshort&namevarb>
        s nameptr "{ll}" format.name$ lastnamefont
        s nameptr "{,~jj}{, ff{\btxfnamespacelong }}{~vv}" format.name$ *
        't :=
%</bststd&!bstshort&namevarb>
%<*bststd&bstshort&namevarb>
        s nameptr "{ll}" format.name$ lastnamefont
        s nameptr "{,~jj}{,~f{.\btxfnamespaceshort }.}{~vv}" format.name$ *
        't :=
%</bststd&bstshort&namevarb>
%<*bststd&bstthree>
          namesleft #2 >
            { " " "\btxetalshort {.}" etalfont * *
              #1 'namesleft := }
            {
%</bststd&bstthree>
%<*bststd>
          namesleft #1 >
            { ", " * t namefont * }
            { numnames #2 >
                { "\btxandcomma {}" * }
                'skip$
              if$
              s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ "others" =
                { " " "\btxetalshort {.}" etalfont * * }
%</bststd>
%<bststd&!bstshort>                { " \btxandlong {}\ " * t namefont * }
%<bststd&bstshort>                { " \btxandshort {.}\ " * t namefont * }
%<*bststd&bstthree>
              if$
            }
%</bststd&bstthree>
%<*bststd>
              if$
            }
          if$
        }
        {
%</bststd>
%<*bststd&!bstshort&!namevara>
          s nameptr "{ll}" format.name$ lastnamefont
          s nameptr "{,~jj}{, ff{\btxfnamespacelong }}{~vv}"
          format.name$ * namefont
%</bststd&!bstshort&!namevara>
%<*bststd&bstshort&!namevara>
          s nameptr "{ll}" format.name$ lastnamefont
          s nameptr "{,~jj}{,~f{.\btxfnamespaceshort }.}{~vv}"
          format.name$ * namefont
%</bststd&bstshort&!namevara>
%<*bststd&!bstshort&namevara>
          s nameptr "{ff{\btxfnamespacelong } }{vv~}" format.name$
          s nameptr "{ll}" format.name$ lastnamefont * 
          s nameptr "{,~jj}" format.name$ * namefont
%</bststd&!bstshort&namevara>
%<*bststd&bstshort&namevara>
          s nameptr "{f{.\btxfnamespaceshort }.~}{vv~}" format.name$
          s nameptr "{ll}" format.name$ lastnamefont * 
          s nameptr "{,~jj}" format.name$ * namefont
%</bststd&bstshort&namevara>
%<*bststd>
        }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.authors}
{ author empty$
    { "" }
    { author format.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
%</bststd>
%<*bststd&!bstshort>
        { "\ (\btxeditorslong {})" * }
        { "\ (\btxeditorlong {})" * }
%</bststd&!bstshort>
%<*bststd&bstshort>
        { "\ (\btxeditorsshort {.})" * }
        { "\ (\btxeditorshort {.})" * }
%</bststd&bstshort>
%<*bststd>
      if$
    }
  if$
}
%    \end{macrocode}
% Format the title:
%    \begin{macrocode}
FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" language.change.case titlefont }
  if$
}
%    \end{macrocode}
% Format the title of a journal article:
%    \begin{macrocode}
FUNCTION {format.jtitle}
{ title empty$
    { "" }
    { title "t" language.change.case jtitlefont }
  if$
}
%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {n.dashify}
{ 't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
        { t #1 #2 substring$ "--" = not
            { "--" *
              t #2 global.max$ substring$ 't :=
            }
            {   { t #1 #1 substring$ "-" = }
                { "-" *
                  t #2 global.max$ substring$ 't :=
                }
              while$
            }
          if$
        }
        { t #1 #1 substring$ *
          t #2 global.max$ substring$ 't :=
        }
      if$
    }
  while$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.date}
{ year empty$
    { month empty$
        { "" }
        { "there's a month but no year in " cite$ * warning$
          month
        }
      if$
    }
    { month empty$
        'year
        { month "\ " * year * }
      if$
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.btitle}
{ title titlefont
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { "\ " }
  if$
  swap$ * *
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {volume.tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { "\ " }
  if$
  swap$ volumefont * *
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { output.state after.block =
%</bststd>
%<bststd&!bstshort>        { "\Btxvolumelong {}" }
%<bststd&!bstshort>        { "\btxvolumelong {}" }
%<bststd&bstshort>        { "\Btxvolumeshort {.}" }
%<bststd&bstshort>        { "\btxvolumeshort {.}" }
%<*bststd>
      if$
      volume volume.tie.or.space.connect
      series empty$
        'skip$
%</bststd>
%<bststd&!bstshort>        { " \btxofserieslong {}\ " * series titlefont * }
%<bststd&bstshort>        { " \btxofseriesshort {.}\ " * series titlefont * }
%<*bststd>
      if$
      "volume and number" number either.or.check
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.number.series}
{ volume empty$
    { number empty$
        { series field.or.null }
        { output.state mid.sentence =
%</bststd>
%<bststd&!bstshort>            { "\btxnumberlong {}" }
%<bststd&!bstshort>            { "\Btxnumberlong {}" }
%<bststd&bstshort>            { "\btxnumbershort {.}" }
%<bststd&bstshort>            { "\Btxnumbershort {.}" }
%<*bststd>
          if$
          number tie.or.space.connect
          series empty$
            { "there's a number but no series in " cite$ * warning$ }
%</bststd>
%<bststd&!bstshort>            { " \btxinserieslong {}\ " * series titlefont * }
%<bststd&bstshort>            { " \btxinseriesshort {.}\ " * series titlefont * }
%<*bststd>
          if$
        }
      if$
    }
    { "" }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.edition}
{ edition empty$
    { "" }
    { 
%</bststd>
%    \end{macrocode}
% Handle the edition first to get the beginning of the sentence.
% Afterwards, the text before the edition is put to the stack and
% exchanged with the edition number itself.
%    \begin{macrocode}
%<*bststd&!bstshort>
      output.state mid.sentence =
        { edition "l" change.case$ }
        { edition "t" change.case$ }
      if$
      "\btxnumerallong {" swap$ *
      "}~\btxeditionlong {}" * 
%</bststd&!bstshort>
%<*bststd&bstshort>
      output.state mid.sentence =
        { edition "l" change.case$ }
        { edition "t" change.case$ }
      if$
      "\btxnumeralshort {" swap$ *
      "}~\btxeditionshort {.}" *
%</bststd&bstshort>
%<*bststd>
    }
  if$
}

FUNCTION {format.isbn}
{ isbn empty$
    { "" }
    { "\mbox{\btxISBN~\btxISBNfont {" isbn * "}}" * }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.issn}
{ issn empty$
    { "" }
    { "\mbox{\btxISSN~\btxISSNfont {" issn * "}}" * }
  if$
}
%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.url}
{ url empty$
    { "" }
    {
      urldate empty$
      { "{\latintext \btxurlfont{" url * "}}" * }
      {
        "{\latintext \btxurlfont{" url * "}}%" *
        newline$ output
        "\btxurldatecomment {\btxkeywordlanguage {\btxurldatefont{"
          urldate * "}}}" *
      }
      if$
    }
  if$
}
%    \end{macrocode}
% Format annotations:
%    \begin{macrocode}
FUNCTION {write.annote}
{ annote empty$
  'skip$
  { 
    annotelanguage empty$
    { "\btxkeywordlanguage {" }
    { "{\selectlanguage {" annotelanguage * "}" * }
    if$
    "\btxannotation {" * annote * "}}" * 
    write$ newline$
  }
  if$
}
%    \end{macrocode}
% 
%    \begin{macrocode}
INTEGERS { multiresult }

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
        { #1 'multiresult := }
        { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.pages}
{ pages empty$
    { "" }
    { pages multi.page.check
%</bststd>
%<*bststd&!bstshort>
        { "\btxpageslong {}" pages n.dashify tie.or.space.connect }
        { "\btxpagelong {}" pages tie.or.space.connect }
%</bststd&!bstshort>
%<*bststd&bstshort>
        { "\btxpagesshort {.}" pages n.dashify tie.or.space.connect }
        { "\btxpageshort {.}" pages tie.or.space.connect }
%</bststd&bstshort>
%<*bststd>
      if$
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.vol.num.pages}
{ volume field.or.null
  number empty$
    'skip$
    { "(" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        { ":" * pages n.dashify * }
      if$
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.chapter.pages}
{ chapter empty$
    'format.pages
    { type empty$
%</bststd>
%<bststd&!bstshort>        { "\btxchapterlong {}" }
%<bststd&bstshort>        { "\btxchaptershort {.}" }
%<*bststd>
        { type "l" language.change.case }
      if$
      chapter tie.or.space.connect
      pages empty$
        'skip$
        { ", " * format.pages * }
      if$
    }
  if$
}

FUNCTION {format.in.ed.booktitle}
{ booktitle empty$
    { "" }
    { editor empty$
%</bststd>
%<*bststd&!bstshort>
        { "\Btxinlong {}\ " booktitle titlefont * }
        { "\Btxinlong {}\ " format.editors * ": " * booktitle titlefont * }
%</bststd&!bstshort>
%<*bststd&bstshort>
        { "\Btxinshort {.}\ " booktitle titlefont * }
        { "\Btxinshort {.}\ " format.editors * ": " * booktitle titlefont * }
%</bststd&bstshort>
%<*bststd>
      if$
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
  key empty$ not and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      type "t" language.change.case
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.tr.number}
{
  number empty$
  {
    type empty$
%</bststd>
%    \end{macrocode}
% \changes{0.40}{2003/09/26}{For \texttt{babalpha.bst}, use
%   \cs{btxtechreplong}}%
%    \begin{macrocode}
%<bststd&!bstshort>      { "\btxtechreplong {}" }
%<bststd&bstshort>      { "\btxtechrepshort {.}" }
%<*bststd>
      { type "t" language.change.case }
    if$
  }
  {
    type empty$
%</bststd>
%    \end{macrocode}
% \changes{0.40}{2003/09/26}{For \texttt{babalpha.bst}, use
%   \cs{Btxtechreplong}}%
%    \begin{macrocode}
%<bststd&!bstshort>      { "\Btxtechreplong {}" }
%<bststd&bstshort>      { "\Btxtechrepshort {.}" }
%<*bststd>
      { type "t" language.change.case }
    if$
    number tie.or.space.connect
  }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.article.crossref}
{ key empty$
%</bststd>
%<*bststd&!bstshort>
    { journal empty$
        { "need key or journal for " cite$ * " to crossref " * crossref *
          warning$
          ""
        }
        { "\Btxinlong {}\ " journal titlefont * }
      if$
    }
    { "\Btxinlong {}\ " key titlefont * }
%</bststd&!bstshort>
%<*bststd&bstshort>
    { journal empty$
        { "need key or journal for " cite$ * " to crossref " * crossref *
          warning$
          ""
        }
        { "\Btxinshort {.}\ " journal titlefont * }
      if$
    }
    { "\Btxinshort {.}\ " key titlefont * }
%</bststd&bstshort>
%<*bststd>
  if$
  " \cite{" * crossref * "}" *
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.crossref.editor}
{
%</bststd>
%<*bststd&!bstshort>
  editor #1 "{ll}{,~jj}{, ff}{~vv}" format.name$ namefont
%</bststd&!bstshort>
%<*bststd&bstshort>
  editor #1 "{ll}{,~jj}{,~f.}{~vv}" format.name$ namefont
%</bststd&bstshort>
%<*bststd>
  editor num.names$ duplicate$
  #2 >
    { pop$ " " "\btxetalshort {.}" etalfont * * }
    { #2 <
        'skip$
        { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            { " " "\btxetalshort {.}" etalfont * * }
%</bststd>
%<*bststd&!bstshort>
            { " \btxandlong {}\ " * editor #2 "{ff}{~vv}{~ll}{, jj}"
%</bststd&!bstshort>
%<*bststd&bstshort>
            { " \btxandshort {.}\ " * editor #2 "{vv~}{ll}"
%</bststd&bstshort>
%<*bststd>
              format.name$ namefont * }
          if$
        }
      if$
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
%</bststd>
%<bststd&!bstshort>      "\Btxinlong {}\ "
%<bststd&bstshort>      "\Btxinshort {.}\ "
%<*bststd>
    }
%</bststd>
%<*bststd&!bstshort>
    { "\Btxvolumelong {}" volume volume.tie.or.space.connect
      " \btxofserieslong {}\ " *
%</bststd&!bstshort>
%<*bststd&bstshort>
    { "\Btxvolumeshort {.}" volume volume.tie.or.space.connect
      " \btxofseriesshort {.}\ " *
%</bststd&bstshort>
%<*bststd>
    }
  if$
  editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
        { series empty$
            { "need editor, key, or series for " cite$ * " to crossref " *
              crossref * warning$
              "" *
            }
            { series titlefont * }
          if$
        }
        { key titlefont * }
      if$
    }
    { format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.incoll.inproc.crossref}
{ editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
        { booktitle empty$
            { "need editor, key, or booktitle for " cite$ * " to crossref " *
              crossref * warning$
              ""
            }
%</bststd>
%<bststd&!bstshort>            { "\Btxinlong {}\ " booktitle titlefont * }
%<bststd&bstshort>            { "\Btxinshort {.}\ " booktitle titlefont * }
%<*bststd>
          if$
        }
%</bststd>
%<bststd&!bstshort>        { "\Btxinlong {}\ " key titlefont * }
%<bststd&bstshort>        { "\Btxinshort {.}\ " key titlefont * }
%<*bststd>
      if$
    }
%</bststd>
%<bststd&!bstshort>    { "\Btxinlong {}\ " format.crossref.editor * }
%<bststd&bstshort>    { "\Btxinshort {.}\ " format.crossref.editor * }
%<*bststd>
  if$
  " \cite{" * crossref * "}" *
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  after.authors
  format.jtitle "title" output.check
  new.block
  crossref missing$
    { journal 
      title missing$
        { titlefont }
        { journalfont }
      if$
      "journal" output.check 
      format.vol.num.pages output
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
  format.issn "\ifbtxprintISSN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {book}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  after.authors
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
      new.block
      format.number.series output
      new.sentence
      publisher "publisher" output.check publisherfont
      address output
    }
    { new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  format.date "year" output.check
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {booklet}
{ output.bibitem
  format.authors output
  after.authors
  format.title "title" output.check
  howpublished address new.block.checkb
  howpublished output
  address output
  format.date output
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {inbook}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  after.authors
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
      format.chapter.pages "chapter and pages" output.check
      new.block
      format.number.series output
      new.sentence
      publisher "publisher" output.check publisherfont
      address output
    }
    { format.chapter.pages "chapter and pages" output.check
      new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  format.date "year" output.check
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {incollection}
{ output.bibitem
  format.authors "author" output.check
  after.authors
  format.title "title" output.check
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      format.chapter.pages output
      new.sentence
      publisher "publisher" output.check publisherfont
      address output
      format.edition output
      format.date "year" output.check
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {inproceedings}
{ output.bibitem
  format.authors "author" output.check
  after.authors
  format.title "title" output.check
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
      format.pages output
      address empty$
        { organization publisher new.sentence.checkb
          organization output
          publisher publisherfont output
          format.date "year" output.check
        }
        { address output.nonnull
          format.date "year" output.check
          new.sentence
          organization output
          publisher publisherfont output
        }
      if$
    }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {conference} { inproceedings }

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {manual}
{ output.bibitem
  author empty$
    { organization empty$
        'skip$
        { organization output.nonnull
          address output
        }
      if$
    }
    { format.authors output.nonnull }
  if$
  after.authors
  format.btitle "title" output.check
  author empty$
    { organization empty$
        { address new.block.checka
          address output
        }
        'skip$
      if$
    }
    { organization address new.block.checkb
      organization output
      address output
    }
  if$
  format.edition output
  format.date output
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  after.authors
  format.title "title" output.check
  new.block
  "\btxmastthesis {}" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {misc}
{ output.bibitem
  format.authors output
  title howpublished new.block.checkc
  format.title output
  howpublished new.block.checka
  howpublished output
  format.date output
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.issn "\ifbtxprintISSN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
  empty.misc.check
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  after.authors
  format.btitle "title" output.check
  new.block
  "\btxphdthesis {}" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {proceedings}
{ output.bibitem
  editor empty$
    { organization output }
    { format.editors output.nonnull }
  if$
  after.authors
  format.btitle "title" output.check
  format.bvolume output
  format.number.series output
  address empty$
    { editor empty$
        { publisher new.sentence.checka }
        { organization publisher new.sentence.checkb
          organization output
        }
      if$
      publisher publisherfont output
      format.date "year" output.check
    }
    { address output.nonnull
      format.date "year" output.check
      new.sentence
      editor empty$
        'skip$
        { organization output }
      if$
      publisher publisherfont output
    }
  if$
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {techreport}
{ output.bibitem
  format.authors "author" output.check
  after.authors
  format.title "title" output.check
  new.block
  format.tr.number output.nonnull
  institution "institution" output.check
  address output
  format.date "year" output.check
  format.isbn "\ifbtxprintISBN" output.isbn
  new.block
  format.url output
  note output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {unpublished}
{ output.bibitem
  format.authors "author" output.check
  after.authors
  format.title "title" output.check
  new.block
  format.url output
  note "note" output.check
  format.date output
  fin.entry
  write.annote
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {default.type} { misc }

%</bststd>
%    \end{macrocode}
% Months and journals:
%    \begin{macrocode}
%<*bststd&!bstshort>
MACRO {jan} {"\btxmonjanlong {}"}
MACRO {feb} {"\btxmonfeblong {}"}
MACRO {mar} {"\btxmonmarlong {}"}
MACRO {apr} {"\btxmonaprlong {}"}
MACRO {may} {"\btxmonmaylong {}"}
MACRO {jun} {"\btxmonjunlong {}"}
MACRO {jul} {"\btxmonjullong {}"}
MACRO {aug} {"\btxmonauglong {}"}
MACRO {sep} {"\btxmonseplong {}"}
MACRO {oct} {"\btxmonoctlong {}"}
MACRO {nov} {"\btxmonnovlong {}"}
MACRO {dec} {"\btxmondeclong {}"}
MACRO {acmcs} {"ACM Computing Surveys"}
MACRO {acta} {"Acta Informatica"}
MACRO {cacm} {"Communications of the ACM"}
MACRO {ibmjrd} {"IBM Journal of Research and Development"}
MACRO {ibmsj} {"IBM Systems Journal"}
MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
MACRO {ieeetc} {"IEEE Transactions on Computers"}
MACRO {ieeetcad}
 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
MACRO {ipl} {"Information Processing Letters"}
MACRO {jacm} {"Journal of the ACM"}
MACRO {jcss} {"Journal of Computer and System Sciences"}
MACRO {scp} {"Science of Computer Programming"}
MACRO {sicomp} {"SIAM Journal on Computing"}
MACRO {tocs} {"ACM Transactions on Computer Systems"}
MACRO {tods} {"ACM Transactions on Database Systems"}
MACRO {tog} {"ACM Transactions on Graphics"}
MACRO {toms} {"ACM Transactions on Mathematical Software"}
MACRO {toois} {"ACM Transactions on Office Information Systems"}
MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
MACRO {tcs} {"Theoretical Computer Science"}
%</bststd&!bstshort>
%<*bststd&bstshort>
MACRO {jan} {"\btxmonjanshort {.}"}
MACRO {feb} {"\btxmonfebshort {.}"}
MACRO {mar} {"\btxmonmarshort {.}"}
MACRO {apr} {"\btxmonaprshort {.}"}
MACRO {may} {"\btxmonmayshort {.}"}
MACRO {jun} {"\btxmonjunshort {.}"}
MACRO {jul} {"\btxmonjulshort {.}"}
MACRO {aug} {"\btxmonaugshort {.}"}
MACRO {sep} {"\btxmonsepshort {.}"}
MACRO {oct} {"\btxmonoctshort {.}"}
MACRO {nov} {"\btxmonnovshort {.}"}
MACRO {dec} {"\btxmondecshort {.}"}
MACRO {acmcs} {"ACM Comput.\ Surv.{}"}
MACRO {acta} {"Acta Inf.{}"}
MACRO {cacm} {"Commun. ACM"}
MACRO {ibmjrd} {"IBM J.~Res.\ Dev.{}"}
MACRO {ibmsj} {"IBM Syst.~J.{}"}
MACRO {ieeese} {"IEEE Trans.\ Softw.\ Eng.{}"}
MACRO {ieeetc} {"IEEE Trans.\ Comput.{}"}
MACRO {ieeetcad}
 {"IEEE Trans.\ Comput.-Aided Design Integrated Circuits"}
MACRO {ipl} {"Inf.\ Process.\ Lett.{}"}
MACRO {jacm} {"J.~ACM"}
MACRO {jcss} {"J.~Comput.\ Syst.\ Sci.{}"}
MACRO {scp} {"Sci.\ Comput.\ Programming"}
MACRO {sicomp} {"SIAM J.~Comput.{}"}
MACRO {tocs} {"ACM Trans.\ Comput.\ Syst.{}"}
MACRO {tods} {"ACM Trans.\ Database Syst.{}"}
MACRO {tog} {"ACM Trans.\ Gr.{}"}
MACRO {toms} {"ACM Trans.\ Math.\ Softw.{}"}
MACRO {toois} {"ACM Trans.\ Office Inf.\ Syst.{}"}
MACRO {toplas} {"ACM Trans.\ Prog.\ Lang.\ Syst.{}"}
MACRO {tcs} {"Theoretical Comput.\ Sci.{}"}
%</bststd&bstshort>
%    \end{macrocode}
% Action.
%    \begin{macrocode}
%<*bststd>

READ

%</bststd>
%    \end{macrocode}
%
% \subsubsection{Sorted bibliographies}
%
% This code is only used for sorted bibliographies.
% \changes{1.00}{2005/02/16}{Fix sorting of \BibTeX\ entries without
%   an author}%
%    \begin{macrocode}
%<*bststd&!bstunsorted>
FUNCTION {sortify}
{ purify$
  "l" change.case$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
INTEGERS { len }

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}

%</bststd&!bstunsorted>
%<*bststd&bstalpha>
%    \end{macrocode}
% 
%    \begin{macrocode}
INTEGERS { et.al.char.used }

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {initialize.et.al.char.used}
{ #0 'et.al.char.used :=
}

%    \end{macrocode}
% 
%    \begin{macrocode}
EXECUTE {initialize.et.al.char.used}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {format.lab.names}
{ 's :=
  s num.names$ 'numnames :=
  numnames #1 >
    { numnames #4 >
  { #3 'namesleft := }
  { numnames 'namesleft := }
      if$
      #1 'nameptr :=
      ""
  { namesleft #0 > }
  { nameptr numnames =
      { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
    { "{\etalchar{+}}" *
      #1 'et.al.char.used :=
    }
    { s nameptr "{v{}}{l{}}" format.name$ * }
        if$
      }
      { s nameptr "{v{}}{l{}}" format.name$ * }
    if$
    nameptr #1 + 'nameptr :=
    namesleft #1 - 'namesleft :=
  }
      while$
      numnames #4 >
  { "{\etalchar{+}}" *
    #1 'et.al.char.used :=
  }
  'skip$
      if$
    }
    { s #1 "{v{}}{l{}}" format.name$
      duplicate$ text.length$ #2 <
  { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
  'skip$
      if$
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {author.key.label}
{ author empty$
    { key empty$
  { cite$ #1 #3 substring$ }
  { key #3 text.prefix$ }
      if$
    }
    { author format.lab.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
  { key empty$
      { cite$ #1 #3 substring$ }
      { key #3 text.prefix$ }
    if$
  }
  { editor format.lab.names }
      if$
    }
    { author format.lab.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {author.key.organization.label}
{ author empty$
    { key empty$
  { organization empty$
      { cite$ #1 #3 substring$ }
      { "The " #4 organization chop.word #3 text.prefix$ }
    if$
  }
  { key #3 text.prefix$ }
      if$
    }
    { author format.lab.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {editor.key.organization.label}
{ editor empty$
    { key empty$
  { organization empty$
      { cite$ #1 #3 substring$ }
      { "The " #4 organization chop.word #3 text.prefix$ }
    if$
  }
  { key #3 text.prefix$ }
      if$
    }
    { editor format.lab.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {calc.label}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
  'editor.key.organization.label
  { type$ "manual" =
      'author.key.organization.label
      'author.key.label
    if$
  }
      if$
    }
  if$
  duplicate$
  year field.or.null purify$ #-1 #2 substring$
  *
  'label :=
  year field.or.null purify$ #-1 #4 substring$
  *
  sortify 'sort.label :=
}

%</bststd&bstalpha>
%<*bststd&!bstunsorted>
%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {sort.format.names}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
        { "   " * }
        'skip$
      if$
%</bststd&!bstunsorted>
%    \end{macrocode}
% \changes{0.41}{2003/11/03}{Corrected \texttt{babunsrt.bst}}%
%    \begin{macrocode}
%<*bststd&!bstshort&!bstunsorted>
      s nameptr "{ll{ }}{  ff{ }}{vv{ } }{  jj{ }}" format.name$ 't :=
%</bststd&!bstshort&!bstunsorted>
%<*bststd&bstshort&!bstunsorted>
      s nameptr "{ll{ }}{  f{ }}{vv{ } }{  jj{ }}" format.name$ 't :=
%</bststd&bstshort&!bstunsorted>
%<*bststd&!bstunsorted>
      nameptr numnames = t "others" = and
        { "et al" * }
        { t sortify * }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  sortify
  #1 global.max$ substring$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {author.sort}
{ author empty$
    { key empty$
        { "to sort, need author or key in " cite$ * warning$
          ""
        }
        { key sortify }
      if$
    }
    { author sort.format.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
        { key empty$
            { "to sort, need author, editor, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {author.organization.sort}
{ author empty$
    { organization empty$
        { key empty$
            { "to sort, need author, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
        { key empty$
            { "to sort, need editor, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {presort}
{
%</bststd&!bstunsorted>
%<*bststd&bstalpha>
  calc.label
  sort.label
  "    "
  *
%</bststd&bstalpha>
%<*bststd&!bstunsorted>
  type$ "book" =
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
        'editor.organization.sort
        { type$ "manual" =
            'author.organization.sort
            'author.sort
          if$
        }
      if$
    }
  if$
%</bststd&!bstunsorted>
%<bststd&bstalpha>  *
%<*bststd&!bstunsorted>
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

%    \end{macrocode}
% 
%    \begin{macrocode}
ITERATE {presort}

%    \end{macrocode}
% 
%    \begin{macrocode}
SORT

%</bststd&!bstunsorted>
%<*bststd&!bstalpha>
%    \end{macrocode}
% 
%    \begin{macrocode}
STRINGS { longest.label }

%    \end{macrocode}
% 
%    \begin{macrocode}
INTEGERS { number.label longest.label.width }

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {longest.label.pass}
{ number.label int.to.str$ 'label :=
  number.label #1 + 'number.label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
}
%</bststd&!bstalpha>
%<*bststd&bstalpha>
%    \end{macrocode}
% 
%    \begin{macrocode}
STRINGS { longest.label last.sort.label next.extra }

%    \end{macrocode}
% 
%    \begin{macrocode}
INTEGERS { longest.label.width last.extra.num }

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 int.to.chr$ 'last.sort.label :=
  "" 'next.extra :=
  #0 'longest.label.width :=
  #0 'last.extra.num :=
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {forward.pass}
{ last.sort.label sort.label =
    { last.extra.num #1 + 'last.extra.num :=
      last.extra.num int.to.chr$ 'extra.label :=
    }
    { "a" chr.to.int$ 'last.extra.num :=
      "" 'extra.label :=
      sort.label 'last.sort.label :=
    }
  if$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {reverse.pass}
{ next.extra "b" =
    { "a" 'extra.label := }
    'skip$
  if$
  label extra.label * 'label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
  extra.label 'next.extra :=
}
%</bststd&bstalpha>
%    \end{macrocode}
%
% \subsubsection{Generic code}
%
%    \begin{macrocode}
%<*bststd>

EXECUTE {initialize.longest.label}

%</bststd>
%<bststd&!bstalpha>ITERATE {longest.label.pass}
%<bststd&bstalpha>ITERATE {forward.pass}
%<bststd&bstalpha>REVERSE {reverse.pass}
%<*bststd>

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {begin.bib}
{
%</bststd>
%<*bststd&bstalpha>
  et.al.char.used
    { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
    'skip$
  if$
%</bststd&bstalpha>
%<*bststd>
  preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  "  \providebibliographyfont{name}{}%" write$ newline$
  "  \providebibliographyfont{lastname}{}%" write$ newline$
  "  \providebibliographyfont{title}{\emph}%" write$ newline$
  "  \providebibliographyfont{jtitle}{\btxtitlefont}%" write$ newline$
  "  \providebibliographyfont{etal}{\emph}%" write$ newline$
  "  \providebibliographyfont{journal}{}%" write$ newline$
  "  \providebibliographyfont{volume}{}%" write$ newline$
  "  \providebibliographyfont{ISBN}{\MakeUppercase}%" write$ newline$
  "  \providebibliographyfont{ISSN}{\MakeUppercase}%" write$ newline$
  "  \providebibliographyfont{url}{\url}%" write$ newline$
  "  \providebibliographyfont{numeral}{}%" write$ newline$
  "  \expandafter\btxselectlanguage\expandafter {\btxfallbacklanguage}"
  write$ newline$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
EXECUTE {begin.bib}

%    \end{macrocode}
% 
%    \begin{macrocode}
EXECUTE {init.state.consts}

%    \end{macrocode}
% 
%    \begin{macrocode}
ITERATE {call.type$}

%    \end{macrocode}
% 
%    \begin{macrocode}
FUNCTION {end.bib}
{ newline$
  "\end{thebibliography}" write$ newline$
}

%    \end{macrocode}
% 
%    \begin{macrocode}
EXECUTE {end.bib}
%</bststd>
%    \end{macrocode}
%
%
% \subsection{AMS styles}
%
% The following \BibTeX\ styles are derived from the AMS \BibTeX-style-files
% by the American Mathematical Society.
% For example, see `amsplain.bst' for more documentation about the
% original.
%    \begin{macrocode}
%<*bstams>
ENTRY
  { address
    annote
    annotelanguage
    author
    booktitle
    chapter
    edition
    editor
    howpublished
    institution
    isbn
    issn
    journal
    key
    language
    month
    mrnumber
    note
    number
    organization
    pages
    publisher
    school
    series
    title
    type
    url
    urldate
    volume
    year
  }
  {}
  { label bysame }


INTEGERS { output.state before.all mid.sentence }

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
}

STRINGS { s t language.state change.temp}

FUNCTION {shows}
{ duplicate$ "::::  `" swap$ * "'" * top$
}

FUNCTION {showstack}
{"STACK================================================================"
top$
stack$
"ENDSTACK============================================================="
top$
}

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

FUNCTION {language.change.case}
{ 
  'change.temp :=
  't :=
  "\btxifchangecase {"
  t change.temp change.case$ *
  "}{" *
  t *
  "}" *
}

FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

%    \end{macrocode}
% \changes{1.00}{2005/02/16}{Remove \texttt{emphasize} and
%   \texttt{smallcaps} from \BibTeX\ styles}%
%    \begin{macrocode}
FUNCTION {namefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxnamefont {" swap$ * "}" * }
  if$
}

%    \end{macrocode}
% \changes{1.12}{2005/06/19}{Add extra formatting of lastnames to
%   \BibTeX\ styles}%
%    \begin{macrocode}
FUNCTION {lastnamefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxlastnamefont {" swap$ * "}" * }
  if$
}

FUNCTION {titlefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxtitlefont {" swap$ * "}" * }
  if$
}

FUNCTION {jtitlefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxjtitlefont {" swap$ * "}" * }
  if$
}

FUNCTION {journalfont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxjournalfont {" swap$ * "}" * }
  if$
}

FUNCTION {publisherfont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxpublisherfont {" swap$ * "}" * }
  if$
}

FUNCTION {volumefont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxvolumefont {" swap$ * "}" * }
  if$
}

FUNCTION {etalfont}
{ duplicate$ empty$
    { pop$ "" }
    { "\btxetalfont {" swap$ * "}" * }
  if$
}

%    \end{macrocode}
% \texttt{n.dashify} is used to make sure page ranges get the \TeX\ code
% (two hyphens) for en-dashes.
%    \begin{macrocode}
FUNCTION {n.dashify}
{ 't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
        { t #1 #2 substring$ "--" = not
            { "--" *
              t #2 global.max$ substring$ 't :=
            }
            {   { t #1 #1 substring$ "-" = }
                { "-" *
                  t #2 global.max$ substring$ 't :=
                }
              while$
            }
          if$
        }
        { t #1 #1 substring$ *
          t #2 global.max$ substring$ 't :=
        }
      if$
    }
  while$
}

%    \end{macrocode}
% |tie.or.space.connect| connects two items with a |~| if the
% second item is less than 3 letters long, otherwise it just puts an
% ordinary space.
%    \begin{macrocode}
FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { "\ " }
  if$
  swap$ * *
}

FUNCTION {add.space.if.necessary}
{ duplicate$ "" =
    'skip$
    { "\ " * }
  if$
}

%    \end{macrocode}
% |either.or.check| gives a warning if two mutually exclusive fields
% were used in the database.
%    \begin{macrocode}
FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

%    \end{macrocode}
% |output.nonnull| is called by output.
%    \begin{macrocode}
FUNCTION {output.nonnull}
%    \end{macrocode}
% remove the top item from the stack because it's in the way.
%    \begin{macrocode}
{ 's :=
  output.state mid.sentence =
%    \end{macrocode}
% If we're in mid-sentence, add a comma to the new top item and write it
%    \begin{macrocode}
    { ", " * write$ }
%    \end{macrocode}
% Otherwise, if we're at the beginning of a bibitem,
%    \begin{macrocode}
    { output.state before.all =
%    \end{macrocode}
% just write out the top item from the stack;
%    \begin{macrocode}
      'write$
%    \end{macrocode}
% and the last alternative is that we're at the end of the current
% bibitem, so we add a period to the top stack item and write it out.
%    \begin{macrocode}
        { add.period$ " " * write$ }
      if$
      mid.sentence 'output.state :=
    }
  if$
%    \end{macrocode}
% Put the top item back on the stack that we removed earlier.
%    \begin{macrocode}
  s
}

%    \end{macrocode}
% Output checks to see if the stack top is empty; if not, it
% calls output.nonnull to write it out.
%    \begin{macrocode}
FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

%    \end{macrocode}
% Standard warning message for a missing or empty field. For the user
% we call any such field `missing' without respect to the distinction
% made by Bib\TeX\ between missing and empty.
%    \begin{macrocode}
FUNCTION {missing.warning}
{ "missing " swap$ * " in " * cite$ * warning$ }

%    \end{macrocode}
% |output.check| is like output except that it gives a warning on-screen
% if the given field in the database entry is empty.  t is the field
% name.
%    \begin{macrocode}
FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ t missing.warning }
    'output.nonnull
  if$
}

FUNCTION {output.bibitem}
{ newline$
%    \end{macrocode}
% \changes{0.40}{2003/09/26}{Switch to a fall-back language when
%   \texttt{language} field is missing}%
% If no language is given, fall back to the language that has been
% active at \cs{begin\{document\}}.
% For \BibTeX, this language gets the name \texttt{nolanguage}.
%    \begin{macrocode}
  language empty$
    { "empty language in " cite$ * warning$
      language.state "nolanguage" =
        'skip$
        {
          "\expandafter\btxselectlanguage\expandafter {"
          "\btxfallbacklanguage}" * write$
          newline$
        }
      if$
      "nolanguage" 'language.state :=
    }
    { language.state language =
        'skip$
        { "\btxselectlanguage {" language * "}" * write$
          newline$
        }
      if$
      language 'language.state :=
    }
  if$
  "\bibitem {" cite$ * "}" * write$
  newline$
%    \end{macrocode}
% This empty string is the first thing that will be written
% the next time \verb|write$| is called.  Done this way because each
% item is saved on the stack until we find out what punctuation
% should be added after it.  Therefore we need an empty first item.
%    \begin{macrocode}
  ""
  before.all 'output.state :=
}

FUNCTION {output.nonempty.mrnumber}
{ duplicate$ missing$
    { pop$ "" }
    'skip$
  if$
  duplicate$ empty$
    'pop$
    { " \MR{" swap$ * "}" * write$ }
  if$
}

FUNCTION {fin.entry}
{ add.period$
  write$
  mrnumber output.nonempty.mrnumber
  newline$
}

%    \end{macrocode}
% Removed |new.block|, |new.block.checka|, |new.block.checkb|,
% |new.sentence|, |new.sentence.checka|, and |new.sentence.checkb|
% functions here, since they don't seem to be needed in the AMS style.
% Also moved some real basic functions like `and' and 'or' earlier in
% the file.
%    \begin{macrocode}
INTEGERS { nameptr namesleft numnames }

%    \end{macrocode}
% The extra section to write out a language field was added
% for babamspl.bst.  Not present in babplain.bst.
%    \begin{macrocode}
FUNCTION {format.language}
{ language empty$
    { "" }
    { "\btxprintamslanguage{\btxlanguagename {" language * "}}" * }
  if$
}

%    \end{macrocode}
% This version of format.names puts names in the format
% ``First von Last, Jr.''
% (i.\,e., first name first, no abbreviating to initials).
%    \begin{macrocode}
FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    {
      s nameptr "{ff{\btxfnamespacelong }~}{vv~}" format.name$
      s nameptr "{ll}" format.name$ lastnamefont *
      s nameptr "{, jj}" format.name$ * 't :=
      nameptr #1 >
        { namesleft #1 >
            { ", " * t namefont * }
            { numnames #2 >
                { "\btxandcomma {}" * }
                'skip$
              if$
              s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ "others" =
                { " " * "\btxetalshort {.}" etalfont * }
                { " \btxandlong {} " * t namefont * }
              if$
            }
          if$
        }
        {
          s nameptr "{ff{\btxfnamespacelong }~}{vv~}" format.name$
          s nameptr "{ll}" format.name$ lastnamefont *
          s nameptr "{, jj}" format.name$ * namefont
        }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {format.authors}
{ author empty$
    { "" }
    { bysame "\bysame" =
         {"\bysame"}
         { author format.names }
     if$
    }
  if$
}

FUNCTION {format.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
        { "\ (\btxeditorsshort {.})" * }
        { "\ (\btxeditorshort {.})" * }
      if$
    }
  if$
}

FUNCTION {format.nonauthor.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
        { ", \btxeditorsshort {.}" * }
        { ", \btxeditorshort {.}" * }
      if$
    }
  if$
}

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" language.change.case titlefont }
  if$
}

FUNCTION {format.jtitle}
{ title empty$
    { "" }
    { title "t" language.change.case jtitlefont }
  if$
}

FUNCTION {format.journal.vol.year}
{ journal empty$
    { "journal name" missing.warning ""}
    { journal journalfont }
  if$
  volume empty$
    'skip$
    { " " * volume volumefont * }
  if$
  year empty$
    { "year" missing.warning }
    { " (" * year * ")" * }
  if$
}

%    \end{macrocode}
% For formatting the issue number for a journal article.
%    \begin{macrocode}
FUNCTION {format.number}
{ number empty$
    { "" }
    { "\btxnumbershort {.}~" number * }
  if$
}

%    \end{macrocode}
% For formatting miscellaneous dates
%    \begin{macrocode}
FUNCTION {format.date}
{ year empty$
    { month empty$
        { "" }
        { "there's a month but no year in " cite$ * warning$
          month
        }
      if$
    }
    { month empty$
        'year
        { month "\ " * year * }
      if$
    }
  if$
}

%    \end{macrocode}
%      The volume, series and number information is sort of tricky.
%      This code handles it as follows:
%      If the series is present, and the volume, but not the number,
%        then we do "\emph{Book title}, Series Name, vol. 000"
%      If the series is present, and the number, but not the volume,
%        then we do "\emph{Book title}, Series Name, no. 000"
%      If the series is present, and both number and volume,
%        then we do "\emph{Book title}, vol. XX, Series Name, no. 000"
%      Finally, if the series is absent,
%        then we do "\emph{Book title}, vol. XX"
%        or         "\emph{Book title}, no. 000"
%        and if both volume and number are present, give a warning message.
%    \begin{macrocode}
FUNCTION {format.bookvolume.series.number}
{ volume empty$
    { "" % Push the empty string as a placeholder in case everything else
         % is empty too.
      series empty$
        'skip$
        { pop$ series } % if series is not empty put in stack
      if$
      number empty$
        'skip$
        { duplicate$ empty$ % if no preceding material,
            'skip$          % do nothing, otherwise
            { ", " * }      % add a comma and space to separate.
          if$
          "\btxnumbershort {.}" number tie.or.space.connect * % add the number information
        }
      if$
    }
%    \end{macrocode}
% If the volume is NOT EMPTY:
%    \begin{macrocode}
    { "\btxvolumeshort {.}" volume tie.or.space.connect % vol. XX
      number empty$
        { series empty$
            'skip$
            { series ", " * swap$ *}    % Series Name, vol. XX
          if$
        }
        { series empty$
            { "can't use both volume and number if series info is missing"
              warning$
              "in BibTeX entry type `" type$ * "'" * top$
            }
            { ", " * series * ", \btxnumbershort {.}" * number tie.or.space.connect }
          if$
        }
      if$
    }
  if$

}  % end of format.bookvolume.series.number

%    \end{macrocode}
% |format.inproc.title.where.editors| is used by inproceedings entry types
%      No case changing or emphasizing for the title.  We want initial
%      caps, roman.
%      We add parentheses around the address (place where conference
%      was held).
%      Likewise we add parentheses around the editors' names.
%    \begin{macrocode}
FUNCTION {format.inproc.title.address.editors}
{ booktitle empty$
    { "" }
    { booktitle
      address empty$
        'skip$
        { add.space.if.necessary "(" * address * ")" * }
      if$
      editor empty$
        'skip$
        { add.space.if.necessary "(" * format.nonauthor.editors * ")" * }
      if$
    }
  if$
}

%    \end{macrocode}
% |format.incoll.title.editors| is similar to |format.inproc...| but
% omits the address. For collections that are not proceedings volumes.
%    \begin{macrocode}
FUNCTION {format.incoll.title.editors}
{ booktitle empty$
    { "" }
    { editor empty$
        { booktitle }
        { booktitle
          add.space.if.necessary "(" * format.nonauthor.editors * ")" *
        }
      if$
    }
  if$
}

FUNCTION {format.edition}
{ edition empty$
    { "" }
    {
      output.state mid.sentence =
        { edition "l" change.case$ }
        { edition "t" change.case$ }
      if$
      "\btxnumeralshort {" swap$ *
      "}~\btxeditionshort {.}" * 
    }
  if$
}

FUNCTION {format.isbn}
{ isbn empty$
    { "" }
    { "\mbox{\btxISBN~\btxISBNfont {" isbn * "}}" * }
  if$
}

FUNCTION {format.issn}
{ issn empty$
    { "" }
    { "\mbox{\btxISSN~\btxISSNfont {" issn * "}}" * }
  if$
}

FUNCTION {format.url}
{ url empty$
    { "" }
    {
      urldate empty$
      { "{\latintext \btxurlfont{" url * "}}" * }
      {
        "{\latintext \btxurlfont{" url * "}}%" *
        newline$ output
        "\btxurldatecomment {\btxkeywordlanguage {\btxurldatefont{"
          urldate * "}}}" *
      }
      if$
    }
  if$
}
%    \end{macrocode}
% Format annotations:
%    \begin{macrocode}
FUNCTION {write.annote}
{ annote empty$
  'skip$
  { 
    annotelanguage empty$
    { "\btxkeywordlanguage {" }
    { "{\selectlanguage {" annotelanguage * "}" * }
    if$
    "\btxannotation {" * annote * "}}" * 
    write$ newline$
  }
  if$
}

INTEGERS { multiresult }

FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
        { #1 'multiresult := }
        { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

FUNCTION {format.pages}
{ pages empty$
    { "" }
    { pages n.dashify }
  if$
}

FUNCTION {format.book.pages}
{ pages empty$
    { "" }
    { pages multi.page.check
        { "\btxpagesshort {.}~" pages n.dashify * }
        { "\btxpageshort {.}~" pages * }
      if$
    }
  if$
}

FUNCTION {format.chapter.pages}
{ chapter empty$
    'format.book.pages
    { type empty$
        { "\btxchaptershort {.}~" }
        { type "l" language.change.case " " * }
      if$
      chapter *
      pages empty$
        'skip$
        { ", " * format.book.pages * }
      if$
    }
  if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
  key empty$ not and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      type "t" language.change.case
    }
  if$
}

FUNCTION {format.tr.number}
{ type empty$
    { "\Btxtechrepshort {.}" }
    'type
  if$
  number empty$
    { "t" language.change.case }
    { number tie.or.space.connect }
  if$
}

%    \end{macrocode}
% The |format.crossref| functions haven't been paid much attention
% at the present time (June 1990) and could probably use some
% work.  MJD
%    \begin{macrocode}
FUNCTION {format.article.crossref}
{ key empty$
    { journal empty$
        { "need key or journal for " cite$ * " to crossref " * crossref *
          warning$
          ""
        }
        { "\btxinshort {} " journal journalfont * }
      if$
    }
    { "\btxinshort {} " key * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.crossref.editor}
{ editor #1 "{vv~}{ll}" format.name$
  editor num.names$ duplicate$
  #2 >
    { pop$ " \btxetalshort {.}" * }
    { #2 <
        'skip$
        { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
            { " \btxetalshort {.}" * }
            { " \btxandlong {} " * editor #2 "{vv~}{ll}" format.name$ * }
          if$
        }
      if$
    }
  if$
}

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
      "\btxinserieslong {} "
    }
    { "\btxvolumeshort {.}" volume tie.or.space.connect
      " \btxofserieslong {} " *
    }
  if$
  editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
        { series empty$
            { "need editor, key, or series for " cite$ * " to crossref " *
              crossref * warning$
              "" *
            }
            { series * }
          if$
        }
        { key * }
      if$
    }
    { format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.incoll.inproc.crossref}
{ editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
        { booktitle empty$
            { "need editor, key, or booktitle for " cite$ * " to crossref " *
              crossref * warning$
              ""
            }
            { "\btxinlong {} " * booktitle titlefont * }
          if$
        }
        { "\btxinlong {} " key * }
      if$
    }
    { "\btxinlong {} " format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

%    \end{macrocode}
% The main functions for each entry type.
%
% journal, vol and year are formatted together because they are
% not separated by commas.
%    \begin{macrocode}
FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  format.jtitle "title" output.check
  crossref missing$
    { format.journal.vol.year output
      format.number output
      format.pages "pages" output.check
    }
    { format.article.crossref output.nonnull
      format.pages "pages" output.check
    }
  if$
  format.issn output
  format.url output
  format.language *
  note output
  fin.entry
  write.annote
}

FUNCTION {book}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  format.title "title" output.check
  format.edition output
  crossref missing$
    { format.bookvolume.series.number output
      publisher "publisher" output.check publisherfont
      address output
    }
    { format.book.crossref output.nonnull
    }
  if$
  format.date "year" output.check
  format.isbn output
  format.url output
  format.language *
  note output
  fin.entry
  write.annote
}

FUNCTION {booklet}
{ output.bibitem
  format.authors output
  format.title "title" output.check
  howpublished output
  address output
  format.date output
  format.url output
  note output
  fin.entry
  write.annote
}

FUNCTION {inbook}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  format.title "title" output.check
  format.edition output
  crossref missing$
    { format.bookvolume.series.number output
      format.chapter.pages "chapter and pages" output.check
      publisher "publisher" output.check publisherfont
      address output
    }
    { format.chapter.pages "chapter and pages" output.check
      format.book.crossref output.nonnull
    }
  if$
  format.date "year" output.check
  format.isbn output
  format.url output
  format.language *
  note output
  fin.entry
  write.annote
}

FUNCTION {incollection}
{ output.bibitem
  format.authors "author" output.check
  format.title "title" output.check
  crossref missing$
    { format.incoll.title.editors "booktitle" output.check
      format.bookvolume.series.number output
      publisher "publisher" output.check publisherfont
      address output
      format.edition output
      format.date "year" output.check
    }
    { format.incoll.inproc.crossref output.nonnull
    }
  if$
  note output
  format.book.pages output
  format.isbn output
  format.url output
  format.language *
  fin.entry
  write.annote
}

FUNCTION {inproceedings}
{ output.bibitem
  format.authors "author" output.check
  format.title "title" output.check
  crossref missing$
    { format.inproc.title.address.editors "booktitle" output.check
      format.bookvolume.series.number output
      organization output
      publisher publisherfont output
      format.date "year" output.check
    }
    { format.incoll.inproc.crossref output.nonnull
    }
  if$
  note output
  format.book.pages output
  format.isbn output
  format.url output
  format.language *
  fin.entry
  write.annote
}

FUNCTION {conference} { inproceedings }

FUNCTION {manual}
{ output.bibitem
  author empty$
    { organization empty$
        'skip$
        { organization output.nonnull
          address output
        }
      if$
    }
    { format.authors output.nonnull }
  if$
  format.title "title" output.check
  author empty$
    { organization empty$
        { address output }
        'skip$
      if$
    }
    { organization output
      address output
    }
  if$
  format.edition output
  format.date output
  format.isbn output
  format.url output
  note output
  fin.entry
  write.annote
}

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  format.title "title" output.check
  "\btxmastthesis {}" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
  format.url output
  note output
  format.book.pages output
  fin.entry
  write.annote
}

FUNCTION {misc}
{ output.bibitem
  format.authors output
  format.title output
  howpublished output
  format.date output
  format.isbn output
  format.issn output
  format.url output
  note output
  format.book.pages output
  fin.entry
  write.annote
  empty.misc.check
}

FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  format.title "title" output.check
  "\btxphdthesis {}" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
  format.isbn output
  format.url output
  note output
  format.book.pages output
  fin.entry
  write.annote
}

FUNCTION {proceedings}
{ output.bibitem
  editor empty$
    { organization output }
    { format.editors output.nonnull }
  if$
  format.title "title" output.check
  format.bookvolume.series.number output
  address empty$
    { editor empty$
        'skip$
        { organization output }
      if$
      publisher publisherfont output
      format.date "year" output.check
    }
    { address output.nonnull
      editor empty$
        'skip$
        { organization output }
      if$
      publisher publisherfont output
      format.date "year" output.check
    }
  if$
  format.isbn output
  format.url output
  note output
  fin.entry
  write.annote
}

FUNCTION {techreport}
{ output.bibitem
  format.authors "author" output.check
  format.title "title" output.check
  format.tr.number output.nonnull
  institution "institution" output.check
  address output
  format.date "year" output.check
  format.isbn output
  format.url output
  note output
  fin.entry
  write.annote
}

FUNCTION {unpublished}
{ output.bibitem
  format.authors "author" output.check
  format.title "title" output.check
  format.url output
  note "note" output.check
  format.date output
  fin.entry
  write.annote
}

FUNCTION {default.type} { misc }

MACRO {jan} {"\btxmonjanlong {}"}
MACRO {feb} {"\btxmonfeblong {}"}
MACRO {mar} {"\btxmonmarlong {}"}
MACRO {apr} {"\btxmonaprlong {}"}
MACRO {may} {"\btxmonmaylong {}"}
MACRO {jun} {"\btxmonjunlong {}"}
MACRO {jul} {"\btxmonjullong {}"}
MACRO {aug} {"\btxmonauglong {}"}
MACRO {sep} {"\btxmonseplong {}"}
MACRO {oct} {"\btxmonoctlong {}"}
MACRO {nov} {"\btxmonnovlong {}"}
MACRO {dec} {"\btxmondeclong {}"}

READ

FUNCTION {sortify}
{ purify$
  "l" language.change.case
}

INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}

FUNCTION {sort.format.names}
{ 's :=
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
        { "   " * }
        'skip$
      if$
      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
      nameptr numnames = t "others" = and
        { "et al" * }
        { t sortify * }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  sortify
  #1 global.max$ substring$
}

FUNCTION {author.sort}
{ author empty$
    { key empty$
        { "to sort, need author or key in " cite$ * warning$
          ""
        }
        { key sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
        { key empty$
            { "to sort, need author, editor, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.organization.sort}
{ author empty$
    { organization empty$
        { key empty$
            { "to sort, need author, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
        { key empty$
            { "to sort, need editor, organization, or key in " cite$ * warning$
              ""
            }
            { key sortify }
          if$
        }
        { "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

FUNCTION {presort}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
        'editor.organization.sort
        { type$ "manual" =
            'author.organization.sort
            'author.sort
          if$
        }
      if$
    }
  if$
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {presort}

SORT

STRINGS { longest.label prev.author this.author }

INTEGERS { number.label longest.label.width }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
  "abcxyz" 'prev.author :=
  "" 'this.author :=
}

FUNCTION {longest.label.pass}
{ number.label int.to.str$ 'label :=
  number.label #1 + 'number.label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
  author empty$
    { editor empty$
      { "" }
      'editor
      if$
    }
    'author
  if$
  'this.author :=
  this.author prev.author =
    { "\bysame" 'bysame := }
    { "" 'bysame :=
      this.author "" =
        { "abcxyz" }
        'this.author
      if$
      'prev.author :=
    }
  if$
}

EXECUTE {initialize.longest.label}

ITERATE {longest.label.pass}

FUNCTION {write.lines}
{ { duplicate$ "." = NOT }
    { write$ newline$ }
  while$
  pop$
}

FUNCTION {begin.bib}
{ preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{" longest.label * "}" * write$ newline$
  "  \providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace}"
    write$ newline$
  "  \providecommand{\MR}{\relax\ifhmode\unskip\space\fi MR }"
    write$ newline$
  "  % \MRhref is called by the amsart/book/proc definition of \MR."
    write$ newline$
  "  \providecommand{\MRhref}[2]{%" write$ newline$
  "    \href{http://www.ams.org/mathscinet-getitem?mr=#1}{#2}"
    write$ newline$
  "  }" write$ newline$
  "  \providecommand{\href}[2]{#2}" write$ newline$
  "  \providebibliographyfont{name}{}%" write$ newline$
  "  \providebibliographyfont{lastname}{}%" write$ newline$
  "  \providebibliographyfont{title}{\emph}%" write$ newline$
  "  \providebibliographyfont{jtitle}{\btxtitlefont}%" write$ newline$
  "  \providebibliographyfont{etal}{}%" write$ newline$
  "  \providebibliographyfont{journal}{}%" write$ newline$
  "  \providebibliographyfont{volume}{\textbf}%" write$ newline$
  "  \providebibliographyfont{ISBN}{\MakeUppercase}%" write$ newline$
  "  \providebibliographyfont{ISSN}{\MakeUppercase}%" write$ newline$
  "  \providebibliographyfont{url}{\url}%" write$ newline$
  "  \providebibliographyfont{numeral}{}%" write$ newline$
  "  \providecommand\btxprintamslanguage[1]{\ (#1)}" write$ newline$
  "  \expandafter\btxselectlanguage\expandafter {\btxfallbacklanguage}"
  write$ newline$
}

EXECUTE {begin.bib}

EXECUTE {init.state.consts}

ITERATE {call.type$}

FUNCTION {end.bib}
{ newline$
  "\end{thebibliography}" write$ newline$
}

EXECUTE {end.bib}
%</bstams>
%    \end{macrocode}
%
% \Finale