% ===============================================================
% Русификация ТеХа для пакета листочков
% ===============================================================
\ProvidesPackage{russ}[2008/02/27  Russian language]
\RequirePackage[cp1251]{inputenc}



% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================
% russlh    Начало: нужен для включения русского языка
% ===============================================================
\language\l@russian
\lefthyphenmin=2
\righthyphenmin=2

\input {t2aenc.def}
\renewcommand{\encodingdefault}{T2A}
\fontencoding{T2A}\normalsize

% From ltfinal.dtx
\def\reserved@a#1#2{%
   \@tempcnta#1\relax
   \@tempcntb#2\relax
   \reserved@b
}
\def\reserved@b{%
   \ifnum\@tempcnta>\@tempcntb\else
      \reserved@c\@tempcnta
      \advance\@tempcnta\@ne
      \expandafter\reserved@b
   \fi
}
\def\reserved@c#1{\catcode#1=11\relax}
% End from ltfinal.dtx
\reserved@a{192}{223} % А-Я
\reserved@a{224}{255} % а-я
\catcode156=11 % Ё
\catcode188=11 % ё

\providecommand{\glqq}{\quotedblbase}
\providecommand{\grqq}{\textquotedblleft}
\providecommand{\flqq}{\guillemotleft}
\providecommand{\frqq}{\guillemotright}
\providecommand{\No}{\textnumero}

% ===============================================================
% russlh        Конец
% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================












% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================
% mathlh.sty   Начало    Позволяет писать русские команды
% ===============================================================
%% \DeclareSymbolFont{roperators}      {T2A}{\rmdefault} {m}{n}
%% \SetSymbolFont    {roperators}{bold}{T2A}{\rmdefault} {b}{n}

\DeclareSymbolFont{rletters}        {T2A}{\rmdefault}{m}{it}
\SetSymbolFont    {rletters}{bold}  {T2A}{\rmdefault}{b}{it}

\expandafter\def\csname T2A-cmd\endcsname#1{%
    \ifx\protect\@typeset@protect\else\noexpand#1\expandafter\@gobble\fi%
    }
