% \iffalse meta-comment
%
% Copyright 1989-1996 Johannes L. Braams and any individual authors
% listed elsewhere in this file.  All rights reserved.
% 
% For further copyright information see any other copyright notices in 
% this file.
% 
% This file is part of the Babel system release 3.6.
% --------------------------------------------------
%   This system is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% 
%   For error reports concerning UNCHANGED versions of this file no
%   more than one year old, see bugs.txt.
% 
%   Please do not request updates from me directly.  Primary
%   distribution is through the CTAN archives.
% 
% 
% IMPORTANT COPYRIGHT NOTICE:
% 
% You are NOT ALLOWED to distribute this file alone.
% 
% You are allowed to distribute this file under the condition that it
% is distributed together with all the files listed in manifest.txt.
% 
% If you receive only some of these files from someone, complain!
% 
% Permission is granted to copy this file to another file with a
% clearly different name and to customize the declarations in that
% copy to serve the needs of your installation, provided that you
% comply with the conditions in the file legal.txt from the LaTeX2e
% distribution.
% 
% However, NO PERMISSION is granted to produce or to distribute a
% modified version of this file under its original name.
%  
% You are NOT ALLOWED to change this file.
% 
% 
% \fi
% \CheckSum{808}
%
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<*dtx>
\ProvidesFile{russianb.dtx}
%</dtx>
%<code>\ProvidesFile{russianb.ldf}
        [1996/12/29 v1.1e Russian support from the babel system]
