%%
%% This is file `amsrefs.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% amsrefs.dtx  (with options: `pkg')
%% 
%%% ====================================================================
%%% @LaTeX-doc-source-file{
%%%   filename  = "amsrefs.dtx",
%%%   version   = "2.0",
%%%   date      = "2004/06/30",
%%%   time      = "11:24:39 EDT",
%%%   author    = "Michael J Downes and David M. Jones",
%%%   address   = "American Mathematical Society,
%%%                Publications Technical Group,
%%%                PO Box 6248,
%%%                Providence, RI 02940,
%%%                USA",
%%%   email     = "tech-support@ams.org",
%%%   URL       = "http://www.ams.org/",
%%%   abstract  = "A LaTeX package that permits bibliography style
%%%                to be controlled completely from the LaTeX side
%%%                instead of being determined chiefly by the BibTeX
%%%                style file.",
%%%   checksum  = "09127 8030 25325 242081",
%%%   docstring = "The checksum field, produced by Robert Solovay's
%%%                checksum utility, gives CRC-16 checksum, lines,
%%%                words, and characters.",
%%%  }
%%% ====================================================================
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\def\amsrefs@warning@nl{\PackageWarningNoLine{amsrefs}}
\@ifpackagewith{amsrefs}{beta}{%
    \amsrefs@warning@nl{The beta option is deprecated^^J%
    and will be removed in a future release of amsrefs}
    \expandafter\edef\csname opt@amsrbeta.sty\endcsname
        {\@ptionlist{amsrefs.sty}}%
    \def\@currname{amsrbeta}%
    \expandafter\let\csname amsrbeta.sty-h@@k\endcsname\@empty
    \def\@tempa{\input{amsrbeta.sty}\endinput}%
}{%
    \let\@tempa\@empty
}
\@tempa
\IfFileExists{url.sty}{%
    \RequirePackage{url}\relax
    \@gobble
}{%
    \@firstofone
}
{
    \DeclareRobustCommand{\url}[1]{%
        \def\@tempa{#1}%
        \texttt{\@urlsetup $\expandafter\strip@prefix\meaning\@tempa$}%
    }%
    \def\@urlsetup{%
        \check@mathfonts \textfont\@ne\the\font \textfont\z@\the\font
        \@apply\@urlfix{\do\+\do\=\do\:\do\-\do\.\do\,\do\;}%
        \@apply\@urlbreak{\do\&\do\/\do\?}%
    }%
    \def\@urlbreak#1{%
        \mathcode`#1="8000
        \begingroup \lccode`\~=`#1 \lowercase{\endgroup \edef~}%
        {\mathchar\number`#1\penalty\hyphenpenalty}%
    }%
    \def\@urlfix#1{%
        \mathcode`#1=`#1\relax
    }%
}
\@ifundefined{NormalCatcodes}{\RequirePackage{pcatcode}\relax}{}
\PushCatcodes\NormalCatcodes
\ProvidesPackage{amsrefs}[2004/06/07 v1.71]
%% WARNING WARNING WARNING: Catcode of apostrophe ' is letter
%% throughout this file.
\catcode`\'=11 % letter
\def\after@deleting@token#1{%
    \afterassignment#1%
    \let\@let@token= % Don't delete this space!
}
\long\def\@ifempty#1{\@xifempty#1@@..\@nil}

\long\def\@xifempty#1#2@#3#4#5\@nil{%
    \ifx#3#4\@xp\@firstoftwo\else\@xp\@secondoftwo\fi
}

\long\def\@ifnotempty#1{\@ifempty{#1}{}}
\def\macrotext{\expandafter\strip@prefix\meaning}
\def\vdef#1#2{%
    \def#1{#2}%
    \edef#1{\macrotext#1}%
}
\def\auto@protect#1{\def#1{\@nx#1}}
\def\g@undef#1{\global\let#1\relax}
\def\@concat#1#2{\edef#1{#1#2}}
\def\add@toks@{\addto@hook\toks@}
\def\@lappend#1#2{%
    \begingroup
        \def\do{\@nx\do\@nx}%
        \edef\@tempa{\def\@nx#1{#1\do#2}}%
    \@xp\endgroup
    \@tempa
}
\def\@apply#1#2{%
    \let\do#1%
    #2%
}
\def\get@numberof#1#2#3{%
    \begingroup
        \def#2{\advance\@tempcnta\@ne \@gobble}%
        \@tempcnta\z@
        #3\relax
        \edef\@tempb{#1=\the\@tempcnta\relax}%
    \@xp\endgroup
    \@tempb
}
\def\safe@set#1#2{%
    \afterassignment\@nilgobble
    #1=0#2\relax\@nil
}
\def\@chomp#1#2{%
    \begingroup
        \toks@\@emptytoks
        \def\@chomper##1##2#2\@empty##3\@nil{%
            \ifx\@let@token\bgroup
                \toks@{{##1}##2}%
            \else
                \toks@{##1##2}%
            \fi
        }%
        \@xp\chomp@ #1\@empty#2\@empty\@nil
        \edef\@tempa{\def\@nx#1\@xp{\the\toks@}}%
    \@xp\endgroup
    \@tempa
}
\def\chomp@{%
    \futurelet\@let@token
    \@chomper
}
\def\amsrefs@warning{\PackageWarning{amsrefs}}
\def\amsrefs@error{\PackageError{amsrefs}}
\def\MessageBreakNS{\MessageBreak\romannumeral`\^^@}
\@ifundefined{@addpunct}{%
    \def\@addpunct#1{%
        \relax\ifhmode
            \ifnum\spacefactor>\@m \else#1\fi
        \fi
    }
    \def\frenchspacing{%
        \sfcode`\.1006
        \sfcode`\?1005
        \sfcode`\!1004
        \sfcode`\:1003
        \sfcode`\;1002
        \sfcode`\,1001\relax
    }
}{}
\providecommand{\nopunct}{\spacefactor \@nopunctsfcode}
\def\@nopunctsfcode{1007 }
\RequirePackage{ifoption}[2000/02/15]
\DeclareExclusiveOptions{sorted,citation-order}
\DeclareExclusiveOptions{alphabetic,shortalphabetic,author-year,numeric}
\DeclareBooleanOption{y2k}
\DeclareBooleanOption{nobysame}
\DeclareBooleanOption{short-journals}
\DeclareBooleanOption{short-publishers}
\DeclareBooleanOption{short-months}
\DeclareBooleanOption{initials}
\DeclareOption{abbrev}{%
    \@pass@ptions
        \@currext
        {initials,short-months,short-journals,short-publishers}%
        \@currname
}
\DeclareExclusiveOptions{traditional-quotes,logical-quotes}
\DeclareExclusiveOptions{sorted-cites,non-sorted-cites}
\DeclareExclusiveOptions{non-compressed-cites,compressed-cites}
\DeclareBooleanOption{backrefs}
\DeclareBooleanOption{?}
\DeclareBooleanOption{lite}
\DeclareBooleanOption{beta}
\DeclareBooleanOption{jpa}
\DeclareBooleanOption{bibtex-style}
\ExecuteOptions{numeric,traditional-quotes,sorted-cites,compressed-cites}

\ProcessOptions\relax