\DeclareMathSymbol{^^c0}{\mathalpha}{rletters}{"C0} %% А
\DeclareMathSymbol{^^c1}{\mathalpha}{rletters}{"C1} %% Б
\DeclareMathSymbol{^^c2}{\mathalpha}{rletters}{"C2} %% В
\DeclareMathSymbol{^^c3}{\mathalpha}{rletters}{"C3} %% Г
\DeclareMathSymbol{^^c4}{\mathalpha}{rletters}{"C4} %% Д
\DeclareMathSymbol{^^c5}{\mathalpha}{rletters}{"C5} %% Е
\DeclareMathSymbol{^^c6}{\mathalpha}{rletters}{"C6} %% Ж
\DeclareMathSymbol{^^c7}{\mathalpha}{rletters}{"C7} %% З
\DeclareMathSymbol{^^c8}{\mathalpha}{rletters}{"C8} %% И
\DeclareMathSymbol{^^c9}{\mathalpha}{rletters}{"C9} %% Й
\DeclareMathSymbol{^^ca}{\mathalpha}{rletters}{"CA} %% К
\DeclareMathSymbol{^^cb}{\mathalpha}{rletters}{"CB} %% Л
\DeclareMathSymbol{^^cc}{\mathalpha}{rletters}{"CC} %% М
\DeclareMathSymbol{^^cd}{\mathalpha}{rletters}{"CD} %% Н
\DeclareMathSymbol{^^ce}{\mathalpha}{rletters}{"CE} %% О
\DeclareMathSymbol{^^cf}{\mathalpha}{rletters}{"CF} %% П
\DeclareMathSymbol{^^d0}{\mathalpha}{rletters}{"D0} %% Р
\DeclareMathSymbol{^^d1}{\mathalpha}{rletters}{"D1} %% С
\DeclareMathSymbol{^^d2}{\mathalpha}{rletters}{"D2} %% Т
\DeclareMathSymbol{^^d3}{\mathalpha}{rletters}{"D3} %% У
\DeclareMathSymbol{^^d4}{\mathalpha}{rletters}{"D4} %% Ф
\DeclareMathSymbol{^^d5}{\mathalpha}{rletters}{"D5} %% Х
\DeclareMathSymbol{^^d6}{\mathalpha}{rletters}{"D6} %% Ц
\DeclareMathSymbol{^^d7}{\mathalpha}{rletters}{"D7} %% Ч
\DeclareMathSymbol{^^d8}{\mathalpha}{rletters}{"D8} %% Ш
\DeclareMathSymbol{^^d9}{\mathalpha}{rletters}{"D9} %% Щ
\DeclareMathSymbol{^^da}{\mathalpha}{rletters}{"DA} %% Ъ
\DeclareMathSymbol{^^db}{\mathalpha}{rletters}{"DB} %% Ы
\DeclareMathSymbol{^^dc}{\mathalpha}{rletters}{"DC} %% Ь
\DeclareMathSymbol{^^dd}{\mathalpha}{rletters}{"DD} %% Э
\DeclareMathSymbol{^^de}{\mathalpha}{rletters}{"DE} %% Ю
\DeclareMathSymbol{^^df}{\mathalpha}{rletters}{"DF} %% Я

\DeclareMathSymbol{^^e0}{\mathalpha}{rletters}{"E0} %% а
\DeclareMathSymbol{^^e1}{\mathalpha}{rletters}{"E1} %% б
\DeclareMathSymbol{^^e2}{\mathalpha}{rletters}{"E2} %% в
\DeclareMathSymbol{^^e3}{\mathalpha}{rletters}{"E3} %% г
\DeclareMathSymbol{^^e4}{\mathalpha}{rletters}{"E4} %% д
\DeclareMathSymbol{^^e5}{\mathalpha}{rletters}{"E5} %% е
\DeclareMathSymbol{^^e6}{\mathalpha}{rletters}{"E6} %% ж
\DeclareMathSymbol{^^e7}{\mathalpha}{rletters}{"E7} %% з
\DeclareMathSymbol{^^e8}{\mathalpha}{rletters}{"E8} %% и
\DeclareMathSymbol{^^e9}{\mathalpha}{rletters}{"E9} %% й
\DeclareMathSymbol{^^ea}{\mathalpha}{rletters}{"EA} %% к
\DeclareMathSymbol{^^eb}{\mathalpha}{rletters}{"EB} %% л
\DeclareMathSymbol{^^ec}{\mathalpha}{rletters}{"EC} %% м
\DeclareMathSymbol{^^ed}{\mathalpha}{rletters}{"ED} %% н
\DeclareMathSymbol{^^ee}{\mathalpha}{rletters}{"EE} %% о
\DeclareMathSymbol{^^ef}{\mathalpha}{rletters}{"EF} %% п
\DeclareMathSymbol{^^f0}{\mathalpha}{rletters}{"F0} %% р
\DeclareMathSymbol{^^f1}{\mathalpha}{rletters}{"F1} %% с
\DeclareMathSymbol{^^f2}{\mathalpha}{rletters}{"F2} %% т
\DeclareMathSymbol{^^f3}{\mathalpha}{rletters}{"F3} %% у
\DeclareMathSymbol{^^f4}{\mathalpha}{rletters}{"F4} %% ф
\DeclareMathSymbol{^^f5}{\mathalpha}{rletters}{"F5} %% х
\DeclareMathSymbol{^^f6}{\mathalpha}{rletters}{"F6} %% ц
\DeclareMathSymbol{^^f7}{\mathalpha}{rletters}{"F7} %% ч
\DeclareMathSymbol{^^f8}{\mathalpha}{rletters}{"F8} %% ш
\DeclareMathSymbol{^^f9}{\mathalpha}{rletters}{"F9} %% щ
\DeclareMathSymbol{^^fa}{\mathalpha}{rletters}{"FA} %% ъ
\DeclareMathSymbol{^^fb}{\mathalpha}{rletters}{"FB} %% ы
\DeclareMathSymbol{^^fc}{\mathalpha}{rletters}{"FC} %% ь
\DeclareMathSymbol{^^fd}{\mathalpha}{rletters}{"FD} %% э
\DeclareMathSymbol{^^fe}{\mathalpha}{rletters}{"FE} %% ю
\DeclareMathSymbol{^^ff}{\mathalpha}{rletters}{"FF} %% я

\DeclareMathSymbol{^^9c}{\mathalpha}{rletters}{"9C} %% Ё
\DeclareMathSymbol{^^bc}{\mathalpha}{rletters}{"BC} %% ё

\SetMathAlphabet{\mathrm}{normal}{T2A}{\rmdefault}{m}{n}
\SetMathAlphabet{\mathrm}{bold}  {T2A}{\rmdefault}{b}{n}
\SetMathAlphabet{\mathit}{normal}{T2A}{\rmdefault}{m}{it}
\SetMathAlphabet{\mathit}{bold}  {T2A}{\rmdefault}{b}{it}
\SetMathAlphabet{\mathbf}{normal}{T2A}{\rmdefault}{b}{n}
\SetMathAlphabet{\mathbf}{bold}  {T2A}{\rmdefault}{b}{n}
% ===============================================================
% mathlh.sty   Конец
% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================









% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================
% russcorr      Начало         Приводим оформление к нашему стилю
% ===============================================================
%%% Style options
%%%
\newif\if@longtoc
\DeclareOption{longtoc}{\@longtoctrue}
\DeclareOption{shorttoc}{\@longtocfalse}
\newif\if@indentheadings
\DeclareOption{indentheadings}{\@indentheadingstrue}
\DeclareOption{noindentheadings}{\@indentheadingsfalse}
\newif\if@textyо
\DeclareOption{yo}{\@textyоtrue}
\DeclareOption{noyo}{\@textyоfalse}
\ExecuteOptions{shorttoc,noindentheadings,noyo}
\ProcessOptions


\message{^^J Correcting math definitions,}
\def\tg{\mathop{\operator@font tg}\nolimits}
\def\ctg{\mathop{\operator@font ctg}\nolimits}
\def\cosec{\mathop{\operator@font cosec}\nolimits}
\def\arctg{\mathop{\operator@font arctg}\nolimits}
\def\arcctg{\mathop{\operator@font arcctg}\nolimits}
\def\sh{\mathop{\operator@font sh}\nolimits}
\def\ch{\mathop{\operator@font ch}\nolimits}
\def\th{\mathop{\operator@font th}\nolimits}
\def\cth{\mathop{\operator@font cth}\nolimits}

\DeclareSymbolFont{AMSa}{U}{msa}{m}{n} \DeclareSymbolFont{AMSb}{U}{msb}{m}{n}
\DeclareMathSymbol{\varkappa}{\mathord}{AMSb}{"7B}
\DeclareMathSymbol{\leqslant}{\mathrel}{AMSa}{"36}
\DeclareMathSymbol{\geqslant}{\mathrel}{AMSa}{"3E}

\message{heading names,}
\def\contentsname{Оглавление}
\def\figurename{Рис.}
\def\partname{Часть}
\def\listfigurename{Список рисунков}
\def\listtablename{Список таблиц}
\def\refname{Литература}
\def\bibname{Литература}
\def\indexname{Предметный указатель}
\def\tablename{Таблица}
\def\abstractname{Аннотация}
\@ifundefined{chapter}{}{\def\chaptername{Глава}}
\def\proofname{Доказательство}
%%
\message{counters,}
\def\ralph#1{\@ralph{\@nameuse {c@#1}}}
\def\@ralph#1{\ifcase #1\or а\or б\or в\or г\or д\or е\or ж\or з\or
и\else\@iralph{#1}\fi
}
\def\@iralph#1{\ifcase #1\or\or\or\or\or\or\or\or\or\or
     к\or л\or м\or н\or о\or п\or р\or с\or т\or у\or
     ф\or х\or ц\or ч\or ш\or щ\or э\or ю\or я\else\@ctrerr
     \fi}
\def\Ralph#1{\@Ralph{\@nameuse {c@#1}}}
\def\@Ralph#1{\ifcase #1%
     \or А\or Б\or В\or Г\or Д\or Е\or Ж\or З\or
     И\else\@iRalph{#1}\fi}
\def\@iRalph#1{\ifcase #1%
     \or\or\or\or\or\or\or\or\or\or К\or Л\or М\or
     Н\or О\or П\or Р\or С\or Т\or У\or Ф\or Х\or Ц\or
     Ч\or Ш\or Щ\or Э\or Ю\or Я\else\@ctrerr
     \fi}
\newcommand*{\ipunct}[1]{\@ipunct{\@nameuse{c@#1}}}
\newcommand*{\@ipunct}[1]%
  {\ifcase #1\or (\it i\/)\or (\it ii\/)\or (\it iii\/)\or (\it iv\/)\or (\it v\/)\or %
  (\it vi\/)\or (\it vii\/)\or (\it viii\/)\or (\it ix\/)\or (\it x\/)\or (\it xi\/)\or (\it xii\/)\or %
  (\it xiii\/)\or (\it xiv\/)\or (\it xv\/)\or (\it xvi\/)\or (\it xvii\/)\or (\it xviii\/)%
  \or (\it xix\/)\or (\it xx\/) \else\@ctrerr \fi}



\message{lists,}
% Теперь "русифицируем" окружение enumerate:
\def\labelenumi{\theenumi.}
\def\theenumii{\ralph{enumii}}
\def\labelenumii{\theenumii.}
\def\p@enumii{\theenumi}
\def\labelenumiii{{\bf--}}
\let\theenumiii\relax
\def\p@enumiii{\theenumi\theenumii}
%
% И еще запретим вкладывать четыре enumerate друг в друга ...
%
\def\enumerate{\ifnum \@enumdepth >2% было 3, а не 2
\@toodeep\else
      \advance\@enumdepth \@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
      {\csname label\@enumctr\endcsname}{\usecounter
        {\@enumctr}\def\makelabel##1{\hss\llap{##1}}}\fi}
%
% Теперь определим окружение rlist
% для создания списков, в которых
% \item'ы нумеруются русскими буквами
% (строчными для rlist, прописными для rlist[u])
%
\@definecounter{rlistctr}
\newif\if@rlistsnested\@rlistsnestedfalse
\def\rlist{\@ifnextchar[{\@rlist}{\@rlist[l]}}
\def\@rlist[#1]{\if u#1\def\@tempa{R}\else\def\@tempa{r}\fi
                \if@rlistsnested\@toodeep\else
                \@rlistsnestedtrue
                \edef\therlistctr{\expandafter\noexpand\csname
                                @\@tempa alph\endcsname\noexpand\c@rlistctr}%
                \list{\labelrlist}{\usecounter
                   {rlistctr}}\fi}
\let\endrlist\endlist
\def\labelrlist{\therlistctr)}


\message{headings,}
\def\@seccntformat#1{\csname pre#1\endcsname\csname the#1\endcsname
                \csname post#1\endcsname}
\let\@Tocseccntformat\@seccntformat
\def\@postskip@{\hskip.5em\relax}

\def\postsection{.\@postskip@}
\def\postsubsection{.\@postskip@}
\def\postsubsubsection{.\@postskip@}
\def\postparagraph{.\@postskip@}
\def\postsubparagraph{.\@postskip@}

\def\presection{}
\def\presubsection{}
\def\presubsubsection{}
\def\preparagraph{}
\def\presubparagraph{}
%%% Unfortunately, \@seccntformat is not reflected in toc.
%%% Hence, I had to hack up the definition of \@sect a little.
\def\@sect#1#2#3#4#5#6[#7]#8{%
  \ifnum #2>\c@secnumdepth
    \let\@svsec\@empty
  \else
    \refstepcounter{#1}%
    \protected@edef\@svsec{\@seccntformat{#1}\relax}%
  \fi
  \@tempskipa #5\relax
  \ifdim \@tempskipa>\z@
    \begingroup
      #6{%
        \@hangfrom{\hskip #3\relax\@svsec}%
          \interlinepenalty \@M #8\@@par}%
    \endgroup
    \csname #1mark\endcsname{#7}%
    \addcontentsline{toc}{#1}{%
      \ifnum #2>\c@secnumdepth \else
        \protect\numberline{\@Tocseccntformat{#1}}%
      \fi
      \if@longtoc#8\else#7\fi}%
  \else
    \def\@svsechd{%
      #6{\hskip #3\relax
      \@svsec #8}%
      \csname #1mark\endcsname{#7}%
      \addcontentsline{toc}{#1}{%
        \ifnum #2>\c@secnumdepth \else
          \protect\numberline{\@Tocseccntformat{#1}}%
        \fi
        \if@longtoc#8\else#7\fi}}%
  \fi
  \@xsect{#5}}


\if@indentheadings
\def\section{\@startsection {section}{1}{\parindent}%
                                   {3.5ex \@plus 1ex \@minus .2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\reset@font\Large\bfseries}}
\def\subsection{\@startsection{subsection}{2}{\parindent}%
                                     {3.25ex\@plus 1ex \@minus .2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\reset@font\large\bfseries}}
\def\subsubsection{\@startsection{subsubsection}{3}{\parindent}%
                                     {3.25ex\@plus 1ex \@minus .2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\reset@font\normalsize\bfseries}}
\fi


\def\@mainmattertrue{\let\if@mainmatter\iftrue}
\def\@mainmatterfalse{\let\if@mainmatter\iffalse}
\@ifclassloaded{report}{\@mainmattertrue}{}

\@ifundefined{chapter}{}{%
\def\postchapter{.}
\def\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{plain}%
                    \global\@topnum\z@
                    \if@indentheadings\@afterindenttrue
                        \else\@afterindentfalse
                    \fi
                    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter
                                         \postchapter}%
                        \if@longtoc#2\else#1\fi}%
                       \else
                         \addcontentsline{toc}{chapter}%
                       {\if@longtoc#2\else#1\fi}\fi
                    \else
                      \addcontentsline{toc}{chapter}{\if@longtoc#2\else#1\fi}
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
}% end of conditional
\@ifundefined{chapter}{}{%
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\reset@font \@tempdima\parindent \raggedright
%%%            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     \if@indentheadings\advance\leftskip\@tempdima\fi
%%%  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    \ifnum \c@secnumdepth >\m@ne
       \if@mainmatter
         \huge\bfseries \@chapapp{} \thechapter\postchapter
         \par\nobreak
         \vskip 20\p@
       \fi
       \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par
    \nobreak
    \vskip 40\p@
  }}%
\def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}%
                   \@afterheading
                 \fi}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\reset@font \@tempdima\parindent \raggedright
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     \if@indentheadings\advance\leftskip\@tempdima\fi
%%^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \nobreak
    \vskip 40\p@
  }}
}% end of conditional


\message{captions,}
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#1. #2}%
  \ifdim \wd\@tempboxa >\hsize
    \unhbox\@tempboxa\par
  \else
    \global \@minipagefalse
    \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

\long\def\@caption#1[#2]#3{\par\addcontentsline{\csname
  ext@#1\endcsname}{#1}{\protect\numberline{\csname
  the#1\endcsname.}{\ignorespaces #2}}\begingroup
    \@parboxrestore
    \normalsize
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
  \endgroup}

\message{theorems,}
\def\afterthmseparator{.}
\expandafter\ifx\csname theoremstyle\endcsname\relax
  \def\@begintheorem#1#2{\trivlist
     \item[\hskip \labelsep{\bfseries #1\ #2\unskip\afterthmseparator
  }]\itshape}
  \def\@opargbegintheorem#1#2#3{\trivlist
        \item[\hskip \labelsep{\bfseries #1\ #2\ (#3)\afterthmseparator
  }]\itshape}
\fi
\message{running heads,}
\def\@ArticleHeadingsCorr{%
  \if@twoside
   \def\ps@headings{\let\@mkboth\markboth
   \let\@oddfoot\@empty\let\@evenfoot\@empty
   \def\@evenhead{\thepage\hfil\slshape\leftmark}%
   \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \def\sectionmark####1{\markboth {\uppercase{\ifnum \c@secnumdepth >\z@
      \thesection\postsection \hskip 1em\relax \fi ####1}}{}}%
    \def\subsectionmark####1{\markright {\ifnum \c@secnumdepth >\@ne
            \thesubsection\postsubsection \hskip 1em\relax \fi ####1}}}
  \else
   \def\ps@headings{\let\@mkboth\markboth
    \let\@oddfoot\@empty
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \def\sectionmark####1{\markright {\uppercase{\ifnum \c@secnumdepth >\z@
      \thesection\postsection \hskip 1em\relax \fi ####1}}}}
  \fi
}
\def\@ReportHeadingsCorr{%
  \if@twoside
    \def\ps@headings{\let\@mkboth\markboth
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\thepage\hfil\slshape\leftmark}%
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \def\chaptermark####1{\markboth{\uppercase{\ifnum\c@secnumdepth>\m@ne
         \@chapapp\ \thechapter.\fi ####1}}{}}%
    \def\sectionmark####1{\markright{\uppercase{\ifnum\c@secnumdepth>\z@
      \thesection. \fi ####1}}}}
  \else
    \def\ps@headings{\let\@mkboth\markboth
    \let\@oddfoot\@empty
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \def\chaptermark####1{\markright{\uppercase{\ifnum\c@secnumdepth>\m@ne
      \@chapapp\ \thechapter. \fi ####1}}}}
  \fi
}
\def\@BookHeadingsCorr{%
\def\ps@headings{\let\@mkboth\markboth
 \let\@oddfoot\@empty\let\@evenfoot\@empty
 \def\@evenhead{\thepage\hfil\slshape\leftmark}%
 \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
      \def\chaptermark####1{%
        \markboth {\uppercase{\ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
            \@chapapp\ \thechapter. \fi
            ####1}}{}}%
 \def\sectionmark####1{\markright {\uppercase{\ifnum \c@secnumdepth >\z@
   \thesection. \fi ####1}}}}
}
\@ifclassloaded{article}{\@ArticleHeadingsCorr}{}
\@ifclassloaded{report}{\@ReportHeadingsCorr}{}
\@ifclassloaded{book}{\@BookHeadingsCorr}{}
%% \if A\@mainstyle % стиль - article (вставлено ".\@aftersepkern" после номера)
%%   \@ArticleHeadingsCorr
%% \else\if R\@mainstyle % стиль=report. Два пробела после точки заменены на один.
%%   \@ReportHeadingsCorr
%% \else % стиль=book (два пробела после точки заменены на один)
%%   \@BookHeadingsCorr
%% \fi\fi
%

\message{appendix,}
%% \if A\@mainstyle
\@ifclassloaded{article}{%
  \def\appendix{\par
    \setcounter{section}{0}%
    \setcounter{subsection}{0}%
    \let\sectionname\appendixname
    \def\thesection{\@Ralph\c@section}}
}{%
\def\appendix{\par
   \setcounter{chapter}{0}%
   \setcounter{section}{0}%
   \def\@chapapp{\appendixname}%
   \def\thechapter{\@Ralph\c@chapter}}
}

\message{\string\cleardoublepage,}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
   {\null\ps@empty % добавил \ps@empty (и заодно заменил \hbox{} на \null )
\newpage}\if@twocolumn{\null\ps@empty\newpage}\fi\fi\fi} % ditto

\message{quotes,}
% !!!! Отсюда и до второго вхождения !!!! все сперто из german.sty
\def\@allowhyphens{\penalty\@M\hskip\z@skip}
\def\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}\dimen\z@\ht\z@
     \advance\dimen\z@ -\ht\tw@
     \setbox\z@\hbox{\lower\dimen\z@ \box\z@}\ht\z@\ht\tw@ \dp\z@\dp\tw@ }
%    (this lowers the german left quotes to the same level as the comma.)
\def\@glqq{{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi \leavevmode
     \set@low@box{''}\box\z@\kern-.04em\@allowhyphens\@SF\relax}}
\def\glqq{\protect\@glqq}
\def\@grqq{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi \kern-.07em``\kern.07em\@SF\relax}
\def\grqq{\protect\@grqq}
\def\@glq{{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi \leavevmode
     \set@low@box{'}\box\z@\kern-.04em\@allowhyphens\@SF\relax}}
\def\glq{\protect\@glq}
\def\@grq{\kern-.07em`\kern.07em}
\def\grq{\protect\@grq}
% !!!!

% \сегодня is the Russian counterpart of \today;
% we prefer to keep the original \today intact
\def\сегодня{\number\day\space
                \ifcase\month\or
                 января\or февраля\or марта\or апреля\or мая\or
                 июня\or июля\or августа\or сентября\or октября\or
                 ноября\or декабря\fi\space\number\year}


\frenchspacing
\righthyphenmin 2

\if@textyо
   \message{the letter `yo',}
   \def\@textyе{е}
   \def\@textyЕ{Е}
   \DeclareRobustCommand{\"}[1]{%
    {\edef\@tempa{#1}%
     \ifx\@tempa\@textyе \char 163\relax
       \else \ifx\@tempa\@textyЕ \char 176\relax
         \else \accent "7F #1\fi\fi
    }%
   }
\fi


%% What follows is intended to ensure compatibility with
%% an earlier version of Russification of LaTeX 2.09,
%% where a possibility to automatically count the total number of
%% pages in the document was supported.
\let\c@totalpages=\@tempcnta
\let\@@global\global

\message{... finished.}

\AtBeginDocument{\ifdim\hsize<\@cclv\p@\pretolerance\m@ne\fi}

% ===============================================================
% russcorr      Конец
% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================
















% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================
% russadd        Начало
% ===============================================================
% ------------------ команды типа \те (т.е.) --------------------

% Набирайте "т.е." командой \те . Остальное -- аналогично.
% Теперь можно не беспокоиться о пробелах после этих команд.
% Например, можно наравне с
%     ..., \те\ ...
%     ..., \те{} ...
% писать просто
%     ..., \те ...
%

\newcommand*{\те}{т.\,е.\xspace}
\newcommand*{\Те}{Т.\,е.\xspace}
\newcommand*{\тк}{т.\,к.\xspace}
\newcommand*{\Тк}{Т.\,к.\xspace}
\newcommand*{\итд}{и~т.\,д.\xspace}
\newcommand*{\итп}{и~т.\,п.\xspace}
\newcommand{\лк}{\guillemotleft\nobreak\ignorespaces}
\newcommand{\пк}{\guillemotright\xspace}

%

% ------------------ команды типа \т (тире) ---------------------
% Команда \клей позволяет приклеивать слова к формуле или ещё чему-нибудь.
% Например, "частицы\клей $+$\клей поле"
% Команды \д (\ч) и \Д (\ч) ставят дефисы (чёрточки), после которых
% разрывы строки запрещены и разрешены, соответственно.
% Итак,
%   \д ставит дефис, после которого разрыв строки ЗАПРЕЩЁН.
%         Напр., "$1$\д форма"
%   \Д ставит дефис, после которого разрыв строки РАЗРЕШЁН.
%         Напр., "Остроградского\ч Гаусса" (или тут нужно \Д ?)
% Для интересующихся: если написать "$1$-форма" или "Остроградского--Гаусса",
% то будет разрешено разрывать строчку после дефиса и запрещено переносить
% слова "форма", "Остроградского" и "Гаусса". По этой причине и появилась
% команда \клей.
%

\newcommand*{\клей}{\nobreak\hskip\z@skip}
\DeclareRobustCommand*{\д}{\клей\hbox{-}\клей}
\DeclareRobustCommand*{\Д}{\клей\hbox{-}\hskip\z@skip}
\DeclareRobustCommand*{\ч}{\,\textendash\,\клей}
\DeclareRobustCommand*{\ч}{\,\textendash\,\hskip\z@skip}
\DeclareRobustCommand*{\т}{~\textemdash{} }
\DeclareRobustCommand*{\Т}{~\textemdash{} }
% ===============================================================
% russadd        Конец
% ===============================================================
% ===============================================================
% ===============================================================
% ===============================================================