%
% Babel package for LaTeX version 2e
% Copyright (C) 1989 - 1996
%           by Johannes Braams, TeXniek
%
% Russianb Language Definition File
% Copyright (C) 1995 - 1996
%           by Olga Lapko <cyrtug@mir.msk.su>
%              Johannes Braams, TeXniek
%
% Please report errors to: J.L. Braams
%                          JLBraams@cistron.nl
%
%<*filedriver>
\documentclass{ltxdoc}
\newcommand\TeXhax{\TeX hax}
\newcommand\babel{\textsf{babel}}
\newcommand\langvar{$\langle \it lang \rangle$}
\newcommand\note[1]{}
\newcommand\Lopt[1]{\textsf{#1}}
\newcommand\file[1]{\texttt{#1}}
\newcommand\pkg[1]{\texttt{#1}}
\begin{document}
 \DocInput{russianb.dtx}
\end{document}
%</filedriver>
%\fi
% \GetFileInfo{russianb.dtx}
%
% \changes{russianb-1.1c}{1996/07/11}{Replaced \cs{undefined} with
%    \cs{@undefined} and \cs{empty} with \cs{@empty} for consistency
%    with \LaTeX} 
% \changes{russianb-1.1d}{1996/10/10}{Moved the definition of
%    \cs{atcatcode} right to the beginning.}
%
%  \section{The Russian language}
%
%    The file \file{\filename}\footnote{The file described in this
%    section has version number \fileversion\ and was last revised on
%    \filedate. This file was initially derived from the original
%    version of \file{german.sty}, which has some definitions for
%    Russian. Later the definitions from \file{russian.sty} version 1.0b
%    (for \LaTeX\ 2.09), \file{russian.sty} version v2.5c (for \LaTeX2e)
%    and \file{francais.sty} version 4.5c and
%    \file{germanb.sty} version 2.5c were added.}
%    defines all the language-specific macros for the Russian
%    language. It needs the file \file{cyrcod} for success documentation
%    with Russian encodings (see below).
%
%    For this language the character |"| is made active. In
%    table~\ref{tab:russian-quote} an overview is given of its
%    purpose.
%    \begin{table}[htb]
%     \begin{center}
%     \begin{tabular}{lp{8cm}}
%      \verb="|= & disable ligature at this position.          \\
%      |"-| & an explicit hyphen sign, allowing hyphenation
%                  in the rest of the word.                     \\
%      |""| & like |"-|, but producing no hyphen sign
%                  (for compund words with hyphen, e.g.\ |x-""y|
%                  or some other signs  as ``disable/enable''). \\
%      |"~| & for a compound word mark without a breakpoint.    \\
%      |"=| & for a compound word mark with a breakpoint, allowing
%             hyphenation in the composing words.               \\
%      |"`| & for German left double quotes (looks like ,,).    \\
%      |"'| & for German right double quotes (looks like ``).   \\%''
%      |"<| & for French left double quotes (looks like $<<$).  \\
%      |">| & for French right double quotes (looks like $>>$). \\
%     \end{tabular}
%     \caption{The extra definitions made
%              by \file{russianb}}\label{tab:russian-quote}
%     \end{center}
%    \end{table}
%
%    The quotes in table~\ref{tab:russian-quote} can also be typeset by
%    using the commands in table~\ref{tab:rmore-quote}.
%    \begin{table}[htb]
%     \begin{center}
%     \begin{tabular}{lp{8cm}}
%      |\glqq| & for German left double quotes (looks like ,,).   \\
%      |\grqq| & for German right double quotes (looks like ``).  \\%''
%      |\flqq| & for French left double quotes (looks like $<<$). \\
%      |\frqq| & for French right double quotes (looks like $>>$).\\
%      |\dq|   & the original quotes character (|"|).        \\
%     \end{tabular}
%     \caption{More commands which produce quotes, defined
%              by \babel}\label{tab:rmore-quote}
%     \end{center}
%    \end{table}
%
%    The quotation marks traditionally used in Russian language were
%    borrowed from other languages (e.g. French and German) so they
%    keep their original names. 
%
% \StopEventually{}
%
%    The macro |\LdfInit| takes care of preventing that this file is
%    loaded more than once, checking the category code of the
%    \texttt{@} sign, etc.
% \changes{russianb-1.1d}{1996/11/03}{Now use \cs{LdfInit} to perform
%    initial checks} 
% \changes{russianb-1.1e}{1996/12/29}{Added closing brace to second
%    argument of \cs{LdfInit}} 
%    \begin{macrocode}
%<*code>
\LdfInit{russian}{captionsrussian}
%    \end{macrocode}
%
%    When this file is read as an option, i.e., by the |\usepackage|
%    command, \texttt{russianb} will be an `unknown' language, in
%    which case we have to make it known. So we check for the
%    existence of |\l@russian| to see whether we have to do something
%    here. 
%
%    \begin{macrocode}
\ifx\l@russian\@undefined
  \@nopatterns{Russian}%
  \adddialect\l@russian0
\fi
%    \end{macrocode}
%
%    Tyesetting Russian texts implies that a special set of fonts needs
%    to be used. The current support for Russian uses a set of fonts
%    that more or less `match' with the computer modern fonts.
%    Therefore we define the Local WashingtoN encoding (LWN, see the
%    file \file{cyrillic.fdd}). We make sure that this encoding is
%    known to \LaTeX. 
%    \begin{macrocode}
\input{LWNenc.def}
%    \end{macrocode}
%
%  \begin{macro}{\latinencoding}
%    We need to know the encoding for text that is supposed to be
%    typeset in  latin text. We assume that it will be the encoding
%    which is active at the end of the \babel\ package. If the
%    \pkg{fontenc} package is loaded later, then... too bad!
%    \begin{macrocode}
\AtEndOfPackage{\edef\latinencoding{\cf@encoding}}
%    \end{macrocode}
%  \end{macro}
%
%    Now we define two commands that offer the possibility to switch
%    between cyrillic and roman encodings.
%
%  \begin{macro}{\cyrillictext}
%  \begin{macro}{\latintext}
%    The command |\cyrillictext| will switch from latin font encoding
%    to the cyrillic font encoding, the command |\latintext| switches
%    back. This assumes that the `normal' font encoding is a latin
%    one. These commands are \emph{declarations}, for shorter peaces
%    of text the commands |\textlatin| and |\textcyrillic| can be
%    used.
%    \begin{macrocode}
\DeclareRobustCommand{\cyrillictext}{%
  \fontencoding{LWN}\selectfont
  \def\encodingdefault{LWN}}
\DeclareRobustCommand{\latintext}{%
  \fontencoding{\latinencoding}\selectfont
  \def\encodingdefault{\latinencoding}}
\let\lat\latintext
\let\cyr\cyrillictext
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\textcyrillic}
%  \begin{macro}{\textlatin}
%    These commands take an argument which is then typeset using the
%    requested font encoding.
%    \begin{macrocode}
%    \end{macrocode}
\DeclareRobustCommand{\textcyrillic}[1]{\cyrillictext #1}
\DeclareRobustCommand{\textlatin}[1]{\latintext #1}
%  \end{macro}
%  \end{macro}
%
%    The next step consists of defining commands to switch to (and
%    from) the Russian language.
%
% \begin{macro}{\captionsrussian}
%    The macro |\captionsrussian| defines all strings used in the four
%    standard document classes provided with \LaTeX. There are the two
%    commands: |\cyr| and |\lat| which switch on the right (Cyrillic
%    or Latin) encoding. 
%
%    \begin{macrocode}
\addto\captionsrussian{%
  \def\prefacename{%
    {\cyr \CYRP\CYRr\CYRe\CYRd\CYRi\CYRs\CYRl\CYRo\CYRv\CYRi\CYRe}}%
   %{\cyr \CYRV\CYRv\CYRe\CYRd\CYRe\CYRn\CYRi\CYRe}}%
  \def\refname{%
    {\cyr \CYRS\CYRp\CYRi\CYRs\CYRo\CYRk\space
      \CYRl\CYRi\CYRt\CYRe\CYRr\CYRa\CYRt\CYRu\CYRr\CYRy}}%
  \def\abstractname{%
    {\cyr \CYRA\CYRn\CYRn\CYRo\CYRt\CYRa\CYRc\CYRi\CYRya}}%
  \def\bibname{%
    {\cyr\CYRB\CYRi\CYRb\CYRl\CYRi\CYRo\CYRg\CYRr\CYRa\CYRf\CYRi\CYRya}}%
  \def\chaptername{%
    {\cyr \CYRG\CYRl\CYRa\CYRv\CYRa}}%
  \def\appendixname{%
    {\cyr \CYRP\CYRr\CYRi\CYRl\CYRo\CYRzh\CYRe\CYRn\CYRi\CYRe}}%
%    \end{macrocode}
%    There are two names for the Table of Contents that are in use in
%    Russian publications.
%    \begin{macrocode}
  \def\contentsname{%
%    \end{macrocode}
%    For books this one is appropriate:
%    \begin{macrocode}
    {\cyr \CYRO\CYRg\CYRl\CYRa\CYRv\CYRl\CYRe\CYRn\CYRi\CYRe}}%
%    \end{macrocode}
%    but for proceedings the following is preferred:
%    \begin{macrocode}
   %{\cyr \CYRS\CYRo\CYRd\CYRe\CYRr\CYRzh\CYRa\CYRn\CYRi\CYRe}}%
  \def\listfigurename{%
    {\cyr \CYRS\CYRp\CYRi\CYRs\CYRo\CYRk\space
      \CYRi\CYRl\CYRl\CYRyu\CYRs\CYRt\CYRr\CYRa\CYRc\CYRi\CYRishrt}}%
%    \end{macrocode}
%    The List of Tables is not used so we provide an empty definition
%    by default.
%    \begin{macrocode}
  \def\listtablename{%
    %\CYRS\CYRp\CYRi\CYRs\CYRo\CYRk\space
    %\CYRt\CYRa\CYRb\CYRl\CYRi\CYRc}%
    }
  \def\indexname{%
    {\cyr \CYRP\CYRr\CYRe\CYRd\CYRm\CYRe\CYRt\CYRn\CYRy\CYRishrt\space
      \CYRu\CYRk\CYRa\CYRz\CYRa\CYRt\CYRe\CYRl\CYRssgn}}%
  \def\authorname{%
    {\cyr \CYRI\CYRm\CYRe\CYRn\CYRn\CYRo\CYRishrt\space
      \CYRu\CYRk\CYRa\CYRz\CYRa\CYRt\CYRe\CYRl\CYRssgn}}%
  \def\figurename{{\cyr \CYRR\CYRi\CYRs.}}%
  \def\tablename{{\cyr \CYRT\CYRa\CYRb\CYRl\CYRi\CYRc\CYRa}}%
  \def\partname{{\cyr \CYRCH\CYRa\CYRs\CYRt\CYRssgn}}%
  \def\enclname{{\cyr \CYRv\CYRk\CYRl.}}%
  \def\ccname{{\cyr \CYRi\CYRs\CYRh.}}%
  \def\headtoname{{\cyr \CYRv\CYRh.}}%
  \def\pagename{{\cyr \CYRs.}}%
  \def\seename{{\cyr \CYRs\CYRm.}}%
  \def\alsoname{{\cyr \CYRs\CYRm.\ \CYRt\CYRa\CYRk\CYRzh\CYRe}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\daterussian}
%    The macro |\daterussian| redefines the command
%    |\today| to produce Russian dates.
%    \begin{macrocode}
\def\month@russian{\ifcase\month\or
  \CYRya\CYRn\CYRv\CYRa\CYRr\CYRya\or
  \CYRf\CYRe\CYRv\CYRr\CYRa\CYRl\CYRya\or
  \CYRm\CYRa\CYRr\CYRt\CYRa\or
  \CYRa\CYRp\CYRr\CYRe\CYRl\CYRya\or
  \CYRm\CYRa\CYRya\or
  \CYRi\CYRyu\CYRn\CYRya\or
  \CYRi\CYRyu\CYRl\CYRya\or
  \CYRa\CYRv\CYRg\CYRu\CYRs\CYRt\CYRa\or
  \CYRs\CYRe\CYRn\CYRt\CYRya\CYRb\CYRr\CYRya\or
  \CYRo\CYRk\CYRt\CYRya\CYRb\CYRr\CYRya\or
  \CYRn\CYRo\CYRya\CYRb\CYRr\CYRya\or
  \CYRd\CYRe\CYRk\CYRa\CYRb\CYRr\CYRya\fi}
\def\daterussian{%
  \def\today{\number\day~\month@russian\space\number\year~\CYRg.}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\extrasrussian}
%    The macro |\extrasrussian| will perform all the extra definitions
%    needed for the Russian language. The macro |\noextrasrussian|
%    is used to cancel the actions of |\extrasrussian|.
%
% \changes{russianb-1.1b}{1996/02/20}{Added switch to \texttt{LWN}
%    encoding} 
%    The first action we define is to switch to the \texttt{LWN}
%    encoding whenever we enter `russian'.
%    \begin{macrocode}
\addto\extrasrussian{\cyrillictext}
%    \end{macrocode}
%    When the file \file{LWNenc.def} was processed by LaTeX it stores
%    the current font encoding in |\latinencoding|, assuming that
%    \LaTeX\ uses \texttt{T1} or \texttt{OT1} as default. Therefore we
%    switch back to |\latinencoding| whenever the russian language is
%    no longer `active'.
%    \begin{macrocode}
\addto\noextrasrussian{\latintext}
%    \end{macrocode}
%
%  \begin{macro}{\verbatim@font}
% \changes{russianb-1.1b}{1996/02/20}{Added changing of
%    \cs{verbatim@font}} 
%    In order to get verbatim text in the latin alphabet we need to
%    change the definition of an internal \LaTeX\ command somewhat:
%    \begin{macrocode}
\def\verbatim@font{%
  \normalfont
  \fontencoding\latinencoding\ttfamily}
%    \end{macrocode}
%  \end{macro}
%
%    In order to be able to use cyrillic letters in mathematics we
%    need to have the package \pkg{cyrmath} available.
%    \begin{macrocode}
\AtEndOfPackage{\RequirePackage{cyrmath}}
%    \end{macrocode}
%
%    The category code of the characters \texttt{:}, \texttt{;},
%    \texttt{!} and \texttt{?} is made |\active| to insert a little
%    white space.
%
%    For Russian (as well as for German) the \texttt{"} character
%    also is made active.
%
% \changes{russianb-1.1a}{1995/03/07}{Use the new mechanism for dealing
%    with active chars}
%    \begin{macrocode}
\initiate@active@char{:}
\initiate@active@char{;}
\initiate@active@char{!}
\initiate@active@char{?}
\initiate@active@char{"}
%    \end{macrocode}
%    The code above is necessary because we need extra active
%    characters. The character |"| is used as indicated in
%    table~\ref{tab:russian-quote}.
%
%    We specify that the russian group of shorthands should be used.
%    \begin{macrocode}
\addto\extrasrussian{\languageshorthands{russian}}
%    \end{macrocode}
%    These characters are `turned on' once, later their definition may
%    vary.
%    \begin{macrocode}
\addto\extrasrussian{%
  \bbl@activate{:}\bbl@activate{;}%
  \bbl@activate{!}\bbl@activate{?}%
  \bbl@activate{"}}
%\addto\noextrasrussian{%
%  \bbl@deactivate{:}\bbl@deactivate{;}%
%  \bbl@deactivate{!}\bbl@deactivate{?}%
%  \bbl@deactivate{"}}
%    \end{macrocode}
%
% \begin{macro}{\russian@sh@;@}
% \begin{macro}{\russian@sh@:@}
% \begin{macro}{\russian@sh@!@}
% \begin{macro}{\russian@sh@?@}
%    We have to reduce the amount of white space before \texttt{;},
%    \texttt{:} and \texttt{!}. 
%    This should only happen in horizontal mode, hence the test with
%    |\ifhmode|. 
% \changes{russianb-1.1a}{1995/07/04}{Use new \cs{DefineActiveNoArg}}
% \changes{russianb-1.1a}{1995/07/04}{Use the more general mechanism of
%    \cs{declare@shorthand}}
% \changes{russianb-1.1b}{1996/02/08}{Updated to reflect the latest
%    french definitions} 
%    \begin{macrocode}
\declare@shorthand{russian}{;}{%
  \ifhmode
%    \end{macrocode}
%    In horizontal mode we check for the presence of a `space',
%    `unskip' if it exists and place a |0.1em| kerning.
%    \begin{macrocode}
    \ifdim\lastskip>\z@
      \unskip\penalty\@M\thinspace
    \else
      \thinspace
    \fi
  \fi
%    \end{macrocode}
%    Now we can insert a |;| character.
%    \begin{macrocode}
  \string;}
%    \end{macrocode}
%
%    Because these definitions are very similar only one is displayed
%    in a way that the definition can be easily checked.
%
%    \begin{macrocode}
\declare@shorthand{russian}{:}{%
  \ifhmode
    \ifdim\lastskip>\z@
      \unskip\penalty\@M\thinspace
    \else
      \thinspace
    \fi
  \fi
  \string:}
%    \end{macrocode}
%    \begin{macrocode}
\declare@shorthand{russian}{!}{%
  \ifhmode
    \ifdim\lastskip>\z@
      \unskip\penalty\@M\thinspace
    \else
      \thinspace
    \fi
  \fi
  \string!}
%    \end{macrocode}
%    \begin{macrocode}
\declare@shorthand{russian}{?}{%
  \ifhmode
    \ifdim\lastskip>\z@
      \unskip\penalty\@M\thinspace
    \else
      \thinspace
    \fi
  \fi
  \string?}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%  \begin{macro}{\system@sh@:@}
%  \begin{macro}{\system@sh@!@}
%  \begin{macro}{\system@sh@?@}
%  \begin{macro}{\system@sh@;@}
% \changes{russianb-1.1a}{1995/07/04}{Added system level shorthands}
%    When the active characters appear in an environment where their
%    Russian behaviour is not wanted they should give an `expected'
%    result. Therefore we define shorthands at system level as well.
%    \begin{macrocode}
\declare@shorthand{system}{:}{\string:}
\declare@shorthand{system}{!}{\string!}
\declare@shorthand{system}{?}{\string?}
\declare@shorthand{system}{;}{\string;}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
%    To be able to define the function of |"|, we first define a
%    couple of `support' macros.
%
%  \begin{macro}{\dq}
%    We save the original double quote character in |\dq| to keep
%    it available, the math accent |\"| can now be typed as |"|.
%    \begin{macrocode}
\begingroup \catcode`\"12
\def\x{\endgroup
  \def\@SS{\mathchar"7019 }
  \def\dq{"}}
\x
%    \end{macrocode}
%  \end{macro}
%
% \changes{russianb-1.1a}{1995/07/04}{Use \cs{ddot} instead of
%    \cs{@MATHUMLAUT}}
%
%    Now we can define the doublequote macros:
%    german and french quotes.
%    The french quotes are maded in Russian font so they are described
%    in \file{lhrcod.sty}
%    \begin{macrocode}
\declare@shorthand{russian}{"`}{%
  \textormath{\quotedblbase{}}{\mbox{\quotedblbase}}}
\declare@shorthand{russian}{"'}{%
  \textormath{\kern-.07em\textquotedblleft{}}{\mbox{\textquotedblleft}}}
\declare@shorthand{russian}{"<}{%
  \textormath{\flqq}{\mbox{\flqq}}}
\declare@shorthand{russian}{">}{%
  \textormath{\frqq}{\mbox{\frqq}}}
%    \end{macrocode}
%    and some additional commands:
%    \begin{macrocode}
\declare@shorthand{russian}{""}{\hskip\z@skip}
\declare@shorthand{russian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
\declare@shorthand{russian}{"=}{\penalty\@M\hskip\z@skip}
\declare@shorthand{russian}{"|}{%
  \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}%
              \allowhyphens}{}}
%    \end{macrocode}
%    The next two macros for |"-| and |"---| have some difference.
%    We must check whether the second token is a hyphen character:
%    \begin{macrocode}
\declare@shorthand{russian}{"-}{%
%    \end{macrocode}
%    If the next token is |-|, we typeset an emdash, else---hyphen sign:
%    \begin{macrocode}
  \def\russian@sh@tmp{%
    \if\russian@sh@next-\expandafter\russian@sh@emdash
    \else\expandafter\russian@sh@hyphen\fi
  }%
%    \end{macrocode}
%    \TeX{} looks for the next sign after first |-|, the meaning of this
%    sign it writes to  |\russian@sh@next| and call |\russian@sh@tmp|
%    \begin{macrocode}
  \futurelet\russian@sh@next\russian@sh@tmp}
%    \end{macrocode}
%    There are the definitions of hyphen and emdash:
%    hyphen definition:
%    \begin{macrocode}
\def\russian@sh@hyphen{%
  \penalty\@M\-\allowhyphens}
%    \end{macrocode}
%    emdash definition, there are the two parameters: we must ``eat''
%    two last hyphen signs of our emdash:
%    \begin{macrocode}
\def\russian@sh@emdash#1#2{%
  \ifdim\lastskip>\z@
    \unskip
  \fi
  \penalty\@M
  \hskip.2\fontdimen6\font
  \hbox to.8\fontdimen6\font{--\hss--}%
  \hskip.2\fontdimen6\font
  \ignorespaces}
%    \end{macrocode}
%
%    The russian hyphenation patterns can be used with |\lefthyphenmin|
%    and |\righthyphenmin| set to~2.
% \changes{russianb-1.1a}{1995/07/04}{use \cs{russianhyphenmins} to
%    store the correct values}
%    \begin{macrocode}
\def\russianhyphenmins{\tw@\tw@}
%    \end{macrocode}
%
%    Now the thing |\extrasrussian| needs to do is to make
%    sure that |\frenchspacing| is in effect.
%    If this is not the case the execution of |\noextrasrussian|
%    will switch it off again.
%    \begin{macrocode}
\addto\extrasrussian{\bbl@frenchspacing}
\addto\noextrasrussian{\bbl@nonfrenchspacing}
%    \end{macrocode}
% \end{macro}
%
%    Now we add a new enumeration style for Russian manuscripts with
%    Cyrillic letters and later on we define some math operatornames
%    in accordance with Russian typesetting traditions. 
%
%  \begin{macro}{\Asbuk}
%    We begin by defining |\Asbuk| which functions like |\Alph|, but
%    produces (uppercase) cyrillic letters intead of latin ones.
%    \begin{macrocode}
\def\Asbuk#1{\expandafter\@Asbuk\csname c@#1\endcsname}
\def\@Asbuk#1{\ifcase#1\or
  \CYRA\or \CYRB\or \CYRV\or \CYRG\or \CYRD\or \CYRE\or \CYRZH\or
  \CYRZ\or \CYRI\or \CYRK\or \CYRL\or \CYRM\or \CYRN\or \CYRO\or
  \CYRP\or \CYRR\or \CYRS\or \CYRT\or \CYRU\or \CYRF\or \CYRH\or
  \CYRC\or \CYRCH\or \CYRSH\or \CYRSHCH\or \CYRErev\or \CYRYU\or
  \CYRYA\else\@ctrerr\fi}%
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\asbuk}
%    The macro |\asbuk| is similar to |\alph|, it produces lowercase
%    Russian letters. 
%    \begin{macrocode}
\def\asbuk#1{\expandafter\@asbuk\csname c@#1\endcsname}
\def\@asbuk#1{\ifcase#1\or
  \CYRa\or \CYRb\or \CYRv\or \CYRg\or \CYRd\or \CYRe\or \CYRzh\or
  \CYRz\or \CYRi\or \CYRk\or \CYRl\or \CYRm\or \CYRn\or \CYRo\or
  \CYRp\or \CYRr\or \CYRs\or \CYRt\or \CYRu\or \CYRf\or \CYRh\or
  \CYRc\or \CYRch\or \CYRsh\or \CYRshch\or \CYRerev\or \CYRyu\or
  \CYRya\else\@ctrerr\fi}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\mathrussian}
%    Some math functions in Russian math books have other names:
%    e.g. |sinh| in Russian is written as |sh| etc. So we define a
%    number of new math operators.
%    \begin{macrocode}
\def\sh{\mathop{\operator@font sh}\nolimits} % same as \sinh
\def\ch{\mathop{\operator@font ch}\nolimits} % same as \cosh
\def\tg{\mathop{\operator@font tg}\nolimits} % same as \tan
\def\arctg{\mathop{\operator@font arctg}\nolimits} % same as \arctan
\def\arcctg{\mathop{\operator@font arcctg}\nolimits} %
\def\th{\mathop{\operator@font th}\nolimits} % same as \tanh
\def\ctg{\mathop{\operator@font ctg}\nolimits} % same as \cot
\def\cth{\mathop{\operator@font cth}\nolimits} % same as \coth
\def\cosec{\mathop{\operator@font cosec}\nolimits} % same as \csc
\def\Prob{\mathop{\hbox{\sfshape P}}\nolimits}
\def\nod{\mathop{\operator@font \CYRn.\CYRo.\CYRd.}\nolimits}
\def\nok{\mathop{\operator@font \CYRn.\CYRo.\CYRk.}\nolimits}
\def\Variance{\mathop{\hbox{\sfshape D}}\nolimits}
%    \end{macrocode}
%  \end{macro}
%
%    The macro |\ldf@finish| takes care of looking for a
%    configuration file, setting the main language to be switched on
%    at |\begin{document}| and resetting the category code of
%    \texttt{@} to its original value.
% \changes{russianb-1.1d}{1996/11/03}{Now use \cs{ldf@finish} to wrap
%    up} 
%    \begin{macrocode}
\ldf@finish{russian}
%</code>
%    \end{macrocode}
%
% \Finale
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\endinput