\ProcessExclusiveOptions
\IfOption{backrefs}{%
    \IfFileExists{hyperref.sty}{%
        \RequirePackage{hyperref}[1999/07/08]
    }{}%
    \IfFileExists{backref.sty}{%
        \RequirePackage{backref}[1999/05/30]
    }{}%
}{}
\IfOption{?}{%
    \typeout{^^J%
        Documentation for the amsrefs package is found in amsrdoc.dvi^^J%
        (or .pdf or .tex).
        ^^J%
    }%
}{}%
\RequirePackage{rkeyval}[2001/12/22]
\IfOption{lite}{% True? Then don't load the next two packages.
}{%              False? OK, let's load them:
    \RequirePackage{textcmds}[2001/12/14]
    \RequirePackage{mathscinet}[2002/01/01]
}
\newcommand{\BibField}[1]{\csname bib'#1\endcsname}
\newcommand{\IfEmptyBibField}{\rkvIfEmpty{bib}}
\let\fld@elt=?
\let\name=?
\DefineAdditiveKey{bib}{author}{\name}
\DefineAdditiveKey{bib}{editor}{\name}
\DefineAdditiveKey{bib}{translator}{\name}
\DefineAdditiveKey{bib}{contribution}{\fld@elt}
\DefineAdditiveKey{bib}{isbn}{\fld@elt}
\DefineAdditiveKey{bib}{issn}{\fld@elt}
\DefineAdditiveKey{bib}{review}{\fld@elt}
\DefineAdditiveKey{bib}{partial}{\fld@elt}
\DefineSimpleKey{bib}{address}
\DefineSimpleKey{bib}{book}
\DefineSimpleKey{bib}{booktitle}
\DefineSimpleKey{bib}{conference}
\DefineSimpleKey{bib}{copula}
\DefineSimpleKey{bib}{date}
\DefineSimpleKey{bib}{doi}
\DefineSimpleKey{bib}{edition}
\DefineSimpleKey{bib}{eprint}
\DefineSimpleKey{bib}{fulljournal}
\DefineSimpleKey{bib}{hyphenation}
\DefineSimpleKey{bib}{institution}
\DefineSimpleKey{bib}{journal}
\DefineSimpleKey{bib}{label}
\DefineSimpleKey{bib}{language}
\DefineSimpleKey{bib}{name}
\DefineSimpleKey{bib}{note}
\DefineSimpleKey{bib}{number}
\DefineSimpleKey{bib}{organization}
\DefineSimpleKey{bib}{pages}
\DefineSimpleKey{bib}{part}
\DefineSimpleKey{bib}{place}
\DefineSimpleKey{bib}{publisher}
\DefineSimpleKey{bib}{reprint}
\DefineSimpleKey{bib}{school}
\DefineSimpleKey{bib}{series}
\DefineSimpleKey{bib}{setup}
\DefineSimpleKey{bib}{status}
\DefineSimpleKey{bib}{subtitle}
\DefineSimpleKey{bib}{title}
\DefineSimpleKey{bib}{translation}
\DefineSimpleKey{bib}{type}
\DefineSimpleKey{bib}{url}
\DefineSimpleKey{bib}{volume}
\DefineSimpleKey{bib}{xref}
\DefineSimpleKey{bib}{year}
\DefineDummyKey{bib}{transition}
\DefineSimpleKey{prop}{inverted}
\DefineSimpleKey{prop}{language}
\newcommand{\BibSpec}[2]{%
    \toks@\@emptytoks
    \@ifnotempty{#2}{%
        \@ifnextchar{+}{\@xp\bibspec@scan\@gobble}{\bibspec@scan}%
        #2\@empty\@empty\@empty\@empty
    }%
    \@xp\edef\csname setbib@#1\endcsname{\the\toks@}%
}
\def\bibspec@scan#1#2#3#4{%
    \add@toks@{\bib@append{#1}{#2}}%
    \edef\@tempa{%
        \toks@{\the\toks@ \@xp\@nx\csname bib'#3\endcsname}%
    }%
    \@tempa
    \ifx\@empty#4%
        \@xp\@gobble % end the recursion
    \else
        \ifx +#4\else\bibspec@scan@error\fi
    \fi
    \bibspec@scan
}
\def\bibspec@scan@error{\amsrefs@error{Bad BibSpec: Expected '+'}}
\def\bib@append#1#2#3{%
    \ifx\@empty#3%
    \else
        \ifx\relax#3%
            \errmessage{#3=\relax}%
        \else
            \begingroup
                \series@index\m@ne
                \def\current@bibfield{#3}%
                \@ifempty{#1}{%
                    \@temptokena{\ifnum\lastkern=\@ne\ignorespaces\fi #2}%
                }{%
                    \@temptokena{\SwapBreak{#1}#2}%
                }%
                \toks@\@xp{#3}%
                \edef\@tempa{\the\@temptokena{\the\toks@}}%
                \rkvIfAdditive#3{}{%
                    \get@current@properties
                    \select@auxlanguage
                }%
                \@tempa
            \endgroup
        \fi
    \fi
}
\def\select@auxlanguage{%
    \ifx\prop'language\@empty
    \else
        \@xp\selectlanguage\@xp{\prop'language}%
    \fi
}
\def\erase@field#1{%
    \aftergroup\let\aftergroup#1\aftergroup\@empty
}
\def\get@current@properties{%
    \begingroup
        \@xp\get@nth@property\@xp\@tempa\current@bibfield\series@index
        \edef\@tempa{%
            \@nx\RestrictedSetKeys{}{prop}{%
                \def\@nx\@tempa{\@nx\prop@reset \@nx\the\@nx\rsk@toks}%
            }{\@tempa}%
        }%
        \@tempa
    \@xp\endgroup
    \@tempa
}
\newcommand{\BibSpecAlias}[2]{%
    \@xp\def\@xp\@tempa\@xp{\csname setbib@#1\@xp\endcsname}%
    \@xp\ifx\csname setbib@#2\endcsname\@tempa
        \amsrefs@error{%
            Mirror alias #1->#2 not allowed (infinite loop)}\@ehc
    \else
        \@xp\def\csname setbib@#1\@xp\endcsname
            \@xp{\csname setbib@#2\endcsname}%
    \fi
}
\BibSpec{article}{%
    +{}  {\PrintAuthors}                {author}
    +{,} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintContributions}         {contribution}
    +{.} { \PrintPartials}              {partial}
    +{,} { }                            {journal}
    +{}  { \textbf}                     {volume}
    +{}  { \PrintDatePV}                {date}
    +{,} { \issuetext}                  {number}
    +{,} { \eprintpages}                {pages}
    +{,} { }                            {status}
    +{,} { \PrintDOI}                   {doi}
    +{,} { available at \eprint}        {eprint}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{partial}{%
    +{}  {}                             {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintContributions}         {contribution}
    +{,} { }                            {journal}
    +{}  { \textbf}                     {volume}
    +{}  { \PrintDatePV}                {date}
    +{,} { \issuetext}                  {number}
    +{,} { \eprintpages}                {pages}
}

\BibSpec{contribution}{%
    +{} {}                             {type}
    +{} { by \PrintNameList}           {author}
}

\BibSpec{book}{%
    +{}  {\PrintPrimary}                {transition}
    +{,} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintEdition}               {edition}
    +{}  { \PrintEditorsB}              {editor}
    +{,} { \PrintTranslatorsC}          {translator}
    +{,} { \PrintContributions}         {contribution}
    +{,} { }                            {series}
    +{,} { \voltext}                    {volume}
    +{,} { }                            {publisher}
    +{,} { }                            {organization}
    +{,} { }                            {address}
    +{,} { \PrintDateB}                 {date}
    +{,} { }                            {status}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{collection.article}{%
    +{}  {\PrintAuthors}                {author}
    +{,} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintContributions}         {contribution}
    +{,} { \PrintConference}            {conference}
    +{}  {\PrintBook}                   {book}
    +{,} { }                            {booktitle}
    +{,} { \PrintDateB}                 {date}
    +{,} { pp.~}                        {pages}
    +{,} { }                            {status}
    +{,} { \PrintDOI}                   {doi}
    +{,} { available at \eprint}        {eprint}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{conference}{%
    +{}  {}                        {title}
    +{}  {\PrintConferenceDetails} {transition}
}

\BibSpec{innerbook}{%
    +{,} { }                            {title}
    +{.} { }                            {part}
    +{:} { }                            {subtitle}
    +{,} { \PrintEdition}               {edition}
    +{}  { \PrintEditorsB}              {editor}
    +{,} { \PrintTranslatorsC}          {translator}
    +{,} { \PrintContributions}         {contribution}
    +{,} { }                            {series}
    +{,} { \voltext}                    {volume}
    +{,} { }                            {publisher}
    +{,} { }                            {organization}
    +{,} { }                            {address}
    +{,} { \PrintDateB}                 {date}
    +{.} { }                            {note}
}

\BibSpec{report}{%
    +{}  {\PrintPrimary}                {transition}
    +{,} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintEdition}               {edition}
    +{,} { \PrintContributions}         {contribution}
    +{,} { Technical Report }           {number}
    +{,} { }                            {series}
    +{,} { }                            {organization}
    +{,} { }                            {address}
    +{,} { \PrintDateB}                 {date}
    +{,} { \eprint}                     {eprint}
    +{,} { }                            {status}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{thesis}{%
    +{}  {\PrintAuthors}                {author}
    +{,} { \textit}                     {title}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintThesisType}            {type}
    +{,} { }                            {organization}
    +{,} { }                            {address}
    +{,} { \PrintDateB}                 {date}
    +{,} { \eprint}                     {eprint}
    +{,} { }                            {status}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}
\BibSpecAlias{periodical}{book}
\BibSpecAlias{collection}{book}
\BibSpecAlias{proceedings}{book}
\BibSpecAlias{manual}{book}
\BibSpecAlias{miscellaneous}{book}
\BibSpecAlias{misc}{miscellaneous}
\BibSpecAlias{unpublished}{book}
\BibSpecAlias{proceedings.article}{collection.article}
\BibSpecAlias{techreport}{report}
\edef\setbib@incollection{%
    \@xp\@nx\csname setbib@collection.article\endcsname
}
\edef\setbib@inproceedings{%
    \@xp\@nx\csname setbib@collection.article\endcsname
}
\BibSpec{name}{%
    +{}  {\PrintAuthors}    {name}
}

\BibSpec{publisher}{%
    +{,} { } {publisher}
    +{,} { } {address}
}
\newcounter{bib}
\newenvironment{biblist}{%
    \setcounter{bib}\z@
    \@biblist
}{%
    \@endbiblist
}
\newenvironment{biblist*}{%
    \@biblist
}{%
    \@endbiblist
}
\newcommand\@biblist[1][]{%
    \stepcounter{bib@env}
    \normalfont
    \footnotesize
    \labelsep .5em\relax
    \list{\BibLabel}{%
        \restore@labelwidth
        \@maxlabelwidth\z@
        \@nmbrlisttrue
        \def\@listctr{bib}%
        \let\makelabel\bib@mklab
        #1\relax
    }%
    \sloppy
    \interlinepenalty\@m
    \clubpenalty\@M
    \widowpenalty\clubpenalty
    \frenchspacing
    \ResetCapSFCodes
}
\def\@endbiblist{%
    \save@labelwidth
    \def\@noitemerr{\@latex@warning{Empty bibliography list}}%
    \endlist
}
\newdimen\@maxlabelwidth
\def\bib@mklab#1{%
    \settowidth\@tempdima{#1}%
    \ifdim \@tempdima > \@maxlabelwidth
        \global\@maxlabelwidth\@tempdima
    \fi
    #1\hfil
}
\newcounter{bib@env}
\def\save@labelwidth{%
    \if@filesw
        \immediate\write\@auxout{%
            \string\newlabel{[bibenv:\the\c@bib@env]}{\the\@maxlabelwidth}%
        }%
    \fi
}
\def\restore@labelwidth{%
    \@xp\ifx \csname r@[bibenv:\the\c@bib@env]\endcsname \relax
        \resetbiblist{00}%
    \else
        \@xp\labelwidth\csname r@[bibenv:\the\c@bib@env]\endcsname
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
    \fi
}
\providecommand{\ResetCapSFCodes}{%
    \count@=`\A
    \def\@tempa{%
        \sfcode\count@=\@m
        \advance\count@\@ne
            \ifnum\count@>`\Z\relax \expandafter\@gobble \fi
        \@tempa
    }%
    \@tempa
}
\def\CurrentBib{??}
\newcommand{\BibLabel}{%
    [\hyper@anchorstart{cite.\CurrentBib}\relax\thebib\hyper@anchorend]%
}
\newcommand{\resetbiblist}[1]{%
    \settowidth\labelwidth{\def\thebib{#1}\BibLabel}%
    \leftmargin\labelwidth
    \ifdim\labelwidth=\z@
        \leftmargin=1em
        \itemindent=-\leftmargin
    \else
        \advance\leftmargin\labelsep
    \fi
}
\newcommand{\bib}{%
    \begingroup
        \@ifstar{%
            \@tempswatrue
            \let\@bibdef\star@bibdef
            \BibItem
        }{%
            \@tempswafalse
            \BibItem
        }%
}
\newcommand{\BibItem}[2]{%
    \def\@tempa{#1}%
    \edef\@tempb{%
        \@nx\@bibdef\@xp\@nx\csname setbib@#2\endcsname{#2}%
            {\macrotext\@tempa}%
    }%
    \@tempb
}
\AtBeginDocument{\let\@bibdef\normal@bibdef}
\AtBeginDocument{\let\bib@exec\bib@print}
\def\normal@bibdef#1#2#3{%
    \def\CurrentBibType{#2}%
    \ifx\relax#1%
        \amsrefs@error{Undefined entry type: #2}\@ehc
        \let#1\setbib@misc
    \fi
    \RestrictedSetKeys{}{bib}%
        {\bib@exec{#3}{\the\rsk@toks}{#1}\endgroup}%
}

\let\@bibdef\normal@bibdef
\def\star@bibdef{%
    \let\bib@exec\bib@store
    \normal@bibdef
}
\def\copy@bibdef{%
    \if@tempswa
        \@xp\defer@bibdef
    \else
        \@xp\copy@bibdef@a
    \fi
}
\def\copy@bibdef@a#1#2#3#4{%
    \@open@bbl@file
    \process@xrefs{#4}%
    \bbl@write{%
        \string\bib\if@tempswa*\fi{#3}{#2}\string{\iffalse}\fi
    }%
    \RestrictedSetKeys{\global\let\rsk@set\bbl@copy}\@empty
        {\bbl@write{\iffalse{\fi\string}^^J}%
         \endgroup}{#4}%
}
\catcode`\:=11

\def\modify@xref@fields{%
    \let\set:bib'author\output@xref@a
    \let\set:bib'editor\output@xref@a
    \let\set:bib'translator\output@xref@a
    \let\set:bib'journal\output@xref@a
    \let\set:bib'publisher\output@xref@a
    \def\set:bib'xref##1##2{\output@xref@{##1}\@empty}%
}

\catcode`\:=12

\def\process@xrefs#1{%
    \begingroup
        \RestrictedSetKeys{\modify@xref@fields}{bib}{\the\rsk@toks}{#1}%
    \endgroup
}

\def\output@xref@a#1#2{%
    \def\@tempa{#1}%
    \lowercase{\def\@tempb{#1}}%
    \ifx\@tempa\@tempb
        \output@xref@{#1}%
    \fi
}

\def\output@xref@#1{%
    \@ifnotempty{#1}{%
        \@ifundefined{bi@#1}{}{%
            \begingroup
                \let\star@bibdef\copy@bibdef@a
                \csname bi@#1\endcsname
            \endgroup
        }%
        \@xp\g@undef\csname bi@#1\endcsname
    }%
}
\def\bbl@copy#1\endcsname#2{%
    \begingroup
        \def\@tempa{#1}%
        \toks@{{#2}}%
        \star@{\bbl@copy@a}{}%
}
\def\bbl@copy@a#1{%
        \@ifnotempty{#1}{%
            \add@toks@{*{#1}}%
        }%
        \bbl@write{ \space\@tempa=\the\toks@,}%
    \endgroup
    \rsk@resume
}
\def\selective@bibdef#1#2#3{%
    \@xp\selbibdef@a\csname b@#3\endcsname{#1}{#2}{#3}%
}
\def\selbibdef@a#1{%
    \def\@tempa{\endgroup\@gobblefour}%
    \ifx\relax#1\else \@xp\selbibdef@b#1\@nil \fi
    \@tempa
}
\def\selbibdef@b#1#2#3\@nil{%
    \ifx 1#2\let\@tempa\copy@bibdef\fi
}
\def\defer@bibdef#1#2#3#4{%
        \@xp\gdef\csname bi@#3\endcsname{%
            \bib*{#3}{#2}{#4}%
        }%
        \@xp\addto@defer@list \csname bi@#3\endcsname
    \endgroup
}
\let\bibdefer@list\@empty
\def\addto@defer@list#1{%
    \begingroup
        \def\do{\@nx\do\@nx}%
        \xdef\bibdefer@list{\bibdefer@list\do#1}%
    \endgroup
}
\def\bib@store#1{%
    \afterassignment\@gobble
    \@xp\xdef\csname bi@#1\endcsname
}
\def\numeric@refs{00}
\def\bib@print#1#2#3{%
    \bib@start{#1}%
        \let\setbib@@#3%
        #2\relax       % execute definitions locally
        \bib@resolve@xrefs
        \bib@field@patches
        \bib@selectlanguage
        \generate@label
        \bib'setup
        \bib@cite{#1}%
        \kern\@ne sp
        \ifx\setbib@@\setbib@article
            \ifx\bib'booktitle\@empty
                \ifx\bib'book\@empty
                    \ifx\bib'conference\@empty
                    \else
                        \let\setbib@@\setbib@incollection
                    \fi
                \else
                    \let\setbib@@\setbib@incollection
                \fi
            \else
                \let\setbib@@\setbib@incollection
            \fi
        \fi
        \setbib@@
    \bib@end
}
\def\bib@print@inner#1#2{%
    \begingroup
        #2\relax       % execute definitions locally
        \bib@field@patches
        \bib'setup
        #1%
    \endgroup
}
\let\current@citekey\@empty
\let\prev@citekey\@empty
\def\bib@start#1{%
    \begingroup
        \def\current@citekey{#1}%
}
\def\bib@end{%
        \relax
        \@xp\PrintBackRefs\@xp{\CurrentBib}%
        \par
        \save@primary
        \global\let\prev@citekey\current@citekey
    \endgroup
}
\def\bib@resolve@xrefs{%
    \xref@check@c\bib'xref
    \xref@check@a\bib'author
    \xref@check@a\bib'editor
    \xref@check@a\bib'translator
    \xref@check@b\bib'journal
    \xref@check@b\bib'publisher
}
\def\xref@check@a#1{%
    \ifx\@empty#1\relax
    \else
        \begingroup
            \toks@\@emptytoks
            \@temptokenb\@emptytoks
            \series@index\z@
            \def\name{\xref@check@aa#1}%
            #1\relax
            \edef\@tempa{%
                \def\@nx#1{\the\toks@}%
                \the\@temptokenb
            }%
        \@xp\endgroup
        \@tempa
    \fi
}
\def\xref@check@aa#1#2{%
    \advance\series@index\@ne
    \def\@tempa{#2}%
    \lowercase{\def\@tempb{#2}}%
    \ifx\@tempa\@tempb
        \ifx\@tempa\@empty
            \add@toks@{\name{}}%
        \else
            \@ifundefined{bi@#2}{%
                \BibAbbrevWarning{#2}%
                \add@toks@{\name{#2}}%
            }{%
                \xref@check@ab#1{#2}%
            }%
        \fi
    \else
        \add@toks@{\name{#2}}%
    \fi
}
\def\xref@check@ab#1#2{%
    \csname bi@#2\endcsname
    \ifx\@empty\bib'name
        \@temptokena{#2}%
    \else
        \@temptokena\@xp{\bib'name}%
        \get@property\@tempa\bib'name
        \edef\@tempa{%
            \@nx\addto@hook\@temptokenb{%
                \@nx\reset@nth@property\@nx#1\the\series@index{\@tempa}%
            }%
        }%
        \@tempa
    \fi
    \edef\@tempa{\@nx\add@toks@{\@nx\name{\the\@temptokena}}}%
    \@tempa
}
\def\xref@check@b#1{%
    \ifx\@empty#1%
    \else
        \toks@\@xp{#1}%
        \edef\@tempb{\lowercase{\def\@nx\@tempa{\the\toks@}}}%
        \@tempb
        \ifx\@tempa#1\relax % all lowercase
            \@ifundefined{bi@#1}{%
                \BibAbbrevWarning{#1}%
            }{%
                \let#1\@empty
                \xref@check@c\@tempa
            }%
        \fi
    \fi
}
\def\xref@check@c#1{%
    \ifx#1\@empty
    \else
        \begingroup
            \let\DSK@def\xref@add@toks
            \let\DSK@append\xref@append
            \toks@\@emptytoks
            \let\bib@reset\@empty
            \@for\xref@ID:=#1\do{%
                \@ifundefined{bi@\xref@ID}{%
                    \XRefWarning{\xref@ID}%
                }{%
                    \csname bi@\xref@ID\endcsname
                }%
            }%
            \edef\@tempa{\endgroup\the\toks@}%
        \@tempa
    \fi
}
\def\xref@add@toks#1#2#3{%
    \ifx#1\@empty
        \edef\@tempa{%
            \@nx\add@toks@{\@xp\@nx\csname\rkv@setter#1\endcsname{#2}{#3}}%
        }%
        \@tempa
    \else
        \in@\bib'title{#1}%
        \ifin@
            \ifx\bib'booktitle\@empty
                \edef\@tempa{%
                    \@nx\add@toks@{%
                        \@xp\@nx\csname set:bib'booktitle\endcsname
                    }%
                }%
                \@tempa
                \add@toks@{{#2}{#3}}%
            \fi
        \fi
    \fi
}
\def\xref@append#1#2#3#4{%
    \edef\@tempa{%
        \@nx\add@toks@{\@xp\@nx\csname\rkv@setter#2\endcsname{#3}{#4}}%
    }%
    \@tempa
}
\def\BibAbbrevWarning#1{\amsrefs@warning{Abbreviation '#1' undefined}}
\def\XRefWarning#1{\amsrefs@warning{Xref '#1' undefined}}
\let\current@primary\@empty
\let\previous@primary\@empty
\IfOption{nobysame}{%
    \let\save@primary\@empty
}{%
    \def\save@primary{%
        \global\let\previous@primary\current@primary
    }%
}
\def\bib@field@patches{%
    \ifx\bib'author\@empty
        \ifx\bib'editor\@empty
            \let\current@primary\bib'translator
            \let\print@primary\PrintTranslatorsA
        \else
            \let\current@primary\bib'editor
            \let\print@primary\PrintEditorsA
        \fi
    \else
        \let\current@primary\bib'author
        \let\print@primary\PrintAuthors
    \fi
    \ifx\bib'address\@empty
        \let\bib'address\bib'place
    \fi
    \ifx\bib'organization\@empty
        \ifx\bib'institution\@empty
            \let\bib'organization\bib'school
        \else
            \let\bib'organization\bib'institution
        \fi
    \fi
    \ifx\bib'date\@empty
        \ifx\bib'year\@empty
            \let\bib@year\bib'status
        \else
            \bib@parsedate\bib'year
        \fi
    \else
        \bib@parsedate\bib'date
    \fi
    \def\@tempa{year}%
    \ifx\bib'volume\@tempa
        \let\bib'volume\bib@year
        \let\bib'date\@empty
    \fi
    \bib@language@fixup
}
\let\bib@year\@empty
\let\bib@month\@empty
\let\bib@day\@empty
\def\bib@parsedate#1{%
    \@xp\bib@parsedate@a#1---\@nil
}
\def\bib@parsedate@a#1-#2-#3-#4\@nil{%
    \def\bib@year{#1}%
    \def\bib@month{#2}%
    \def\bib@day{#3}%
    \ifx\@empty\bib@day
        \ifx\@empty\bib@month
            \let\bib'date\bib@year
        \else
            \def\bib'date{#1-#2}%
        \fi
    \else
        \def\bib'date{#1-#2-#3}%
    \fi
}
\def\bib@language@fixup{%
    \ifx\bib'hyphenation\@empty
        \ifx\bib'language\@empty
            \let\bib@language\biblanguagedefault
        \else
            \let\bib@language\bib'language
        \fi
    \else
        \let\bib@language\bib'hyphenation
    \fi
    \def\@tempa##1 ##2\@nil{\lowercase{\def\bib@language{##1}}}%
    \@firstofone{\@xp\@tempa\bib@language} \@nil
}
\def\bib@selectlanguage{%
    \@ifsame@patterns{\languagename}{\bib@language}{}{%
        \@ifundefined{date\bib@language}{}{%
            \@xp\selectlanguage\@xp{\bib@language}%
        }%
    }%
}
\def\@ifsame@patterns#1#2{%
    \@xp\@ifsamepat\csname l@#1\@xp\endcsname\csname l@#2\endcsname
}
\def\@ifsamepat#1#2{%
    \ifnum \ifx\relax#1\m@ne\else#1\fi = \ifx\relax#2\m@ne\else#2\fi
        \@xp\@firstoftwo
    \else
        \@xp\@secondoftwo
    \fi
}
\providecommand{\languagename}{english}
\def\biblanguageEnglish{english}
\let\biblanguagedefault\biblanguageEnglish
\let\bib@language\@empty
\let\generate@label\relax
\def\cite@label{\@currentlabel}
\let\alpha@label\relax
\def\bib@cite#1{%
    \def\CurrentBib{#1}%
    \alpha@label            % modify \thebib if necessary
    \item\leavevmode
    \SK@\SK@@label{#1}%
    \@xp\bib@cite@a\csname b@#1\endcsname
    \bibcite@write{#1}%
}
\def\bib@cite@a#1{%
    \ifx\relax#1%
        \begingroup
            \auto@protect\etaltext
            \protected@edef\@tempa{%
                \gdef\@nx#1{%
                    \@nx\citesel 01{\cite@label}{\bib@label@year}{}%
                }%
            }%
        \@xp\endgroup
        \@tempa
    \else
        \@xp\bib@cite@check\@xp#1#1\@empty\@empty\@empty\@empty\@empty
    \fi
}
\def\bib@cite@check#1#2#3#4#5#6#7{%
    \ifx 1#4\relax
        \DuplicateBibKeyWarning
    \else
        \begingroup
            \auto@protect\etaltext
            \@apply\auto@protect\amsrefs@textsymbols
            \@apply\auto@protect\amsrefs@textaccents
            \@tempswafalse
            \in@\CitePrintUndefined{#5}%
            \ifin@
                \let\@tempa\@empty
            \else
                \def\@tempa{#5}%
            \fi
            \ifx\@tempa\@empty
            \else
                \@xp\ifx\@xp\@currentlabel\cite@label
                    \edef\@tempb{\cite@label}%
                \else
                    \let\@tempb\cite@label
                \fi
                \ifx\@tempa\@tempb
                    \def\@tempa{#6}%
                    \ifx\@tempa\bib@label@year
                    \else
                        \@tempswatrue
                    \fi
                \else
                    \@tempswatrue
                \fi
            \fi
            \if@tempswa
                \@ifempty{#6}{%
                    \def\@tempa{#5}%
                    \let\@tempb\cite@label
                }{%
                    \def\@tempa{#5, #6}%
                    \def\@tempb{\cite@label, \bib@label@year}%
                }%
                \amsrefs@warning{Citation label for \extr@cite#1 is
                    changing from `\@tempa ' to `\@tempb '}%
            \fi
            \protected@edef\@tempa{%
                \gdef\@nx#1{%
                    \@nx\citesel #31{\cite@label}{\bib@label@year}{#7}%
                }%
            }%
        \@xp\endgroup
        \@tempa
    \fi
}
\let\bib@label@year\@empty
\def\DuplicateBibKeyWarning{%
    \amsrefs@warning{%
        Duplicate \protect\bib\space key
        `\CurrentBib ' detected\MessageBreakNS}%
}
\def\bibcite@write#1{%
    \if@filesw
        \let\citesel\citesel@write
        \csname b@#1\endcsname
    \fi
}
\def\citesel@write#1#2#3#4#5{%
    \begingroup
        \toks@{{#3}{#4}}%
        \immediate\write\@auxout{\string\bibcite{\CurrentBib}{\the\toks@}}%
    \endgroup
}
\AtEndDocument{\let\bibcite\@gobbletwo}
\providecommand{\bibname}{Bibliography}
\providecommand{\refname}{References}
\newenvironment{bibchapter}[1][\bibname]{%
    \begingroup
        \protected@edef\@{\endgroup\protect\chapter*{#1}}%
        \@
}{\par}
\newenvironment{bibsection}[1][\refname]{%
    \begingroup
        \protected@edef\@{\endgroup\protect\section*{#1}}%
        \@
}{\par}
\@ifundefined{chapter}{%
    \newenvironment{bibdiv}{\bibsection}{\endbibsection}
}{%
    \newenvironment{bibdiv}{\bibchapter}{\endbibchapter}
}
\renewenvironment{thebibliography}[1]{%
    \bibdiv
    \biblist[\resetbiblist{#1}]%
}{%
    \endbiblist
    \endbibdiv
}
\newcommand{\DefineName}[2]{%
    \bib*{#1}{name}{name={#2}}%
}
\newcommand{\DefineJournal}[4]{%
    \bib*{#1}{periodical}{
        issn={#2},
        journal={#4}
    }%
}
\newcommand{\DefinePublisher}[4]{%
    \bib*{#1}{publisher}{%
        publisher={#3},
        address={#4}
    }%
}
\newcommand{\bibselect}{%
    \@ifstar{%
        \let\@bibdef\copy@bibdef
        \BibSelect
    }{%
        \let\@bibdef\selective@bibdef
        \BibSelect
    }%
}
\newcommand{\BibSelect}[2][\bblname]{%
    \if@filesw
        \typeout{Trying to create bbl file `#1.bbl' ...}%
        \def\bibselect@msg{%
            \typeout{ ... rats. Unable to create bbl file.}%
        }%
        \let\@open@bbl@file\OpenBBLFile
        \@for\@tempa:=#2\do{\ReadBibData{\@tempa}}%
    \fi
    \@close@bbl@file
    \@apply\g@undef\bibdefer@list
    \global\let\bibdefer@list\@empty
    \let\@bibdef\normal@bibdef
    \@input@{#1.bbl}%
    \let\BibSelect\MultipleBibSelectWarning
}
\newcommand\MultipleBibSelectWarning[2][]{%
    \amsrefs@warning{%
        Multiple \string\bibselect 's found (only one
        \string\bibselect\space per biblist environment is allowed)%
    }%
}
\def\bblname{\jobname}
\newread\bib@dbfile
\newcommand{\ReadBibData}[1]{%
    \IfFileExists{#1.ltb}{%
        \openin\bib@dbfile=\@filef@und \relax
    }{%
        \IfFileExists{#1.ltx}{%
            \openin\bib@dbfile=\@filef@und \relax
        }{%
            \IfFileExists{#1.tex}{%
                \openin\bib@dbfile=\@filef@und \relax
            }{%
                \begingroup
                    \NoBibDBFile{#1}%
                    \let\ReadBibData@a\endgroup
            }%
        }%
    }%
    \ReadBibData@a
}
\def\NoBibDBFile#1{%
    \amsrefs@warning{No data file #1.ltb (.ltx, .tex) found}%
}
\def\ReadBibData@a{%
    \ProvidesFile{\@filef@und}\relax
    \begingroup
        \let\star@bibdef\defer@bibdef
        \ReadBibLoop
    \endgroup
    \closein\bib@dbfile
}
\def\ReadBibLoop{%
    \ifeof\bib@dbfile
        \@xp\@gobble
    \else
        \read\bib@dbfile to\CurLine
        \@xp\ReadBibLoop@a\CurLine\@empty\@nil
    \fi
    \ReadBibLoop
}
\long\def\ReadBibLoop@a#1#2\@nil{%
    \ifx\bib#1%
        \CurLine % just exec it
    \else
        \ifx\endinput#1%
            \let\ReadBibLoop\@empty
        \else
            \@xp\ReadBibLoop@b#1#2\@empty\@nil
        \fi
    \fi
}
\long\def\ReadBibLoop@b#1#2\@nil{%
    \ifx\bib#1%
        \CurLine % just exec it
    \fi
}
\let\bbl@out=\relax
\let\bbl@write\@gobble
\let\@open@bbl@file\relax
\let\@close@bbl@file\relax
\def\OpenBBLFile{%
    \if@filesw
        % Just use the next unused output stream
        \count@\count17
        \advance\count@\@ne
        \ifnum\count@<\sixt@@n
            \global\chardef\bbl@out=\count@
            \immediate\openout\bbl@out=\bblname.bbl\relax
            \global\let\@close@bbl@file\CloseBBLFile
            \gdef\bbl@write{\immediate\write\bbl@out}%
        \else
            \ch@ck\count@\sixt@@n\write
        \fi
    \fi
    \global\let\@open@bbl@file\relax
}
\def\CloseBBLFile{%
    \immediate\closeout\bbl@out\relax
    \global\let\@close@bbl@file\relax
    \global\let\bbl@write\@gobble
    \global\let\bbl@out\relax
}
\def\citesel@update#1#2#3#4#5#6{%
    \gdef#6{\citesel 1#2{#3}{#4}{#5}}%
}
\def\citesel@number#1#2#3#4#5{#3}
\def\citesel@year#1#2#3#4#5{#4}
\let\citesel\citesel@number
\expandafter\let\csname cite \endcsname\relax
\renewcommand{\cite}[2][]{%
    \if\cite@single#2,\@gobble \else\MultipleCiteKeyWarning{#2}{#1}\fi
    \@ifempty{#1}{%
        \cites@o{#2}%
    }{%
        \ObsoleteCiteOptionWarning
        \cites@a{*{#1}}{#2}%
    }%
}
\def\MultipleCiteKeyWarning#1#2{%
    \amsrefs@warning{%
        Use of \string\cites\space is recommended instead of %
        \string\cite\space\MessageBreak
        for multiple cites '#1'}%
    \@ifnotempty{#2}{%
        \amsrefs@warning{Star option requires \string\citelist\space here}%
    }%
    \global\let\MultipleCiteKeyWarning\@gobbletwo
}
\def\ObsoleteCiteOptionWarning{%
    \amsrefs@warning{%
        The form \string\cite{...}*{...} is recommended\MessageBreak
        instead of \string\cite[...]{...}}%
    \global\let\ObsoleteCiteOptionWarning\@empty
}
\edef\cite@single#1,#2{\iffalse{\fi\iffalse{\fi\string}#2.\string}}
\def\cites@o#1{\star@{\cites@oo{#1}}{}}
\def\cites@oo#1#2{\@ifempty{#2}{\cites@a{}{#1}}{\cites@a{*{#2}}{#1}}}
\def\cites@a#1#2{%
    \begingroup
        \toks@{\endgroup \cites@b{#1}}%
        \vdef\@tempa{#2}%
        \edef\@tempa{%
            \the\toks@ \@firstofone{\@xp\zap@space\@tempa} \@empty
        }%
        \@tempa,\@empty
        \edef\@tempa{\endgroup\@nx\citelist{\the\toks@}}%
        \@tempa
}
\def\cites@b#1#2,#3{%
    \begingroup
        \toks@{\InnerCite{#2}#1}%
        \ifx\@empty#3\@xp\@gobble\fi
        \cites@c#3%
}
\def\cites@c#1,#2{%
    \add@toks@{\InnerCite{#1}}%
    \ifx\@empty#2\@xp\@gobble\fi
    \cites@c#2%
}
\def\citeleft{[}
\def\citeright{]}
\def\citemid{,\penalty9999 \space}
\def\citepunct{,\penalty9999 \hskip.13em plus.1em minus.05em\relax}
\def\citeAltPunct{;\ }
\providecommand{\citeform}{\@firstofone}
\DeclareRobustCommand{\citelist}{\@citelist}
\def\@citelist#1{%
    \leavevmode
    \begingroup
        \@citestyle
        \citeleft\nopunct   % suppress first \citepunct
        \cite@begingroup
            \in@*{#1}%
            \ifin@
                \let\citepunct\citeAltPunct
            \fi
            \let\cite@endgroup\@empty
            \cites@init
            \def\citeleft{\@addpunct{\citepunct}}%
            \let\citeright\ignorespaces
            \def\cite{\InnerCite}%
            \process@citelist{#1}%
        \endgroup
        \citeright
    \endgroup
}
\providecommand{\@citestyle}{\m@th\upshape\mdseries}
\def\cite@begingroup{\begingroup\let\cite@begingroup\relax}
\let\cite@endgroup\endgroup
\def\cites@init{%
    \gdef\prev@names{???}%
    \let\cites@init\@empty
}
\newcommand{\InnerCite}[1]{\star@{\cite@a\citesel{#1}}{}}
\def\cite@a#1#2{%
    \BackCite{#2}%
    \cite@begingroup
        \cites@init
        \let\citesel#1\relax
        \ifx\citesel\citesel@author
            \let\citeleft\@empty
            \let\citeright\@empty
        \fi
        \begingroup
            \toks@{\endgroup \cite@b}%
            \vdef\@tempa{#2}%
            \edef\@tempa{%
                \the\toks@{\@firstofone{\@xp\zap@space\@tempa} \@empty}%
            }%
        \@tempa
}
\def\cite@b#1#2{%
    \@xp\cite@bc\csname b@#1\@xp\endcsname {#1}{#2}%
}
\def\cite@bc#1#2{%
    \ifx#1\@@undefined \global\let#1\relax \fi
    \ifx#1\relax       \global\let#1\empty@cite \fi
    \@xp\cite@nobib@test#1{}{}{}{}\@nil#1%
    \cite@cj#1%
}
\def\empty@cite{\citesel 00{}{}{}}
\def\cite@nobib@test#1#2#3#4#5\@nil#6{%
    \@ifempty{#4}{%
        \G@refundefinedtrue
        \UndefinedCiteWarning#6%
        \xdef#6{\@nx\citesel #2#3{%
            \@nx\CitePrintUndefined{\extr@cite#6}}{}{}}%
    }{}%
}
\def\UndefinedCiteWarning#1{%
    \@latex@warning{%
        Citation `\extr@cite#1' on page \thepage\space undefined}%
}
\DeclareRobustCommand{\CitePrintUndefined}[1]{%
    \begingroup\fontshape{n}\fontseries\mddefault \ttfamily ?#1\endgroup
}
\let\CPU@normal\CitePrintUndefined
\def\cite@cj#1#2{%
        \leavevmode
            \begingroup
                \cite@cb#1% write info to aux file
                \ar@SK@cite#1%
                \@citeleft
                \ar@hyperlink{#1}%
                \@ifnotempty{#2}{\citemid{#2}}%
                \citeright
            \endgroup
            \ignorespaces % ignore spaces inside \citelist
        \cite@endgroup
}
\def\@citeleft{\citeleft}
\def\cite@cb#1{%
    \if@filesw
        \immediate\write\@auxout{\string\citation{\extr@cite#1}}%
    \fi
    \begingroup
        \let\citesel\citesel@update
        #1#1%
    \endgroup
}
\def\extr@cite{\@xp\@gobblethree\string}
\DeclareRobustCommand{\cites}{\cites@a{}}
\providecommand{\citen}{\ocite}
\def\ycite{\cite}
\let\ycites\cites
\let\ocite\ycite
\let\ocites\cites
\let\fullcite\cite
\let\fullocite\ocite
\let\citeauthor\ycite
\let\citeauthory\ycite
\renewcommand{\nocite}[1]{\othercites{#1}}
\newcommand{\othercites}[1]{%
    \cite@begingroup
        \let\cite@endgroup\@empty
        \def\citelist{\othercitelist}%
        \cites{#1}%
}
\newcommand{\othercitelist}[1]{%
    \cite@begingroup
        \let\cite@endgroup\@empty
        \cites@init
        \let\citeleft\relax
        \let\citeright\ignorespaces
        \def\InnerCite{\OtherCite}%
        \def\cite@cj ##1##2{%
            \begingroup
                \@xp\citesel##1%
                \cite@cb ##1%
            \endgroup
            \@xp\ifx\csname b@*\endcsname ##1%
                \global\let\selective@bibdef\copy@bibdef
            \fi
            \ignorespaces
            \cite@endgroup
        }%
    #1\relax
    \endgroup
}
\def\OtherCite#1{\cite@a\citesel@other{#1}{}{}}
\def\citesel@other#1#2#3#4#5#6{}
\@namedef{b@*}{\citesel 11{*}{*}{*}}
\def\process@citelist@sorted#1{%
    \ifx\citesel\citesel@number
        \cite@sorted@s #1\cite@sorted@e
    \else
        \NonNumericCiteWarning
        \process@citelist@unsorted{#1}%
    \fi
}
\def\NonNumericCiteWarning{%
    \amsrefs@warning{%
        Unable to confirm that cite keys are numeric: not sorting%
    }%
}
\def\process@citelist@unsorted#1{%
    \ignorespaces#1\relax
}
\let\process@citelist\process@citelist@sorted
\def\CPU@sort#1{2147483647}
\def\cite@sorted@s{%
    \begingroup
        \let\CitePrintUndefined\CPU@sort
        \let\cite@cjs\cite@cj
        \let\cite@cj\cite@compress
        \begingroup
            \toks@\@emptytoks
            \let\cite@cj\cite@sort
            \ignorespaces
}
\def\cite@sorted@e{%
        \@xp\endgroup
        \the\toks@
        \cite@dash
        \prev@cite
    \endgroup
}
\def\cite@sort#1#2{%
    \safe@set\@tempcnta#1% highest number so far
    \toks@{\cite@cj#1{#2}}%
    \@temptokena\toks@
    \let\cite@cj\cite@sort@a
    \ignorespaces
}
\def\cite@sort@a#1#2{%
    \safe@set\@tempcntb#1%
    \ifnum\@tempcntb > \@tempcnta
        \add@toks@{\cite@cj#1{#2}}%
        \@tempcnta\@tempcntb
    \else
        \let\cite@cj\cite@sort@b
        \toks@\@emptytoks
        \def\@tempb{\add@toks@{\cite@cj#1{#2}}}%
        \the\@temptokena
        \@tempb
        \let\cite@cj\cite@sort@a
    \fi
    \@temptokena\toks@
    \ignorespaces
}
\def\cite@sort@b#1#2{%
    \safe@set\count@#1%
    \ifnum\@tempcntb < \count@
        \@tempb
        \let\@tempb\@empty
    \fi
    \add@toks@{\cite@cj#1{#2}}%
    \ignorespaces
}
\let\prev@cite\@empty
\def\prev@cite@cb{%
    \ifx\@prev@cite\@empty
    \else
        \begingroup
            \def\cite@print##1##2{%
                \cite@cb##1%
            }%
            \prev@cite
        \endgroup
    \fi
}
\def\cite@print#1#2{%
    \begingroup
        \let\CitePrintUndefined\CPU@normal
        \cite@cjs#1{#2}%
    \endgroup
}
\let\cite@dash\@empty
\def\print@one@dash{%
    \textendash \nopunct
    \let\cite@dash\@empty
}
\def\cite@compress#1#2{%
    \cite@print#1{#2}%
    \@ifempty{#2}{%
        \safe@set\@tempcnta#1%
        \let\cite@cj\cite@compress@a
    }{}%
}
\def\cite@compress@a#1#2{%
    \@ifempty{#2}{%
        \advance\@tempcnta\@ne
        \safe@set\@tempcntb#1%
        \ifnum\@tempcnta=\@tempcntb
            \def\prev@cite{\cite@print#1{}}%
            \let\cite@cj\cite@compress@b
        \else
            \cite@print#1{}%
            \@tempcnta\@tempcntb
        \fi
    }{%
        \cite@print#1{#2}%
        \let\cite@cj\cite@compress
    }%
}
\def\cite@compress@b#1#2{%
    \@ifempty{#2}{%
        \advance\@tempcnta\@ne
        \safe@set\@tempcntb#1%
        \ifnum\@tempcnta=\@tempcntb
            \let\cite@dash\print@one@dash
            \prev@cite@cb
            \def\prev@cite{\cite@print#1{}}%
        \else
            \cite@dash
            \prev@cite
            \let\prev@cite\@empty
            \cite@print#1{}%
            \@tempcnta\@tempcntb
            \let\cite@cj\cite@compress@a
        \fi
    }{%
        \cite@dash
        \prev@cite
        \let\prev@cite\@empty
        \cite@print#1{#2}%
        \let\cite@cj\cite@compress
    }%
}
\def\bibcite#1{\@xp\bibcite@a\csname b@#1\endcsname}
\def\bibcite@a#1#2{%
    \ifx\relax#1%
        \gdef#1{\citesel 00#2{}}%
    \else
        \begingroup
            \@xp\bibcite@b\@xp#1#1{#2}%
        \endgroup
    \fi
}
\def\bibcite@b#1#2#3#4#5#6#7#8{\gdef#1{\citesel#3#4#8{#7}}}
\newcommand{\citedest}[1]{\@xp\cite@dest\csname b@#1\endcsname}
\def\cite@dest#1{%
    \ifx\relax#1%
        \gdef#1{\citesel 00{}{}{}}%
    \fi
    \@xp\cite@dest@b\@xp#1#1%
}
\def\cite@dest@b#1#2#3#4#5#6#7#8{%
    \@ifempty{#7}{%
        \def#1{\citesel #3#4{#5}{#6}{{#8}}}%
    }{%
        \gdef#1{\citesel #3#4{#5}{#6}{#7,{#8}}}%
    }%
}
\@ifundefined{ifBR@verbose}{\let\ifBR@verbose\iffalse \let\fi\fi}{}%
\let\BackCite\@gobble
\def\back@cite#1{%
    \ifBR@verbose
        \PackageInfo{backref}{back cite \string `\extr@cite#1'}%
    \fi
    \Hy@backout{#1}%
}
\def\print@backrefs#1{%
    \space\SentenceSpace$\uparrow$\csname br@#1\endcsname
}
\let\PrintBackRefs\@gobble
\def\ar@hyperlink#1{\hyper@@link [cite]{}{cite.\extr@cite#1}{#1}}
\def\ar@SK@cite#1{\@bsphack\@xp\SK@\@xp\SK@@ref\@xp{\extr@cite#1}\@esphack}
\AtBeginDocument{%
    \@ifundefined{hyper@@link}{%
        \let\ar@hyperlink\@firstofone
        \let\hyper@anchorstart\@gobble
        \let\hyper@anchorend\relax
    }{}%
    \@ifundefined{SK@@label}{%
        \let\ar@SK@cite\@gobble
        \let\SK@@label\@gobble
        \let\SK@\@gobbletwo
    }{}%
}
\let\amsrefs@textaccents\@empty
\def\DeclareNameAccent{%
    \@lappend\amsrefs@textaccents
}
\DeclareNameAccent\"
\DeclareNameAccent\'
\DeclareNameAccent\.
\DeclareNameAccent\=
\DeclareNameAccent\^
\DeclareNameAccent\`
\DeclareNameAccent\~%
\DeclareNameAccent\b
\DeclareNameAccent\c
\DeclareNameAccent\d
\DeclareNameAccent\H
\DeclareNameAccent\k
\DeclareNameAccent\r
\DeclareNameAccent\t
\DeclareNameAccent\u
\DeclareNameAccent\v
\DeclareNameAccent\utilde
\DeclareNameAccent\uarc
\DeclareNameAccent\dudot
\DeclareNameAccent\lfhook
\DeclareNameAccent\udot
\DeclareNameAccent\polhk
\DeclareNameAccent\soft
\DeclareNameAccent\etalchar
\let\amsrefs@textsymbols\@empty
\def\DeclareNameSymbol#1#2{%
    \@lappend\amsrefs@textsymbols#1%
    \@lappend\amsrefs@textsymbols#2%
    \ifx#1#2\else
        \@lappend\amsrefs@textsymbols#2%
        \@lappend\amsrefs@textsymbols#2%
    \fi
}
\DeclareNameSymbol\i\i
\DeclareNameSymbol\j\j
\DeclareNameSymbol\AE\ae
\DeclareNameSymbol\OE\oe
\DeclareNameSymbol\O\o
\DeclareNameSymbol\DH\dh
\DeclareNameSymbol\DJ\dj
\DeclareNameSymbol\L\l
\DeclareNameSymbol\NG\ng
\DeclareNameSymbol\SS\ss
\DeclareNameSymbol\TH\th
\DeclareNameSymbol\Dbar\dbar
\DeclareNameSymbol\lasp\lasp
\DeclareNameSymbol\rasp\rasp
\DeclareNameSymbol\cprime\cprime
\DeclareNameSymbol\cdprime\cdprime
\DeclareNameSymbol\bud\bud
\DeclareNameSymbol\cydot\cydot
\DeclareNameSymbol~~%
\def\normalize@edef#1#2{%
    \begingroup
        \@apply\auto@protect\amsrefs@textsymbols
        \@apply\wrap@accent\amsrefs@textaccents
        \let\@tabacckludge\use@accent
        \let~\space
        \edef\@tempa{\def\@nx#1{#2}}%
    \@xp\endgroup
    \@tempa
}
\def\use@accent#1{\csname\string#1\endcsname}
\def\wrap@accent#1{%
    \def#1##1{{\@nx#1##1}}%
}
\def\lc@edef#1#2{%
    \begingroup
        \let\@tabacckludge\use@accent %%??
        \@apply\auto@protect\amsrefs@textaccents
        \@apply\lc@do\amsrefs@textsymbols
        \edef\@tempa{\lowercase{\def\@nx#1{#2}}}%
    \@xp\endgroup
    \@tempa
}
\def\lc@do#1\do#2{%
    \ifx#1#2%
        \auto@protect#1%
    \else
        \def#1{#2}%
    \fi
}
\def\purge@edef#1#2{%
    \begingroup
        \@apply\auto@protect\amsrefs@textsymbols
        \let~\space
        \@apply\purge@accent\amsrefs@textaccents
        \let\@tabacckludge\@gobble
        \def\i{i}%
        \def\j{j}%
        \edef\@tempa{#2}%
        \toks@\@emptytoks
        \@xp\purge@edef@ \@tempa \@nil
        \edef\@tempa{\def\@nx#1{\the\toks@}}%
    \@xp\endgroup
    \@tempa
}
\def\purge@edef@{%
    \futurelet\@let@token
    \purge@edef@a
}
\def\purge@edef@a#1{%
    \ifx\@let@token\@nil
        \let\@tempa\@empty
    \else
        \ifx\@let@token\bgroup
            \def\@tempa{%
                \purge@edef@ #1\@nil
                \purge@edef@
            }%
        \else
            \add@toks@{#1}%
            \let\@tempa\purge@edef@
        \fi
    \fi
    \@tempa
}
\def\purge@accent#1{%
    \def#1##1{##1}%
}
\def\name@split{%
    \get@namepart\bib'surname\name@split@given
}
\def\name@split@given{%
    \get@namepart\bib'given\name@split@jr
}
\def\name@split@jr{%
    \get@namepart\bib'jr\name@split@finish
}
\def\name@split@finish{%
    \ifx\bib'surname\@empty \EmptyNameWarning \fi
%%      \ifx\@empty\bib'given
%%          \NameCheck \bib'surname ??\@nil
%%      \else
        \extract@initials\bib'given
%%      \fi
    \@nilgobble
}
\def\get@namepart#1#2{%
    \toks@{#1}%
    \@temptokena{#2}%
    \get@namepart@a
}
\def\get@namepart@a{%
    \futurelet\@let@token
    \get@namepart@b
}
\def\get@namepart@b{%
    \ifx\@let@token\@sptoken
        \@xp\get@namepart@c
    \else
        \@xp\get@namepart@d
    \fi
}
\def\get@namepart@c{%
    \after@deleting@token\get@namepart@a
}
\def\get@namepart@d{%
    \futurelet\@let@token
    \get@namepart@e
}
\def\get@namepart@e{%
    \ifx\@let@token,%
        \@xp\let\the\toks@\@empty
        \edef\@tempa{%
            \@nx\after@deleting@token\the\@temptokena
        }%
        \@xp\@tempa
    \else
        \@xp\get@namepart@f
    \fi
}
\def\get@namepart@f#1#2,{%
    \ifx\@let@token\bgroup
        \@xp\def\the\toks@{{#1}#2}%
    \else
        \@xp\def\the\toks@{#1#2}%
    \fi
    \the\@temptokena
}
\def\EmptyNameWarning{\amsrefs@warning{Empty contributor name}}
\def\extract@initials#1{%
    \begingroup
        \auto@protect\ini@hyphen
        \auto@protect\nobreakspace
        \let~\relax
        \@apply\auto@protect\amsrefs@textsymbols
        \@apply\auto@protect\amsrefs@textaccents
        \normalize@edef\@tempa{#1}%
        \ifx\@tempa\@empty
        \else
            \process@hyphens\@tempa
            \process@dots\@tempa
            \process@names\@tempa
            \@chomp\@tempa{~}%
        \fi
        \edef\@tempa{\def\@nx\bib'initials{\@tempa}}%
    \@xp\endgroup
    \@tempa
}
\def\ini@hyphen{\unskip-\nobreak}
\def\process@hyphens#1{%
    \begingroup
        \toks@\@emptytoks
        \@xp\process@one@hyphen #1-\@nil
        \edef\@tempa{\the\toks@}%
        \@chomp\@tempa{ \ini@hyphen\space}%
        \edef\@tempa{\def\@nx#1{\@tempa}}%
    \@xp\endgroup
    \@tempa
}
\def\process@one@hyphen{%
    \futurelet\@let@token
    \process@one@hyphen@a
}
\def\process@one@hyphen@a{%
    \ifx\@let@token\@nil
        \let\fsa@n\@gobble
    \else
        \ifx\@let@token -%
            \TrailingHyphenWarning
            \let\fsa@n\process@one@hyphen@b
        \else
            \ifx\@let@token\@sptoken
                \let\fsa@n\process@one@hyphen@b
            \else
                \let\fsa@n\process@one@hyphen@c
            \fi
        \fi
    \fi
    \fsa@n
}
\def\process@one@hyphen@b{%
    \after@deleting@token\process@one@hyphen
}
\def\process@one@hyphen@c#1#2-{%
    \ifx\bgroup\@let@token
        \add@toks@{{#1}#2 \ini@hyphen\space}%
    \else
        \add@toks@{#1#2 \ini@hyphen\space}%
    \fi
    \futurelet\@let@token
    \process@one@hyphen@d
}
\def\process@one@hyphen@d{%
    \ifx\@let@token\@nil
        \@xp\@gobble
    \else
        \@xp\process@one@hyphen
    \fi
}
\def\TrailingHyphenWarning{%
    \amsrefs@warning{Trailing hyphen deleted from name}%
}
\def\process@dots#1{%
    \begingroup
        \toks@\@emptytoks
        \@xp\process@one@dot #1.\@nil
        \edef\@tempa{\the\toks@}%
        \@chomp\@tempa{. }%
        \@chomp\@tempa{ }%
        \edef\@tempa{\def\@nx#1{\@tempa}}%
    \@xp\endgroup
    \@tempa
}
\def\process@one@dot{%
    \futurelet\@let@token
    \process@one@dot@a
}
\def\process@one@dot@a{%
    \ifx\@let@token .%
        \def\fsa@n{\after@deleting@token\process@bare@dot}%
    \else
        \ifx\@let@token\@sptoken
            \let\fsa@n\process@one@dot@b
        \else
            \let\fsa@n\process@one@dot@c
        \fi
    \fi
    \fsa@n
}
\def\process@bare@dot{%
    \add@toks@{. }%
    \futurelet\@let@token
    \process@one@dot@d
}
\def\process@one@dot@b{%
    \after@deleting@token\process@one@dot
}
\def\process@one@dot@c#1#2.{%
    \ifx\bgroup\@let@token
        \add@toks@{{#1}#2. }%
    \else
        \add@toks@{#1#2. }%
    \fi
    \futurelet\@let@token
    \process@one@dot@d
}
\def\process@one@dot@d{%
    \ifx\@let@token\@nil
        \@xp\@gobble
    \else
        \@xp\process@one@dot
    \fi
}
\def\process@names#1{%
    \begingroup
        \toks@\@emptytoks
        \@xp\extract@initial #1 \@nil
        \edef\@tempa{\def\@nx#1{\the\toks@}}%
    \@xp\endgroup
    \@tempa
}
\def\extract@initial{%
    \futurelet\@let@token
    \extract@initial@a
}
\def\extract@initial@a{%
    \ifx\@let@token\@nil
        \let\fsa@n\@gobble
    \else
        \ifx\@let@token\@sptoken
            \let\fsa@n\extract@initial@b
        \else
            \let\fsa@n\extract@initial@c
        \fi
    \fi
    \fsa@n
}
\def\extract@initial@b{%
    \after@deleting@token\extract@initial
}
\def\extract@initial@c#1#2 {%
    \ifx\@let@token\bgroup
        \@extract@initial {{#1}}#2\@nil
    \else
        \@extract@initial #1#2\@nil
    \fi
    \futurelet\@let@token
    \extract@initial@d
}
\def\extract@initial@d{%
    \ifx\@let@token\@nil
        \@xp\@gobble
    \else
        \@xp\extract@initial
    \fi
}
\def\@extract@initial#1#2\@nil{%
    \ifx\ini@hyphen#1%
        \add@toks@{\ini@hyphen}%
    \else
        \in@{.\@nil}{#1#2\@nil}% Look for a period at the end of the name
        \ifin@
            \add@toks@{#1#2~}%
        \else
            \count@chars\@tempcnta{#1#2}%
            \ifnum\@tempcnta > \@ne
                \add@toks@{#1.~}%
            \else
                \add@toks@{#1~}%
            \fi
        \fi
    \fi
}
\def\count@chars#1#2{%
    \begingroup
        \@tempcnta\z@
        \@count@chars#2\@nil
        \edef\@tempb{#1=\the\@tempcnta\relax}%
    \@xp\endgroup
    \@tempb
}
\def\@count@chars#1{%
    \ifx #1\@nil
    \else
        \advance\@tempcnta\@ne
        \@xp\@count@chars
    \fi
}
\let\previous@stem\@empty
\let\current@stem\@empty
\let\previous@year\@empty
\let\current@year\@empty
\def\append@to@stem{\global\@concat\current@stem}
\def\generate@alphalabel{%
    \ifx\bib'label\@empty
        \begingroup
            \global\let\previous@stem\current@stem
            \global\let\current@stem\@empty
            \@apply\auto@protect\amsrefs@textsymbols
            \@apply\auto@protect\amsrefs@textaccents
            \auto@protect\name
            \auto@protect\etaltext
            \normalize@edef\@tempa\current@primary
            \get@numberof\@tempcnta\name\@tempa
            \calc@author@part
            \append@label@year
            \calc@alpha@suffix
            \edef\@tempa{%
                \def\@nx\bib'label{%
                    \current@stem
                    \alpha@label@suffix
                }%
            }%
        \@xp\endgroup
        \@tempa
    \fi
}
\def\calc@author@part{%
    \ifnum \@tempcnta = 1
        \@xp\@oneauthorlabel\@xp{\@tempa}%
    \else
        \@xp\@multiauthorlabel\@xp{\@tempa}%
    \fi
}
\def\@firstone#1{\@car#1\@empty\@nil}
\def\@firstthree#1{\@carcube#1\@empty\@empty\@empty\@nil}
\let\@nametoken\@firstone
\def\hyph@to@space#1-{#1 \hyph@to@space}
\def\@marknames#1{%
    \@ifnotempty{#1}{\surround@names#1 ' }%
}
\def\surround@names#1 {%
    \ifx '#1%
    \else
        \@nx\@nametoken{#1}%
        \@xp\surround@names
    \fi
}
\def\extract@surnames#1#2{%
    \get@namepart\@tempb\@nilgobble #2,\@nil
    \edef\@tempb{\@nx\@marknames{\@xp\hyph@to@space\@tempb\@gobble-}}%
    \edef#1{\@tempb}%
}
\newcommand{\@oneauthorlabel}[1]{%
    \def\name##1{%
        \extract@surnames\@tempa{##1}%
        \get@numberof\@tempcnta\@nametoken\@tempa
        \ifnum \@tempcnta = 1
            \let\@nametoken\@firstthree
        \fi
        \append@to@stem{\@tempa}%
    }%
    #1%
}
\def\@threeauthors\name#1\name#2\name#3#4\@empty{%
    \name{#1}\name{#2}\name{#3}%
    \append@to@stem{\etalchar{+}}%
}
\newcommand{\@multiauthorlabel}[1]{%
    \def\name##1{%
        \ifx\etaltext ##1%
            \def\@tempa{\@nx\etalchar{+}}%
            \let\name\@gobble
        \else
            \extract@surnames\@tempa{##1}%
        \fi
        \append@to@stem{\@tempa}%
    }%
    \ifnum \@tempcnta > 4 \@xp \@threeauthors \fi
    #1\@empty
}
\newcommand{\etalchar}[1]{$^{#1}$}
\def\year@short#1#2#3#4\@nil{#3#4}
\def\append@label@year{%
    \safe@set\@tempcnta\bib@year
    \edef\bib@citeyear{\the\@tempcnta}%
    \append@to@stem{%
        \ifx\bib@year\@empty
        \else
            \@xp\year@short \bib@citeyear \@nil
        \fi
    }%
}
\let\alpha@label@suffix\@empty

\newcount\alpha@suffix
\alpha@suffix\@ne
\let\@suffix@format\@alph
\def\calc@alpha@suffix{%
    \@tempswafalse
    \compare@stems\previous@stem\current@stem
    \ifsame@stems
        \ifx\previous@year\current@year
            \@tempswatrue
        \fi
    \fi
    \if@tempswa
        \global\advance\alpha@suffix\@ne
        \edef\alpha@label@suffix{\@suffix@format\alpha@suffix}%
        \ifnum\alpha@suffix=\tw@
            \immediate\write\@auxout{%
                \string\ModifyBibLabel{\prev@citekey}%
            }%
        \fi
    \else
        \let\alpha@label@suffix\@empty
        \global\alpha@suffix\@ne
        \@xp\ifx \csname b@\current@citekey @suffix\endcsname \relax
        \else
            \edef\alpha@label@suffix{\@suffix@format\alpha@suffix}%
        \fi
    \fi
}
\newif\ifsame@stems
\def\compare@stems#1#2{%
    \begingroup
        \purge@edef\@tempa{#1}%
        \purge@edef\@tempb{#2}%
        \lc@edef\@tempa{\@tempa}%
        \lc@edef\@tempb{\@tempb}%
        \ifx\@tempa\@tempb
            \def\@tempa{\same@stemstrue}%
        \else
            \def\@tempa{\same@stemsfalse}%
        \fi
    \@xp\endgroup
    \@tempa
}
\def\ModifyBibLabel#1{%
    \global\@xp\let\csname b@#1@suffix\endcsname\@empty
}
\newcount\series@index
\def\PrintSeries#1#2#3#4#5#6#7#8{%
    \begingroup
        \def\series@add@a{#2}%
        \def\series@add@b{\SwapBreak{#3}#4}%
        \def\series@add@c{\SwapBreak{#5}#6}%
        \def\series@add@d{\SwapBreak{#7}#8}%
        \def\series@add@e{\SwapBreak{#7}}%
        \PrintSeries@a{#1}%
}
\def\PrintSeries@a#1#2#3#4{%
        \get@numberof\@tempcnta#1{#3}%
        \chardef\series@total=\@tempcnta
        \ifnum\series@total=\@ne
            \let\SingularPlural\@firstoftwo
        \else
            \let\SingularPlural\@secondoftwo
        \fi
        \series@index=\z@
        \let#1\series@add
        #2#3#4\relax
    \endgroup
}
\def\series@add#1{%
    \advance\series@index\@ne
    \ifx\etaltext#1\relax
        \ifnum\series@index=\tw@
            \def\@tempa{\space\SubEtal}%
        \else
            \def\@tempa{\series@add@e\space\SubEtal}%
        \fi
        \series@index\@MM
    \else
        \ifcase\series@index
        \or
            \let\@tempa\series@add@a
        \or
            \ifnum\series@total<\thr@@
                \let\@tempa\series@add@b
            \else
                \let\@tempa\series@add@c
            \fi
        \else
            \ifnum\series@index=\series@total
                \let\@tempa\series@add@d
            \else
                \ifnum\series@index<\series@total
                    \let\@tempa\series@add@c
                \else
                    \let\@tempa\@gobble
                \fi
            \fi
        \fi
    \fi
    \@tempa{#1}%
}
\def\SwapBreak#1{%
    \relax\ifvmode\leavevmode\fi
    \@tempcnta\@MM
    \toks@{#1}%
    \unskip
    \ifnum \lastkern>\@ne \unkern \fi
    \ifnum\lastpenalty=\z@
    \else
        \@tempcnta\lastpenalty
        \unpenalty
    \fi
    \edef\@tempa{%
        \@nx\deferredquoteslogical
        \ifnum\lastkern=\@ne
        \else
            \ifnum\spacefactor=\sfcode\@xp\@xp\@xp`\@xp\@car\string#1)\@nil
            \else
                \ifnum\spacefactor=\@nopunctsfcode
                \else
                    \the\toks@
                \fi
            \fi
        \fi
        \@nx\deferredquotes
        \ifnum\@tempcnta=\@MM \else \penalty\number\@tempcnta\space \fi
        \ifnum\lastkern=\@ne \ignorespaces \fi
    }%
    \@tempa
}
\newcommand{\SingularPlural}[2]{#1}
\newcommand{\Plural}{\SingularPlural{}}
\BibSpec{nameLE}{
    +{}{}{given}
    +{}{\IfEmptyBibField{given}{}{ }}{surname}
    +{}{ }{jr}
}
\BibSpec{nameBE}{
    +{}{}{surname}
    +{}{ }{given}
}
\BibSpec{nameinverted}{
    +{} {}  {surname}
    +{,}{ } {given}
    +{,}{ } {jr}
}
\newcommand{\PrintNames}{%
    \@ifstar{\PrintNames@a\set@othername}{\PrintNames@a\set@firstname}%
}
\newcommand{\PrintNames@a}[4]{%
    \PrintSeries{\name}
        {#1}
        {}{ and \set@othername}
        {,}{ \set@othername}
        {,}{ and \set@othername}
        {#2}{#4}{#3}%
}
\def\set@firstname#1{%
    \set@name{#1}\setbib@nameLE
}
\def\set@othername#1{%
    \set@name{#1}\setbib@nameLE
}
\def\set@name#1{%
    \name@split#1,,,\@nil
    \set@name@a
}
\def\set@name@a#1{%
    \begingroup
        \get@current@properties
        \select@auxlanguage
        \def\@tempa{yes}%
        \ifx\@tempa\prop'inverted
            \setbib@nameBE
        \else
            #1%
        \fi
    \endgroup
}
\def\PrintPrimary{%
    \ifx\current@primary\@empty
        \EmptyPrimaryWarning
    \else
        \print@primary\current@primary
    \fi
}
\def\EmptyPrimaryWarning{%
    \amsrefs@warning{No authors, editors or translators}%
}
\newcommand{\PrintAuthors}[1]{%
    \ifx\previous@primary\current@primary
        \sameauthors\@empty
    \else
        \def\current@bibfield{\bib'author}%
        \PrintNames{}{}{#1}%
    \fi
}
\newcommand{\sameauthors}[1]{\bysame#1}
\def\bysame{%
    \leavevmode\hbox to3em{\hrulefill}\thinspace
    \kern\z@
}
\newcommand{\PrintNameList}{\PrintNames{}{}}
\newcommand{\PrintEditorsC}[1]{%
    \PrintNames{Edited by }{}{#1}%
}
\newcommand{\PrintEditorsA}[1]{%
    \ifx\previous@primary\current@primary
        \sameauthors{(ed\Plural{s}.)}%
    \else
        \def\current@bibfield{\bib'editor}%
        \PrintNames{}{ (ed\Plural{s}.)}{#1}%
    \fi
    \erase@field\bib'editor
}
\newcommand{\PrintEditorsB}{%
    \PrintNames*{(}{\SwapBreak{,}~ed\Plural{s}.)}%
}
\newcommand{\PrintContributions}[1]{%
    \PrintSeries
        {\fld@elt}
        {\print@contribution}
        {}{ and \print@contribution}
        {,}{ \print@contribution}
        {,}{ and \print@contribution}{}{#1}{}%
}
\newcommand{\print@contribution}[1]{%
    \in@={#1}%
    \ifin@
        \ifnum\series@index=\@ne with \fi
        \RestrictedSetKeys{}{bib}{%
            \bib@print@inner\setbib@contribution{\the\rsk@toks}%
        }{#1}%
    \else
        #1%
    \fi
}
\def\resolve@inner#1#2{%
    \in@={#2}%
    \ifin@
        \RestrictedSetKeys{}{bib}{#1{\the\rsk@toks}}{#2}%
    \else
        \@ifundefined{bi@#2}{%
            \XRefWarning{#2}%
        }{%
            #1{\csname bi@#2\endcsname}%
        }%
    \fi
}
\def\PrintConference{%
    \resolve@inner{\bib@print@inner\setbib@conference}
}
\def\PrintConferenceDetails#1{%
    \ifx\@empty\bib'address
        \ifx\@empty\bib'date
        \else
            \PrintConferenceDetails@
        \fi
    \else
        \PrintConferenceDetails@
    \fi
}
\def\PrintConferenceDetails@{%
    \ifnum\lastkern=\@ne\else\space\fi(\kern 1sp
    \ifx\@empty\bib'address
    \else
        \bib'address
    \fi
    \ifx\@empty\bib'date
    \else
        \SwapBreak{,}\space
        \print@date
    \fi
    )%\spacefactor\sfcode`\,%
}
\def\PrintBook{%
    \resolve@inner{\bib@print@inner\setbib@innerbook}
}
\def\PrintReprint{%
    \resolve@inner{\bib@reprint}
}
\def\bib@reprint#1{%
    \begingroup
        #1\relax            % execute definitions locally
        \bib@field@patches
        \bib'setup
        \IfEmptyBibField{copula}{reprinted in}{\bib'copula} \nopunct
        \let\bib'language\@empty
        \setbib@book
    \endgroup
}
\def\PrintTranslation{%
    \resolve@inner{\bib@translation}
}
\def\bib@translation#1{%
    \begingroup
        #1\relax            % execute definitions locally
        \bib@field@patches
        \bib'setup
        \let\PrintPrimary\@empty
        \bib@append{;}{ % keep this space!
            \IfEmptyBibField{language}{English}{\bib'language} transl.%
            \IfEmptyBibField{pages}{ in \kern\@ne sp}{, }%
        }\bib'transition
        \let\bib'language\@empty
        \setbib@@
    \endgroup
}
\newcommand{\PrintTranslatorsC}[1]{%
    \PrintNames{translated by }{}{#1}%
}
\newcommand{\PrintTranslatorsA}[1]{%
    \ifx\previous@primary\current@primary
        \sameauthors{(trans.)}%
    \else
        \def\current@bibfield{\bib'translator}%
        \PrintNames{}{ (trans.)}{#1}%
    \fi
    \erase@field\bib'translator
}
\newcommand{\PrintTranslatorsB}[1]{
    \PrintNames*{(}{\SwapBreak{,}~tran\Plural{s}.)}%
}
\DefineName{alii}{\etaltext}
\DefineName{others}{\etaltext}
\newcommand{\etaltext}{et al.}
\newcommand{\SubEtal}[1]{\etaltext}
\newcommand{\print@partial}{%
    \resolve@inner{\bib@print@inner\setbib@partial}
}
\newcommand{\parenthesize}[1]{%
    \leavevmode\push@bracket)\upn{(}#1\pop@bracket
}
\providecommand{\upn}[1]{#1}
\let\bracket@stack\@empty

\def\push@bracket#1{%
    \xdef\bracket@stack{#1\bracket@stack}%
}

\def\pop@bracket{%
    \iffalse{\fi
    \@xp\pop@bracket@a\bracket@stack \@empty}%
}

\def\pop@bracket@a#1{%
    \leavevmode\/\upn{#1}%
    \xdef\bracket@stack{\iffalse}\fi
}
\newcommand{\bibquotes}[1]{%
    \textquotedblleft#1%
    \gdef\deferredquotes{%
        \global\let\deferredquotes\@empty
        \textquotedblright
    }%
}
\providecommand{\mdash}{\textemdash}
\providecommand{\ndash}{\textendash}
\def\MR#1{%
    \relax\ifhmode\unskip\spacefactor3000 \space\fi
    \def\@tempa##1:##2:##3\@nil{%
        \ifx @##2\@empty##1\else\textbf{##1:}##2\fi
    }%
    \MRhref{#1}{MR \@tempa#1:@:\@nil}%
}
\providecommand{\MRhref}[1]{}
\newcommand{\PrintReviews}[1]{%
    \PrintSeries{\fld@elt}{}{,}{ }{,}{ }{,}{ }{}{#1}{}%
}
\newcommand{\PrintPartials}[1]{%
    \PrintSeries
        {\fld@elt}
        {\print@partial}
        {;}{ \print@partial}
        {;}{ \print@partial}
        {;}{ \print@partial}{}{#1}{}%
}
\newcommand{\PrintISBNs}[1]{%
    \PrintSeries{\fld@elt}{}{,}{ }{,}{ }{,}{ }{ISBN }{#1}{}%
}
\newcommand{\voltext}{\IfEmptyBibField{series}{Vol.~}{vol.~}}
\newcommand{\issuetext}{no.~}
\newcommand{\DashPages}[1]{%
    p\pp@scan@a#1@\ndash p@\ndash{\pp@scan#1@-p@-{}\@nil}\@nil.~#1%
}

\def\pp@scan#1-#2@-#3#4\@nil{#3}

\def\pp@scan@a#1\ndash#2@\ndash#3#4\@nil{#3}
\newcommand{\eprintpages}[1]{%
    #1\IfEmptyBibField{eprint}{}{\IfEmptyBibField{journal}{ pp.}{}}%
}
\def\PrintThesisType#1{%
    \thesis@type#1?\@nil{#1}%
}

\def\thesis@type#1#2\@nil#3{%
    \ifx p#1%
        Ph.D. Thesis%
    \else
        \ifx m#1%
            Master's Thesis%
        \else
            #3%
        \fi
    \fi
}
\newcommand{\PrintDOI}[1]{%
    DOI #1%
    \IfEmptyBibField{volume}{, (to appear in print)}{}%
}
\newcommand{\PrintDatePV}[1]{%
    \IfEmptyBibField{doi}{%
        \let\@tempa\PrintDate
    }{%
        \IfEmptyBibField{volume}{%
            \let\@tempa\PrintDatePosted
        }{%
            \let\@tempa\PrintDate
        }%
    }%
    \@tempa{#1}%
}
\newcommand{\PrintDate}[1]{(\print@date)}
\newcommand{\PrintDateB}[1]{\print@date}
\def\print@date{%
    \ifx\bib@month\@empty
    \else
        \print@month@day
    \fi
    \bib@year
}
\def\print@month@day{%
    \bib@monthname
    \ifx\@empty\bib@day \else \nobreakspace\number 0\bib@day,\fi
    \space
}
\newcommand{\bib@monthname}{%
    \ifcase 0\bib@month
    \or January\or February\or March\or April\or May\or June\or
      July\or August\or September\or October\or November\or December\or
      Winter\or Spring\or Summer\or Fall\else Unknown Month%
    \fi
}
\newcommand{\PrintYear}[1]{\bib@year}
\newcommand{\PrintDatePosted}[1]{\unskip,  posted on \print@date}
\newcommand{\PrintEdition}[1]{%
    \afterassignment\print@edition
    \count@ 0#1\relax\@nil
}
\def\print@edition#1#2\@nil{%
    \ifx\relax#1\relax
        \ifnum\count@>\z@
            \CardinalNumeric\count@
        \else
            ??th%
        \fi
        \ \editiontext
    \else
        \ifnum \count@>\z@ \number\count@ \fi
        #1#2\relax
    \fi
}
\newcommand{\editiontext}{ed.}
\newcommand{\CardinalNumeric}[1]{%
    \number#1\relax
    \if
        \ifnum#1<14
            \ifnum#1>\thr@@ T\else F\fi
        \else
            F%
        \fi
        T%
            th%
    \else
        \@xp\keep@last@digit\@xp#1\number#1\relax
        \ifcase#1th\or st\or nd\or rd\else th\fi
    \fi
}
\def\keep@last@digit#1#2{%
    \ifx\relax#2%
        \@xp\@gobbletwo
    \else
        #1=#2\relax
    \fi
    \keep@last@digit#1%
}
\newcommand{\SentenceSpace}{\relax\ifhmode\spacefactor`\. \fi}
\newcommand{\eprint}[1]{\url{#1}}
\let\bibliographystyle\@gobble
\def\bibtex@style{amsrn}
\AtBeginDocument{
    \if@filesw
        \immediate\write\@auxout{\string\bibstyle{\bibtex@style}}%
    \fi
}
\IfOption{alphabetic}{%
    \def\bibtex@style{amsra}%
    \def\alpha@label{%
        \ifx\@empty\bib'label
            \def\thebib{\CurrentBib}%
        \else
            \let\thebib\bib'label
        \fi
    }%
    \let\generate@label\generate@alphalabel
    \let\process@citelist\process@citelist@unsorted
    \def\numeric@refs{01}%
}{}
\IfOption{shortalphabetic}{%
    \def\bibtex@style{amsrs}%
    \def\alpha@label{%
        \ifx\@empty\bib'label
            \def\thebib{\CurrentBib}%
        \else
            \let\thebib\bib'label
        \fi
    }%
    \let\@suffix@format\@arabic
    \def\calc@author@part{%
        \@xp\@multiauthorlabel\@xp{\@tempa}%
    }%
    \let\append@label@year\@empty
    \let\generate@label\generate@alphalabel
    \let\process@citelist\process@citelist@unsorted
    \def\numeric@refs{01}%
}{}
\IfOption{backrefs}{%
    \let\PrintBackRefs\print@backrefs
    \@ifundefined{Hy@backout}{%
        \amsrefs@warning{backref option requires hyperref package}%
    }{%
        \let\BackCite\back@cite
        \AtBeginDocument{\@starttoc{brf}{}}%
    }%
}{%
}
\IfOption{citation-order}{%
    \IfOption{alphabetic}{%
        \amsrefs@warning@nl{%
            The 'citation-order' and 'alphabetic' options are
            incompatible%
        }%
    }{
        \def\bibtex@style{amsru}%
    }
}{}
\IfOption{initials}{% TRUE:
    \BibSpec{nameLE}{
        +{}{}{initials}
        +{}{\IfEmptyBibField{initials}{}{ }}{surname}
        +{}{ }{jr}
    }

    \BibSpec{nameBE}{
        +{}{}{surname}
        +{}{ }{initials}
    %    +{}{ }{jr}
    }

    \BibSpec{nameinverted}{
        +{} {}  {surname}
        +{,}{ } {initials}
        +{,}{ } {jr}
    }
}{% initials? FALSE:
} % end conditional code for initials option
\IfOption{jpa}{%
    \amsrefs@warning{The 'jpa' option is obsolete}%
    \typeout{Trying \string\usepackage{amsjpa} instead ...}%
    \RequirePackage{amsjpa}[2000/02/02]
}{}
\let\deferredquotes\@empty
\IfOption{logical-quotes}{%
    \def\deferredquoteslogical{\deferredquotes}%
}{%
    \let\deferredquoteslogical\relax
}
\IfOption{non-compressed-cites}{%
    \let\cite@compress\cite@print
}{}
\IfOption{non-sorted-cites}{%
    \let\process@citelist\process@citelist@unsorted
}{}
\IfOption{short-journals}{%
    \renewcommand{\DefineJournal}[4]{%
        \bib*{#1}{periodical}{
            issn={#2},
            journal={#3},
        }%
    }
}{}
\IfOption{short-publishers}{%
    \renewcommand{\DefinePublisher}[4]{%
        \bib*{#1}{publisher}{%
            publisher={#2},%
            address={#4},
        }%
    }%
}{}
\IfOption{short-months}{%
    \renewcommand{\bib@monthname}{%
        \ifcase 0\bib@month
        \or Jan.\or Feb.\or Mar.\or Apr.\or May\or June\or
          July\or Aug.\or Sep.\or Oct.\or Nov.\or Dec.\or
          Winter\or Spring\or Summer\or Fall\else Unknown Month%
        \fi
    }%
}{}
\IfOption{y2k}{%
    \IfOption{alphabetic}{%
        \def\year@short#1\@nil{#1}%
        \def\bibtex@style{amsry}%
    }{%
        \amsrefs@warning@nl{%
            The 'y2k' option can only be used with the^^J%
            'alphabetic' option%
        }%
}
}{}
\IfOption{bibtex-style}{%
    \RequirePackage{amsbst}
}{}
\IfOption{author-year}{}{\PopCatcodes \endinput}
\def\generate@label{%
    \ifx\bib'label\@empty
        \begingroup
            \global\let\previous@stem\current@stem
            \global\let\current@stem\@empty
            \global\let\previous@year\current@year
            \global\let\current@year\bib@year
            \@apply\auto@protect\amsrefs@textsymbols
            \@apply\auto@protect\amsrefs@textaccents
            \def\name##1{\@nx\name{\lnscan@a##1,\@nil}}%
            \auto@protect\etaltext
            \normalize@edef\current@stem{\current@primary}%
            \xdef\current@stem{\current@stem}%
            \calc@alpha@suffix
            \edef\@tempa{%
                \def\@nx\cite@label{\current@stem}%
                \def\@nx\bib@label@year{%
                    \current@year
                    \alpha@label@suffix
                }%
            }
        \@xp\endgroup
        \@tempa
    \fi
}
\def\lnscan@a#1,#2\@nil{#1}
\def\citesel@author#1#2#3#4#5{\PrintCiteNames{#3}}
\def\citesel@authoryear#1#2#3#4#5{\PrintCNY{#3}{#4}}
\def\citesel@object#1#2#3#4#5{\PrintCiteNames{#3} \citeleft#4}
\let\citesel\citesel@authoryear
\def\numeric@refs{01}%
\def\citeleft{(}%
\def\citeright{)}%
\def\@citeleft{\ifx\citesel\citesel@object\else\citeleft\fi}%
\def\citepunct{; }
\let\BibLabel\@empty
\let\process@citelist\process@citelist@unsorted
\DeclareRobustCommand{\ycite}[1]{%
    \star@{\cite@a\citesel@year{#1}}{}%
}
\DeclareRobustCommand{\ycites}[1]{%
    \begingroup
        \def\citepunct{, }%
        \let\citesel\citesel@year
        \cites{#1}%
    \endgroup
}
\DeclareRobustCommand{\ocite}[1]{%
    \star@{\cite@a\citesel@object{#1}}{}%
}
\DeclareRobustCommand{\ocites}[1]{%
    \begingroup
        \let\@citelist\@ocitelist
        \cites{#1}%
    \endgroup
}
\def\@ocitelist#1{%
    \PrintSeries{\InnerCite}%
        {\ocite}%
        {}{ and \ocite}%
        {,}{ \ocite}%
        {,}{ and \ocite}%
        {}%
        {#1}%
        {}%
}
\DeclareRobustCommand{\citeauthor}[1]{%
    \star@{\cite@a\citesel@author{#1}}{}%
}
\DeclareRobustCommand{\citeauthory}[1]{%
    \citeauthor{#1} \ycite{#1}%
}
\DeclareRobustCommand{\fullcite}[1]{%
    \begingroup
        \let\print@citenames\CiteNamesFull
        \star@{\cite@a\citesel@authoryear{#1}}{}%
    \endgroup
}
\DeclareRobustCommand{\fullocite}[1]{%
    \begingroup
        \let\print@citenames\CiteNamesFull
        \star@{\cite@a\citesel@object{#1}}{}%
    \endgroup
}
\def\set@firstname#1{%
    \set@name{#1}\setbib@nameinverted
}
\def\PrintCNY#1#2{%
    \PrintCiteNames{#1}%
    \@ifnotempty{#2}{\@addpunct{,} #2}%
}
\def\PrintCiteNames#1{%
    \leavevmode
    \def\@tempa{#1}%
    \ifx\@tempa\prev@names
    \else
        \gdef\prev@names{#1}%
        \@xp\ifx\@car#1.\@nil\CitePrintUndefined
            #1\relax
        \else
            \print@citenames{#1}%
        \fi
    \fi
}
\newcommand{\CiteNames}[1]{%
    \PrintSeries{\name}%
        {}%
        {}{ and }%
        {}{\@gobble}%
        {}{ \etaltext\@\@gobble}%
        {}%
        {#1}%
        {}%
}
\let\print@citenames\CiteNames
\newcommand{\CiteNamesFull}[1]{%
    \PrintSeries{\name}%
        {}%
        {}{ and }%
        {,}{ }%
        {,}{ and }%
        {}%
        {#1}%
        {}%
}
\renewcommand{\PrintDate}[1]{\bib@label@year}
\def\print@date{%
    \IfEmptyBibField{date}{%
        \IfEmptyBibField{year}{\BibField{status}}{\bib@year}%
    }{%
        \bib@year
    }%
}
\BibSpec{article}{%
    +{}  {\PrintAuthors}                {author}
    +{.} { \PrintDate}                  {date}
    +{.} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintContributions}         {contribution}
    +{.} { \PrintPartials}              {partial}
    +{,} { }                            {journal}
    +{}  { \textbf}                     {volume}
    +{,} { \issuetext}                  {number}
    +{,} { \eprintpages}                {pages}
    +{,} { }                            {status}
    +{,} { \PrintDOI}                   {doi}
    +{,} { available at \eprint}        {eprint}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{book}{%
    +{}  {\PrintPrimary}                {transition}
    +{.} { \PrintDate}                  {date}
    +{.} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintEdition}               {edition}
    +{}  { \PrintEditorsB}              {editor}
    +{,} { \PrintTranslatorsC}          {translator}
    +{,} { \PrintContributions}         {contribution}
    +{,} { }                            {series}
    +{,} { \voltext}                    {volume}
    +{,} { }                            {publisher}
    +{,} { }                            {organization}
    +{,} { }                            {address}
    +{,} { }                            {status}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{collection.article}{%
    +{}  {\PrintAuthors}                {author}
    +{.} { \PrintDate}                  {date}
    +{.} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintContributions}         {contribution}
    +{,} { \PrintConference}            {conference}
    +{}  {\PrintBook}                   {book}
    +{,} { }                            {booktitle}
    +{,} { pp.~}                        {pages}
    +{,} { }                            {status}
    +{,} { \PrintDOI}                   {doi}
    +{,} { available at \eprint}        {eprint}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{report}{%
    +{}  {\PrintPrimary}                {transition}
    +{.} { \PrintDate}                  {date}
    +{.} { \textit}                     {title}
    +{.} { }                            {part}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintEdition}               {edition}
    +{,} { \PrintContributions}         {contribution}
    +{,} { Technical Report }           {number}
    +{,} { }                            {series}
    +{,} { }                            {organization}
    +{,} { }                            {address}
    +{,} { \eprint}                     {eprint}
    +{,} { }                            {status}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}

\BibSpec{thesis}{%
    +{}  {\PrintAuthors}                {author}
    +{.} { \PrintDate}                  {date}
    +{.} { \textit}                     {title}
    +{:} { \textit}                     {subtitle}
    +{,} { \PrintThesisType}            {type}
    +{,} { }                            {organization}
    +{,} { }                            {address}
    +{,} { \eprint}                     {eprint}
    +{,} { }                            {status}
    +{}  { \parenthesize}               {language}
    +{}  { \PrintTranslation}           {translation}
    +{;} { \PrintReprint}               {reprint}
    +{.} { }                            {note}
    +{.} {}                             {transition}
    +{}  {\SentenceSpace \PrintReviews} {review}
}
\PopCatcodes
\endinput
%%
%% End of file `amsrefs.sty'.
