%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Стилевой файл для трудов конференции УРС-2005
% (с) ИТЭС ОИВТ РАН, 2005
% Версия 1.0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}[1994/01/01]
\ProvidesClass{elbrus}[2005/19/12 v1.0 by P.R. Levashov]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions

%\LoadClass{article}
\LoadClass[a4paper]{article}
\usepackage{calc}
%\usepackage{amssymb}
\usepackage[cp1251]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{graphicx}
%\usepackage{array}
%\usepackage{caption2}
%\usepackage{vmargin}
%\setpapersize[portrait]{A4}
%\setmargins{2.5cm}{2cm}{165mm}{255.5mm}{0pt}{0mm}{0pt}{5mm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page style redifinitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setlength{\headheight}{0mm}
\setlength{\voffset}{-1in}
\setlength{\topmargin}{9.5mm}
\setlength{\headsep}{0mm}
\setlength{\textheight}{254.5mm}

\setlength{\hoffset}{-1in}
\setlength{\oddsidemargin}{25mm}
\setlength{\textwidth}{165mm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Bibliography redefinitions 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\tolerance=400

\renewcommand{\@biblabel}[1]{#1.\hfill}

\newcounter{tmp}

\renewenvironment{thebibliography}[1]%
{\begin{list}{\arabic{tmp}.}{%
\usecounter{tmp}%
\vspace{4pt}%
\setlength{\rightmargin}{0pt}%
\settowidth{\labelwidth}{\@biblabel{#1}}%
\settowidth{\labelsep}{\ \ }%
\setlength{\leftmargin}{\labelwidth+\labelsep}%
\setlength{\topsep}{50pt}%
\setlength{\parsep}{0pt}%
\setlength{\itemsep}{0pt}%
\item[]}}%
{\end{list}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Font redefinitions 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand{\normalsize}{%
   \@setfontsize\normalsize\@ixpt\@xpt
   \abovedisplayskip 9\p@ \@plus 2\p@ \@minus 4.5\p@
   \abovedisplayshortskip \z@ \@plus 3\p@
   \belowdisplayshortskip 5.5\p@ \@plus 2.5\p@ \@minus 3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI}
\normalsize
\renewcommand{\small}{%
    \@setfontsize\small\@viiipt{9.5}%
    \abovedisplayskip 6\p@ \@plus 2\p@ \@minus 4\p@
    \abovedisplayshortskip \z@ \@plus 2\p@
    \belowdisplayshortskip 4\p@ \@plus 2\p@ \@minus 2\p@
    \def\@listi{\leftmargin\leftmargini
                \topsep 2\p@ \@plus 2\p@ \@minus 2\p@
                \parsep 1\p@ \@plus\p@ \@minus\p@
                \itemsep \parsep
%%                \itemindent\z@
                }%
   \belowdisplayskip \abovedisplayskip
}
\renewcommand{\footnotesize}{%
    \@setfontsize\footnotesize\@viipt{8}%
    \abovedisplayskip 6\p@ \@plus 2\p@ \@minus 4\p@
    \abovedisplayshortskip \z@ \@plus 2\p@
    \belowdisplayshortskip 4\p@ \@plus 2\p@ \@minus 2\p@
    \def\@listi{\leftmargin\leftmargini
                \topsep 2\p@ \@plus 2\p@ \@minus 2\p@
                \parsep 1\p@ \@plus\p@ \@minus\p@
                \itemsep \parsep
%%                \itemindent\z@
               }%
   \belowdisplayskip \abovedisplayskip
}
\newcommand{\miniscule}{\@setfontsize\miniscule\@vpt{6}}
\renewcommand{\tiny}{\@setfontsize\tiny\@vpt{6}}
\renewcommand{\scriptsize}{\@setfontsize\scriptsize\@vipt{7}}
\renewcommand{\large}{\@setfontsize\large\@xpt{12}}
\renewcommand{\Large}{\@setfontsize\Large\@xipt{13.6}}
\renewcommand{\LARGE}{\@setfontsize\LARGE\@xiipt{14.5}}
\renewcommand{\huge}{\@setfontsize\huge\@xivpt{18}}
\renewcommand{\Huge}{\@setfontsize\Huge\@xviipt{22}}
\newcommand{\HUGE}{\@setfontsize\HUGE\@xxpt{25}}
\if@twocolumn
  \setlength\parindent{1em}
\else
  \setlength\parindent{12\p@}
\fi
\setlength\smallskipamount{3\p@ \@plus 1\p@ \@minus 1\p@}
\setlength\medskipamount{6\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\bigskipamount{12\p@ \@plus 4\p@ \@minus 4\p@}
\setlength\headheight{11\p@}
\setlength\headsep{.225in}
\setlength\topskip{9\p@}
\setlength\footskip{.33in}
\setlength\maxdepth{.5\topskip}
\setlength\@maxdepth\maxdepth
\setlength\footnotesep{6.0\p@}  %% ????????
\setlength{\skip\footins}{8\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\floatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
\setlength\intextsep   {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\dblfloatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
\setlength\@fptop{0\p@ \@plus 1fil}
\setlength\@fpsep{9\p@ \@plus 2fil}
\setlength\@fpbot{0\p@ \@plus 1fil}
\setlength\@dblfptop{0\p@ \@plus 1fil}
\setlength\@dblfpsep{7\p@ \@plus 2fil}
\setlength\@dblfpbot{0\p@ \@plus 1fil}
\if@twocolumn
  \setlength\marginparsep{10\p@}
\else
  \setlength\marginparsep{7\p@}
\fi
\setlength{\marginparpush}{5\p@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Special commands for \cite redefinition
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\edef\citenum{% to restore funny codes
  \catcode\string`\string ` \the\catcode\string`\`
  \catcode\string`\string ' \the\catcode\string`\'
  \catcode\string`\string = \the\catcode\string`\=
  \catcode\string`\string _ \the\catcode\string`\_
  \catcode\string`\string : \the\catcode\string`\:}
\catcode\string`\`12
\catcode`\'12
\catcode`\=12
\catcode`\_8
\catcode`\:12

%   Handle optional variations:  [verbose,nospace,space,nosort,noadjust],
%   \citeform,\citeleft,\citeright,\citemid,\citepunct,\citedash
%
%   Set defaults:

%   [ on the left.
\@ifundefined{citeleft}{\let\citeleft=[}{}

%   ] on the right:
\@ifundefined{citeright}{\let\citeright=]}{}

%   , (comma space) before note
\@ifundefined{citemid}{\def\citemid{,\penalty\@medpenalty\ }}{}

%   , (comma thin-space) between entries; [nospace] eliminates the space
\@ifundefined{citepunct}{
   \def\citepunct{,\penalty\@m\hskip.13emplus.1emminus.1em}%
 }{}

%   -- (endash) designating range of numbers:
% (using \hbox avoids easy \exhyphenpenalty breaks)
\@ifundefined{citedash}{\def\citedash{\hbox{--}\penalty\@m }}{}

%   Each number left as-is:
\@ifundefined{citeform}{\def\citeform{}}{}

%   Do not repeat warnings.  [verbose] reverses
\let\oc@verbo\relax

\@ifundefined{DeclareOption}{}%
{ \toks@={\def\oc@verbo#1#2#3#4{}}
  \DeclareOption{verbose}{\the\toks@}
  \DeclareOption{nospace}{\def\citepunct{,\penalty\@m}}
  \DeclareOption{space}{\def\citepunct{,\penalty\@highpenalty\ }}
  \DeclareOption{nosort}{\def\@addto@cite@list
   {\edef\@cite@list{\@cite@list \@celt{\@B@citeB}}}}
  \DeclareOption{sort}{\let\@cite@list\relax}% default!
  \DeclareOption{noadjust}{\let\cite@adjust\@empty}% Don't change spaces
  \DeclareOption{adjust}{\let\cite@adjust\relax}% adjust space before [ ]
%  \ProvidesPackage{cite}[2001/10/14 \space  v 3.9]
  \ProcessOptions }

%----------------------
% \citen uses \@nocite to ignore spaces after commas, and write the aux file
% \citation. \citen then loops over the citation tags, using \@make@cite@list
% to make a sorted list of numbers.  Finally, \citen executes \@citelist to
% compress ranges of numbers and print the list. \citen can be used by itself
% to give citation numbers without the brackets and other formatting; e.g.,
% "See also ref.~\citen{junk}."
%
\edef\citen{\noexpand\protect \expandafter\noexpand\csname citen \endcsname}

\@namedef{citen }#1{%
\begingroup
\let\@safe@activesfalse\@empty
\@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg
\@tempcntb\m@ne    % \@tempcntb tracks highest number
\let\@h@ld\relax   % nothing held from list yet
\let\@citea\@empty % no punctuation preceding first
\let\@celt\delimiter % an unexpandable, but identifiable, token
\def\@cite@list{}% % empty list to start
\@for \@citeb:=\@no@sparg\do{\@make@cite@list}% make a sorted list of numbers
% After sorted citelist is made, execute it to compress citation ranges.
\@tempcnta\m@ne    % no previous number
\let\@celt\@compress@cite \@cite@list % output number list with compression
\@h@ld % output anything held over
\endgroup}

% For each citation, check if it is defined and if it is a number.
% if a number: insert it in the sorted \@cite@list
% otherwise: output it immediately.
%
\def\@make@cite@list{%
 \expandafter\let \expandafter\@B@citeB
          \csname b@\@citeb\@extra@b@citeb \endcsname
 \ifx\@B@citeB\relax % undefined: output ? and warning
    \@citea {\bf{?}}\let\@citea\citepunct \G@refundefinedtrue
    \@warning {Citation `\@citeb' on page \thepage\space undefined}%
    \oc@verbo \global\@namedef{b@\@citeb\@extra@b@citeb}{?}%
 \else %  defined               % remove previous line to repeat warnings
    \ifcat _\ifnum\z@<0\@B@citeB _\else A\fi % a positive number, put in list
       \@addto@cite@list
    \else % citation is not a number, output immediately
       \@citea \citeform{\@B@citeB}%
       \let\@citea\citepunct
 \fi\fi}

% Regular definition for adding entry to cite list, with sorting

\@ifundefined{@addto@cite@list}{% sort option either declared or defaulted
  \def\@addto@cite@list{\@tempcnta\@B@citeB \relax
     \ifnum \@tempcnta>\@tempcntb % new highest, add to end (efficiently)
        \edef\@cite@list{\@cite@list \@celt{\@B@citeB}}%
        \@tempcntb\@tempcnta
     \else % arbitrary number: insert appropriately
        \edef\@cite@list{\expandafter\@sort@celt \@cite@list \@gobble @}%
     \fi}
%
% \@sort@celt inserts number (\@tempcnta) into list of \@celt{num} (#1{#2})
% \@celt must not be expandable; list should end with two vanishing tokens.
%
  \def\@sort@celt#1#2{\ifx \@celt #1% parameters are \@celt {num}
       \ifnum #2<\@tempcnta % number goes later in list
          \@celt{#2}%
          \expandafter\expandafter\expandafter\@sort@celt % continue
       \else % number goes here
          \@celt{\number\@tempcnta}\@celt{#2}% stop comparing
    \fi\fi}
}% end sort option definitions
{}% nosort definition is done in options processing

% Check if each number follows previous and can be put in a range
%
\def\@compress@cite#1{%  % This is executed for each number
  \advance\@tempcnta\@ne % Now \@tempcnta is one more than the previous number
  \ifnum #1=\@tempcnta   % Number follows previous--hold on to it
     \ifx\@h@ld\relax    % first pair of successives
        \edef\@h@ld{\@citea \noexpand\citeform{#1}}%
     \else               % compressible list of successives
        \def\@h@ld{\citedash \citeform{#1}}%
     \fi
  \else   %  non-successor -- dump what's held and do this one
     \@h@ld \@citea \citeform{#1}\let\@h@ld\relax
  \fi \@tempcnta#1\let\@citea\citepunct
}

\edef\cite{\noexpand\protect\expandafter\noexpand\csname cite \endcsname}

\@namedef{cite }{\@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}

%  Make \@citex refer to \citen:
%
\def\@citex[#1]#2{\@cite{\citen{#2}}{#1}}%

%  Replacement for \@cite which defines the formatting normally done
%  around the citation list.  Minor changes can
%  be done by changing \citeleft, \citemid, and \citeright; but in other
%  cases it might be necessary to redefine the whole macro.
%
\def\@cite#1#2{\leavevmode \cite@adjust
  \citeleft{#1\if@tempswa \citemid #2\fi
  \spacefactor\@m % punctuation in note doesn't affect outside
  }\citeright}

%  Put a penalty before the citation, and adjust the spacing: if no space
%  already or if there is extra space due to some punctuation, then change
%  to one inter-word space.
%
\@ifundefined{cite@adjust}{\def\cite@adjust{%
  \@tempskipa\lastskip \edef\@tempa{\the\@tempskipa}\unskip
  \ifnum\lastpenalty=\z@ \penalty\@highpenalty \fi
  \ifx\@tempa\@zero@skip \spacefactor1001 \fi % if no space before, set flag
  \ifnum\spacefactor>\@m \ \else \hskip\@tempskipa \fi}}{}

\edef\@zero@skip{\the\z@skip}

% \nocite: This is changed to ignore *ALL* spaces and be robust.  The
% parameter list, with spaces removed, is `returned' in \@no@sparg, which
% is used by \citen.
%
\edef\nocite{\noexpand\protect\expandafter\noexpand\csname nocite \endcsname}

\@namedef{nocite }#1{\@bsphack \@nocite{#1}%
 \@for \@citeb:=\@no@sparg\do{\@ifundefined{b@\@citeb\@extra@b@citeb}%
    {\G@refundefinedtrue\@warning{Citation `\@citeb' undefined}%
    \oc@verbo \global\@namedef{b@\@citeb\@extra@b@citeb}{?}}{}}%
 \@esphack}

\def\@nocite#1{\begingroup\let\protect\string% normalize active chars
      \xdef\@no@sparg{\expandafter\@ignsp#1 \: }\endgroup% and remove *ALL* spaces
 \if@filesw \immediate\write\@auxout {\string\citation {\@no@sparg}}\fi}

% for ignoring *ALL* spaces in the input.  This presumes there are no
% \outer tokens and no \if-\fi constructs in the parameter.  Spaces inside
% braces are retained.
%
\def\@ignsp#1 {\ifx\:#1\@empty\else #1\expandafter\@ignsp\fi}

\let\nocitecount\relax  % in case \nocitecount was used for drftcite

\@ifundefined{@extra@b@citeb}{\def\@extra@b@citeb{}}{}
%  in case no fancy bib package (chapterbib) defines this

\@ifundefined{G@refundefinedtrue}{\let\G@refundefinedtrue\relax}{}

\@ifundefined{bbl@cite@choice}{}{\@ifundefined{org@@citex}{}%
  {\let\org@@citex\@citex}}% Prevent stomping by babel

\citenum % execute restore-catcodes

% Aliases:
\let\citenum\citen
\let\citeonline\citen


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definitions for floatflt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcounter{OptionTest}
\setcounter{OptionTest}{0}
\DeclareOption{rflt}{\setcounter{OptionTest}{1}}
\DeclareOption{lflt}{\setcounter{OptionTest}{2}}
\DeclareOption{vflt}{\setcounter{OptionTest}{0}}
\DeclareOption*{\OptionNotUsed}
\ProcessOptions
\newbox\figbox
\newbox\tabbox
\newbox\pagebox
\newcount\ffigcount
\newcount\ftabcount
\newcount\fftest
\newcount\hangcount
\newcount\nosuccesstryfig
\newcount\nosuccesstrytab
\newdimen\figgutter   \figgutter=1truepc
\newdimen\tabgutter   \tabgutter=1truepc
\newdimen\htdone      \htdone=0pt
\newdimen\pageht
\newdimen\startpageht
\newdimen\tabbredd
\newdimen\floatfltwidth
\newdimen\fltitemwidth
\newif\iftryingfig     \tryingfigfalse
\newif\iftryingtab     \tryingtabfalse
\newif\ifdoingfig      \doingfigfalse
\newif\ifdoingtab      \doingtabfalse
\newif\iffigprocessing \figprocessingfalse
\newif\iftabprocessing \tabprocessingfalse
\newif\ifpageafterfig  \pageafterfigfalse
\newif\ifpageaftertab  \pageaftertabfalse
\newif\ifoddpages
\newif\ifoutput
\newtoks\outputpretest
\newenvironment{floatingfigure}[2][v]%
{\@tfor \@tempa :=#1\do
         {\if\@tempa r\global\oddpagestrue\fi
          \if\@tempa l\global\oddpagesfalse\fi
          \if\@tempa p%
              \ifodd\c@page\global\oddpagestrue
                \else\global\oddpagesfalse\fi
          \fi
          \if\@tempa v%
             \ifnum\theOptionTest=0
                 \ifodd\c@page\global\oddpagestrue
                   \else\global\oddpagesfalse\fi
             \else
                  \ifodd\theOptionTest\global\oddpagestrue
                    \else\global\oddpagesfalse\fi
             \fi
          \fi
         }
 \expandafter\ifx\csname oldoutput\endcsname\relax% ref. TeXbook Ex.7.7
    \PackageError{floatflt}{The `floatflt' package is not initialized}
     {Try to reinstall the `floatflt' package.\MessageBreak
      Type `x' to quit or <Return> to try to go on.}\@@end\fi
 \global\everypar={\tryfig\oldeverypar}% must be set globally!
 \global\advance\ffigcount by 1
 \iffigprocessing
    {\count0=\ffigcount\advance\count0 by -1
     \PackageWarningNoLine{floatflt}{Floating figures \the\count0\space%
       \space and \the\ffigcount\space colliding}%
    }%
 \fi
 \iftabprocessing \PackageWarningNoLine{floatflt}{Floating figure %
   \the\ffigcount\space and floating table \the\ftabcount\space colliding}
 \fi
 \def\@captype{figure}
 \global\setlength{\floatfltwidth}{#2}
 \global\figprocessingtrue
 \global\setbox\figbox=\vbox\bgroup% begin of figbox
                               \hrule height 0pt width #2 depth 0pt%
                               \hsize=#2%
}
{
\egroup
\figinsert\par%
}
\newenvironment{floatingtable}[2][v]%
{\@tfor \@tempa :=#1\do
         {\if\@tempa r\global\oddpagestrue\fi
          \if\@tempa l\global\oddpagesfalse\fi
          \if\@tempa p%
              \ifodd\c@page\global\oddpagestrue
                \else\global\oddpagesfalse\fi
          \fi
          \if\@tempa v%
             \ifnum \theOptionTest=0
                 \ifodd\c@page\global\oddpagestrue
                   \else\global\oddpagesfalse\fi
             \else
                  \ifodd\theOptionTest\global\oddpagestrue
                    \else\global\oddpagesfalse\fi
             \fi
          \fi
         }
\expandafter\ifx\csname oldoutput\endcsname\relax% ref. TeXbook Ex.7.7
     \PackageError{floatflt}{The `floatflt' package is not initialized}
     {Try to reinstall the `floatflt' package.\MessageBreak
      Type `x' to quit or <Return> to try to go on.}\@@end\fi
\global\setbox\tabbox=\vbox\bgroup\hrule height 0pt width 0pt depth 0pt%
   \hsize=0pt\egroup
 \global\everypar={\trytab\oldeverypar}
 \global\advance\ftabcount by 1
 \iftabprocessing
    {\count0=\ftabcount\advance\count0 by -1
     \PackageWarningNoLine{floatflt}{Floating tables \the\count0\space%
            \space and \the\ftabcount \space colliding}%
    }
 \fi
 \iftabprocessing \PackageWarningNoLine{floatflt}{Floating table %
   \the\ffigcount\space and floating figure \the\ftabcount\space colliding}
 \fi
 \settowidth{\tabbredd}{#2}
 \global\setlength{\floatfltwidth}{\tabbredd}
 \def\@captype{table}
 \global\tabprocessingtrue
 \global\setbox\tabbox=\vbox\bgroup% begin of tabbox
                              \hrule height 0pt width\tabbredd depth 0pt%
                               \hsize=\tabbredd
\noindent\ifnum\ftabcount >1\ifoddpages\else\hspace*{-12pt}\fi\fi%
#2\vspace{0.2\baselineskip}%
}
{
\egroup% end of \tabbox
\tabinsert\par%
}
\AtBeginDocument{%
\edef\oldoutput{\the\output}%
\output={\the\outputpretest%
           \ifoutput\oldoutput\fi}
\outputpretest={\outputtrue}
\edef\oldeverypar{\the\everypar}
}
\def\dofigtest{%
   \ifnum\outputpenalty=-10005
     \setbox\pagebox=\vbox{\unvbox255}%
     \global\pageht=\ht\pagebox
     \global\outputfalse
     \unvbox\pagebox
   \else
     \global\outputtrue
     \ifdoingfig
         \global\pageafterfigtrue
     \fi
   \fi}%
\def\dotabtest{%
   \ifnum\outputpenalty=-10005
     \setbox\pagebox=\vbox{\unvbox255}%
     \global\pageht=\ht\pagebox
     \global\outputfalse
     \unvbox\pagebox
   \else
     \global\outputtrue
     \ifdoingtab
         \global\pageaftertabtrue
     \fi
   \fi}%
\def\tryfig{%
      \iftryingfig
       {\everypar={\relax}\setbox0=\lastbox%
       \parindent=\wd0 \parskip=0pt \par%
       \penalty-10005 \leavevmode}%
       \dimen0=\vsize%
       \advance\dimen0 by -\pageht%
       \advance\dimen0 by -2\baselineskip%
       \ifdim\dimen0>\ht\figbox%
         \dimen0=0.3\baselineskip
         \vrule depth \dimen0 width 0pt
         \vadjust{\kern -\dimen0%
         \vtop to \dimen0{%
             \baselineskip=\dimen0%
             \vss \vbox to 1ex{%
             \ifoddpages%
               \hbox to \hsize{\hss\copy\figbox}%
             \else% leftsetting
               \hbox to \hsize{\copy\figbox\hss}%
             \fi% \ifodd\count0
             \vss}\null}}%
       \global\tryingfigfalse%
       \global\doingfigtrue
       \global\startpageht=\pageht
       \global\htdone=0pt
       \dohangf
       \ifnum\nosuccesstryfig>0%
         \typeout{floatflt Message: Flt. fig. \the\ffigcount\space set on page
             \the\count0, shifted \the\nosuccesstryfig\space par(s) forward.}%
       \else
         \typeout{Package floatflt Message: Floating figure \the\ffigcount
              \space set on page \the\count0}%
       \fi
     \else
       \global\advance\nosuccesstryfig by 1
     \fi
     \else%
     \ifdoingfig
       {\everypar={\relax}\setbox0=\lastbox
       \parindent=\wd0 \parskip=0pt \par
         \penalty-10005 \leavevmode}%
    \global\htdone=\pageht
    \global\advance\htdone by -\startpageht
    \ifpageafterfig
      \global\doingfigfalse
    \else
      \dimen0=\ht\figbox%
      \advance\dimen0 by 0.5\baselineskip%
      \ifdim\htdone<\dimen0%
         \dohangf
      \else
         \global\doingfigfalse
      \fi
    \fi
    \ifdoingfig\relax\else\global\figprocessingfalse\fi
  \else
    \global\outputpretest={\outputtrue}%
  \fi
\fi
}
\def\trytab{%
      \iftryingtab%
       {\everypar={\relax}\setbox0=\lastbox%
       \parindent=\wd0 \parskip=0pt \par%
       \penalty-10005 \leavevmode}%
       \dimen0=\vsize%
       \advance\dimen0 by -\pageht%
       \advance\dimen0 by -2\baselineskip%
       \ifdim\dimen0>\ht\tabbox%
         \dimen0=0.3\baselineskip
         \vrule depth \dimen0 width 0pt
         \vadjust{\kern -\dimen0%
         \vtop to \dimen0{%
             \baselineskip=\dimen0%
             \vss \vbox to 1ex{%
              \ifoddpages%
               \hbox to \hsize{\hss\copy\tabbox}%
             \else% leftsetting
               \hbox to \hsize{\copy\tabbox\hss}%
             \fi% \ifodd\count0
             \vss}\null}}%
       \global\tryingtabfalse%
       \global\doingtabtrue
       \global\startpageht=\pageht
       \global\htdone=0pt
       \dohangt
       \ifnum\nosuccesstrytab>0%
         \typeout{floatflt Message: Flt. tab. \the\ftabcount\space set on page
             \the\count0, shifted \the\nosuccesstrytab\space par(s) forward.}%
       \else
         \typeout{Package floatflt Message: Floating table \the\ftabcount\space
                  set on page \the\count0}%
       \fi
     \else
       \global\advance\nosuccesstrytab by 1
     \fi
     \else
     \ifdoingtab
       {\everypar={\relax}\setbox0=\lastbox
       \parindent=\wd0 \parskip=0pt \par
         \penalty-10005 \leavevmode}%
    \global\htdone=\pageht
    \global\advance\htdone by -\startpageht
    \ifpageaftertab
      \global\doingtabfalse
    \else
      \dimen0=\ht\tabbox%
      \advance\dimen0 by 0.5\baselineskip%
      \ifdim\htdone<\dimen0%
         \dohangt
      \else
         \global\doingtabfalse
      \fi
    \fi
    \ifdoingtab\relax\else\global\tabprocessingfalse\fi
  \else
    \global\outputpretest={\outputtrue}%
  \fi
\fi
}
\def\figinsert{%
   \global\nosuccesstryfig=0%
   \global\outputpretest={\dofigtest}%
   \global\tryingfigtrue \global\doingfigfalse%
   \global\pageafterfigfalse}%
\def\tabinsert{%
   \global\nosuccesstrytab=0%
   \global\outputpretest={\dotabtest}%
   \global\tryingtabtrue \global\doingtabfalse%
   \global\pageaftertabfalse}%
\def\dohangf{%
   \dimen0=\ht\figbox%
   \advance\dimen0 by -\htdone%
   \advance\dimen0 by 1.49\baselineskip%
   \hangcount=\dimen0%
   \divide\hangcount by \baselineskip%
   \dimen0=\wd\figbox%
   \advance\dimen0 by \figgutter%
   \ifoddpages%
     \global\hangafter=-\hangcount% placing right
     \global\hangindent=-\dimen0%
   \else% \ifleftsetting
     \global\hangafter=-\hangcount% placing left
     \global\hangindent=\dimen0%
   \fi
}
\def\dohangt{%
   \dimen0=\ht\tabbox%
   \advance\dimen0 by -\htdone%
   \advance\dimen0 by 1.49\baselineskip%
   \hangcount=\dimen0%
   \divide\hangcount by \baselineskip%
   \dimen0=\wd\tabbox%
   \advance\dimen0 by \tabgutter%
   \ifoddpages%
     \global\hangafter=-\hangcount% placing right
     \global\hangindent=-\dimen0%
   \else% \ifleftsetting
     \global\hangafter=-\hangcount% placing left
     \global\hangindent=\dimen0%
   \fi
}
\newcommand{\fltitem}[2][0pt]{\setlength{\fltitemwidth}{\linewidth}%
  \addtolength{\fltitemwidth}{-\floatfltwidth}%
  \addtolength{\fltitemwidth}{-0.5em}%
  \item \parbox[t]{\fltitemwidth}{#2}\\[#1]}
\newcommand{\fltditem}[3][0pt]{\setlength{\fltitemwidth}{\linewidth}%
  \addtolength{\fltitemwidth}{-\floatfltwidth}%
  \addtolength{\fltitemwidth}{-0.5em}%
  \item[#2] \parbox[t]{\fltitemwidth}{#3}\\[#1]}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Spacing between lines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand{\baselinestretch}{1.05}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Special commands for proceedings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand\elbrustitle[1]{{\centering\textbf{#1}\\}}
\newcommand\elbrusauthor[1]{{\vspace{3pt}\centering\textbf{\textit{#1}}\\}}
\newcommand\elbrusaffil[1]{{\vspace{3pt}\centering\textit{#1}\\}}
\newcommand\elbrusemail[1]{{\vspace{3pt}\centering\textsl{#1}\vspace{6pt}\\\relax}}
%\setlength{\extrarowheight}{3pt}

\renewcommand{\@makecaption}[2]{%
\vspace{\abovecaptionskip}%
\sbox{\@tempboxa}{\textbf{#1.} #2}
\ifdim \wd\@tempboxa >\hsize
\textbf{#1.} #2\par
\else
\global\@minipagefalse
\hbox to \hsize {\hfil \textbf{#1.} #2\hfil}%
\fi
\vspace{\belowcaptionskip}}

%\renewcommand{\figurename}{Рис.~\arabic{figure}. }

%\renewcommand*\captionlabeldelim{.}
